The goal of this patchset is to improve and simplify the stm32 thermal
driver:
* remove hardware interrupt handler that is useless
* let the framewwork handle the trip points
* fix interrupt management to avoid receiving hundreds of
interrupts when the temperature is close to the low threshold.
* improve temperature reading resolution
Pascal Paillet (5):
thermal: stm32: remove hardware irq handler
thermal: stm32: fix icifr register name
thermal: stm32: handle multiple trip points
thermal: stm32: improve temperature resolution
thermal: stm32: fix low threshold interrupt flood
drivers/thermal/st/stm_thermal.c | 367 ++++++++++---------------------
1 file changed, 111 insertions(+), 256 deletions(-)
--
2.17.1
Fix a mistake with the ICIFR register name.
Signed-off-by: Pascal Paillet <[email protected]>
---
drivers/thermal/st/stm_thermal.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 31aa63fb3db1..7577242dadb4 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -30,7 +30,7 @@
#define DTS_DR_OFFSET 0x1C
#define DTS_SR_OFFSET 0x20
#define DTS_ITENR_OFFSET 0x24
-#define DTS_CIFR_OFFSET 0x28
+#define DTS_ICIFR_OFFSET 0x28
/* DTS_CFGR1 register mask definitions */
#define HSREF_CLK_DIV_MASK GENMASK(30, 24)
@@ -111,10 +111,10 @@ static irqreturn_t stm_thermal_alarm_irq_thread(int irq, void *sdata)
value = readl_relaxed(sensor->base + DTS_SR_OFFSET);
if ((value & LOW_THRESHOLD) == LOW_THRESHOLD)
- writel_relaxed(LOW_THRESHOLD, sensor->base + DTS_CIFR_OFFSET);
+ writel_relaxed(LOW_THRESHOLD, sensor->base + DTS_ICIFR_OFFSET);
if ((value & HIGH_THRESHOLD) == HIGH_THRESHOLD)
- writel_relaxed(HIGH_THRESHOLD, sensor->base + DTS_CIFR_OFFSET);
+ writel_relaxed(HIGH_THRESHOLD, sensor->base + DTS_ICIFR_OFFSET);
thermal_zone_device_update(sensor->th_dev, THERMAL_EVENT_UNSPECIFIED);
@@ -336,7 +336,7 @@ static int stm_enable_irq(struct stm_thermal_sensor *sensor)
*/
/* Make sure LOW_THRESHOLD IT is clear before enabling */
- writel_relaxed(LOW_THRESHOLD, sensor->base + DTS_CIFR_OFFSET);
+ writel_relaxed(LOW_THRESHOLD, sensor->base + DTS_ICIFR_OFFSET);
/* Enable IT generation for low threshold */
value = readl_relaxed(sensor->base + DTS_ITENR_OFFSET);
@@ -345,7 +345,7 @@ static int stm_enable_irq(struct stm_thermal_sensor *sensor)
/* Enable the low temperature threshold if needed */
if (sensor->low_temp_enabled) {
/* Make sure HIGH_THRESHOLD IT is clear before enabling */
- writel_relaxed(HIGH_THRESHOLD, sensor->base + DTS_CIFR_OFFSET);
+ writel_relaxed(HIGH_THRESHOLD, sensor->base + DTS_ICIFR_OFFSET);
/* Enable IT generation for high threshold */
value |= HIGH_THRESHOLD;
--
2.17.1
> The goal of this patchset is to improve and simplify the stm32 thermal
> driver:
> * remove hardware interrupt handler that is useless
> * let the framewwork handle the trip points
> * fix interrupt management to avoid receiving hundreds of
> interrupts when the temperature is close to the low threshold.
> * improve temperature reading resolution
gentle reminder !
> Pascal Paillet (5):
> thermal: stm32: remove hardware irq handler
> thermal: stm32: fix icifr register name
> thermal: stm32: handle multiple trip points
> thermal: stm32: improve temperature resolution
> thermal: stm32: fix low threshold interrupt flood
>
> drivers/thermal/st/stm_thermal.c | 367 ++++++++++---------------------
> 1 file changed, 111 insertions(+), 256 deletions(-)
>