Loading drivers/gpu/drm/nouveau/nouveau_volt.c +35 −8 Original line number Diff line number Diff line Loading @@ -170,6 +170,13 @@ nouveau_volt_init(struct drm_device *dev) */ vidshift = 2; break; case 0x40: headerlen = volt[1]; recordlen = volt[2]; entries = volt[3]; /* not a clue what the entries are for.. */ vidmask = volt[11]; /* guess.. */ vidshift = 0; break; default: NV_WARN(dev, "voltage table 0x%02x unknown\n", volt[0]); return; Loading Loading @@ -197,7 +204,10 @@ nouveau_volt_init(struct drm_device *dev) } /* parse vbios entries into common format */ voltage->level = kcalloc(entries, sizeof(*voltage->level), GFP_KERNEL); if (volt[0] < 0x40) { voltage->nr_level = entries; voltage->level = kcalloc(entries, sizeof(*voltage->level), GFP_KERNEL); if (!voltage->level) return; Loading @@ -206,7 +216,24 @@ nouveau_volt_init(struct drm_device *dev) voltage->level[i].voltage = entry[0] * 10000; voltage->level[i].vid = entry[1] >> vidshift; } voltage->nr_level = entries; } else { u32 volt_uv = ROM32(volt[4]); s16 step_uv = ROM16(volt[8]); u8 vid; voltage->nr_level = voltage->vid_mask + 1; voltage->level = kcalloc(voltage->nr_level, sizeof(*voltage->level), GFP_KERNEL); if (!voltage->level) return; for (vid = 0; vid <= voltage->vid_mask; vid++) { voltage->level[vid].voltage = volt_uv; voltage->level[vid].vid = vid; volt_uv += step_uv; } } voltage->supported = true; } Loading Loading
drivers/gpu/drm/nouveau/nouveau_volt.c +35 −8 Original line number Diff line number Diff line Loading @@ -170,6 +170,13 @@ nouveau_volt_init(struct drm_device *dev) */ vidshift = 2; break; case 0x40: headerlen = volt[1]; recordlen = volt[2]; entries = volt[3]; /* not a clue what the entries are for.. */ vidmask = volt[11]; /* guess.. */ vidshift = 0; break; default: NV_WARN(dev, "voltage table 0x%02x unknown\n", volt[0]); return; Loading Loading @@ -197,7 +204,10 @@ nouveau_volt_init(struct drm_device *dev) } /* parse vbios entries into common format */ voltage->level = kcalloc(entries, sizeof(*voltage->level), GFP_KERNEL); if (volt[0] < 0x40) { voltage->nr_level = entries; voltage->level = kcalloc(entries, sizeof(*voltage->level), GFP_KERNEL); if (!voltage->level) return; Loading @@ -206,7 +216,24 @@ nouveau_volt_init(struct drm_device *dev) voltage->level[i].voltage = entry[0] * 10000; voltage->level[i].vid = entry[1] >> vidshift; } voltage->nr_level = entries; } else { u32 volt_uv = ROM32(volt[4]); s16 step_uv = ROM16(volt[8]); u8 vid; voltage->nr_level = voltage->vid_mask + 1; voltage->level = kcalloc(voltage->nr_level, sizeof(*voltage->level), GFP_KERNEL); if (!voltage->level) return; for (vid = 0; vid <= voltage->vid_mask; vid++) { voltage->level[vid].voltage = volt_uv; voltage->level[vid].vid = vid; volt_uv += step_uv; } } voltage->supported = true; } Loading