diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-08-30 22:45:19 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2015-09-12 22:43:02 -0400 |
commit | cd1faefa66425c3fa338777773c5c017edea3439 (patch) | |
tree | 5b756c8f57e20dbd91b09882c060045735f62018 /drivers/hwmon | |
parent | 728d29400488d54974d3317fe8a232b45fdb42ee (diff) |
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 4 | ||||
-rw-r--r-- | drivers/hwmon/nct6775.c | 48 |
2 files changed, 34 insertions, 18 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 500b262b89bb..e13c902e8966 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -1140,8 +1140,8 @@ config SENSORS_NCT6775 | |||
1140 | help | 1140 | help |
1141 | If you say yes here you get support for the hardware monitoring | 1141 | If you say yes here you get support for the hardware monitoring |
1142 | functionality of the Nuvoton NCT6106D, NCT6775F, NCT6776F, NCT6779D, | 1142 | functionality of the Nuvoton NCT6106D, NCT6775F, NCT6776F, NCT6779D, |
1143 | NCT6791D, NCT6792D and compatible Super-I/O chips. This driver | 1143 | NCT6791D, NCT6792D, NCT6793D, and compatible Super-I/O chips. This |
1144 | replaces the w83627ehf driver for NCT6775F and NCT6776F. | 1144 | driver replaces the w83627ehf driver for NCT6775F and NCT6776F. |
1145 | 1145 | ||
1146 | This driver can also be built as a module. If so, the module | 1146 | This driver can also be built as a module. If so, the module |
1147 | will be called nct6775. | 1147 | will be called nct6775. |
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 2aaedbe0b023..8b4fa55e46c6 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -39,6 +39,7 @@ | |||
39 | * nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3 | 39 | * nct6779d 15 5 5 2+6 0xc560 0xc1 0x5ca3 |
40 | * nct6791d 15 6 6 2+6 0xc800 0xc1 0x5ca3 | 40 | * nct6791d 15 6 6 2+6 0xc800 0xc1 0x5ca3 |
41 | * nct6792d 15 6 6 2+6 0xc910 0xc1 0x5ca3 | 41 | * nct6792d 15 6 6 2+6 0xc910 0xc1 0x5ca3 |
42 | * nct6793d 15 6 6 2+6 0xd120 0xc1 0x5ca3 | ||
42 | * | 43 | * |
43 | * #temp lists the number of monitored temperature sources (first value) plus | 44 | * #temp lists the number of monitored temperature sources (first value) plus |
44 | * the number of directly connectable temperature sensors (second value). | 45 | * the number of directly connectable temperature sensors (second value). |
@@ -63,7 +64,7 @@ | |||
63 | 64 | ||
64 | #define USE_ALTERNATE | 65 | #define USE_ALTERNATE |
65 | 66 | ||
66 | enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792 }; | 67 | enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793 }; |
67 | 68 | ||
68 | /* used to set data->name = nct6775_device_names[data->sio_kind] */ | 69 | /* used to set data->name = nct6775_device_names[data->sio_kind] */ |
69 | static const char * const nct6775_device_names[] = { | 70 | static const char * const nct6775_device_names[] = { |
@@ -73,6 +74,17 @@ static const char * const nct6775_device_names[] = { | |||
73 | "nct6779", | 74 | "nct6779", |
74 | "nct6791", | 75 | "nct6791", |
75 | "nct6792", | 76 | "nct6792", |
77 | "nct6793", | ||
78 | }; | ||
79 | |||
80 | static const char * const nct6775_sio_names[] __initconst = { | ||
81 | "NCT6106D", | ||
82 | "NCT6775F", | ||
83 | "NCT6776D/F", | ||
84 | "NCT6779D", | ||
85 | "NCT6791D", | ||
86 | "NCT6792D", | ||
87 | "NCT6793D", | ||
76 | }; | 88 | }; |
77 | 89 | ||
78 | static unsigned short force_id; | 90 | static unsigned short force_id; |
@@ -104,6 +116,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); | |||
104 | #define SIO_NCT6779_ID 0xc560 | 116 | #define SIO_NCT6779_ID 0xc560 |
105 | #define SIO_NCT6791_ID 0xc800 | 117 | #define SIO_NCT6791_ID 0xc800 |
106 | #define SIO_NCT6792_ID 0xc910 | 118 | #define SIO_NCT6792_ID 0xc910 |
119 | #define SIO_NCT6793_ID 0xd120 | ||
107 | #define SIO_ID_MASK 0xFFF0 | 120 | #define SIO_ID_MASK 0xFFF0 |
108 | 121 | ||
109 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; | 122 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; |
@@ -537,7 +550,7 @@ static const s8 NCT6791_ALARM_BITS[] = { | |||
537 | 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ | 550 | 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ |
538 | 12, 9 }; /* intrusion0, intrusion1 */ | 551 | 12, 9 }; /* intrusion0, intrusion1 */ |
539 | 552 | ||
540 | /* NCT6792 specific data */ | 553 | /* NCT6792/NCT6793 specific data */ |
541 | 554 | ||
542 | static const u16 NCT6792_REG_TEMP_MON[] = { | 555 | static const u16 NCT6792_REG_TEMP_MON[] = { |
543 | 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; | 556 | 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; |
@@ -1060,6 +1073,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) | |||
1060 | case nct6779: | 1073 | case nct6779: |
1061 | case nct6791: | 1074 | case nct6791: |
1062 | case nct6792: | 1075 | case nct6792: |
1076 | case nct6793: | ||
1063 | return reg == 0x150 || reg == 0x153 || reg == 0x155 || | 1077 | return reg == 0x150 || reg == 0x153 || reg == 0x155 || |
1064 | ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || | 1078 | ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || |
1065 | reg == 0x402 || | 1079 | reg == 0x402 || |
@@ -1411,6 +1425,7 @@ static void nct6775_update_pwm_limits(struct device *dev) | |||
1411 | case nct6779: | 1425 | case nct6779: |
1412 | case nct6791: | 1426 | case nct6791: |
1413 | case nct6792: | 1427 | case nct6792: |
1428 | case nct6793: | ||
1414 | reg = nct6775_read_value(data, | 1429 | reg = nct6775_read_value(data, |
1415 | data->REG_CRITICAL_PWM_ENABLE[i]); | 1430 | data->REG_CRITICAL_PWM_ENABLE[i]); |
1416 | if (reg & data->CRITICAL_PWM_ENABLE_MASK) | 1431 | if (reg & data->CRITICAL_PWM_ENABLE_MASK) |
@@ -2826,6 +2841,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr, | |||
2826 | case nct6779: | 2841 | case nct6779: |
2827 | case nct6791: | 2842 | case nct6791: |
2828 | case nct6792: | 2843 | case nct6792: |
2844 | case nct6793: | ||
2829 | nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], | 2845 | nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], |
2830 | val); | 2846 | val); |
2831 | reg = nct6775_read_value(data, | 2847 | reg = nct6775_read_value(data, |
@@ -3260,7 +3276,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data) | |||
3260 | pwm4pin = false; | 3276 | pwm4pin = false; |
3261 | pwm5pin = false; | 3277 | pwm5pin = false; |
3262 | pwm6pin = false; | 3278 | pwm6pin = false; |
3263 | } else { /* NCT6779D, NCT6791D, or NCT6792D */ | 3279 | } else { /* NCT6779D, NCT6791D, NCT6792D, or NCT6793D */ |
3264 | regval = superio_inb(sioreg, 0x1c); | 3280 | regval = superio_inb(sioreg, 0x1c); |
3265 | 3281 | ||
3266 | fan3pin = !(regval & (1 << 5)); | 3282 | fan3pin = !(regval & (1 << 5)); |
@@ -3273,7 +3289,8 @@ nct6775_check_fan_inputs(struct nct6775_data *data) | |||
3273 | 3289 | ||
3274 | fan4min = fan4pin; | 3290 | fan4min = fan4pin; |
3275 | 3291 | ||
3276 | if (data->kind == nct6791 || data->kind == nct6792) { | 3292 | if (data->kind == nct6791 || data->kind == nct6792 || |
3293 | data->kind == nct6793) { | ||
3277 | regval = superio_inb(sioreg, 0x2d); | 3294 | regval = superio_inb(sioreg, 0x2d); |
3278 | fan6pin = (regval & (1 << 1)); | 3295 | fan6pin = (regval & (1 << 1)); |
3279 | pwm6pin = (regval & (1 << 0)); | 3296 | pwm6pin = (regval & (1 << 0)); |
@@ -3647,6 +3664,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3647 | break; | 3664 | break; |
3648 | case nct6791: | 3665 | case nct6791: |
3649 | case nct6792: | 3666 | case nct6792: |
3667 | case nct6793: | ||
3650 | data->in_num = 15; | 3668 | data->in_num = 15; |
3651 | data->pwm_num = 6; | 3669 | data->pwm_num = 6; |
3652 | data->auto_pwm_num = 4; | 3670 | data->auto_pwm_num = 4; |
@@ -3922,6 +3940,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3922 | case nct6779: | 3940 | case nct6779: |
3923 | case nct6791: | 3941 | case nct6791: |
3924 | case nct6792: | 3942 | case nct6792: |
3943 | case nct6793: | ||
3925 | break; | 3944 | break; |
3926 | } | 3945 | } |
3927 | 3946 | ||
@@ -3954,6 +3973,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3954 | break; | 3973 | break; |
3955 | case nct6791: | 3974 | case nct6791: |
3956 | case nct6792: | 3975 | case nct6792: |
3976 | case nct6793: | ||
3957 | tmp |= 0x7e; | 3977 | tmp |= 0x7e; |
3958 | break; | 3978 | break; |
3959 | } | 3979 | } |
@@ -4051,7 +4071,8 @@ static int __maybe_unused nct6775_resume(struct device *dev) | |||
4051 | if (reg != data->sio_reg_enable) | 4071 | if (reg != data->sio_reg_enable) |
4052 | superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable); | 4072 | superio_outb(sioreg, SIO_REG_ENABLE, data->sio_reg_enable); |
4053 | 4073 | ||
4054 | if (data->kind == nct6791 || data->kind == nct6792) | 4074 | if (data->kind == nct6791 || data->kind == nct6792 || |
4075 | data->kind == nct6793) | ||
4055 | nct6791_enable_io_mapping(sioreg); | 4076 | nct6791_enable_io_mapping(sioreg); |
4056 | 4077 | ||
4057 | superio_exit(sioreg); | 4078 | superio_exit(sioreg); |
@@ -4110,15 +4131,6 @@ static struct platform_driver nct6775_driver = { | |||
4110 | .probe = nct6775_probe, | 4131 | .probe = nct6775_probe, |
4111 | }; | 4132 | }; |
4112 | 4133 | ||
4113 | static const char * const nct6775_sio_names[] __initconst = { | ||
4114 | "NCT6106D", | ||
4115 | "NCT6775F", | ||
4116 | "NCT6776D/F", | ||
4117 | "NCT6779D", | ||
4118 | "NCT6791D", | ||
4119 | "NCT6792D", | ||
4120 | }; | ||
4121 | |||
4122 | /* nct6775_find() looks for a '627 in the Super-I/O config space */ | 4134 | /* nct6775_find() looks for a '627 in the Super-I/O config space */ |
4123 | static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) | 4135 | static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) |
4124 | { | 4136 | { |
@@ -4154,6 +4166,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) | |||
4154 | case SIO_NCT6792_ID: | 4166 | case SIO_NCT6792_ID: |
4155 | sio_data->kind = nct6792; | 4167 | sio_data->kind = nct6792; |
4156 | break; | 4168 | break; |
4169 | case SIO_NCT6793_ID: | ||
4170 | sio_data->kind = nct6793; | ||
4171 | break; | ||
4157 | default: | 4172 | default: |
4158 | if (val != 0xffff) | 4173 | if (val != 0xffff) |
4159 | pr_debug("unsupported chip ID: 0x%04x\n", val); | 4174 | pr_debug("unsupported chip ID: 0x%04x\n", val); |
@@ -4179,7 +4194,8 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) | |||
4179 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); | 4194 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); |
4180 | } | 4195 | } |
4181 | 4196 | ||
4182 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792) | 4197 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || |
4198 | sio_data->kind == nct6793) | ||
4183 | nct6791_enable_io_mapping(sioaddr); | 4199 | nct6791_enable_io_mapping(sioaddr); |
4184 | 4200 | ||
4185 | superio_exit(sioaddr); | 4201 | superio_exit(sioaddr); |
@@ -4289,7 +4305,7 @@ static void __exit sensors_nct6775_exit(void) | |||
4289 | } | 4305 | } |
4290 | 4306 | ||
4291 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); | 4307 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
4292 | MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D/NCT6792D driver"); | 4308 | MODULE_DESCRIPTION("Driver for NCT6775F and compatible chips"); |
4293 | MODULE_LICENSE("GPL"); | 4309 | MODULE_LICENSE("GPL"); |
4294 | 4310 | ||
4295 | module_init(sensors_nct6775_init); | 4311 | module_init(sensors_nct6775_init); |