Re: [PATCH 2/2] platform/x86: thinkpad_acpi: Fix to correct wrong temp reporting on some ThinkPads
From: Vishnu Sankar
Date: Wed Feb 14 2024 - 18:22:59 EST
Ilpo,
Thanks for the review.
On Wed, Feb 14, 2024 at 7:23 PM Ilpo Järvinen
<ilpo.jarvinen@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, 14 Feb 2024, Vishnu Sankar wrote:
>
> > Added non-standard thermal register support for some ThinkPads.
> >
> > Some of the Thinkpads use a non-standard ECFW which uses different
> > thermal register addresses.
> > This is a fix to correct the wrong temperature reporting on
> > those systems.
> >
> > Tested on Lenovo ThinkPad L13 Yoga Gen2
> >
> > Suggested-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
> > Signed-off-by: Vishnu Sankar <vishnuocv@xxxxxxxxx>
> > ---
> > -Improvements as requested.
> > -Improved the readability in case TPACPI_THERMAL_TPEC_12.
> > -idx < 8 from idx idx <=7 to match idx = 8
> > -KILO used from linux/units.h instead of 1000.
>
> > static enum thermal_access_mode thermal_read_mode;
> > static bool thermal_use_labels;
> > +static bool thermal_with_ns_address; /*Non-standard thermal reg address*/
>
> Comment is missing spaces.
Acked.
>
> > @@ -6239,6 +6267,20 @@ static int thermal_get_sensor(int idx, s32 *value)
> > }
> > break;
> >
> > + /* The Non-standard EC uses 12 Thermal areas */
> > + case TPACPI_THERMAL_TPEC_12:
> > + if (idx >= 12)
> > + return -EINVAL;
> > +
> > + t = idx < 8 ? TP_EC_THERMAL_TMP0_NS + idx :
> > + TP_EC_THERMAL_TMP8_NS + (idx - 8);
> > +
> > + if (!acpi_ec_read(t, &tmp))
> > + return -EIO;
> > +
> > + *value = tmp * KILO;
>
> Hmm, MILLI would be much more approriate here? But if this relates to
> degrees, there is MILLIDEGREE_PER_DEGREE?
Will Change to MILLIDEGREE_PER_DEGREE from KILO
>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
>
> --
> i.
--
Regards,
Vishnu Sankar
+817015150407 (Japan)