Commit 30255100 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hwmon-for-linus-v4.3-rc2' of...

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
parents 9efeaaf9 cd1faefa
...@@ -32,6 +32,10 @@ Supported chips: ...@@ -32,6 +32,10 @@ Supported chips:
Prefix: 'nct6792' Prefix: 'nct6792'
Addresses scanned: ISA address retrieved from Super I/O registers Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: Available from Nuvoton upon request Datasheet: Available from Nuvoton upon request
* Nuvoton NCT6793D
Prefix: 'nct6793'
Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: Available from Nuvoton upon request
Authors: Authors:
Guenter Roeck <linux@roeck-us.net> Guenter Roeck <linux@roeck-us.net>
......
...@@ -1140,8 +1140,8 @@ config SENSORS_NCT6775 ...@@ -1140,8 +1140,8 @@ config SENSORS_NCT6775
help help
If you say yes here you get support for the hardware monitoring If you say yes here you get support for the hardware monitoring
functionality of the Nuvoton NCT6106D, NCT6775F, NCT6776F, NCT6779D, functionality of the Nuvoton NCT6106D, NCT6775F, NCT6776F, NCT6779D,
NCT6791D, NCT6792D and compatible Super-I/O chips. This driver NCT6791D, NCT6792D, NCT6793D, and compatible Super-I/O chips. This
replaces the w83627ehf driver for NCT6775F and NCT6776F. driver replaces the w83627ehf driver for NCT6775F and NCT6776F.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called nct6775. will be called nct6775.
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
* nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3 * nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3
* nct6791d 15 6 6 2+6 0xc800 0xc1 0x5ca3 * nct6791d 15 6 6 2+6 0xc800 0xc1 0x5ca3
* nct6792d 15 6 6 2+6 0xc910 0xc1 0x5ca3 * nct6792d 15 6 6 2+6 0xc910 0xc1 0x5ca3
* nct6793d 15 6 6 2+6 0xd120 0xc1 0x5ca3
* *
* #temp lists the number of monitored temperature sources (first value) plus * #temp lists the number of monitored temperature sources (first value) plus
* the number of directly connectable temperature sensors (second value). * the number of directly connectable temperature sensors (second value).
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
#define USE_ALTERNATE #define USE_ALTERNATE
enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792 }; enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793 };
/* used to set data->name = nct6775_device_names[data->sio_kind] */ /* used to set data->name = nct6775_device_names[data->sio_kind] */
static const char * const nct6775_device_names[] = { static const char * const nct6775_device_names[] = {
...@@ -73,6 +74,17 @@ static const char * const nct6775_device_names[] = { ...@@ -73,6 +74,17 @@ static const char * const nct6775_device_names[] = {
"nct6779", "nct6779",
"nct6791", "nct6791",
"nct6792", "nct6792",
"nct6793",
};
static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
"NCT6791D",
"NCT6792D",
"NCT6793D",
}; };
static unsigned short force_id; static unsigned short force_id;
...@@ -104,6 +116,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); ...@@ -104,6 +116,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal");
#define SIO_NCT6779_ID 0xc560 #define SIO_NCT6779_ID 0xc560
#define SIO_NCT6791_ID 0xc800 #define SIO_NCT6791_ID 0xc800
#define SIO_NCT6792_ID 0xc910 #define SIO_NCT6792_ID 0xc910
#define SIO_NCT6793_ID 0xd120
#define SIO_ID_MASK 0xFFF0 #define SIO_ID_MASK 0xFFF0
enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 };
...@@ -354,6 +367,10 @@ static const u16 NCT6775_REG_TEMP_CRIT[ARRAY_SIZE(nct6775_temp_label) - 1] ...@@ -354,6 +367,10 @@ static const u16 NCT6775_REG_TEMP_CRIT[ARRAY_SIZE(nct6775_temp_label) - 1]
/* NCT6776 specific data */ /* NCT6776 specific data */
/* STEP_UP_TIME and STEP_DOWN_TIME regs are swapped for all chips but NCT6775 */
#define NCT6776_REG_FAN_STEP_UP_TIME NCT6775_REG_FAN_STEP_DOWN_TIME
#define NCT6776_REG_FAN_STEP_DOWN_TIME NCT6775_REG_FAN_STEP_UP_TIME
static const s8 NCT6776_ALARM_BITS[] = { static const s8 NCT6776_ALARM_BITS[] = {
0, 1, 2, 3, 8, 21, 20, 16, /* in0.. in7 */ 0, 1, 2, 3, 8, 21, 20, 16, /* in0.. in7 */
17, -1, -1, -1, -1, -1, -1, /* in8..in14 */ 17, -1, -1, -1, -1, -1, -1, /* in8..in14 */
...@@ -533,7 +550,7 @@ static const s8 NCT6791_ALARM_BITS[] = { ...@@ -533,7 +550,7 @@ static const s8 NCT6791_ALARM_BITS[] = {
4, 5, 13, -1, -1, -1, /* temp1..temp6 */ 4, 5, 13, -1, -1, -1, /* temp1..temp6 */
12, 9 }; /* intrusion0, intrusion1 */ 12, 9 }; /* intrusion0, intrusion1 */
/* NCT6792 specific data */ /* NCT6792/NCT6793 specific data */
static const u16 NCT6792_REG_TEMP_MON[] = { static const u16 NCT6792_REG_TEMP_MON[] = {
0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d };
...@@ -1056,6 +1073,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) ...@@ -1056,6 +1073,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg)
case nct6779: case nct6779:
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
return reg == 0x150 || reg == 0x153 || reg == 0x155 || return reg == 0x150 || reg == 0x153 || reg == 0x155 ||
((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) ||
reg == 0x402 || reg == 0x402 ||
...@@ -1407,6 +1425,7 @@ static void nct6775_update_pwm_limits(struct device *dev) ...@@ -1407,6 +1425,7 @@ static void nct6775_update_pwm_limits(struct device *dev)
case nct6779: case nct6779:
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
reg = nct6775_read_value(data, reg = nct6775_read_value(data,
data->REG_CRITICAL_PWM_ENABLE[i]); data->REG_CRITICAL_PWM_ENABLE[i]);
if (reg & data->CRITICAL_PWM_ENABLE_MASK) if (reg & data->CRITICAL_PWM_ENABLE_MASK)
...@@ -2822,6 +2841,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr, ...@@ -2822,6 +2841,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr,
case nct6779: case nct6779:
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], nct6775_write_value(data, data->REG_CRITICAL_PWM[nr],
val); val);
reg = nct6775_read_value(data, reg = nct6775_read_value(data,
...@@ -3256,7 +3276,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data) ...@@ -3256,7 +3276,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
pwm4pin = false; pwm4pin = false;
pwm5pin = false; pwm5pin = false;
pwm6pin = false; pwm6pin = false;
} else { /* NCT6779D, NCT6791D, or NCT6792D */ } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */
regval = superio_inb(sioreg, 0x1c); regval = superio_inb(sioreg, 0x1c);
fan3pin = !(regval & (1 << 5)); fan3pin = !(regval & (1 << 5));
...@@ -3269,7 +3289,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data) ...@@ -3269,7 +3289,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
fan4min = fan4pin; fan4min = fan4pin;
if (data->kind == nct6791 || data->kind == nct6792) { if (data->kind == nct6791 || data->kind == nct6792 ||
data->kind == nct6793) {
regval = superio_inb(sioreg, 0x2d); regval = superio_inb(sioreg, 0x2d);
fan6pin = (regval & (1 << 1)); fan6pin = (regval & (1 << 1));
pwm6pin = (regval & (1 << 0)); pwm6pin = (regval & (1 << 0));
...@@ -3528,8 +3549,8 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3528,8 +3549,8 @@ static int nct6775_probe(struct platform_device *pdev)
data->REG_FAN_PULSES = NCT6776_REG_FAN_PULSES; data->REG_FAN_PULSES = NCT6776_REG_FAN_PULSES;
data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT;
data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME;
data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME;
data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME;
data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H;
data->REG_PWM[0] = NCT6775_REG_PWM; data->REG_PWM[0] = NCT6775_REG_PWM;
data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT;
...@@ -3600,8 +3621,8 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3600,8 +3621,8 @@ static int nct6775_probe(struct platform_device *pdev)
data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES; data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES;
data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT;
data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME;
data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME;
data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME;
data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H;
data->REG_PWM[0] = NCT6775_REG_PWM; data->REG_PWM[0] = NCT6775_REG_PWM;
data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT;
...@@ -3643,6 +3664,7 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3643,6 +3664,7 @@ static int nct6775_probe(struct platform_device *pdev)
break; break;
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
data->in_num = 15; data->in_num = 15;
data->pwm_num = 6; data->pwm_num = 6;
data->auto_pwm_num = 4; data->auto_pwm_num = 4;
...@@ -3677,8 +3699,8 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3677,8 +3699,8 @@ static int nct6775_probe(struct platform_device *pdev)
data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES; data->REG_FAN_PULSES = NCT6779_REG_FAN_PULSES;
data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT; data->FAN_PULSE_SHIFT = NCT6775_FAN_PULSE_SHIFT;
data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME; data->REG_FAN_TIME[0] = NCT6775_REG_FAN_STOP_TIME;
data->REG_FAN_TIME[1] = NCT6775_REG_FAN_STEP_UP_TIME; data->REG_FAN_TIME[1] = NCT6776_REG_FAN_STEP_UP_TIME;
data->REG_FAN_TIME[2] = NCT6775_REG_FAN_STEP_DOWN_TIME; data->REG_FAN_TIME[2] = NCT6776_REG_FAN_STEP_DOWN_TIME;
data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H; data->REG_TOLERANCE_H = NCT6776_REG_TOLERANCE_H;
data->REG_PWM[0] = NCT6775_REG_PWM; data->REG_PWM[0] = NCT6775_REG_PWM;
data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT;
...@@ -3918,6 +3940,7 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3918,6 +3940,7 @@ static int nct6775_probe(struct platform_device *pdev)
case nct6779: case nct6779:
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
break; break;
} }
...@@ -3950,6 +3973,7 @@ static int nct6775_probe(struct platform_device *pdev) ...@@ -3950,6 +3973,7 @@ static int nct6775_probe(struct platform_device *pdev)
break; break;
case nct6791: case nct6791:
case nct6792: case nct6792:
case nct6793:
tmp |= 0x7e; tmp |= 0x7e;
break; break;
} }
...@@ -4047,7 +4071,8 @@ static int __maybe_unused nct6775_resume(struct device *dev) ...@@ -4047,7 +4071,8 @@ static int __maybe_unused nct6775_resume(struct device *dev)
if (reg != data->sio_reg_enable) if (reg != data->sio_reg_enable)
superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable); superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable);
if (data->kind == nct6791 || data->kind == nct6792) if (data->kind == nct6791 || data->kind == nct6792 ||
data->kind == nct6793)
nct6791_enable_io_mapping(sioreg); nct6791_enable_io_mapping(sioreg);
superio_exit(sioreg); superio_exit(sioreg);
...@@ -4106,15 +4131,6 @@ static struct platform_driver nct6775_driver = { ...@@ -4106,15 +4131,6 @@ static struct platform_driver nct6775_driver = {
.probe = nct6775_probe, .probe = nct6775_probe,
}; };
static const char * const nct6775_sio_names[] __initconst = {
"NCT6106D",
"NCT6775F",
"NCT6776D/F",
"NCT6779D",
"NCT6791D",
"NCT6792D",
};
/* nct6775_find() looks for a '627 in the Super-I/O config space */ /* nct6775_find() looks for a '627 in the Super-I/O config space */
static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
{ {
...@@ -4150,6 +4166,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) ...@@ -4150,6 +4166,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
case SIO_NCT6792_ID: case SIO_NCT6792_ID:
sio_data->kind = nct6792; sio_data->kind = nct6792;
break; break;
case SIO_NCT6793_ID:
sio_data->kind = nct6793;
break;
default: default:
if (val != 0xffff) if (val != 0xffff)
pr_debug("unsupported chip ID: 0x%04x\n", val); pr_debug("unsupported chip ID: 0x%04x\n", val);
...@@ -4175,7 +4194,8 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) ...@@ -4175,7 +4194,8 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01);
} }
if (sio_data->kind == nct6791 || sio_data->kind == nct6792) if (sio_data->kind == nct6791 || sio_data->kind == nct6792 ||
sio_data->kind == nct6793)
nct6791_enable_io_mapping(sioaddr); nct6791_enable_io_mapping(sioaddr);
superio_exit(sioaddr); superio_exit(sioaddr);
...@@ -4285,7 +4305,7 @@ static void __exit sensors_nct6775_exit(void) ...@@ -4285,7 +4305,7 @@ static void __exit sensors_nct6775_exit(void)
} }
MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>");
MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D/NCT6792D driver"); MODULE_DESCRIPTION("Driver for NCT6775F and compatible chips");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_init(sensors_nct6775_init); module_init(sensors_nct6775_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment