Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (nct6775) Add support for NCT6793D

NCT6793D is register compatible with NCT6792D.

Also move nct6775_sio_names[] closer to enum kinds to simplify
adding new chips.

Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+38 -18
+4
Documentation/hwmon/nct6775
··· 32 32 Prefix: 'nct6792' 33 33 Addresses scanned: ISA address retrieved from Super I/O registers 34 34 Datasheet: Available from Nuvoton upon request 35 + * Nuvoton NCT6793D 36 + Prefix: 'nct6793' 37 + Addresses scanned: ISA address retrieved from Super I/O registers 38 + Datasheet: Available from Nuvoton upon request 35 39 36 40 Authors: 37 41 Guenter Roeck <linux@roeck-us.net>
+2 -2
drivers/hwmon/Kconfig
··· 1140 1140 help 1141 1141 If you say yes here you get support for the hardware monitoring 1142 1142 functionality of the Nuvoton NCT6106D, NCT6775F, NCT6776F, NCT6779D, 1143 - NCT6791D, NCT6792D and compatible Super-I/O chips. This driver 1144 - replaces the w83627ehf driver for NCT6775F and NCT6776F. 1143 + NCT6791D, NCT6792D, NCT6793D, and compatible Super-I/O chips. This 1144 + driver replaces the w83627ehf driver for NCT6775F and NCT6776F. 1145 1145 1146 1146 This driver can also be built as a module. If so, the module 1147 1147 will be called nct6775.
+32 -16
drivers/hwmon/nct6775.c
··· 39 39 * nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3 40 40 * nct6791d 15 6 6 2+6 0xc800 0xc1 0x5ca3 41 41 * nct6792d 15 6 6 2+6 0xc910 0xc1 0x5ca3 42 + * nct6793d 15 6 6 2+6 0xd120 0xc1 0x5ca3 42 43 * 43 44 * #temp lists the number of monitored temperature sources (first value) plus 44 45 * the number of directly connectable temperature sensors (second value). ··· 64 63 65 64 #define USE_ALTERNATE 66 65 67 - enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792 }; 66 + enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793 }; 68 67 69 68 /* used to set data->name = nct6775_device_names[data->sio_kind] */ 70 69 static const char * const nct6775_device_names[] = { ··· 74 73 "nct6779", 75 74 "nct6791", 76 75 "nct6792", 76 + "nct6793", 77 + }; 78 + 79 + static const char * const nct6775_sio_names[] __initconst = { 80 + "NCT6106D", 81 + "NCT6775F", 82 + "NCT6776D/F", 83 + "NCT6779D", 84 + "NCT6791D", 85 + "NCT6792D", 86 + "NCT6793D", 77 87 }; 78 88 79 89 static unsigned short force_id; ··· 116 104 #define SIO_NCT6779_ID 0xc560 117 105 #define SIO_NCT6791_ID 0xc800 118 106 #define SIO_NCT6792_ID 0xc910 107 + #define SIO_NCT6793_ID 0xd120 119 108 #define SIO_ID_MASK 0xFFF0 120 109 121 110 enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; ··· 550 537 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ 551 538 12, 9 }; /* intrusion0, intrusion1 */ 552 539 553 - /* NCT6792 specific data */ 540 + /* NCT6792/NCT6793 specific data */ 554 541 555 542 static const u16 NCT6792_REG_TEMP_MON[] = { 556 543 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; ··· 1073 1060 case nct6779: 1074 1061 case nct6791: 1075 1062 case nct6792: 1063 + case nct6793: 1076 1064 return reg == 0x150 || reg == 0x153 || reg == 0x155 || 1077 1065 ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || 1078 1066 reg == 0x402 || ··· 1425 1411 case nct6779: 1426 1412 case nct6791: 1427 1413 case nct6792: 1414 + case nct6793: 1428 1415 reg = nct6775_read_value(data, 1429 1416 data->REG_CRITICAL_PWM_ENABLE[i]); 1430 1417 if (reg & data->CRITICAL_PWM_ENABLE_MASK) ··· 2841 2826 case nct6779: 2842 2827 case nct6791: 2843 2828 case nct6792: 2829 + case nct6793: 2844 2830 nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], 2845 2831 val); 2846 2832 reg = nct6775_read_value(data, ··· 3276 3260 pwm4pin = false; 3277 3261 pwm5pin = false; 3278 3262 pwm6pin = false; 3279 - } else { /* NCT6779D, NCT6791D, or NCT6792D */ 3263 + } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */ 3280 3264 regval = superio_inb(sioreg, 0x1c); 3281 3265 3282 3266 fan3pin = !(regval & (1 << 5)); ··· 3289 3273 3290 3274 fan4min = fan4pin; 3291 3275 3292 - if (data->kind == nct6791 || data->kind == nct6792) { 3276 + if (data->kind == nct6791 || data->kind == nct6792 || 3277 + data->kind == nct6793) { 3293 3278 regval = superio_inb(sioreg, 0x2d); 3294 3279 fan6pin = (regval & (1 << 1)); 3295 3280 pwm6pin = (regval & (1 << 0)); ··· 3664 3647 break; 3665 3648 case nct6791: 3666 3649 case nct6792: 3650 + case nct6793: 3667 3651 data->in_num = 15; 3668 3652 data->pwm_num = 6; 3669 3653 data->auto_pwm_num = 4; ··· 3940 3922 case nct6779: 3941 3923 case nct6791: 3942 3924 case nct6792: 3925 + case nct6793: 3943 3926 break; 3944 3927 } 3945 3928 ··· 3973 3954 break; 3974 3955 case nct6791: 3975 3956 case nct6792: 3957 + case nct6793: 3976 3958 tmp |= 0x7e; 3977 3959 break; 3978 3960 } ··· 4071 4051 if (reg != data->sio_reg_enable) 4072 4052 superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable); 4073 4053 4074 - if (data->kind == nct6791 || data->kind == nct6792) 4054 + if (data->kind == nct6791 || data->kind == nct6792 || 4055 + data->kind == nct6793) 4075 4056 nct6791_enable_io_mapping(sioreg); 4076 4057 4077 4058 superio_exit(sioreg); ··· 4131 4110 .probe = nct6775_probe, 4132 4111 }; 4133 4112 4134 - static const char * const nct6775_sio_names[] __initconst = { 4135 - "NCT6106D", 4136 - "NCT6775F", 4137 - "NCT6776D/F", 4138 - "NCT6779D", 4139 - "NCT6791D", 4140 - "NCT6792D", 4141 - }; 4142 - 4143 4113 /* nct6775_find() looks for a '627 in the Super-I/O config space */ 4144 4114 static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) 4145 4115 { ··· 4166 4154 case SIO_NCT6792_ID: 4167 4155 sio_data->kind = nct6792; 4168 4156 break; 4157 + case SIO_NCT6793_ID: 4158 + sio_data->kind = nct6793; 4159 + break; 4169 4160 default: 4170 4161 if (val != 0xffff) 4171 4162 pr_debug("unsupported chip ID: 0x%04x\n", val); ··· 4194 4179 superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); 4195 4180 } 4196 4181 4197 - if (sio_data->kind == nct6791 || sio_data->kind == nct6792) 4182 + if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || 4183 + sio_data->kind == nct6793) 4198 4184 nct6791_enable_io_mapping(sioaddr); 4199 4185 4200 4186 superio_exit(sioaddr); ··· 4305 4289 } 4306 4290 4307 4291 MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); 4308 - MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D/NCT6792D driver"); 4292 + MODULE_DESCRIPTION("Driver for NCT6775F and compatible chips"); 4309 4293 MODULE_LICENSE("GPL"); 4310 4294 4311 4295 module_init(sensors_nct6775_init);