ASoC: codecs: wsa884x: Accept temperatures across the full trim range

wsa884x_get_temp() rejects any reading outside 5..45 degC with -EAGAIN.
A speaker that has been playing, or sits in a warm laptop, easily runs
above 45 degC, so its temperature becomes unreadable when it matters.

The check only needs to drop bogus conversions, such as the all-zero
reading before the PA is first enabled. Bound it by the -10..150 degC
two-point trim range instead.

Fixes: 6b99dc62d9 ("ASoC: codecs: wsa884x: Implement temperature reading and hwmon")
Cc: stable@vger.kernel.org
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20261023171316.819857-3-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Srinivas Kandagatla 2026-10-23 18:13:11 +01:00 committed by Mark Brown
parent e21fb64a8c
commit 00535515e3

View File

@ -720,10 +720,11 @@
/*
* Device will report senseless data in many cases, so discard any measurements
* outside of valid range.
* outside of the two-point trim range. Do not narrow this to ambient: a
* speaker that has been playing easily runs well above 45 degC.
*/
#define WSA884X_LOW_TEMP_THRESHOLD 5
#define WSA884X_HIGH_TEMP_THRESHOLD 45
#define WSA884X_LOW_TEMP_THRESHOLD WSA884X_T1_TEMP
#define WSA884X_HIGH_TEMP_THRESHOLD WSA884X_T2_TEMP
struct wsa884x_priv {
struct regmap *regmap;
@ -1929,8 +1930,8 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)
dev_dbg(wsa884x->dev, "Measured temp %ld (dmeas=%d, d1=%d, d2=%d)\n",
val, dmeas, d1, d2);
if ((val > WSA884X_LOW_TEMP_THRESHOLD) &&
(val < WSA884X_HIGH_TEMP_THRESHOLD)) {
if (val >= WSA884X_LOW_TEMP_THRESHOLD &&
val <= WSA884X_HIGH_TEMP_THRESHOLD) {
wsa884x->temperature = val;
*temp = val * 1000;
ret = 0;