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 <quic_manafm@quicinc.com>
This commit is contained in:
Manaf Meethalavalappu Pallikunhi 2021-12-16 15:51:52 +05:30 committed by Rashid Zafar
parent 8f25da0261
commit c3aaeca366

View File

@ -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);