drm/nouveau/volt: Fix for some cards having 0 maximum voltage
authorMark Menzynski <mmenzyns@redhat.com>
Fri, 2 Aug 2019 09:21:00 +0000 (11:21 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 23 Aug 2019 02:55:34 +0000 (12:55 +1000)
Some, mostly Fermi, vbioses appear to have zero max voltage. That causes Nouveau to not parse voltage entries, thus users not being able to set higher clocks.

When changing this value Nvidia driver still appeared to ignore it, and I wasn't able to find out why, thus the code is ignoring the value if it is zero.

CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Mark Menzynski <mmenzyns@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/bios/volt.c

index 7143ea4611aa3ef7d809d1d1b90148a97b1c7c67..33a9fb5ac558577fe7879c2b760d5b5d1beef3aa 100644 (file)
@@ -96,6 +96,8 @@ nvbios_volt_parse(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len,
                info->min     = min(info->base,
                                    info->base + info->step * info->vidmask);
                info->max     = nvbios_rd32(bios, volt + 0x0e);
+               if (!info->max)
+                       info->max = max(info->base, info->base + info->step * info->vidmask);
                break;
        case 0x50:
                info->min     = nvbios_rd32(bios, volt + 0x0a);