Karol Herbst
2017-Apr-22 12:22 UTC
[Nouveau] [PATCH] volt: Improve min/max deteaction of range based volting
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) { 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; } -- 2.12.2
Martin Peres
2017-Apr-22 12:23 UTC
[Nouveau] [PATCH] volt: Improve min/max deteaction of range based volting
deteaction -> detection On 22/04/17 15:22, Karol Herbst wrote:> 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) { > 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; > } >Reviewed-by: Martin Peres <martin.peres at free.fr>
Roy Spliet
2017-Apr-22 14:46 UTC
[Nouveau] [PATCH] volt: Improve min/max deteaction of range based volting
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?> 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; > }
Karol Herbst
2017-Apr-22 14:58 UTC
[Nouveau] [PATCH] volt: Improve min/max deteaction of range based volting
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; >> } > >
Seemingly Similar Threads
- [PATCH] volt: Improve min/max deteaction of range based volting
- [PATCH 0/2] add min/max voltage to hwmon
- [PATCH v2 00/22] Volting/Clocking improvements for Fermi and newer
- [PATCH 0/9] Groundwork for clocking fixes
- [PATCH 00/19] Volting/Clocking improvements for Fermi and newer