nouveau: add voltage workaround for buggy bioses
Subsystems (3)
PATCH 1/1 nouveau: add voltage workaround for buggy bioses
This makes all performance modes on c0 be detected properly, since all voltages were aligned to step_uv, but the reported voltages were offset relative to it, so no voltage was ever found.
Signed-off-by Maarten Lankhorst <[email protected]>
---
--- drivers/gpu/drm/nouveau/nouveau_drv.h | 1 + drivers/gpu/drm/nouveau/nouveau_perf.c | 15 +++++++++++++++ drivers/gpu/drm/nouveau/nouveau_volt.c | 3 +++ 3 files changed, 19 insertions(+)
drivers/gpu/drm/nouveau/nouveau_drv.h +1 -0
@@ -388,6 +388,7 @@ struct nouveau_pm_voltage {struct nouveau_pm_voltage_level *level;int nr_level; +u16 step_uv, step_ofs; };/* Exclusive upper limits */
drivers/gpu/drm/nouveau/nouveau_perf.c +15 -0
@@ -248,6 +248,7 @@ static void nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) { struct drm_nouveau_private *dev_priv = dev->dev_private; +struct nouveau_pm_voltage *volt = &dev_priv->engine.pm.voltage;struct bit_entry P ;u8 *vmap;int id;
@@ -284,6 +285,20 @@ nouveau_perf_voltage(struct drm_device *dev, struct nouveau_pm_level *perflvl) perflvl->volt_min =ROM32 (vmap[0 ]); perflvl->volt_max =ROM32 (vmap[4 ]); } + +/* Adjust for buggy bioses */ +if (!volt->step_uv || !volt->step_ofs) +return ; + +if (perflvl->volt_min % volt->step_uv != volt->step_ofs) { + perflvl->volt_min -= perflvl->volt_min % volt->step_uv; + perflvl->volt_min += volt->step_ofs; + } + +if (perflvl->volt_max % volt->step_uv != volt->step_ofs) { + perflvl->volt_max -= perflvl->volt_max % volt->step_uv; + perflvl->volt_max += volt->step_ofs; + } }void
drivers/gpu/drm/nouveau/nouveau_volt.c +3 -0
@@ -232,6 +232,9 @@ nouveau_volt_init(struct drm_device *dev) voltage->level[vid].vid = vid; volt_uv += step_uv; } + voltage->step_uv = step_uv >=0 ? step_uv : -step_uv; +if (step_uv) + voltage->step_ofs = volt_uv % voltage->step_uv; } voltage->supported = true;