hwmon: (nct6775) Flip Caseopen alarm as 1 is OK
PATCH 1/1 hwmon: (nct6775) Flip Caseopen alarm as 1 is OK
we flip intrusion alarms as nc6796d-s datasheet states:
- CASEOPEN0_STS. CaseOpen Status.
* 1: Caseopen0 is detected and latched.
* 0: Caseopen0 is not latched.
--- drivers/hwmon/nct6775-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/hwmon/nct6775-core.c +10 -0
@@ -1734,6 +1734,16 @@ nct6775_show_alarm(struct device *dev, struct device_attribute *attr, char *buf)return PTR_ERR (data); nr = data->ALARM_BITS[sattr->index]; + +/* nc6796d-s datasheet states: CASEOPEN0_STS. CaseOpen Status. +* 1: Caseopen0 is detected and latched. +* 0: Caseopen0 is not latched. +* so we flip intrusion alarms, 1 is OK +*/ +if (data->kind == nct6799 && sattr->index >=INTRUSION_ALARM_BASE ) +return sprintf (buf,"%u\n" , + (unsigned int )!((data->alarms >> nr) &0x01 )); +return sprintf (buf,"%u\n" , (unsigned int )((data->alarms >> nr) &0x01 )); }
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
prerequisite-patch-id: 36e3467bd9ea72cb3ad2bef638a8389a9537d111
prerequisite-patch-id: 85db508f68cabb50472c0cc5ef3953fc46bee3b1
prerequisite-patch-id: 1504eb67a66d80604d73cda09059629f102fc961
Signature · 1 line
2.39.2
Guenter Roeck
maintainerQuoted 18 lines · Ahmad Khalifa
we flip intrusion alarms as nc6796d-s datasheet states:
-CASEOPEN0_STS. CaseOpen Status.
* 1: Caseopen0 is detected and latched.
* 0: Caseopen0 is not latched.Signed-off-by Ahmad Khalifa <[email protected]>--- drivers/hwmon/nct6775-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/hwmon/nct6775-core.c +0
-0@@ -1734,6 +1734,16 @@ nct6775_show_alarm(struct device *dev, struct device_attribute *attr, char *buf)return PTR_ERR (data); nr = data->ALARM_BITS[sattr->index];
drivers/hwmon/nct6775-core.c nct6775_show_alarm(struct device *dev, struct device_attribute *attr, char *buf) · line 1746
Quoted 10 lines
drivers/hwmon/nct6775-core.c +10
-0+ +/* nc6796d-s datasheet states: CASEOPEN0_STS. CaseOpen Status. +* 1: Caseopen0 is detected and latched. +* 0: Caseopen0 is not latched. +* so we flip intrusion alarms, 1 is OK +*/ +if (data->kind == nct6799 && sattr->index >=INTRUSION_ALARM_BASE ) +return sprintf (buf,"%u\n" , + (unsigned int )!((data->alarms >> nr) &0x01 )); +
Ok, I am lost here. 1 means that case open is detected and latched. That is no different to all other chips of the series. Why would you want to return 0 (no alarm) in this case for nc6796d-s ?
Guenter
Quoted 8 lines
drivers/hwmon/nct6775-core.c +0
-0return sprintf (buf,"%u\n" , (unsigned int )((data->alarms >> nr) &0x01 )); }base-commit:
06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
prerequisite-patch-id:36e3467bd9ea72cb3ad2bef638a8389a9537d111
prerequisite-patch-id:85db508f68cabb50472c0cc5ef3953fc46bee3b1
prerequisite-patch-id:1504eb67a66d80604d73cda09059629f102fc961
Quoted 9 lines · Guenter Roeck
Quoted 5 lines · Ahmad Khalifa
+ /* nc6796d-s datasheet states:
CASEOPEN0_STS. CaseOpen Status. + * 1: Caseopen0 is detected and latched.
+ * 0: Caseopen0 is not latched.
+ * so we flip intrusion alarms, 1 is OK
+ */Ok, I am lost here. 1 means that case open is detected and latched. That is no different to all other chips of the series. Why would you want to return 0 (no alarm) in this case for nc6796d-s ?
I read it as 'latched' vs 'not latched', but if it's the same for all of them, then I take this patch back.
My mistake.
Signature · 2 lines
Regards, Ahmad Khalifa
Guenter Roeck
maintainerQuoted 7 lines · Ahmad Khalifa
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Ahmad Khalifa
+ /* nc6796d-s datasheet states:
CASEOPEN0_STS. CaseOpen Status. + * 1: Caseopen0 is detected and latched.
+ * 0: Caseopen0 is not latched.
+ * so we flip intrusion alarms, 1 is OK
+ */
Quoted 9 lines
Quoted 3 lines
Ok, I am lost here. 1 means that case open is detected and latched. That is no different to all other chips of the series. Why would you want to return 0 (no alarm) in this case for nc6796d-s ?
I read it as 'latched' vs 'not latched', but if it's the same for all of them, then I take this patch back.
My mistake.
The chips latch the case open signal, so once case open is detected it has to be reset by writing into the attribute. The rest (latched vs. not latched) is just wording; "not latched" just means that case open was not detected since the bit was last reset.
Guenter