Re: [PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-23 Thread Björn Gerhart
Thanks for the review Guenter, I checked your proposals. Here comes an update 
of the patch, and I hope this time the format fits as it should.

Changes:
- simplified differences in register addresses
- although kept NCT6116_REG_TEMP_SOURCE, because otherwise the module
  throughs „Invalid temperature source“ messages on loading for each
  register not available
- fixed fan enablements
- simplified case statement (fall through)

Signed-off-by: Bjoern Gerhart 
---
diff -Npaur a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
--- a/drivers/hwmon/nct6775.c   2019-07-10 17:08:30.710690605 +0200
+++ b/drivers/hwmon/nct6775.c   2019-07-23 10:17:33.217639944 +0200
@@ -34,6 +34,7 @@
  *
  * Chip#vin#fan#pwm#temp  chip IDs   man ID
  * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
+ * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
  * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
  * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
  * nct6779d15  5   5   2+60xc560 0xc10x5ca3
@@ -72,12 +73,13 @@
 
 #define USE_ALTERNATE
 
-enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
-nct6795, nct6796, nct6797, nct6798 };
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
+nct6793, nct6795, nct6796, nct6797, nct6798 };
 
 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
"nct6106",
+   "nct6116",
"nct6775",
"nct6776",
"nct6779",
@@ -92,6 +94,7 @@ static const char * const nct6775_device
 
 static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
+   "NCT6116D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
@@ -129,6 +132,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable d
 #define SIO_REG_ADDR   0x60/* Logical device address (2 bytes) */
 
 #define SIO_NCT6106_ID 0xc450
+#define SIO_NCT6116_ID 0xd280
 #define SIO_NCT6775_ID 0xb470
 #define SIO_NCT6776_ID 0xc330
 #define SIO_NCT6779_ID 0xc560
@@ -839,10 +843,8 @@ static const u16 NCT6106_FAN_PULSE_SHIFT
 
 static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
 static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
-static const u16 NCT6106_REG_PWM[] = { 0x119, 0x129, 0x139 };
 static const u16 NCT6106_REG_PWM_READ[] = { 0x4a, 0x4b, 0x4c };
 static const u16 NCT6106_REG_FAN_MODE[] = { 0x113, 0x123, 0x133 };
-static const u16 NCT6106_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130 };
 static const u16 NCT6106_REG_TEMP_SOURCE[] = {
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 };
 
@@ -910,6 +912,70 @@ static const u16 NCT6106_REG_TEMP_CRIT[3
[12] = 0x205,
 };
 
+/* NCT6112D/NCT6114D/NCT6116D specific data */
+
+static const u16 NCT6116_REG_FAN[] = { 0x20, 0x22, 0x24, 0x26, 0x28 };
+static const u16 NCT6116_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4, 0xe6, 0xe8 };
+static const u16 NCT6116_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0xf6, 0xf5 };
+static const u16 NCT6116_FAN_PULSE_SHIFT[] = { 0, 2, 4, 6, 6 };
+
+static const u16 NCT6116_REG_PWM[] = { 0x119, 0x129, 0x139, 0x199, 0x1a9 };
+static const u16 NCT6116_REG_FAN_MODE[] = { 0x113, 0x123, 0x133, 0x193, 0x1a3 
};
+static const u16 NCT6116_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130, 0x190, 0x1a0 
};
+static const u16 NCT6116_REG_TEMP_SOURCE[] = {
+   0xb0, 0xb1, 0xb2 };
+
+static const u16 NCT6116_REG_CRITICAL_TEMP[] = {
+   0x11a, 0x12a, 0x13a, 0x19a, 0x1aa };
+static const u16 NCT6116_REG_CRITICAL_TEMP_TOLERANCE[] = {
+   0x11b, 0x12b, 0x13b, 0x19b, 0x1ab };
+
+static const u16 NCT6116_REG_CRITICAL_PWM_ENABLE[] = {
+   0x11c, 0x12c, 0x13c, 0x19c, 0x1ac };
+static const u16 NCT6116_REG_CRITICAL_PWM[] = {
+   0x11d, 0x12d, 0x13d, 0x19d, 0x1ad };
+
+static const u16 NCT6116_REG_FAN_STEP_UP_TIME[] = {
+   0x114, 0x124, 0x134, 0x194, 0x1a4 };
+static const u16 NCT6116_REG_FAN_STEP_DOWN_TIME[] = {
+   0x115, 0x125, 0x135, 0x195, 0x1a5 };
+static const u16 NCT6116_REG_FAN_STOP_OUTPUT[] = {
+   0x116, 0x126, 0x136, 0x196, 0x1a6 };
+static const u16 NCT6116_REG_FAN_START_OUTPUT[] = {
+   0x117, 0x127, 0x137, 0x197, 0x1a7 };
+static const u16 NCT6116_REG_FAN_STOP_TIME[] = {
+   0x118, 0x128, 0x138, 0x198, 0x1a8 };
+static const u16 NCT6116_REG_TOLERANCE_H[] = {
+   0x112, 0x122, 0x132, 0x192, 0x1a2 };
+
+static const u16 NCT6116_REG_TARGET[] = {
+   0x111, 0x121, 0x131, 0x191, 0x1a1 };
+
+static const u16 NCT6116_REG_AUTO_TEMP[] = {
+   0x160, 0x170, 0x180, 0x1d0, 0x1e0 };
+static const u16 NCT6116_REG_AUTO_PWM[] = {
+   0x164, 0x174, 0x184, 0x1d4, 0x1e4 };
+
+static const s8 NCT6116_ALARM_BITS[] = {
+   0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+   9, -1, -1, -1, -1, -1, -1,  /* in8..in9 */
+   -1, /* unused */
+   32, 33, 34, 35, 36,

Re: [PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-22 Thread Björn Gerhart
Thanks for the review Guenter, I checked your proposals, and here I 
comes an update of the patch.


Changes:
- simplified differences in register addresses
- fixed fan enablements
- simplified case statement

Signed-off-by: Bjoern Gerhart 
---
diff -Naur a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
--- a/drivers/hwmon/nct6775.c 2019-07-10 17:08:30.710690605 +0200
+++ b/drivers/hwmon/nct6775.c 2019-07-22 16:02:17.363091327 +0200
@@ -34,6 +34,7 @@
 *
 * Chip #vin #fan #pwm #temp chip IDs man ID
 * nct6106d 9 3 3 6+3 0xc450 0xc1 0x5ca3
+ * nct6116d 9 5 5 3+3 0xd280 0xc1 0x5ca3
 * nct6775f 9 4 3 6+3 0xb470 0xc1 0x5ca3
 * nct6776f 9 5 3 6+3 0xc330 0xc1 0x5ca3
 * nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3
@@ -72,12 +73,13 @@

 #define USE_ALTERNATE

-enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, 
nct6793,

- nct6795, nct6796, nct6797, nct6798 };
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, 
nct6792,

+ nct6793, nct6795, nct6796, nct6797, nct6798 };

 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
 "nct6106",
