summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nct6775.h
diff options
context:
space:
mode:
authorAhmad Khalifa <ahmad@khalifa.ws>2023-07-17 21:10:51 +0100
committerGuenter Roeck <linux@roeck-us.net>2023-08-21 06:04:29 -0700
commit3b7f4bde06daaff391a374fc27c8163b2847de34 (patch)
tree4fdca9cd96b8ece875fa1f3778c9b652ebb1f3f6 /drivers/hwmon/nct6775.h
parentb3af14c4c2841343584b61c49b0cfb8808764239 (diff)
downloadlinux-stable-3b7f4bde06daaff391a374fc27c8163b2847de34.tar.gz
linux-stable-3b7f4bde06daaff391a374fc27c8163b2847de34.tar.bz2
linux-stable-3b7f4bde06daaff391a374fc27c8163b2847de34.zip
hwmon: (nct6775) Increase and reorder ALARM/BEEP bits
* Increase available bits, IN: 16 to 24, FAN: 8 to 12, TEMP: 6 to 12 * Reorder alarm/beep definitions to match in order to allow additional inputs in the future * Remove comments about 'unused' bits as probe() is a better reference Testing note: * Tested on nct6799 with IN/FAN/TEMP, and changing min/max/high/hyst, that triggers the corresponding alarms correctly. Good confirmation on the original mapping of the registers and masks. As to be expected, only 4 fans and 2 temps (fixed) have limits currently on nct6799 on my board. * Trouble with testing intrusion alarms and beeps, no way to confirm those. As I understand now, intrusion/caseopen is probably not connected on my board. And I haven't seen a buzzer on a board in ages. Signed-off-by: Ahmad Khalifa <ahmad@khalifa.ws> Link: https://lore.kernel.org/r/20230717201050.1657809-1-ahmad@khalifa.ws Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/nct6775.h')
-rw-r--r--drivers/hwmon/nct6775.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/hwmon/nct6775.h b/drivers/hwmon/nct6775.h
index a84c6ce7275d..c752bc7bbe72 100644
--- a/drivers/hwmon/nct6775.h
+++ b/drivers/hwmon/nct6775.h
@@ -239,10 +239,25 @@ nct6775_add_attr_group(struct nct6775_data *data, const struct attribute_group *
#define NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE 0x28
-#define FAN_ALARM_BASE 16
-#define TEMP_ALARM_BASE 24
-#define INTRUSION_ALARM_BASE 30
-#define BEEP_ENABLE_BASE 15
+/*
+ * ALARM_BITS and BEEP_BITS store bit-index for the mask of the registers
+ * loaded into data->alarm and data->beep.
+ *
+ * Every input register (IN/TEMP/FAN) must have a corresponding
+ * ALARM/BEEP bit at the same index BITS[BASE + index]
+ * Set value to -1 to disable the visibility of that '*_alarm' attribute and
+ * to pad the bits until the next BASE
+ *
+ * Beep has an additional GLOBAL_BEEP_ENABLE bit
+ */
+#define VIN_ALARM_BASE 0
+#define FAN_ALARM_BASE 24
+#define TEMP_ALARM_BASE 36
+#define INTRUSION_ALARM_BASE 48
+#define BEEP_ENABLE_BASE 50
+
+#define NUM_ALARM_BITS (INTRUSION_ALARM_BASE + 4)
+#define NUM_BEEP_BITS (BEEP_ENABLE_BASE + 1)
/*
* Not currently used: