drm/nouveau/bios/volt: Parse min and max for Version 0x40
authorKarol Herbst <karolherbst@gmail.com>
Sun, 23 Apr 2017 08:36:31 +0000 (10:36 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 16 Jun 2017 04:04:19 +0000 (14:04 +1000)
This is according to what we have in nvbios.

Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors
in sensors for some GPUs.

Signed-off-by: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c

index a7797a9e9cbcf4500635909440a8d89b025ac5ed..7143ea4611aa3ef7d809d1d1b90148a97b1c7c67 100644 (file)
@@ -93,9 +93,9 @@ nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
                info->step    = nvbios_rd16(bios, volt + 0x08);
                info->vidmask = nvbios_rd08(bios, volt + 0x0b);
                info->ranged  = true; /* XXX: find the flag byte */
-               /*XXX*/
-               info->min     = 0;
-               info->max     = info->base;
+               info->min     = min(info->base,
+                                   info->base + info->step * info->vidmask);
+               info->max     = nvbios_rd32(bios, volt + 0x0e);
                break;
        case 0x50:
                info->min     = nvbios_rd32(bios, volt + 0x0a);