+ "nct6116",
 "nct6775",
 "nct6776",
 "nct6779",
@@ -92,6 +94,7 @@

 static const char * const nct6775_sio_names[] __initconst = {
 "NCT6106D",
+ "NCT6116D",
 "NCT6775F",
 "NCT6776D/F",
 "NCT6779D",
@@ -129,6 +132,7 @@
 #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */

 #define SIO_NCT6106_ID 0xc450
+#define SIO_NCT6116_ID 0xd280
 #define SIO_NCT6775_ID 0xb470
 #define SIO_NCT6776_ID 0xc330
 #define SIO_NCT6779_ID 0xc560
@@ -839,10 +843,8 @@

 static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
 static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
-static const u16 NCT6106_REG_PWM[] = { 0x119, 0x129, 0x139 };
 static const u16 NCT6106_REG_PWM_READ[] = { 0x4a, 0x4b, 0x4c };
 static const u16 NCT6106_REG_FAN_MODE[] = { 0x113, 0x123, 0x133 };
-static const u16 NCT6106_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130 };
 static const u16 NCT6106_REG_TEMP_SOURCE[] = {
 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 };

@@ -910,6 +912,68 @@
 [12] = 0x205,
 };

+/* NCT6112D/NCT6114D/NCT6116D specific data */
+
+static const u16 NCT6116_REG_FAN[] = { 0x20, 0x22, 0x24, 0x26, 0x28 };
+static const u16 NCT6116_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4, 0xe6, 0xe8 
};
+static const u16 NCT6116_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0xf6, 
0xf5 };

+static const u16 NCT6116_FAN_PULSE_SHIFT[] = { 0, 2, 4, 6, 6 };
+
+static const u16 NCT6116_REG_PWM[] = { 0x119, 0x129, 0x139, 0x199, 
0x1a9 };
+static const u16 NCT6116_REG_FAN_MODE[] = { 0x113, 0x123, 0x133, 0x193, 
0x1a3 };
+static const u16 NCT6116_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130, 0x190, 
0x1a0 };

