aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-09-19 20:38:30 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:27:58 -0400
commitdc7339df11bc7a90268929e57e13a14951343cc3 (patch)
tree9b2e1afa590933f2c82b86b74d78af2adc4d88ac /drivers/gpu/drm/nouveau
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')
-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)
110 struct nvbios *bios = &dev_priv->vbios; 110 struct nvbios *bios = &dev_priv->vbios;
111 struct bit_entry P; 111 struct bit_entry P;
112 u8 *volt = NULL, *entry; 112 u8 *volt = NULL, *entry;
113 int i, recordlen, entries, vidmask, vidshift; 113 int i, headerlen, recordlen, entries, vidmask, vidshift;
114 114
115 if (bios->type == NVBIOS_BIT) { 115 if (bios->type == NVBIOS_BIT) {
116 if (bit_table(dev, 'P', &P)) 116 if (bit_table(dev, 'P', &P))
@@ -142,18 +142,21 @@ nouveau_volt_init(struct drm_device *dev)
142 case 0x10: 142 case 0x10:
143 case 0x11: 143 case 0x11:
144 case 0x12: 144 case 0x12:
145 recordlen = 5; 145 headerlen = 5;
146 recordlen = volt[1];
146 entries = volt[2]; 147 entries = volt[2];
147 vidshift = 0; 148 vidshift = 0;
148 vidmask = volt[4]; 149 vidmask = volt[4];
149 break; 150 break;
150 case 0x20: 151 case 0x20:
152 headerlen = volt[1];
151 recordlen = volt[3]; 153 recordlen = volt[3];
152 entries = volt[2]; 154 entries = volt[2];
153 vidshift = 0; /* could be vidshift like 0x30? */ 155 vidshift = 0; /* could be vidshift like 0x30? */
154 vidmask = volt[5]; 156 vidmask = volt[5];
155 break; 157 break;
156 case 0x30: 158 case 0x30:
159 headerlen = volt[1];
157 recordlen = volt[2]; 160 recordlen = volt[2];
158 entries = volt[3]; 161 entries = volt[3];
159 vidshift = hweight8(volt[5]); 162 vidshift = hweight8(volt[5]);
@@ -190,7 +193,7 @@ nouveau_volt_init(struct drm_device *dev)
190 if (!voltage->level) 193 if (!voltage->level)
191 return; 194 return;
192 195
193 entry = volt + volt[1]; 196 entry = volt + headerlen;
194 for (i = 0; i < entries; i++, entry += recordlen) { 197 for (i = 0; i < entries; i++, entry += recordlen) {
195 voltage->level[i].voltage = entry[0]; 198 voltage->level[i].voltage = entry[0];
196 voltage->level[i].vid = entry[1] >> vidshift; 199 voltage->level[i].vid = entry[1] >> vidshift;