On 7/15/23 08:32, Ahmad Khalifa wrote:
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 <ahmad@xxxxxxxxxx>
---
drivers/hwmon/nct6775-core.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 1006765d8483..b0435b0bb1ba 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -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));
+
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
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