+
+static const u16 NCT6116_REG_CRITICAL_TEMP[] = {
+ 0x11a, 0x12a, 0x13a, 0x19a, 0x1aa };
+static const u16 NCT6116_REG_CRITICAL_TEMP_TOLERANCE[] = {
+ 0x11b, 0x12b, 0x13b, 0x19b, 0x1ab };
+
+static const u16 NCT6116_REG_CRITICAL_PWM_ENABLE[] = {
+ 0x11c, 0x12c, 0x13c, 0x19c, 0x1ac };
+static const u16 NCT6116_REG_CRITICAL_PWM[] = {
+ 0x11d, 0x12d, 0x13d, 0x19d, 0x1ad };
+
+static const u16 NCT6116_REG_FAN_STEP_UP_TIME[] = {
+ 0x114, 0x124, 0x134, 0x194, 0x1a4 };
+static const u16 NCT6116_REG_FAN_STEP_DOWN_TIME[] = {
+ 0x115, 0x125, 0x135, 0x195, 0x1a5 };
+static const u16 NCT6116_REG_FAN_STOP_OUTPUT[] = {
+ 0x116, 0x126, 0x136, 0x196, 0x1a6 };
+static const u16 NCT6116_REG_FAN_START_OUTPUT[] = {
+ 0x117, 0x127, 0x137, 0x197, 0x1a7 };
+static const u16 NCT6116_REG_FAN_STOP_TIME[] = {
+ 0x118, 0x128, 0x138, 0x198, 0x1a8 };
+static const u16 NCT6116_REG_TOLERANCE_H[] = {
+ 0x112, 0x122, 0x132, 0x192, 0x1a2 };
+
+static const u16 NCT6116_REG_TARGET[] = {
+ 0x111, 0x121, 0x131, 0x191, 0x1a1 };
+
+static const u16 NCT6116_REG_AUTO_TEMP[] = {
+ 0x160, 0x170, 0x180, 0x1d0, 0x1e0 };
+static const u16 NCT6116_REG_AUTO_PWM[] = {
+ 0x164, 0x174, 0x184, 0x1d4, 0x1e4 };
+
+static const s8 NCT6116_ALARM_BITS[] = {
+ 0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+ 9, -1, -1, -1, -1, -1, -1, /* in8..in9 */
+ -1, /* unused */
+ 32, 33, 34, 35, 36, /* fan1..fan5 */
+ -1, -1, -1, /* unused */
+ 16, 17, 18, -1, -1, -1, /* temp1..temp6 */
+ 48, -1 /* intrusion0, intrusion1 */
+};
+
+static const s8 NCT6116_BEEP_BITS[] = {
+ 0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+ 9, 10, 11, 12, -1, -1, -1, /* in8..in14 */
+ 32, /* global beep enable */
+ 24, 25, 26, 27, 28, /* fan1..fan5 */
+ -1, -1, -1, /* unused */
+ 16, 17, 18, -1, -1, -1, /* temp1..temp6 */
+ 34, -1 /* intrusion0, intrusion1 */
+};
+
 static enum pwm_enable reg_to_pwm_enable(int pwm, int mode)
 {
 if (mode == 0 && pwm == 255)
@@ -1308,6 +1372,11 @@
 return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
 reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
 reg == 0x111 || reg == 0x121 || reg == 0x131;
+ case nct6116:
+ return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
+ reg == 0x26 || reg == 0x28 || reg == 0xe0 || reg == 0xe2 ||
+ reg == 0xe4 || reg == 0xe6 || reg == 0xe8 || reg == 0x111 ||
+ reg == 0x121 || reg == 0x1

Re: [PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-19 Thread Björn Gerhart
Hi Guenter,

I reworked the code after studying the details of the spec.

Changes:
- patch created against the tree of the kernel sources base dir
- only define the different registers in contrast to nct6106
- fixed details of the fan configuration

Signed-off-by: Bjoern Gerhart 
---
diff -Naur a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
--- a/drivers/hwmon/nct6775.c   2019-07-19 15:29:34.960278982 +0200
+++ b/drivers/hwmon/nct6775.c   2019-07-19 15:29:47.332805721 +0200
@@ -34,6 +34,7 @@
  *
  * Chip#vin#fan#pwm#temp  chip IDs   man ID
  * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
+ * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
  * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
  * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
  * nct6779d15  5   5   2+60xc560 0xc10x5ca3
@@ -72,12 +73,13 @@
 
 #define USE_ALTERNATE
 
-enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
-nct6795, nct6796, nct6797, nct6798 };
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
+nct6793, nct6795, nct6796, nct6797, nct6798 };
 
 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
"nct6106",
+   "nct6116",
"nct6775",
"nct6776",
"nct6779",
@@ -92,6 +94,7 @@
 
 static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
+   "NCT6116D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
@@ -129,6 +132,7 @@
 #define SIO_REG_ADDR   0x60/* Logical device address (2 bytes) */
 
 #define SIO_NCT6106_ID 0xc450
+#define SIO_NCT6116_ID 0xd280
 #define SIO_NCT6775_ID 0xb470
 #define SIO_NCT6776_ID 0xc330
 #define SIO_NCT6779_ID 0xc560
@@ -910,6 +914,78 @@
[12] = 0x205,
 };
 
+/* NCT6112D/NCT6114D/NCT6116D specific data */
+
+static const u16 NCT6116_REG_TEMP[] = { 0x10, 0x11, 0x12 };
+static const u16 NCT6116_REG_TEMP_HYST[] = { 0xc3, 0xc7, 0xcb };
+static const u16 NCT6116_REG_TEMP_OVER[] = { 0xc2, 0xc6, 0xca };
+static const u16 NCT6116_REG_TEMP_CRIT_L[] = { 0xc0, 0xc4, 0xc8 };
+static const u16 NCT6116_REG_TEMP_CRIT_H[] = { 0xc1, 0xc5, 0xc9 };
+static const u16 NCT6116_REG_TEMP_CONFIG[] = { 0xb7, 0xb8, 0xb9 };
+
+static const u16 NCT6116_REG_FAN[] = { 0x20, 0x22, 0x24, 0x26, 0x28 };
+static const u16 NCT6116_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4, 0xe6, 0xe8 };
+static const u16 NCT6116_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0xf6, 0xf5 };
+static const u16 NCT6116_FAN_PULSE_SHIFT[] = { 0, 2, 4, 6, 6 };
+
+static const u8 NCT6116_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
+static const u8 NCT6116_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
+static const u16 NCT6116_REG_PWM[] = { 0x119, 0x129, 0x139, 0x199, 0x1a9 };
+static const u16 NCT6116_REG_FAN_MODE[] = { 0x113, 0x123, 0x133, 0x193, 0x1a3 
};
+static const u16 NCT6116_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130, 0x190, 0x1a0 
};
+static const u16 NCT6116_REG_TEMP_SOURCE[] = { 0xb0, 0xb1, 0xb2 };
+
+static const u16 NCT6116_REG_CRITICAL_TEMP[] = {
+   0x11a, 0x12a, 0x13a, 0x19a, 0x1aa };
+static const u16 NCT6116_REG_CRITICAL_TEMP_TOLERANCE[] = {
+   0x11b, 0x12b, 0x13b, 0x19b, 0x1ab };
+
+static const u16 NCT6116_REG_CRITICAL_PWM_ENABLE[] = {
+   0x11c, 0x12c, 0x13c, 0x19c, 0x1ac };
+static const u16 NCT6116_REG_CRITICAL_PWM[] = {
+   0x11d, 0x12d, 0x13d, 0x19d, 0x1ad };
+
+static const u16 NCT6116_REG_FAN_STEP_UP_TIME[] = {
+   0x114, 0x124, 0x134, 0x194, 0x1a4 };
+static const u16 NCT6116_REG_FAN_STEP_DOWN_TIME[] = {
+   0x115, 0x125, 0x135, 0x195, 0x1a5 };
+static const u16 NCT6116_REG_FAN_STOP_OUTPUT[] = {
+   0x116, 0x126, 0x136, 0x196, 0x1a6 };
+static const u16 NCT6116_REG_FAN_START_OUTPUT[] = {
+   0x117, 0x127, 0x137, 0x197, 0x1a7 };
+static const u16 NCT6116_REG_FAN_STOP_TIME[] = {
+   0x118, 0x128, 0x138, 0x198, 0x1a8 };
+static const u16 NCT6116_REG_TOLERANCE_H[] = {
+   0x112, 0x122, 0x132, 0x192, 0x1a2 };
+
+static const u16 NCT6116_REG_TARGET[] = {
+   0x111, 0x121, 0x131, 0x191, 0x1a1 };
+
+static const u16 NCT6116_REG_AUTO_TEMP[] = {
+   0x160, 0x170, 0x180, 0x1d0, 0x1e0 };
+static const u16 NCT6116_REG_AUTO_PWM[] = {
+   0x164, 0x174, 0x184, 0x1d4, 0x1e4 };
+
+static const s8 NCT6116_ALARM_BITS[] = {
+   0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+   9, -1, -1, -1, -1, -1, -1,  /* in8..in9 */
+   -1, /* unused */
+   32, 33, 34, 35, 36, /* fan1..fan5 */
+   -1, -1, -1, /* unused */
+   16, 17, 18, -1, -1, -1, /* temp1..temp6 */
+   48, -1  /* intrusion0, intrusion1 */
+};
+
+static const s8 NCT6116_BEEP_BITS[] = {
+   0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+   9, 10, 11, 12, -1, -1,

Re: [PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-18 Thread Björn Gerhart
Thanks Guenter! Please see my comments below.


> Am 16.07.2019 um 15:44 schrieb Guenter Roeck :
> 
> On 7/15/19 9:47 AM, Björn Gerhart wrote:
>> Hello again and thanks for the early feedback! This is the re-worked patch 
>> of the one I sent last week. It’s created against kernel 5.1.15 and already 
>> depends on the preceding patch concerning the same code.
>> The nct6116 is the successor model of nct6106. Mainly, I’m unsure if certain 
>> details of the spec are mapped correctly to the code. These details are:
>> - NCT6116_BEEP_BITS
> 
> looks good to me.
> 
>> - int cr24 (cr23 is new, and I’m unsure if the code has to get modified 
>> therefore)
> 
> I don't see cr23h in the datasheet available to me. What am I missing ?
> 
My fault - there is no cr23h at all.

> But, yes, there are differences:
> 
> nct6116:
>   cr1ah[2] determines AUXFANIN1/AUXFANOUT1 settings
>   cr1b[1-1] and cr2a[1] determine AUXFANIN2/AUXFANOUT2 settings
>   cr2b[7] is an alternate for AUXFANIN1/AUXFANOUT1
>   cr2b[4] enable AUXFANIN0/AUXFANOUT0 (same as AUXFANIN/AUXFANOUT ?) on 
> pin 6, 14
>   cr24[3] enables AUXFANOUT on pin 14
> 
> nct6106:
>   cr24[7] enables AUXFANIN on pin 6
>   cr24[3] enables AUXFANOUT on pin 14
> 
This part turns to be the most tricky one. For me the meaning/interpretation of 
all the possible options is quite confusing. Especially when some contents 
might get mirrored to different registers.

The nct6116 covers 5 fans in total, and I identified fan4 as AUXFAN1 and fan5 
as AUXFAN2. So respectively, AUXFAN0 should be the same as AUXFAN and reference 
to fan3.

Following, the piece of code which I hope to reflect this part of the datasheet 
properly:
{ else if (data->kind == nct6116) {
int cr1a = superio_inb(sioreg, 0x1a);
int cr1b = superio_inb(sioreg, 0x1b);
int cr24 = superio_inb(sioreg, 0x24);
int cr2a = superio_inb(sioreg, 0x2a);
 
pwm3pin = cr24 & 0x08;
fan3pin = cr2b & 0x10;
pwm4pin = cr1a & 0x04;
if !(cr1b & 0x03) {
pwm5pin = cr2a & 0x02;
}

The registers described in the spec do not differ between pwmpin and fanpin. 
Which one shall get used?
If the same content is good for in and out, is pwm4pin == fan4pin?

>> - NCT6116_REG_FAN_PULSES
>> - NCT6116_FAN_PULSE_SHIFT
>> - NCT6116_ALARM_BITS
>> With the nct6116 wired on my mainboard, the sensors command seems to work as 
>> I would expect.
>> Signed-off-by: Bjoern Gerhart 
>> ---
>> --- nct6775-5.1.15-1.el7.elrepo.x86_64-bugfixed/nct6775.c2019-07-10 
>> 17:08:30.710690605 +0200
>> +++ nct6775/nct6775.c2019-07-10 17:30:38.012416414 +0200
>> @@ -34,6 +34,7 @@
>>   *
>>   * Chip#vin#fan#pwm#temp  chip IDs   man ID
>>   * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
>> + * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
>>   * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
>>   * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
>>   * nct6779d15  5   5   2+60xc560 0xc10x5ca3
>> @@ -72,12 +73,13 @@
>>#define USE_ALTERNATE
>>  -enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
>> - nct6795, nct6796, nct6797, nct6798 };
>> +enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
>> + nct6793, nct6795, nct6796, nct6797, nct6798 };
>>/* used to set data->name = nct6775_device_names[data->sio_kind] */
>>  static const char * const nct6775_device_names[] = {
>>  "nct6106",
>> +"nct6116",
>>  "nct6775",
>>  "nct6776",
>>  "nct6779",
>> @@ -92,6 +94,7 @@
>>static const char * const nct6775_sio_names[] __initconst = {
>>  "NCT6106D",
>> +"NCT6116D",
>>  "NCT6775F",
>>  "NCT6776D/F",
>>  "NCT6779D",
>> @@ -129,6 +132,7 @@
>>  #define SIO_REG_ADDR0x60/* Logical device address (2 
>> bytes) */
>>#define SIO_NCT6106_ID0xc450
>> +#define SIO_NCT6116_ID  0xd280
>>  #define SIO_NCT6775_ID  0xb470
>>  #define SIO_NCT6776_ID  0xc330
>>  #define SIO_NCT6779_ID  0xc560
>> @@ -910,6 +914,119 @@
>>  [12] = 0x205,
>>  };
>>  +/* NCT6112D/NCT6114D/NCT6116D specific data */
>> +
>> +#define NC

[PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-15 Thread Björn Gerhart
Hello again and thanks for the early feedback! This is the re-worked patch of 
the one I sent last week. It’s created against kernel 5.1.15 and already 
depends on the preceding patch concerning the same code.

The nct6116 is the successor model of nct6106. Mainly, I’m unsure if certain 
details of the spec are mapped correctly to the code. These details are:
- NCT6116_BEEP_BITS
- int cr24 (cr23 is new, and I’m unsure if the code has to get modified 
therefore)
- NCT6116_REG_FAN_PULSES
- NCT6116_FAN_PULSE_SHIFT
- NCT6116_ALARM_BITS

With the nct6116 wired on my mainboard, the sensors command seems to work as I 
would expect.

Signed-off-by: Bjoern Gerhart 
---
--- nct6775-5.1.15-1.el7.elrepo.x86_64-bugfixed/nct6775.c   2019-07-10 
17:08:30.710690605 +0200
+++ nct6775/nct6775.c   2019-07-10 17:30:38.012416414 +0200
@@ -34,6 +34,7 @@
  *
  * Chip#vin#fan#pwm#temp  chip IDs   man ID
  * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
+ * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
  * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
  * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
  * nct6779d15  5   5   2+60xc560 0xc10x5ca3
@@ -72,12 +73,13 @@
 
 #define USE_ALTERNATE
 
-enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
-nct6795, nct6796, nct6797, nct6798 };
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
+nct6793, nct6795, nct6796, nct6797, nct6798 };
 
 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
"nct6106",
+   "nct6116",
"nct6775",
"nct6776",
"nct6779",
@@ -92,6 +94,7 @@
 
 static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
+   "NCT6116D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
@@ -129,6 +132,7 @@
 #define SIO_REG_ADDR   0x60/* Logical device address (2 bytes) */
 
 #define SIO_NCT6106_ID 0xc450
+#define SIO_NCT6116_ID 0xd280
 #define SIO_NCT6775_ID 0xb470
 #define SIO_NCT6776_ID 0xc330
 #define SIO_NCT6779_ID 0xc560
@@ -910,6 +914,119 @@
[12] = 0x205,
 };
 
+/* NCT6112D/NCT6114D/NCT6116D specific data */
+
+#define NCT6116_REG_VBAT   0x318
+#define NCT6116_REG_DIODE  0x319
+#define NCT6116_DIODE_MASK 0x01
+
+static const u16 NCT6116_REG_IN_MAX[] = {
+   0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9e, 0xa0, 0xa2 };
+static const u16 NCT6116_REG_IN_MIN[] = {
+   0x91, 0x93, 0x95, 0x97, 0x99, 0x9b, 0x9f, 0xa1, 0xa3 };
+static const u16 NCT6116_REG_IN[] = {
+   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09 };
+
+static const u16 NCT6116_REG_TEMP[] = { 0x10, 0x11, 0x12 };
+static const u16 NCT6116_REG_TEMP_MON[] = { 0x18, 0x19, 0x1a };
+static const u16 NCT6116_REG_TEMP_HYST[] = { 0xc3, 0xc7, 0xcb };
+static const u16 NCT6116_REG_TEMP_OVER[] = { 0xc2, 0xc6, 0xca };
+static const u16 NCT6116_REG_TEMP_CRIT_L[] = { 0xc0, 0xc4, 0xc8 };
+static const u16 NCT6116_REG_TEMP_CRIT_H[] = { 0xc1, 0xc5, 0xc9 };
+static const u16 NCT6116_REG_TEMP_OFFSET[] = { 0x311, 0x312, 0x313 };
+static const u16 NCT6116_REG_TEMP_CONFIG[] = { 0xb7, 0xb8, 0xb9 };
+
+static const u16 NCT6116_REG_FAN[] = { 0x20, 0x22, 0x24, 0x26, 0x28 };
+static const u16 NCT6116_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4, 0xe6, 0xe8 };
+static const u16 NCT6116_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0xf6, 0xf5 };
+static const u16 NCT6116_FAN_PULSE_SHIFT[] = { 0, 2, 4, 6, 6 };
+
+static const u8 NCT6116_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
+static const u8 NCT6116_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
+static const u16 NCT6116_REG_PWM[] = { 0x119, 0x129, 0x139, 0x199, 0x1a9 };
+static const u16 NCT6116_REG_PWM_READ[] = { 0x4a, 0x4b, 0x4c };
+static const u16 NCT6116_REG_FAN_MODE[] = { 0x113, 0x123, 0x133, 0x193, 0x1a3 
};
+static const u16 NCT6116_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130, 0x190, 0x1a0 
};
+static const u16 NCT6116_REG_TEMP_SOURCE[] = { 0xb0, 0xb1, 0xb2 };
+
+static const u16 NCT6116_REG_CRITICAL_TEMP[] = {
+   0x11a, 0x12a, 0x13a, 0x19a, 0x1aa };
+static const u16 NCT6116_REG_CRITICAL_TEMP_TOLERANCE[] = {
+   0x11b, 0x12b, 0x13b, 0x19b, 0x1ab };
+
+static const u16 NCT6116_REG_CRITICAL_PWM_ENABLE[] = {
+   0x11c, 0x12c, 0x13c, 0x19c, 0x1ac };
+#define NCT6116_CRITICAL_PWM_ENABLE_MASK   0x10
+static const u16 NCT6116_REG_CRITICAL_PWM[] = {
+   0x11d, 0x12d, 0x13d, 0x19d, 0x1ad };
+
+static const u16 NCT6116_REG_FAN_STEP_UP_TIME[] = {
+   0x114, 0x124, 0x134, 0x194, 0x1a4 };
+static const u16 NCT6116_REG_FAN_STEP_DOWN_TIME[] = {
+   0x115, 0x125, 0x135, 0x195, 0x1a5 };
+static const u16 NCT6116_REG_FAN_STOP_OUTPUT[] = {
+   0x116, 0x126, 0x136, 0x196, 0x1a6 };
+static const u16 NCT6116_REG_FAN_START_OUTPUT[] = {
+   0x117, 0x127, 0x137, 0x197, 0x1a7 };
+stat

