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

Merge tag 'hwmon-for-linus-v4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:
"Two patches for the nct6775 driver: add support for NCT6793D, and fix
swapped registers"

* tag 'hwmon-for-linus-v4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (nct6775) Add support for NCT6793D
hwmon: (nct6775) Swap STEP_UP_TIME and STEP_DOWN_TIME registers for most chips

+48 -24
+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.
+42 -22
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 }; ··· 367 354 368 355 /* NCT6776 specific data */ 369 356 357 + /* STEP_UP_TIME and STEP_DOWN_TIME regs are swapped for all chips but NCT6775 */ 358 + #define NCT6776_REG_FAN_STEP_UP_TIME NCT6775_REG_FAN_STEP_DOWN_TIME 359 + #define NCT6776_REG_FAN_STEP_DOWN_TIME NCT6775_REG_FAN_STEP_UP_TIME 360 + 370 361 static const s8 NCT6776_ALARM_BITS[] = { 371 362 0, 1, 2, 3, 8, 21, 20, 16, /* in0.. in7 */ 372 363 17, -1, -1, -1, -1, -1, -1, /* in8..in14 */ ··· 550 533 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ 551 534 12, 9 }; /* intrusion0, intrusion1 */ 552 535 553 - /* NCT6792 specific data */ 536 + /* NCT6792/NCT6793 specific data */ 554 537 555 538 static const u16 NCT6792_REG_TEMP_MON[] = { 556 539 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; ··· 1073 1056 case nct6779: 1074 1057 case nct6791: 1075 1058 case nct6792: 1059 + case nct6793: 1076 1060 return reg == 0x150 || reg == 0x153 || reg == 0x155 || 1077 1061 ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || 1078 1062 reg == 0x402 || ··· 1425 1407 case nct6779: 1426 1408 case nct6791: 1427 1409 case nct6792: 1410 + case nct6793: 1428 1411 reg = nct6775_read_value(data, 1429 1412 data->REG_CRITICAL_PWM_ENABLE[i]); 1430 1413 if (reg & data->CRITICAL_PWM_ENABLE_MASK) ··· 2841 2822 case nct6779: 2842 2823 case nct6791: 2843 2824 case nct6792: 2825 + case nct6793: 2844 2826 nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], 2845 2827 val); 2846 2828 reg = nct6775_read_value(data, ··· 3276 3256 pwm4pin = false; 3277 3257 pwm5pin = false; 3278 3258 pwm6pin = false; 3279 - } else { /* NCT6779D, NCT6791D, or NCT6792D */ 3259 + } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */ 3280 3260 regval = superio_inb(sioreg, 0x1c); 3281 3261 3282 3262 fan3pin = !(regval & (1 << 5)); ··· 3289 3269 3290 3270 fan4min = fan4pin; 3291 3271 3292 - if (data->kind == nct6791 || data->kind == nct6792) { 3272 + if (data->kind == nct6791 || data->kind == nct6792 || 3273 + data->kind == nct6793) { 3293 3274 regval = superio_inb(sioreg, 0x2d); 3294 3275 fan6pin = (regval & (1 << 1)); 3295 3276 pwm6pin = (regval & (1 << 0)); ··· 3549 3528 data->REG_FAN_PULSES = NCT6776_REG_FAN_PULSES; 3550 3529 data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; 3551 3530 data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; 3552 - data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; 3553 - data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; 3531 + data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME; 3532 + data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME; 3554 3533 data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; 3555 3534 data->REG_PWM[0] = NCT6775_REG_PWM; 3556 3535 data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; ··· 3621 3600 data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES; 3622 3601 data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; 3623 3602 data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; 3624 - data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; 3625 - data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; 3603 + data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME; 3604 + data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME; 3626 3605 data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; 3627 3606 data->REG_PWM[0] = NCT6775_REG_PWM; 3628 3607 data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; ··· 3664 3643 break; 3665 3644 case nct6791: 3666 3645 case nct6792: 3646 + case nct6793: 3667 3647 data->in_num = 15; 3668 3648 data->pwm_num = 6; 3669 3649 data->auto_pwm_num = 4; ··· 3699 3677 data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES; 3700 3678 data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; 3701 3679 data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; 3702 - data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; 3703 - data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; 3680 + data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME; 3681 + data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME; 3704 3682 data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; 3705 3683 data->REG_PWM[0] = NCT6775_REG_PWM; 3706 3684 data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; ··· 3940 3918 case nct6779: 3941 3919 case nct6791: 3942 3920 case nct6792: 3921 + case nct6793: 3943 3922 break; 3944 3923 } 3945 3924 ··· 3973 3950 break; 3974 3951 case nct6791: 3975 3952 case nct6792: 3953 + case nct6793: 3976 3954 tmp |= 0x7e; 3977 3955 break; 3978 3956 } ··· 4071 4047 if (reg != data->sio_reg_enable) 4072 4048 superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable); 4073 4049 4074 - if (data->kind == nct6791 || data->kind == nct6792) 4050 + if (data->kind == nct6791 || data->kind == nct6792 || 4051 + data->kind == nct6793) 4075 4052 nct6791_enable_io_mapping(sioreg); 4076 4053 4077 4054 superio_exit(sioreg); ··· 4131 4106 .probe = nct6775_probe, 4132 4107 }; 4133 4108 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 4109 /* nct6775_find() looks for a '627 in the Super-I/O config space */ 4144 4110 static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) 4145 4111 { ··· 4166 4150 case SIO_NCT6792_ID: 4167 4151 sio_data->kind = nct6792; 4168 4152 break; 4153 + case SIO_NCT6793_ID: 4154 + sio_data->kind = nct6793; 4155 + break; 4169 4156 default: 4170 4157 if (val != 0xffff) 4171 4158 pr_debug("unsupported chip ID: 0x%04x\n", val); ··· 4194 4175 superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); 4195 4176 } 4196 4177 4197 - if (sio_data->kind == nct6791 || sio_data->kind == nct6792) 4178 + if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || 4179 + sio_data->kind == nct6793) 4198 4180 nct6791_enable_io_mapping(sioaddr); 4199 4181 4200 4182 superio_exit(sioaddr); ··· 4305 4285 } 4306 4286 4307 4287 MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); 4308 - MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D/NCT6792D driver"); 4288 + MODULE_DESCRIPTION("Driver for NCT6775F and compatible chips"); 4309 4289 MODULE_LICENSE("GPL"); 4310 4290 4311 4291 module_init(sensors_nct6775_init);