hwmon: (w83795) Clear intrusion alarm
Subsystems (2)
PATCH 6/7 hwmon: (w83795) Clear intrusion alarm
When asked to clear the intrusion alarm, do so immediately. We have to invalidate the cache to make sure the new status will be read. But we also have to read from the status register once to clear the pending alarm, as writing to CLR_CHS surprising won't clear it automatically.
--- w83795.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwmon/w83795.c +4 -0
@@ -755,6 +755,10 @@ store_chassis_clear(struct device *dev, val =w83795_read (client,W83795_REG_CLR_CHASSIS ); val |=0x80 ;w83795_write (client,W83795_REG_CLR_CHASSIS , val); + +/* Clear status and force cache refresh */ +w83795_read (client,W83795_REG_ALARM (5 )); + data->valid =0 ;mutex_unlock (&data->update_lock);return count; }
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 13 lines · Jean Delvare
When asked to clear the intrusion alarm, do so immediately. We have to invalidate the cache to make sure the new status will be read. But we also have to read from the status register once to clear the pending alarm, as writing to
CLR_CHSsurprising won't clear it automatically.Signed-off-by Jean Delvare <[email protected]>--- w83795.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hwmon/w83795.c store_chassis_clear(struct device *dev, · line 760
Quoted 6 lines
drivers/hwmon/w83795.c +3
-0@@ -755,6 +755,10 @@ store_chassis_clear(struct device *dev, val =w83795_read (client,W83795_REG_CLR_CHASSIS ); val |=0x80 ;w83795_write (client,W83795_REG_CLR_CHASSIS , val); + +/* Clear status and force cache refresh */ +w83795_read (client,W83795_REG_ALARM (5 ));
Won't that clear other (possibly unreported) alarms as well ?
If that is not a problem,
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Jean Delvare
When asked to clear the intrusion alarm, do so immediately. We have to invalidate the cache to make sure the new status will be read. But we also have to read from the status register once to clear the pending alarm, as writing to
CLR_CHSsurprising won't clear it automatically.Signed-off-by Jean Delvare <[email protected]>--- w83795.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 11 lines
drivers/hwmon/w83795.c store_chassis_clear(struct device *dev, · line 760
Quoted 9 lines
drivers/hwmon/w83795.c +3
-0@@ -755,6 +755,10 @@ store_chassis_clear(struct device *dev, val =w83795_read (client,W83795_REG_CLR_CHASSIS ); val |=0x80 ;w83795_write (client,W83795_REG_CLR_CHASSIS , val); + +/* Clear status and force cache refresh */ +w83795_read (client,W83795_REG_ALARM (5 ));Won't that clear other (possibly unreported) alarms as well ?
It will clear the interrupt bit for other sources in that register, yes. But the update function does exactly this already, so this is nothing new. I don't think it will have any effect on the real-time register, but I can't check it, because the other sources in that register are fan9 to fan14, which do not exist on my system.
If I get any report of a user with more than 8 fans connected to a W83795G/ADG device, I'll check the exact behavior. But I think the current code is and will stay acceptable regardless, because clearing the chassis intrusion status is such a rare event.
Quoted 4 lines
If that is not a problem,
Acked-by Guenter Roeck <[email protected]>
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors