summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nct6775.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-09-19 23:26:16 -0400
committerGuenter Roeck <linux@roeck-us.net>2018-10-10 23:37:13 -0400
commit0599682b826ff7bbf9d5804fa37bcef36b0c9404 (patch)
tree6de4d40ea3dadf102123b6154edfe932975447b6 /drivers/hwmon/nct6775.c
parente41da286a2fd9a5459d7a02203f776aef5e2bd8a (diff)
hwmon: (nct6775) Add support for NCT6798D
NCT6798D is, with the exception of fan and pwm channel configuration registers, similar to other chips of the series. One interesting difference is the chip ID, which is now extended to 13 bit (the 12-bit chip ID value overlaps with the chip ID of NCT6797D). Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/nct6775.c')
-rw-r--r--drivers/hwmon/nct6775.c84
1 files changed, 80 insertions, 4 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index 9569acf80e18..c3040079b1cb 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -43,6 +43,9 @@
43 * nct6795d 14 6 6 2+6 0xd350 0xc1 0x5ca3 43 * nct6795d 14 6 6 2+6 0xd350 0xc1 0x5ca3
44 * nct6796d 14 7 7 2+6 0xd420 0xc1 0x5ca3 44 * nct6796d 14 7 7 2+6 0xd420 0xc1 0x5ca3
45 * nct6797d 14 7 7 2+6 0xd450 0xc1 0x5ca3 45 * nct6797d 14 7 7 2+6 0xd450 0xc1 0x5ca3
46 * (0xd451)
47 * nct6798d 14 7 7 2+6 0xd458 0xc1 0x5ca3
48 * (0xd459)
46 * 49 *
47 * #temp lists the number of monitored temperature sources (first value) plus 50 * #temp lists the number of monitored temperature sources (first value) plus
48 * the number of directly connectable temperature sensors (second value). 51 * the number of directly connectable temperature sensors (second value).
@@ -70,7 +73,7 @@
70#define USE_ALTERNATE 73#define USE_ALTERNATE
71 74
72enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793, 75enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792, nct6793,
73 nct6795, nct6796, nct6797 }; 76 nct6795, nct6796, nct6797, nct6798 };
74 77
75/* used to set data->name = nct6775_device_names[data->sio_kind] */ 78/* used to set data->name = nct6775_device_names[data->sio_kind] */
76static const char * const nct6775_device_names[] = { 79static const char * const nct6775_device_names[] = {
@@ -84,6 +87,7 @@ static const char * const nct6775_device_names[] = {
84 "nct6795", 87 "nct6795",
85 "nct6796", 88 "nct6796",
86 "nct6797", 89 "nct6797",
90 "nct6798",
87}; 91};
88 92
89static const char * const nct6775_sio_names[] __initconst = { 93static const char * const nct6775_sio_names[] __initconst = {
@@ -97,6 +101,7 @@ static const char * const nct6775_sio_names[] __initconst = {
97 "NCT6795D", 101 "NCT6795D",
98 "NCT6796D", 102 "NCT6796D",
99 "NCT6797D", 103 "NCT6797D",
104 "NCT6798D",
100}; 105};
101 106
102static unsigned short force_id; 107static unsigned short force_id;
@@ -133,7 +138,8 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal");
133#define SIO_NCT6795_ID 0xd350 138#define SIO_NCT6795_ID 0xd350
134#define SIO_NCT6796_ID 0xd420 139#define SIO_NCT6796_ID 0xd420
135#define SIO_NCT6797_ID 0xd450 140#define SIO_NCT6797_ID 0xd450
136#define SIO_ID_MASK 0xFFF0 141#define SIO_NCT6798_ID 0xd458
142#define SIO_ID_MASK 0xFFF8
137 143
138enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; 144enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 };
139 145
@@ -761,6 +767,44 @@ static const char *const nct6796_temp_label[] = {
761#define NCT6796_TEMP_MASK 0xbfff0ffe 767#define NCT6796_TEMP_MASK 0xbfff0ffe
762#define NCT6796_VIRT_TEMP_MASK 0x80000c00 768#define NCT6796_VIRT_TEMP_MASK 0x80000c00
763 769
770static const char *const nct6798_temp_label[] = {
771 "",
772 "SYSTIN",
773 "CPUTIN",
774 "AUXTIN0",
775 "AUXTIN1",
776 "AUXTIN2",
777 "AUXTIN3",
778 "AUXTIN4",
779 "SMBUSMASTER 0",
780 "SMBUSMASTER 1",
781 "Virtual_TEMP",
782 "Virtual_TEMP",
783 "",
784 "",
785 "",
786 "",
787 "PECI Agent 0",
788 "PECI Agent 1",
789 "PCH_CHIP_CPU_MAX_TEMP",
790 "PCH_CHIP_TEMP",
791 "PCH_CPU_TEMP",
792 "PCH_MCH_TEMP",
793 "Agent0 Dimm0",
794 "Agent0 Dimm1",
795 "Agent1 Dimm0",
796 "Agent1 Dimm1",
797 "BYTE_TEMP0",
798 "BYTE_TEMP1",
799 "",
800 "",
801 "",
802 "Virtual_TEMP"
803};
804
805#define NCT6798_TEMP_MASK 0x8fff0ffe
806#define NCT6798_VIRT_TEMP_MASK 0x80000c00
807
764/* NCT6102D/NCT6106D specific data */ 808/* NCT6102D/NCT6106D specific data */
765 809
766#define NCT6106_REG_VBAT 0x318 810#define NCT6106_REG_VBAT 0x318
@@ -1293,6 +1337,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg)
1293 case nct6795: 1337 case nct6795:
1294 case nct6796: 1338 case nct6796:
1295 case nct6797: 1339 case nct6797:
1340 case nct6798:
1296 return reg == 0x150 || reg == 0x153 || reg == 0x155 || 1341 return reg == 0x150 || reg == 0x153 || reg == 0x155 ||
1297 (reg & 0xfff0) == 0x4c0 || 1342 (reg & 0xfff0) == 0x4c0 ||
1298 reg == 0x402 || 1343 reg == 0x402 ||
@@ -1649,6 +1694,7 @@ static void nct6775_update_pwm_limits(struct device *dev)
1649 case nct6795: 1694 case nct6795:
1650 case nct6796: 1695 case nct6796:
1651 case nct6797: 1696 case nct6797:
1697 case nct6798:
1652 reg = nct6775_read_value(data, 1698 reg = nct6775_read_value(data,
1653 data->REG_CRITICAL_PWM_ENABLE[i]); 1699 data->REG_CRITICAL_PWM_ENABLE[i]);
1654 if (reg & data->CRITICAL_PWM_ENABLE_MASK) 1700 if (reg & data->CRITICAL_PWM_ENABLE_MASK)
@@ -3084,6 +3130,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr,
3084 case nct6795: 3130 case nct6795:
3085 case nct6796: 3131 case nct6796:
3086 case nct6797: 3132 case nct6797:
3133 case nct6798:
3087 nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], 3134 nct6775_write_value(data, data->REG_CRITICAL_PWM[nr],
3088 val); 3135 val);
3089 reg = nct6775_read_value(data, 3136 reg = nct6775_read_value(data,
@@ -3505,7 +3552,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
3505 } else { 3552 } else {
3506 /* 3553 /*
3507 * NCT6779D, NCT6791D, NCT6792D, NCT6793D, NCT6795D, NCT6796D, 3554 * NCT6779D, NCT6791D, NCT6792D, NCT6793D, NCT6795D, NCT6796D,
3508 * NCT6797D 3555 * NCT6797D, NCT6798D
3509 */ 3556 */
3510 int cr1a = superio_inb(sioreg, 0x1a); 3557 int cr1a = superio_inb(sioreg, 0x1a);
3511 int cr1b = superio_inb(sioreg, 0x1b); 3558 int cr1b = superio_inb(sioreg, 0x1b);
@@ -3606,6 +3653,23 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
3606 3653
3607 pwm7pin = cr1d & BIT(4); 3654 pwm7pin = cr1d & BIT(4);
3608 break; 3655 break;
3656 case nct6798:
3657 fan6pin = !(cr1b & BIT(0)) && (cre0 & BIT(3));
3658 fan6pin |= cr2a & BIT(4);
3659 fan6pin |= creb & BIT(5);
3660
3661 fan7pin = cr1b & BIT(5);
3662 fan7pin |= !(cr2b & BIT(2));
3663 fan7pin |= creb & BIT(3);
3664
3665 pwm6pin = !(cr1b & BIT(0)) && (cre0 & BIT(4));
3666 pwm6pin |= !(cred & BIT(2)) && (cr2a & BIT(3));
3667 pwm6pin |= (creb & BIT(4)) && !(cr2a & BIT(0));
3668
3669 pwm7pin = !(cr1d & (BIT(2) | BIT(3)));
3670 pwm7pin |= cr2d & BIT(7);
3671 pwm7pin |= creb & BIT(2);
3672 break;
3609 default: /* NCT6779D */ 3673 default: /* NCT6779D */
3610 break; 3674 break;
3611 } 3675 }
@@ -3984,9 +4048,11 @@ static int nct6775_probe(struct platform_device *pdev)
3984 case nct6795: 4048 case nct6795:
3985 case nct6796: 4049 case nct6796:
3986 case nct6797: 4050 case nct6797:
4051 case nct6798:
3987 data->in_num = 15; 4052 data->in_num = 15;
3988 data->pwm_num = (data->kind == nct6796 || 4053 data->pwm_num = (data->kind == nct6796 ||
3989 data->kind == nct6797) ? 7 : 6; 4054 data->kind == nct6797 ||
4055 data->kind == nct6798) ? 7 : 6;
3990 data->auto_pwm_num = 4; 4056 data->auto_pwm_num = 4;
3991 data->has_fan_div = false; 4057 data->has_fan_div = false;
3992 data->temp_fixed_num = 6; 4058 data->temp_fixed_num = 6;
@@ -4030,6 +4096,11 @@ static int nct6775_probe(struct platform_device *pdev)
4030 data->temp_mask = NCT6796_TEMP_MASK; 4096 data->temp_mask = NCT6796_TEMP_MASK;
4031 data->virt_temp_mask = NCT6796_VIRT_TEMP_MASK; 4097 data->virt_temp_mask = NCT6796_VIRT_TEMP_MASK;
4032 break; 4098 break;
4099 case nct6798:
4100 data->temp_label = nct6798_temp_label;
4101 data->temp_mask = NCT6798_TEMP_MASK;
4102 data->virt_temp_mask = NCT6798_VIRT_TEMP_MASK;
4103 break;
4033 } 4104 }
4034 4105
4035 data->REG_CONFIG = NCT6775_REG_CONFIG; 4106 data->REG_CONFIG = NCT6775_REG_CONFIG;
@@ -4300,6 +4371,7 @@ static int nct6775_probe(struct platform_device *pdev)
4300 case nct6795: 4371 case nct6795:
4301 case nct6796: 4372 case nct6796:
4302 case nct6797: 4373 case nct6797:
4374 case nct6798:
4303 break; 4375 break;
4304 } 4376 }
4305 4377
@@ -4336,6 +4408,7 @@ static int nct6775_probe(struct platform_device *pdev)
4336 case nct6795: 4408 case nct6795:
4337 case nct6796: 4409 case nct6796:
4338 case nct6797: 4410 case nct6797:
4411 case nct6798:
4339 tmp |= 0x7e; 4412 tmp |= 0x7e;
4340 break; 4413 break;
4341 } 4414 }
@@ -4541,6 +4614,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
4541 case SIO_NCT6797_ID: 4614 case SIO_NCT6797_ID:
4542 sio_data->kind = nct6797; 4615 sio_data->kind = nct6797;
4543 break; 4616 break;
4617 case SIO_NCT6798_ID:
4618 sio_data->kind = nct6798;
4619 break;
4544 default: 4620 default:
4545 if (val != 0xffff) 4621 if (val != 0xffff)
4546 pr_debug("unsupported chip ID: 0x%04x\n", val); 4622 pr_debug("unsupported chip ID: 0x%04x\n", val);