[PATCH] hwmon: (nct6775) Fix register address and added missed tolerance for nct6106

2019-07-15 Thread Björn Gerhart
Hi Guenter,

the patch was created against kernel 5.1.15. Is the corresponding „baseline“ 
5.1 then?

- Fixed address of third NCT6106_REG_WEIGHT_DUTY_STEP
- added missed NCT6106_REG_TOLERANCE_H

Signed-off-by: Bjoern Gerhart 
—
Index: nct6775.c
===
--- nct6775.c   (revision 16326)
+++ nct6775.c   (working copy)
@@ -866,7 +866,7 @@
 static const u16 NCT6106_REG_WEIGHT_TEMP_SEL[] = { 0x168, 0x178, 0x188 };
 static const u16 NCT6106_REG_WEIGHT_TEMP_STEP[] = { 0x169, 0x179, 0x189 };
 static const u16 NCT6106_REG_WEIGHT_TEMP_STEP_TOL[] = { 0x16a, 0x17a, 0x18a };
-static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x17c };
+static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x18b };
 static const u16 NCT6106_REG_WEIGHT_TEMP_BASE[] = { 0x16c, 0x17c, 0x18c };
 static const u16 NCT6106_REG_WEIGHT_DUTY_BASE[] = { 0x16d, 0x17d, 0x18d };
 
@@ -3778,6 +3778,7 @@
data->REG_FAN_TIME[0] = NCT6106_REG_FAN_STOP_TIME;
data->REG_FAN_TIME[1] = NCT6106_REG_FAN_STEP_UP_TIME;
data->REG_FAN_TIME[2] = NCT6106_REG_FAN_STEP_DOWN_TIME;
+   data->REG_TOLERANCE_H = NCT6106_REG_TOLERANCE_H;
data->REG_PWM[0] = NCT6106_REG_PWM;
data->REG_PWM[1] = NCT6106_REG_FAN_START_OUTPUT;
data->REG_PWM[2] = NCT6106_REG_FAN_STOP_OUTPUT;





