[Nouveau] [PATCH] volt: Improve min/max deteaction of range based volting

Karol Herbst karolherbst at gmail.com
Sat Apr 22 14:58:30 UTC 2017


2017-04-22 16:46 GMT+02:00 Roy Spliet <nouveau at spliet.org>:
> Response in-line:
>
>
> Op 22-04-17 om 13:22 schreef Karol Herbst:
>>
>> info.min and info.max doesn't always represent the actual voltage range we
>> can use. Do the same as with the entry based volting.
>>
>> Fixes "ERROR: Can't get value of subfeature in0_min: Can't read" errors
>> in sensors.
>>
>> Signed-off-by: Karol Herbst <karolherbst at gmail.com>
>> ---
>>   drm/nouveau/nvkm/subdev/volt/base.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drm/nouveau/nvkm/subdev/volt/base.c
>> b/drm/nouveau/nvkm/subdev/volt/base.c
>> index e344901c..61b29c7a 100644
>> --- a/drm/nouveau/nvkm/subdev/volt/base.c
>> +++ b/drm/nouveau/nvkm/subdev/volt/base.c
>> @@ -195,14 +195,16 @@ nvkm_volt_parse_bios(struct nvkm_bios *bios, struct
>> nvkm_volt *volt)
>>         data = nvbios_volt_parse(bios, &ver, &hdr, &cnt, &len, &info);
>>         if (data && info.vidmask && info.base && info.step && info.ranged)
>> {
>>                 nvkm_debug(subdev, "found ranged based VIDs\n");
>> -               volt->min_uv = info.min;
>> -               volt->max_uv = info.max;
>> +               volt->min_uv = 0xffffffff;
>> +               volt->max_uv = 0;
>>                 for (i = 0; i < info.vidmask + 1; i++) {
>>                         if (info.base >= info.min &&
>>                                 info.base <= info.max) {
>
> How bogus are info.min and info.max when you get that error? Is this
> if-statement still valid?

info.min is set to 0. and info.max to the base value. The vbios
parsing is also a little incomplete, which I could fix instead as
well.

Let me hack something up.

>>
>>                                 volt->vid[volt->vid_nr].uv = info.base;
>>                                 volt->vid[volt->vid_nr].vid = i;
>>                                 volt->vid_nr++;
>> +                               volt->min_uv = min(volt->min_uv,
>> info.base);
>> +                               volt->max_uv = max(volt->max_uv,
>> info.base);
>>                         }
>>                         info.base += info.step;
>>                 }
>
>


More information about the Nouveau mailing list