From c3aaeca366b7b001cb2a6f4934fd7c877baecfc2 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Thu, 16 Dec 2021 15:51:52 +0530 Subject: [PATCH] drivers: thermal: tsens: reset cached temp value just after notification The tsens driver caches last read temperature during tsens interrupt violation and notifies framework so that framework will use this cached temperature value instead of new register read. This cached temperature variable will be reset once set trip API gets called for the same sensor. But some reason if set trip API is not called for the same sensor during notification, this cached temperature variable won't reset. It leads to a case where if next tsens violation happens for same sensor, interrupt handler will read this temperature and re-arm previous threshold without notifying thermal framework. It can cause spurious interrupt scenario for tsens. Reset cached temperature value just after thermal framework notification in tsens irq handler. Change-Id: I9707bf5fd245df404122f137b586e4a286be2eee Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/qcom/tsens.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index c3c53350d842..93020c395357 100644 --- a/drivers/thermal/qcom/tsens.c +++ b/drivers/thermal/qcom/tsens.c @@ -529,6 +529,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data) */ break; } + s->cached_temp = INT_MIN; } TSENS_DBG_1(priv, "%s: irq[%d] exit", __func__, irq); @@ -565,7 +566,6 @@ static int tsens_set_trips(void *_sensor, int low, int high) tsens_read_irq_state(priv, hw_id, s, &d); - s->cached_temp = INT_MIN; /* Write the new thresholds and clear the status */ regmap_field_write(priv->rf[LOW_THRESH_0 + hw_id], low_val); regmap_field_write(priv->rf[UP_THRESH_0 + hw_id], high_val);