Re: [PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-10 Thread Björn Gerhart
oh no, the patch is WRONG as I noticed right now. Sorry for the noise! I’ll 
re-work it and come back!

> Am 10.07.2019 um 21:19 schrieb Björn Gerhart :
> 
> The nct6116 is the successor model of nct6106. Mainly I’m unsure about my 
> changes related to:
> - NCT6116_BEEP_BITS
> - int cr24 (cr23 is new, and I’m unsure if the code has to get modified 
> therefore)
> - NCT6116_REG_FAN_PULSES
> - NCT6116_FAN_PULSE_SHIFT
> - NCT6116_ALARM_BITS
> 
> With the nct6116 wired on my mainboard, the sensors command seems to work as 
> I would expect.
> 
> Index: nct6775.c
> ===
> --- nct6775.c (revision 16313)
> +++ nct6775.c (working copy)
> @@ -34,6 +34,7 @@
>  *
>  * Chip#vin#fan#pwm#temp  chip IDs   man ID
>  * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
> + * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
>  * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
>  * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
>  * nct6779d15  5   5   2+60xc560 0xc10x5ca3
> @@ -72,12 +73,13 @@
> 
> #define USE_ALTERNATE
> 
> -enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
> -  nct6795, nct6796, nct6797, nct6798 };
> +enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
> +  nct6793, nct6795, nct6796, nct6797, nct6798 };
> 
> /* used to set data->name = nct6775_device_names[data->sio_kind] */
> static const char * const nct6775_device_names[] = {
>   "nct6106",
> + "nct6116",
>   "nct6775",
>   "nct6776",
>   "nct6779",
> @@ -92,6 +94,7 @@
> 
> static const char * const nct6775_sio_names[] __initconst = {
>   "NCT6106D",
> + "NCT6116D",
>   "NCT6775F",
>   "NCT6776D/F",
>   "NCT6779D",
> @@ -129,6 +132,7 @@
> #define SIO_REG_ADDR  0x60/* Logical device address (2 bytes) */
> 
> #define SIO_NCT6106_ID0xc450
> +#define SIO_NCT6116_ID   0xd280
> #define SIO_NCT6775_ID0xb470
> #define SIO_NCT6776_ID0xc330
> #define SIO_NCT6779_ID0xc560
> @@ -819,18 +823,29 @@
>   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09 };
> 
> static const u16 NCT6106_REG_TEMP[] = { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 };
> +static const u16 NCT6116_REG_TEMP[] = { 0x10, 0x11, 0x12 };
> static const u16 NCT6106_REG_TEMP_MON[] = { 0x18, 0x19, 0x1a };
> static const u16 NCT6106_REG_TEMP_HYST[] = {
>   0xc3, 0xc7, 0xcb, 0xcf, 0xd3, 0xd7 };
> +static const u16 NCT6116_REG_TEMP_HYST[] = {
> + 0xc3, 0xc7, 0xcb };
> static const u16 NCT6106_REG_TEMP_OVER[] = {
>   0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd6 };
> +static const u16 NCT6116_REG_TEMP_OVER[] = {
> + 0xc2, 0xc6, 0xca };
> static const u16 NCT6106_REG_TEMP_CRIT_L[] = {
>   0xc0, 0xc4, 0xc8, 0xcc, 0xd0, 0xd4 };
> +static const u16 NCT6116_REG_TEMP_CRIT_L[] = {
> + 0xc0, 0xc4, 0xc8 };
> static const u16 NCT6106_REG_TEMP_CRIT_H[] = {
>   0xc1, 0xc5, 0xc9, 0xcf, 0xd1, 0xd5 };
> +static const u16 NCT6116_REG_TEMP_CRIT_H[] = {
> + 0xc1, 0xc5, 0xc9 };
> static const u16 NCT6106_REG_TEMP_OFFSET[] = { 0x311, 0x312, 0x313 };
> static const u16 NCT6106_REG_TEMP_CONFIG[] = {
>   0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc };
> +static const u16 NCT6116_REG_TEMP_CONFIG[] = {
> + 0xb7, 0xb8, 0xb9 };
> 
> static const u16 NCT6106_REG_FAN[] = { 0x20, 0x22, 0x24 };
> static const u16 NCT6106_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4 };
> @@ -845,6 +860,8 @@
> static const u16 NCT6106_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130 };
> static const u16 NCT6106_REG_TEMP_SOURCE[] = {
>   0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 };
> +static const u16 NCT6116_REG_TEMP_SOURCE[] = {
> + 0xb0, 0xb1, 0xb2 };
> 
> static const u16 NCT6106_REG_CRITICAL_TEMP[] = { 0x11a, 0x12a, 0x13a };
> static const u16 NCT6106_REG_CRITICAL_TEMP_TOLERANCE[] = {
> @@ -886,6 +903,16 @@
>   48, -1  /* intrusion0, intrusion1 */
> };
> 
> +static const s8 NCT6116_ALARM_BITS[] = {
> + 0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
> + 9, -1, -1, -1, -1, -1, -1,  /* in8..in14 */
> + -1, /* unused */
> + 32, 33, 34, -1, -1, /* fan1..fan5 */
> + -1, -1, -1, /* unused */
> + 16, 17, 18, /* temp1..temp3 */
> + 48, -1  /* intrusion0, intrusion1 */
> +};
> +
> static const u16 NC

[PATCH] hwmon: (nct6775) Integrated new model nct6116

2019-07-10 Thread Björn Gerhart
The nct6116 is the successor model of nct6106. Mainly I’m unsure about my 
changes related to:
- NCT6116_BEEP_BITS
- int cr24 (cr23 is new, and I’m unsure if the code has to get modified 
therefore)
- NCT6116_REG_FAN_PULSES
- NCT6116_FAN_PULSE_SHIFT
- NCT6116_ALARM_BITS

With the nct6116 wired on my mainboard, the sensors command seems to work as I 
would expect.

Index: nct6775.c
===
--- nct6775.c   (revision 16313)
+++ nct6775.c   (working copy)
@@ -34,6 +34,7 @@
  *
  * Chip#vin#fan#pwm#temp  chip IDs   man ID
  * nct6106d 9  3   3   6+30xc450 0xc10x5ca3
+ * nct6116d 9  5   5   3+30xd280 0xc10x5ca3
  * nct6775f 9  4   3   6+30xb470 0xc10x5ca3
  * nct6776f 9  5   3   6+30xc330 0xc10x5ca3
  * nct6779d15  5   5   2+60xc560 0xc10x5ca3
@@ -72,12 +73,13 @@
 
 #define USE_ALTERNATE
 
-enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
-nct6795, nct6796, nct6797, nct6798 };
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
+nct6793, nct6795, nct6796, nct6797, nct6798 };
 
 /* used to set data->name = nct6775_device_names[data->sio_kind] */
 static const char * const nct6775_device_names[] = {
"nct6106",
+   "nct6116",
"nct6775",
"nct6776",
"nct6779",
@@ -92,6 +94,7 @@
 
 static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
+   "NCT6116D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
@@ -129,6 +132,7 @@
 #define SIO_REG_ADDR   0x60/* Logical device address (2 bytes) */
 
 #define SIO_NCT6106_ID 0xc450
+#define SIO_NCT6116_ID 0xd280
 #define SIO_NCT6775_ID 0xb470
 #define SIO_NCT6776_ID 0xc330
 #define SIO_NCT6779_ID 0xc560
@@ -819,18 +823,29 @@
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x07, 0x08, 0x09 };
 
 static const u16 NCT6106_REG_TEMP[] = { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 };
