mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
drm/nouveau/volt/gm20b: add support for vmin parameter
Chips may be characterized for a minimum voltage. Support this extra parameter and select the appropriate minimum voltage for the detected GPU speedo. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
ebe5e526c1
commit
791eeea2dc
@ -146,7 +146,7 @@ gk20a_volt = {
|
|||||||
int
|
int
|
||||||
gk20a_volt_ctor(struct nvkm_device *device, int index,
|
gk20a_volt_ctor(struct nvkm_device *device, int index,
|
||||||
const struct cvb_coef *coefs, int nb_coefs,
|
const struct cvb_coef *coefs, int nb_coefs,
|
||||||
struct gk20a_volt *volt)
|
int vmin, struct gk20a_volt *volt)
|
||||||
{
|
{
|
||||||
struct nvkm_device_tegra *tdev = device->func->tegra(device);
|
struct nvkm_device_tegra *tdev = device->func->tegra(device);
|
||||||
int i, uv;
|
int i, uv;
|
||||||
@ -161,9 +161,9 @@ gk20a_volt_ctor(struct nvkm_device *device, int index,
|
|||||||
volt->base.vid_nr = nb_coefs;
|
volt->base.vid_nr = nb_coefs;
|
||||||
for (i = 0; i < volt->base.vid_nr; i++) {
|
for (i = 0; i < volt->base.vid_nr; i++) {
|
||||||
volt->base.vid[i].vid = i;
|
volt->base.vid[i].vid = i;
|
||||||
volt->base.vid[i].uv =
|
volt->base.vid[i].uv = max(
|
||||||
gk20a_volt_calc_voltage(&coefs[i],
|
gk20a_volt_calc_voltage(&coefs[i], tdev->gpu_speedo),
|
||||||
tdev->gpu_speedo);
|
vmin);
|
||||||
nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
|
nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
|
||||||
volt->base.vid[i].vid, volt->base.vid[i].uv);
|
volt->base.vid[i].vid, volt->base.vid[i].uv);
|
||||||
}
|
}
|
||||||
@ -182,5 +182,5 @@ gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
|||||||
*pvolt = &volt->base;
|
*pvolt = &volt->base;
|
||||||
|
|
||||||
return gk20a_volt_ctor(device, index, gk20a_cvb_coef,
|
return gk20a_volt_ctor(device, index, gk20a_cvb_coef,
|
||||||
ARRAY_SIZE(gk20a_cvb_coef), volt);
|
ARRAY_SIZE(gk20a_cvb_coef), 0, volt);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,6 @@ struct gk20a_volt {
|
|||||||
|
|
||||||
int gk20a_volt_ctor(struct nvkm_device *device, int index,
|
int gk20a_volt_ctor(struct nvkm_device *device, int index,
|
||||||
const struct cvb_coef *coefs, int nb_coefs,
|
const struct cvb_coef *coefs, int nb_coefs,
|
||||||
struct gk20a_volt *volt);
|
int vmin, struct gk20a_volt *volt);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,16 +41,31 @@ const struct cvb_coef gm20b_cvb_coef[] = {
|
|||||||
/* 921600 */ { 2647676, -106455, 1632 },
|
/* 921600 */ { 2647676, -106455, 1632 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const u32 speedo_to_vmin[] = {
|
||||||
|
/* 0, 1, 2, 3, 4, */
|
||||||
|
950000, 840000, 818750, 840000, 810000,
|
||||||
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
gm20b_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
gm20b_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
||||||
{
|
{
|
||||||
|
struct nvkm_device_tegra *tdev = device->func->tegra(device);
|
||||||
struct gk20a_volt *volt;
|
struct gk20a_volt *volt;
|
||||||
|
u32 vmin;
|
||||||
|
|
||||||
|
if (tdev->gpu_speedo_id >= ARRAY_SIZE(speedo_to_vmin)) {
|
||||||
|
nvdev_error(device, "unsupported speedo %d\n",
|
||||||
|
tdev->gpu_speedo_id);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
volt = kzalloc(sizeof(*volt), GFP_KERNEL);
|
volt = kzalloc(sizeof(*volt), GFP_KERNEL);
|
||||||
if (!volt)
|
if (!volt)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
*pvolt = &volt->base;
|
*pvolt = &volt->base;
|
||||||
|
|
||||||
|
vmin = speedo_to_vmin[tdev->gpu_speedo_id];
|
||||||
|
|
||||||
return gk20a_volt_ctor(device, index, gm20b_cvb_coef,
|
return gk20a_volt_ctor(device, index, gm20b_cvb_coef,
|
||||||
ARRAY_SIZE(gm20b_cvb_coef), volt);
|
ARRAY_SIZE(gm20b_cvb_coef), vmin, volt);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user