[PATCH] hwmon: (nct6775) Flip Caseopen alarm as 1 is OK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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));
+
 	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
-- 
2.39.2




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux