diff mbox series

[RFC,5/6] hwmon: axi-fan-control: clear the fan fault irq at startup

Message ID 20210708120111.519444-6-nuno.sa@analog.com
State New
Headers show
Series AXI FAN new features and improvements | expand

Commit Message

Nuno Sa July 8, 2021, 12:01 p.m. UTC
The core might pull itself out of reset automatically which means it can
run with invalid tacho evaluation parameters for some time. Thus, it will
trigger a FAN FAULT interrupt as soon as we unmask it. Some userland apps
might be sensitive to this and act drastically. Hence, we will clear it
here and if there's something really wrong with the FAN or the evaluation
parameters, we'll get that interrupt again...

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/hwmon/axi-fan-control.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/drivers/hwmon/axi-fan-control.c b/drivers/hwmon/axi-fan-control.c
index d4b62d54375b..59c9babb3850 100644
--- a/drivers/hwmon/axi-fan-control.c
+++ b/drivers/hwmon/axi-fan-control.c
@@ -379,6 +379,15 @@  static int axi_fan_control_init(struct axi_fan_control_data *ctl,
 		      ADI_IRQ_SRC_PWM_CHANGED | ADI_IRQ_SRC_TEMP_INCREASE),
 		    ADI_REG_IRQ_MASK, ctl);
 
+	/*
+	 * The core might pull itself out of reset automatically which means it can run with
+	 * invalid tacho evaluation parameters for some time. Thus, it will trigger a FAN
+	 * FAULT interrupt as soon as we unmask it(and some userland apps might be sensitive to
+	 * this). Hence, we will clear it here and if there's something really wrong with the
+	 * FAN or the evaluation parameters, we'll get that interrupt again...
+	 */
+	axi_iowrite(ADI_IRQ_SRC_TACH_ERR, ADI_REG_IRQ_PENDING, ctl);
+
 	/* bring the device out of reset */
 	axi_iowrite(0x01, ADI_REG_RSTN, ctl);