hwmon: Fixes for lm90 driver
Subsystems (2)
Guenter Roeck
maintainercover hwmon: Fixes for lm90 driver
This series fixes a number of issues with the lm90 driver.
- Not all versions of G781 and compatible chips support a conversion rate of 8 (62.5 ms). Limit its value to 0..7.
- Re-enable interrupts/alerts for devices supporting interrupts and with broken ALERT after the alert(s) clear.
- Various chips have a buggy ALERT implementation. Mark them accordingly.
- The attributes for sending alarm notifications should be the alarm attributes, not the associated value attributes.
----------------------------------------------------------------
Guenter Roeck (6):
hwmon: (lm90) Reduce maximum conversion rate for G781
hwmon: (lm90) Re-enable interrupts after alert clears
hwmon: (lm90) Mark alert as broken for MAX6654
hwmon: (lm90) Mark alert as broken for MAX6680
hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649
hwmon: (lm90) Fix sysfs and udev notifications
drivers/hwmon/lm90.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
Guenter Roeck
maintainerPATCH 1/6 hwmon: (lm90) Reduce maximum conversion rate for G781
According to its datasheet, G781 supports a maximum conversion rate value of 8 (62.5 ms). However, chips labeled G781 and G780 were found to only support a maximum conversion rate value of 7 (125 ms). On the other side, chips labeled G781-1 and G784 were found to support a conversion rate value of 8. There is no known means to distinguish G780 from G781 or G784; all chips report the same manufacturer ID and chip revision. Setting the conversion rate register value to 8 on chips not supporting it causes unexpected behavior since the real conversion rate is set to 0 (16 seconds) if a value of 8 is written into the conversion rate register. Limit the conversion rate register value to 7 for all G78x chips to avoid the problem.
--- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
@@ -373,7 +373,7 @@ static const struct lm90_params lm90_params[] = { .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_CRIT, .alert_alarms = 0x7c, - .max_convrate = 8, + .max_convrate = 7, }, [lm86] = { .flags =LM90_HAVE_OFFSET |LM90_HAVE_REM_LIMIT_EXT
Signature · 1 line
2.33.0
Guenter Roeck
maintainerPATCH 2/6 hwmon: (lm90) Re-enable interrupts after alert clears
In reply to Guenter RoeckIf alert handling is broken, interrupts are disabled after an alert and re-enabled after the alert clears. However, if there is an interrupt handler, this does not apply if alerts were originally disabled and enabled when the driver was loaded. In that case, interrupts will stay disabled after an alert was handled though the alert handler even after the alert condition clears. Address the situation by always re-enabling interrupts after the alert condition clears if there is an interrupt handler.
--- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
@@ -848,7 +848,7 @@ static int lm90_update_device(struct device *dev)* Re-enable ALERT# output if it was originally enabled and * relevant alarms are all clear */ -if (!(data->config_orig &0x80 ) && +if ((client->irq || !(data->config_orig &0x80 )) && !(data->alarms & data->alert_alarms)) {if (data->config &0x80 ) {dev_dbg (&client->dev,"Re-enabling ALERT#\n" );
Signature · 1 line
2.33.0
Re: [PATCH 2/6] hwmon: (lm90) Re-enable interrupts after alert clears
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 21 lines
If alert handling is broken, interrupts are disabled after an alert and re-enabled after the alert clears. However, if there is an interrupt handler, this does not apply if alerts were originally disabled and enabled when the driver was loaded. In that case, interrupts will stay disabled after an alert was handled though the alert handler even after the alert condition clears. Address the situation by always re-enabling interrupts after the alert condition clears if there is an interrupt handler.
Fixes 2abdc357c55d9 ("hwmon: (lm90) Unmask hardware interrupt")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/lm90.c +0
-0
drivers/hwmon/lm90.c static int lm90_update_device(struct device *dev) · line 854
Quoted 8 lines
drivers/hwmon/lm90.c +1
-1@@ -848,7 +848,7 @@ static int lm90_update_device(struct device *dev)* Re-enable ALERT# output if it was originally enabled and * relevant alarms are all clear */ -if (!(data->config_orig &0x80 ) && +if ((client->irq || !(data->config_orig &0x80 )) && !(data->alarms & data->alert_alarms)) {if (data->config &0x80 ) {dev_dbg (&client->dev,"Re-enabling ALERT#\n" );
Good catch!
Guenter Roeck
maintainerPATCH 3/6 hwmon: (lm90) Mark alert as broken for MAX6654
In reply to Guenter RoeckExperiments with MAX6654 show that its alert function is broken, similar to other chips supported by the lm90 driver. Mark it accordingly.
--- drivers/hwmon/lm90.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/lm90.c +1 -0
@@ -400,6 +400,7 @@ static const struct lm90_params lm90_params[] = { .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL, }, [max6654] = { + .flags = LM90_HAVE_BROKEN_ALERT, .alert_alarms = 0x7c, .max_convrate = 7, .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
Signature · 1 line
2.33.0
Guenter Roeck
maintainerPATCH 4/6 hwmon: (lm90) Mark alert as broken for MAX6680
In reply to Guenter RoeckExperiments with MAX6680 and MAX6681 show that the alert function of those chips is broken, similar to other chips supported by the lm90 driver. Mark it accordingly.
--- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
@@ -419,7 +419,7 @@ static const struct lm90_params lm90_params[] = { }, [max6680] = { .flags =LM90_HAVE_OFFSET |LM90_HAVE_CRIT - | LM90_HAVE_CRIT_ALRM_SWP, + | LM90_HAVE_CRIT_ALRM_SWP | LM90_HAVE_BROKEN_ALERT, .alert_alarms = 0x7c, .max_convrate = 7, },
Signature · 1 line
2.33.0
Guenter Roeck
maintainerPATCH 5/6 hwmon: (lm90) Mark alert as broken for MAX6646/6647/6649
In reply to Guenter RoeckExperiments with MAX6646 and MAX6648 show that the alert function of those chips is broken, similar to other chips supported by the lm90 driver. Mark it accordingly.
--- drivers/hwmon/lm90.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm90.c +1 -1
@@ -394,7 +394,7 @@ static const struct lm90_params lm90_params[] = { .max_convrate = 9, }, [max6646] = { - .flags = LM90_HAVE_CRIT, + .flags = LM90_HAVE_CRIT | LM90_HAVE_BROKEN_ALERT, .alert_alarms = 0x7c, .max_convrate = 6, .reg_local_ext = MAX6657_REG_R_LOCAL_TEMPL,
Signature · 1 line
2.33.0
Guenter Roeck
maintainerPATCH 6/6 hwmon: (lm90) Fix sysfs and udev notifications
In reply to Guenter Roecksysfs and udev notifications need to be sent to the _alarm attributes, not to the value attributes.
--- drivers/hwmon/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/hwmon/lm90.c +6 -6
@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)if (st &LM90_STATUS_LLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,0 ); + hwmon_temp_min_alarm,0 );if (st &LM90_STATUS_RLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,1 ); + hwmon_temp_min_alarm,1 );if (st2 &MAX6696_STATUS2_R2LOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,2 ); + hwmon_temp_min_alarm,2 );if (st &LM90_STATUS_LHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,0 ); + hwmon_temp_max_alarm,0 );if (st &LM90_STATUS_RHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,1 ); + hwmon_temp_max_alarm,1 );if (st2 &MAX6696_STATUS2_R2HIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,2 ); + hwmon_temp_max_alarm,2 );return true; }
Signature · 1 line
2.33.0
Re: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 30 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +3
-3@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)if (st &LM90_STATUS_LLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,0 ); + hwmon_temp_min_alarm,0 );if (st &LM90_STATUS_RLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,1 ); + hwmon_temp_min_alarm,1 );if (st2 &MAX6696_STATUS2_R2LOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,2 ); + hwmon_temp_min_alarm,2 );if (st &LM90_STATUS_LHIGH ) hwmon_notify_event(data->hwmon_dev, hwmon_temp,
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 10 lines
drivers/hwmon/lm90.c +3
-3- hwmon_temp_max, 0); + hwmon_temp_max_alarm, 0);if (st &LM90_STATUS_RHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,1 ); + hwmon_temp_max_alarm,1 );if (st2 &MAX6696_STATUS2_R2HIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,2 ); + hwmon_temp_max_alarm,2 );
IIUC, "alarm" is about the T_CRIT output line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.
Re: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
15.01.2022 23:33, Dmitry Osipenko пишет:
Quoted 38 lines
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 37 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +5
-5@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)if (st &LM90_STATUS_LLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,0 ); + hwmon_temp_min_alarm,0 );if (st &LM90_STATUS_RLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,1 ); + hwmon_temp_min_alarm,1 );if (st2 &MAX6696_STATUS2_R2LOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,2 ); + hwmon_temp_min_alarm,2 );if (st &LM90_STATUS_LHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,0 ); + hwmon_temp_max_alarm,0 );if (st &LM90_STATUS_RHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,1 ); + hwmon_temp_max_alarm,1 );if (st2 &MAX6696_STATUS2_R2HIGH )
Quoted 9 lines
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 3 lines
drivers/hwmon/lm90.c +1
-1hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,2 ); + hwmon_temp_max_alarm,2 );IIUC, "alarm" is about the
T_CRIToutput line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.
Although, no. I see now that the "alarm_bits" in the code are about the alerts. Should be okay then.
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
Quoted 49 lines · Dmitry Osipenko
15.01.2022 23:33, Dmitry Osipenko пишет:
Quoted 38 lines
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 37 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +5
-5@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status)if (st &LM90_STATUS_LLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,0 ); + hwmon_temp_min_alarm,0 );if (st &LM90_STATUS_RLOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,1 ); + hwmon_temp_min_alarm,1 );if (st2 &MAX6696_STATUS2_R2LOW )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_min,2 ); + hwmon_temp_min_alarm,2 );if (st &LM90_STATUS_LHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,0 ); + hwmon_temp_max_alarm,0 );if (st &LM90_STATUS_RHIGH )hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,1 ); + hwmon_temp_max_alarm,1 );if (st2 &MAX6696_STATUS2_R2HIGH )Quoted 9 lines
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 3 lines
drivers/hwmon/lm90.c +1
-1hwmon_notify_event (data->hwmon_dev, hwmon_temp, - hwmon_temp_max,2 ); + hwmon_temp_max_alarm,2 );IIUC, "alarm" is about the
T_CRIToutput line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.
Quoted 3 lines
Although, no. I see now that the "
alarm_bits" in the code are about the alerts. Should be okay then.
Alarm attributes are really neither about interrupts nor about alerts. Alarm attributes alert userspace that a limit has been exceeded. How and if the driver notices that a limit has been exceeded is an implementation detail. In a specific implementation, alerts or interrupts can be used to notify a driver that a notable event has occurred on a given device, but technically that is not necessary. Polling would do just as well.
Guenter
Re: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
16.01.2022 00:11, Guenter Roeck пишет:
Quoted 55 lines · Dmitry Osipenko
Quoted 50 lines
15.01.2022 23:33, Dmitry Osipenko пишет:
Quoted 39 lines
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 38 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
drivers/hwmon/lm90.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +5
-5@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) if (st & LM90_STATUS_LLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 0); + hwmon_temp_min_alarm, 0); if (st & LM90_STATUS_RLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 1); + hwmon_temp_min_alarm, 1); if (st2 & MAX6696_STATUS2_R2LOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 2); + hwmon_temp_min_alarm, 2); if (st & LM90_STATUS_LHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 0); + hwmon_temp_max_alarm, 0); if (st & LM90_STATUS_RHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 1); + hwmon_temp_max_alarm, 1); if (st2 & MAX6696_STATUS2_R2HIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp,Quoted 9 lines
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 2 lines
drivers/hwmon/lm90.c +1
-1- hwmon_temp_max, 2); + hwmon_temp_max_alarm, 2);IIUC, "alarm" is about the
T_CRIToutput line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.Quoted 3 lines
Although, no. I see now that the "
alarm_bits" in the code are about the alerts. Should be okay then.
Quoted 7 lines
Alarm attributes are really neither about interrupts nor about alerts. Alarm attributes alert userspace that a limit has been exceeded. How and if the driver notices that a limit has been exceeded is an implementation detail. In a specific implementation, alerts or interrupts can be used to notify a driver that a notable event has occurred on a given device, but technically that is not necessary. Polling would do just as well.
Datasheet refers to T_CRIT using the "alarm" term, this confused me a tad.
BTW, we don't have events wired for the temp_crit_alarm attribute.
Guenter Roeck
maintainerRe: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
Quoted 64 lines · Dmitry Osipenko
16.01.2022 00:11, Guenter Roeck пишет:
Quoted 55 lines · Dmitry Osipenko
Quoted 50 lines
15.01.2022 23:33, Dmitry Osipenko пишет:
Quoted 39 lines
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 38 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/lm90.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +5
-5@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) if (st & LM90_STATUS_LLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 0); + hwmon_temp_min_alarm, 0); if (st & LM90_STATUS_RLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 1); + hwmon_temp_min_alarm, 1); if (st2 & MAX6696_STATUS2_R2LOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 2); + hwmon_temp_min_alarm, 2); if (st & LM90_STATUS_LHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 0); + hwmon_temp_max_alarm, 0); if (st & LM90_STATUS_RHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 1); + hwmon_temp_max_alarm, 1); if (st2 & MAX6696_STATUS2_R2HIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp,Quoted 9 lines
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 2 lines
drivers/hwmon/lm90.c +1
-1- hwmon_temp_max, 2); + hwmon_temp_max_alarm, 2);IIUC, "alarm" is about the
T_CRIToutput line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.Quoted 3 lines
Although, no. I see now that the "
alarm_bits" in the code are about the alerts. Should be okay then.Quoted 7 lines
Alarm attributes are really neither about interrupts nor about alerts. Alarm attributes alert userspace that a limit has been exceeded. How and if the driver notices that a limit has been exceeded is an implementation detail. In a specific implementation, alerts or interrupts can be used to notify a driver that a notable event has occurred on a given device, but technically that is not necessary. Polling would do just as well.
Quoted 4 lines
Datasheet refers to
T_CRITusing the "alarm" term, this confused me a tad.BTW, we don't have events wired for the
temp_crit_alarmattribute.
And not for for emergency alarms either. I have a patch prepared to address this, as part of a larger patch series. Unlike the patches in this series, I considered adding events for those attributes an enhancement and not a bug fix.
Guenter
Re: [PATCH 6/6] hwmon: (lm90) Fix sysfs and udev notifications
16.01.2022 18:58, Guenter Roeck пишет:
Quoted 68 lines · Dmitry Osipenko
Quoted 67 lines
16.01.2022 00:11, Guenter Roeck пишет:
Quoted 55 lines · Dmitry Osipenko
Quoted 50 lines
15.01.2022 23:33, Dmitry Osipenko пишет:
Quoted 39 lines
11.01.2022 19:51, Guenter Roeck пишет:
Quoted 38 lines
sysfs and udev notifications need to be sent to the
_alarmattributes, not to the value attributes.Fixes 94dbd23ed88c ("hwmon: (lm90) Use hwmon_notify_event()")Cc Dmitry Osipenko <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
drivers/hwmon/lm90.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)drivers/hwmon/lm90.c +5
-5@@ -1808,22 +1808,22 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) if (st & LM90_STATUS_LLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 0); + hwmon_temp_min_alarm, 0); if (st & LM90_STATUS_RLOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 1); + hwmon_temp_min_alarm, 1); if (st2 & MAX6696_STATUS2_R2LOW) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_min, 2); + hwmon_temp_min_alarm, 2); if (st & LM90_STATUS_LHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 0); + hwmon_temp_max_alarm, 0); if (st & LM90_STATUS_RHIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp, - hwmon_temp_max, 1); + hwmon_temp_max_alarm, 1); if (st2 & MAX6696_STATUS2_R2HIGH) hwmon_notify_event(data->hwmon_dev, hwmon_temp,Quoted 9 lines
drivers/hwmon/lm90.c static bool lm90_is_tripped(struct i2c_client *client, u16 *status) · line 1826
Quoted 2 lines
drivers/hwmon/lm90.c +1
-1- hwmon_temp_max, 2); + hwmon_temp_max_alarm, 2);IIUC, "alarm" is about the
T_CRIToutput line. While these attributes are about the ALERT line. Hence why "alert" notifications need to be sent to the unrelated "alarm" attributes? This change doesn't look right.Quoted 3 lines
Although, no. I see now that the "
alarm_bits" in the code are about the alerts. Should be okay then.Quoted 7 lines
Alarm attributes are really neither about interrupts nor about alerts. Alarm attributes alert userspace that a limit has been exceeded. How and if the driver notices that a limit has been exceeded is an implementation detail. In a specific implementation, alerts or interrupts can be used to notify a driver that a notable event has occurred on a given device, but technically that is not necessary. Polling would do just as well.
Datasheet refers to
T_CRITusing the "alarm" term, this confused me a tad.
Quoted 6 lines
Quoted 2 lines
BTW, we don't have events wired for the
temp_crit_alarmattribute.And not for for emergency alarms either. I have a patch prepared to address this, as part of a larger patch series. Unlike the patches in this series, I considered adding events for those attributes an enhancement and not a bug fix.
Alright