From 4b9d12f1e97c89827c8032bcd4e42546f9681ce9 Mon Sep 17 00:00:00 2001 From: Sudheer Papothi Date: Sat, 18 Aug 2018 05:02:58 +0530 Subject: [PATCH] ASoC: wsa881x: Update temperature value during device down when wsa881x device is down, reading temperature from driver returns error. Instead of propagating the error, return the cached temperature value to the thermal framework to avoid iterative calls to read the temperature that results in excessive logging. Change-Id: I529c83eafec63004c2469bf16a0b53bd5accbdbb Signed-off-by: Sudheer Papothi --- asoc/codecs/wsa881x-temp-sensor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/asoc/codecs/wsa881x-temp-sensor.c b/asoc/codecs/wsa881x-temp-sensor.c index b2ed963b7e..2a1291f34f 100644 --- a/asoc/codecs/wsa881x-temp-sensor.c +++ b/asoc/codecs/wsa881x-temp-sensor.c @@ -80,9 +80,11 @@ temp_retry: if (pdata->wsa_temp_reg_read) { ret = pdata->wsa_temp_reg_read(codec, ®); if (ret) { - pr_err("%s: temperature register read failed: %d\n", - __func__, ret); - return ret; + pr_err("%s: temp read failed: %d, current temp: %d\n", + __func__, ret, pdata->curr_temp); + if (temp) + *temp = pdata->curr_temp; + return 0; } } else { pr_err("%s: wsa_temp_reg_read is NULL\n", __func__);