ACPI: PMIC: xpower: Fix _TMP ACPI errors
authorHans de Goede <hdegoede@redhat.com>
Fri, 26 Nov 2021 15:21:09 +0000 (16:21 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 8 Dec 2021 14:34:57 +0000 (15:34 +0100)
commit5f96ba56552121f4297874d0accf29b9b4a1ae93
tree0cbf12fc22ae7fe22ec174628935ad4b844ab268
parentc5200609c9176482ea96ac73e52bd466b622f385
ACPI: PMIC: xpower: Fix _TMP ACPI errors

On some devices with a X-Powers AXP288 PMIC the LPAT tables in the ACPI
node for the AXP288 PMIC for some reason only describe a small temperature
range, e.g. 27° - 37° Celcius (assuming the entries are in millidegrees).

When the tablet is idle in a room at 21° degrees this is causing values
outside the LPAT table to be read, causing e.g. the following 2 errors
to get spammed to the logs every 4 seconds! :

[ 7512.791316] ACPI Error: AE_ERROR, Returned by Handler for [UserDefinedRegion] (20210930/evregion-281)
[ 7512.791611] ACPI Error: Aborting method \_SB.SXP1._TMP due to previous error (AE_ERROR) (20210930/psparse-529)

Fix this by clamping the raw value to the LPAT table range before
passing it to acpi_lpat_raw_to_temp().

Note clamping has been chosen rather then extrapolating because it is
unknown how other parts of the ACPI tables will respond to temperature
values outside of the LPAT range.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/pmic/intel_pmic_xpower.c