summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_volt.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-09-20 10:38:30 +1000
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 16:27:58 +1000
commitdc7339df11bc7a90268929e57e13a14951343cc3 (patch)
tree9b2e1afa590933f2c82b86b74d78af2adc4d88ac /drivers/gpu/drm/nouveau/nouveau_volt.c
parente49f70f775335ab1ee0ecd54904d2b25982a2600 (diff)
drm/nouveau: fix thinko in volt 0x1x parsing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_volt.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_volt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_volt.c b/drivers/gpu/drm/nouveau/nouveau_volt.c
index 6ce857688eb..04fdc00a67d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_volt.c
+++ b/drivers/gpu/drm/nouveau/nouveau_volt.c
@@ -110,7 +110,7 @@ nouveau_volt_init(struct drm_device *dev)
struct nvbios *bios = &dev_priv->vbios;
struct bit_entry P;
u8 *volt = NULL, *entry;
- int i, recordlen, entries, vidmask, vidshift;
+ int i, headerlen, recordlen, entries, vidmask, vidshift;
if (bios->type == NVBIOS_BIT) {
if (bit_table(dev, 'P', &P))
@@ -142,18 +142,21 @@ nouveau_volt_init(struct drm_device *dev)
case 0x10:
case 0x11:
case 0x12:
- recordlen = 5;
+ headerlen = 5;
+ recordlen = volt[1];
entries = volt[2];
vidshift = 0;
vidmask = volt[4];
break;
case 0x20:
+ headerlen = volt[1];
recordlen = volt[3];
entries = volt[2];
vidshift = 0; /* could be vidshift like 0x30? */
vidmask = volt[5];
break;
case 0x30:
+ headerlen = volt[1];
recordlen = volt[2];
entries = volt[3];
vidshift = hweight8(volt[5]);
@@ -190,7 +193,7 @@ nouveau_volt_init(struct drm_device *dev)
if (!voltage->level)
return;
- entry = volt + volt[1];
+ entry = volt + headerlen;
for (i = 0; i < entries; i++, entry += recordlen) {
voltage->level[i].voltage = entry[0];
voltage->level[i].vid = entry[1] >> vidshift;