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 use 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. > @@ -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? Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> -- i.