+static const u16 NCT6116_REG_TEMP[] = { 0x10, 0x11, 0x12 };
 static const u16 NCT6106_REG_TEMP_MON[] = { 0x18, 0x19, 0x1a };
 static const u16 NCT6106_REG_TEMP_HYST[] = {
0xc3, 0xc7, 0xcb, 0xcf, 0xd3, 0xd7 };
+static const u16 NCT6116_REG_TEMP_HYST[] = {
+   0xc3, 0xc7, 0xcb };
 static const u16 NCT6106_REG_TEMP_OVER[] = {
0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd6 };
+static const u16 NCT6116_REG_TEMP_OVER[] = {
+   0xc2, 0xc6, 0xca };
 static const u16 NCT6106_REG_TEMP_CRIT_L[] = {
0xc0, 0xc4, 0xc8, 0xcc, 0xd0, 0xd4 };
+static const u16 NCT6116_REG_TEMP_CRIT_L[] = {
+   0xc0, 0xc4, 0xc8 };
 static const u16 NCT6106_REG_TEMP_CRIT_H[] = {
0xc1, 0xc5, 0xc9, 0xcf, 0xd1, 0xd5 };
+static const u16 NCT6116_REG_TEMP_CRIT_H[] = {
+   0xc1, 0xc5, 0xc9 };
 static const u16 NCT6106_REG_TEMP_OFFSET[] = { 0x311, 0x312, 0x313 };
 static const u16 NCT6106_REG_TEMP_CONFIG[] = {
0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc };
+static const u16 NCT6116_REG_TEMP_CONFIG[] = {
+   0xb7, 0xb8, 0xb9 };
 
 static const u16 NCT6106_REG_FAN[] = { 0x20, 0x22, 0x24 };
 static const u16 NCT6106_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4 };
@@ -845,6 +860,8 @@
 static const u16 NCT6106_REG_TEMP_SEL[] = { 0x110, 0x120, 0x130 };
 static const u16 NCT6106_REG_TEMP_SOURCE[] = {
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5 };
+static const u16 NCT6116_REG_TEMP_SOURCE[] = {
+   0xb0, 0xb1, 0xb2 };
 
 static const u16 NCT6106_REG_CRITICAL_TEMP[] = { 0x11a, 0x12a, 0x13a };
 static const u16 NCT6106_REG_CRITICAL_TEMP_TOLERANCE[] = {
@@ -886,6 +903,16 @@
48, -1  /* intrusion0, intrusion1 */
 };
 
+static const s8 NCT6116_ALARM_BITS[] = {
+   0, 1, 2, 3, 4, 5, 7, 8, /* in0.. in7 */
+   9, -1, -1, -1, -1, -1, -1,  /* in8..in14 */
+   -1, /* unused */
+   32, 33, 34, -1, -1, /* fan1..fan5 */
+   -1, -1, -1, /* unused */
+   16, 17, 18, /* temp1..temp3 */
+   48, -1  /* intrusion0, intrusion1 */
+};
+
 static const u16 NCT6106_REG_BEEP[NUM_REG_BEEP] = {
0x3c0, 0x3c1, 0x3c2, 0x3c3, 0x3c4 };
 
@@ -1308,6 +1335,10 @@
return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
  reg == 0x111 || reg == 0x121 || reg == 0x131;
+   case nct6116:
+   return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
+ reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
+ reg == 0x111 || reg == 0x121 || reg == 0x131;
case nct6775:
return (((reg & 0xff00) == 0x100 ||
(reg & 0xff00) == 0x200) &&
@@ -1687,6 +1718,7 @@
data->auto_pwm[i][data->auto_pwm_num] = 0xff;
 

[PATCH] hwmon: (nct6775) Fix register address and added missing tolerance

2019-07-10 Thread Björn Gerhart
In the process of adding the new model nct6116, two tiny details of the nct6106 
attracted my attention. Please find the patch therefore below:

Index: nct6775.c
===
--- nct6775.c   (revision 16326)
+++ nct6775.c   (working copy)
@@ -866,7 +866,7 @@
 static const u16 NCT6106_REG_WEIGHT_TEMP_SEL[] = { 0x168, 0x178, 0x188 };
 static const u16 NCT6106_REG_WEIGHT_TEMP_STEP[] = { 0x169, 0x179, 0x189 };
 static const u16 NCT6106_REG_WEIGHT_TEMP_STEP_TOL[] = { 0x16a, 0x17a, 0x18a };
-static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x17c };
+static const u16 NCT6106_REG_WEIGHT_DUTY_STEP[] = { 0x16b, 0x17b, 0x18b };
 static const u16 NCT6106_REG_WEIGHT_TEMP_BASE[] = { 0x16c, 0x17c, 0x18c };
 static const u16 NCT6106_REG_WEIGHT_DUTY_BASE[] = { 0x16d, 0x17d, 0x18d };
 
@@ -3778,6 +3778,7 @@
data->REG_FAN_TIME[0] = NCT6106_REG_FAN_STOP_TIME;
data->REG_FAN_TIME[1] = NCT6106_REG_FAN_STEP_UP_TIME;
data->REG_FAN_TIME[2] = NCT6106_REG_FAN_STEP_DOWN_TIME;
+   data->REG_TOLERANCE_H = NCT6106_REG_TOLERANCE_H;
data->REG_PWM[0] = NCT6106_REG_PWM;
data->REG_PWM[1] = NCT6106_REG_FAN_START_OUTPUT;
data->REG_PWM[2] = NCT6106_REG_FAN_STOP_OUTPUT;

(nct6775) adding support for NCT6116D

2019-05-27 Thread Björn Gerhart
In September of 2018, Nuvoton released the new SuperIO series 6112D, 6114D and 
6116D. On the mainboard I need support for, the NCT6116D is built in, so that’s 
the model I can test against.

Also, I have the datasheet of the series. I would like to add support for the 
NCT6116D to the nct6775 driver. Anyone facing the same needs for supporting a 
model of this series?

Best - Björn