diff options
Diffstat (limited to 'drivers/hwmon/nct6775.c')
-rw-r--r-- | drivers/hwmon/nct6775.c | 77 |
1 files changed, 61 insertions, 16 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 504cbddbdd90..dc0df57200cd 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -38,6 +38,7 @@ | |||
38 | * nct6776f 9 5 3 6+3 0xc330 0xc1 0x5ca3 | 38 | * nct6776f 9 5 3 6+3 0xc330 0xc1 0x5ca3 |
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 | * | 42 | * |
42 | * #temp lists the number of monitored temperature sources (first value) plus | 43 | * #temp lists the number of monitored temperature sources (first value) plus |
43 | * the number of directly connectable temperature sensors (second value). | 44 | * the number of directly connectable temperature sensors (second value). |
@@ -61,7 +62,7 @@ | |||
61 | 62 | ||
62 | #define USE_ALTERNATE | 63 | #define USE_ALTERNATE |
63 | 64 | ||
64 | enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791 }; | 65 | enum kinds { nct6106, nct6775, nct6776, nct6779, nct6791, nct6792 }; |
65 | 66 | ||
66 | /* used to set data->name = nct6775_device_names[data->sio_kind] */ | 67 | /* used to set data->name = nct6775_device_names[data->sio_kind] */ |
67 | static const char * const nct6775_device_names[] = { | 68 | static const char * const nct6775_device_names[] = { |
@@ -70,6 +71,7 @@ static const char * const nct6775_device_names[] = { | |||
70 | "nct6776", | 71 | "nct6776", |
71 | "nct6779", | 72 | "nct6779", |
72 | "nct6791", | 73 | "nct6791", |
74 | "nct6792", | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | static unsigned short force_id; | 77 | static unsigned short force_id; |
@@ -100,6 +102,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); | |||
100 | #define SIO_NCT6776_ID 0xc330 | 102 | #define SIO_NCT6776_ID 0xc330 |
101 | #define SIO_NCT6779_ID 0xc560 | 103 | #define SIO_NCT6779_ID 0xc560 |
102 | #define SIO_NCT6791_ID 0xc800 | 104 | #define SIO_NCT6791_ID 0xc800 |
105 | #define SIO_NCT6792_ID 0xc910 | ||
103 | #define SIO_ID_MASK 0xFFF0 | 106 | #define SIO_ID_MASK 0xFFF0 |
104 | 107 | ||
105 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; | 108 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; |
@@ -529,6 +532,12 @@ static const s8 NCT6791_ALARM_BITS[] = { | |||
529 | 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ | 532 | 4, 5, 13, -1, -1, -1, /* temp1..temp6 */ |
530 | 12, 9 }; /* intrusion0, intrusion1 */ | 533 | 12, 9 }; /* intrusion0, intrusion1 */ |
531 | 534 | ||
535 | /* NCT6792 specific data */ | ||
536 | |||
537 | static const u16 NCT6792_REG_TEMP_MON[] = { | ||
538 | 0x73, 0x75, 0x77, 0x79, 0x7b, 0x7d }; | ||
539 | static const u16 NCT6792_REG_BEEP[NUM_REG_BEEP] = { | ||
540 | 0xb2, 0xb3, 0xb4, 0xb5, 0xbf }; | ||
532 | 541 | ||
533 | /* NCT6102D/NCT6106D specific data */ | 542 | /* NCT6102D/NCT6106D specific data */ |
534 | 543 | ||
@@ -1043,13 +1052,14 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) | |||
1043 | reg == 0x73 || reg == 0x75 || reg == 0x77; | 1052 | reg == 0x73 || reg == 0x75 || reg == 0x77; |
1044 | case nct6779: | 1053 | case nct6779: |
1045 | case nct6791: | 1054 | case nct6791: |
1055 | case nct6792: | ||
1046 | return reg == 0x150 || reg == 0x153 || reg == 0x155 || | 1056 | return reg == 0x150 || reg == 0x153 || reg == 0x155 || |
1047 | ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || | 1057 | ((reg & 0xfff0) == 0x4b0 && (reg & 0x000f) < 0x0b) || |
1048 | reg == 0x402 || | 1058 | reg == 0x402 || |
1049 | reg == 0x63a || reg == 0x63c || reg == 0x63e || | 1059 | reg == 0x63a || reg == 0x63c || reg == 0x63e || |
1050 | reg == 0x640 || reg == 0x642 || | 1060 | reg == 0x640 || reg == 0x642 || |
1051 | reg == 0x73 || reg == 0x75 || reg == 0x77 || reg == 0x79 || | 1061 | reg == 0x73 || reg == 0x75 || reg == 0x77 || reg == 0x79 || |
1052 | reg == 0x7b; | 1062 | reg == 0x7b || reg == 0x7d; |
1053 | } | 1063 | } |
1054 | return false; | 1064 | return false; |
1055 | } | 1065 | } |
@@ -1063,6 +1073,7 @@ static bool is_word_sized(struct nct6775_data *data, u16 reg) | |||
1063 | static inline void nct6775_set_bank(struct nct6775_data *data, u16 reg) | 1073 | static inline void nct6775_set_bank(struct nct6775_data *data, u16 reg) |
1064 | { | 1074 | { |
1065 | u8 bank = reg >> 8; | 1075 | u8 bank = reg >> 8; |
1076 | |||
1066 | if (data->bank != bank) { | 1077 | if (data->bank != bank) { |
1067 | outb_p(NCT6775_REG_BANK, data->addr + ADDR_REG_OFFSET); | 1078 | outb_p(NCT6775_REG_BANK, data->addr + ADDR_REG_OFFSET); |
1068 | outb_p(bank, data->addr + DATA_REG_OFFSET); | 1079 | outb_p(bank, data->addr + DATA_REG_OFFSET); |
@@ -1300,6 +1311,7 @@ static void nct6775_update_pwm(struct device *dev) | |||
1300 | if (!data->target_speed_tolerance[i] || | 1311 | if (!data->target_speed_tolerance[i] || |
1301 | data->pwm_enable[i] == speed_cruise) { | 1312 | data->pwm_enable[i] == speed_cruise) { |
1302 | u8 t = fanmodecfg & 0x0f; | 1313 | u8 t = fanmodecfg & 0x0f; |
1314 | |||
1303 | if (data->REG_TOLERANCE_H) { | 1315 | if (data->REG_TOLERANCE_H) { |
1304 | t |= (nct6775_read_value(data, | 1316 | t |= (nct6775_read_value(data, |
1305 | data->REG_TOLERANCE_H[i]) & 0x70) >> 1; | 1317 | data->REG_TOLERANCE_H[i]) & 0x70) >> 1; |
@@ -1391,6 +1403,7 @@ static void nct6775_update_pwm_limits(struct device *dev) | |||
1391 | case nct6106: | 1403 | case nct6106: |
1392 | case nct6779: | 1404 | case nct6779: |
1393 | case nct6791: | 1405 | case nct6791: |
1406 | case nct6792: | ||
1394 | reg = nct6775_read_value(data, | 1407 | reg = nct6775_read_value(data, |
1395 | data->REG_CRITICAL_PWM_ENABLE[i]); | 1408 | data->REG_CRITICAL_PWM_ENABLE[i]); |
1396 | if (reg & data->CRITICAL_PWM_ENABLE_MASK) | 1409 | if (reg & data->CRITICAL_PWM_ENABLE_MASK) |
@@ -1473,6 +1486,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev) | |||
1473 | data->alarms = 0; | 1486 | data->alarms = 0; |
1474 | for (i = 0; i < NUM_REG_ALARM; i++) { | 1487 | for (i = 0; i < NUM_REG_ALARM; i++) { |
1475 | u8 alarm; | 1488 | u8 alarm; |
1489 | |||
1476 | if (!data->REG_ALARM[i]) | 1490 | if (!data->REG_ALARM[i]) |
1477 | continue; | 1491 | continue; |
1478 | alarm = nct6775_read_value(data, data->REG_ALARM[i]); | 1492 | alarm = nct6775_read_value(data, data->REG_ALARM[i]); |
@@ -1482,6 +1496,7 @@ static struct nct6775_data *nct6775_update_device(struct device *dev) | |||
1482 | data->beeps = 0; | 1496 | data->beeps = 0; |
1483 | for (i = 0; i < NUM_REG_BEEP; i++) { | 1497 | for (i = 0; i < NUM_REG_BEEP; i++) { |
1484 | u8 beep; | 1498 | u8 beep; |
1499 | |||
1485 | if (!data->REG_BEEP[i]) | 1500 | if (!data->REG_BEEP[i]) |
1486 | continue; | 1501 | continue; |
1487 | beep = nct6775_read_value(data, data->REG_BEEP[i]); | 1502 | beep = nct6775_read_value(data, data->REG_BEEP[i]); |
@@ -1504,8 +1519,9 @@ show_in_reg(struct device *dev, struct device_attribute *attr, char *buf) | |||
1504 | { | 1519 | { |
1505 | struct nct6775_data *data = nct6775_update_device(dev); | 1520 | struct nct6775_data *data = nct6775_update_device(dev); |
1506 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | 1521 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
1507 | int nr = sattr->nr; | ||
1508 | int index = sattr->index; | 1522 | int index = sattr->index; |
1523 | int nr = sattr->nr; | ||
1524 | |||
1509 | return sprintf(buf, "%ld\n", in_from_reg(data->in[nr][index], nr)); | 1525 | return sprintf(buf, "%ld\n", in_from_reg(data->in[nr][index], nr)); |
1510 | } | 1526 | } |
1511 | 1527 | ||
@@ -1515,10 +1531,12 @@ store_in_reg(struct device *dev, struct device_attribute *attr, const char *buf, | |||
1515 | { | 1531 | { |
1516 | struct nct6775_data *data = dev_get_drvdata(dev); | 1532 | struct nct6775_data *data = dev_get_drvdata(dev); |
1517 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | 1533 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); |
1518 | int nr = sattr->nr; | ||
1519 | int index = sattr->index; | 1534 | int index = sattr->index; |
1535 | int nr = sattr->nr; | ||
1520 | unsigned long val; | 1536 | unsigned long val; |
1521 | int err = kstrtoul(buf, 10, &val); | 1537 | int err; |
1538 | |||
1539 | err = kstrtoul(buf, 10, &val); | ||
1522 | if (err < 0) | 1540 | if (err < 0) |
1523 | return err; | 1541 | return err; |
1524 | mutex_lock(&data->update_lock); | 1542 | mutex_lock(&data->update_lock); |
@@ -1535,6 +1553,7 @@ show_alarm(struct device *dev, struct device_attribute *attr, char *buf) | |||
1535 | struct nct6775_data *data = nct6775_update_device(dev); | 1553 | struct nct6775_data *data = nct6775_update_device(dev); |
1536 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1554 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1537 | int nr = data->ALARM_BITS[sattr->index]; | 1555 | int nr = data->ALARM_BITS[sattr->index]; |
1556 | |||
1538 | return sprintf(buf, "%u\n", | 1557 | return sprintf(buf, "%u\n", |
1539 | (unsigned int)((data->alarms >> nr) & 0x01)); | 1558 | (unsigned int)((data->alarms >> nr) & 0x01)); |
1540 | } | 1559 | } |
@@ -1570,6 +1589,7 @@ show_temp_alarm(struct device *dev, struct device_attribute *attr, char *buf) | |||
1570 | nr = find_temp_source(data, sattr->index, data->num_temp_alarms); | 1589 | nr = find_temp_source(data, sattr->index, data->num_temp_alarms); |
1571 | if (nr >= 0) { | 1590 | if (nr >= 0) { |
1572 | int bit = data->ALARM_BITS[nr + TEMP_ALARM_BASE]; | 1591 | int bit = data->ALARM_BITS[nr + TEMP_ALARM_BASE]; |
1592 | |||
1573 | alarm = (data->alarms >> bit) & 0x01; | 1593 | alarm = (data->alarms >> bit) & 0x01; |
1574 | } | 1594 | } |
1575 | return sprintf(buf, "%u\n", alarm); | 1595 | return sprintf(buf, "%u\n", alarm); |
@@ -1595,8 +1615,9 @@ store_beep(struct device *dev, struct device_attribute *attr, const char *buf, | |||
1595 | int nr = data->BEEP_BITS[sattr->index]; | 1615 | int nr = data->BEEP_BITS[sattr->index]; |
1596 | int regindex = nr >> 3; | 1616 | int regindex = nr >> 3; |
1597 | unsigned long val; | 1617 | unsigned long val; |
1618 | int err; | ||
1598 | 1619 | ||
1599 | int err = kstrtoul(buf, 10, &val); | 1620 | err = kstrtoul(buf, 10, &val); |
1600 | if (err < 0) | 1621 | if (err < 0) |
1601 | return err; | 1622 | return err; |
1602 | if (val > 1) | 1623 | if (val > 1) |
@@ -1629,6 +1650,7 @@ show_temp_beep(struct device *dev, struct device_attribute *attr, char *buf) | |||
1629 | nr = find_temp_source(data, sattr->index, data->num_temp_beeps); | 1650 | nr = find_temp_source(data, sattr->index, data->num_temp_beeps); |
1630 | if (nr >= 0) { | 1651 | if (nr >= 0) { |
1631 | int bit = data->BEEP_BITS[nr + TEMP_ALARM_BASE]; | 1652 | int bit = data->BEEP_BITS[nr + TEMP_ALARM_BASE]; |
1653 | |||
1632 | beep = (data->beeps >> bit) & 0x01; | 1654 | beep = (data->beeps >> bit) & 0x01; |
1633 | } | 1655 | } |
1634 | return sprintf(buf, "%u\n", beep); | 1656 | return sprintf(buf, "%u\n", beep); |
@@ -1642,8 +1664,9 @@ store_temp_beep(struct device *dev, struct device_attribute *attr, | |||
1642 | struct nct6775_data *data = dev_get_drvdata(dev); | 1664 | struct nct6775_data *data = dev_get_drvdata(dev); |
1643 | int nr, bit, regindex; | 1665 | int nr, bit, regindex; |
1644 | unsigned long val; | 1666 | unsigned long val; |
1667 | int err; | ||
1645 | 1668 | ||
1646 | int err = kstrtoul(buf, 10, &val); | 1669 | err = kstrtoul(buf, 10, &val); |
1647 | if (err < 0) | 1670 | if (err < 0) |
1648 | return err; | 1671 | return err; |
1649 | if (val > 1) | 1672 | if (val > 1) |
@@ -1715,6 +1738,7 @@ show_fan(struct device *dev, struct device_attribute *attr, char *buf) | |||
1715 | struct nct6775_data *data = nct6775_update_device(dev); | 1738 | struct nct6775_data *data = nct6775_update_device(dev); |
1716 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1739 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1717 | int nr = sattr->index; | 1740 | int nr = sattr->index; |
1741 | |||
1718 | return sprintf(buf, "%d\n", data->rpm[nr]); | 1742 | return sprintf(buf, "%d\n", data->rpm[nr]); |
1719 | } | 1743 | } |
1720 | 1744 | ||
@@ -1724,6 +1748,7 @@ show_fan_min(struct device *dev, struct device_attribute *attr, char *buf) | |||
1724 | struct nct6775_data *data = nct6775_update_device(dev); | 1748 | struct nct6775_data *data = nct6775_update_device(dev); |
1725 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1749 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1726 | int nr = sattr->index; | 1750 | int nr = sattr->index; |
1751 | |||
1727 | return sprintf(buf, "%d\n", | 1752 | return sprintf(buf, "%d\n", |
1728 | data->fan_from_reg_min(data->fan_min[nr], | 1753 | data->fan_from_reg_min(data->fan_min[nr], |
1729 | data->fan_div[nr])); | 1754 | data->fan_div[nr])); |
@@ -1735,6 +1760,7 @@ show_fan_div(struct device *dev, struct device_attribute *attr, char *buf) | |||
1735 | struct nct6775_data *data = nct6775_update_device(dev); | 1760 | struct nct6775_data *data = nct6775_update_device(dev); |
1736 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1761 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1737 | int nr = sattr->index; | 1762 | int nr = sattr->index; |
1763 | |||
1738 | return sprintf(buf, "%u\n", div_from_reg(data->fan_div[nr])); | 1764 | return sprintf(buf, "%u\n", div_from_reg(data->fan_div[nr])); |
1739 | } | 1765 | } |
1740 | 1766 | ||
@@ -1746,9 +1772,9 @@ store_fan_min(struct device *dev, struct device_attribute *attr, | |||
1746 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1772 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1747 | int nr = sattr->index; | 1773 | int nr = sattr->index; |
1748 | unsigned long val; | 1774 | unsigned long val; |
1749 | int err; | ||
1750 | unsigned int reg; | 1775 | unsigned int reg; |
1751 | u8 new_div; | 1776 | u8 new_div; |
1777 | int err; | ||
1752 | 1778 | ||
1753 | err = kstrtoul(buf, 10, &val); | 1779 | err = kstrtoul(buf, 10, &val); |
1754 | if (err < 0) | 1780 | if (err < 0) |
@@ -1932,6 +1958,7 @@ show_temp_label(struct device *dev, struct device_attribute *attr, char *buf) | |||
1932 | struct nct6775_data *data = nct6775_update_device(dev); | 1958 | struct nct6775_data *data = nct6775_update_device(dev); |
1933 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 1959 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
1934 | int nr = sattr->index; | 1960 | int nr = sattr->index; |
1961 | |||
1935 | return sprintf(buf, "%s\n", data->temp_label[data->temp_src[nr]]); | 1962 | return sprintf(buf, "%s\n", data->temp_label[data->temp_src[nr]]); |
1936 | } | 1963 | } |
1937 | 1964 | ||
@@ -2008,6 +2035,7 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf) | |||
2008 | struct nct6775_data *data = nct6775_update_device(dev); | 2035 | struct nct6775_data *data = nct6775_update_device(dev); |
2009 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); | 2036 | struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr); |
2010 | int nr = sattr->index; | 2037 | int nr = sattr->index; |
2038 | |||
2011 | return sprintf(buf, "%d\n", (int)data->temp_type[nr]); | 2039 | return sprintf(buf, "%d\n", (int)data->temp_type[nr]); |
2012 | } | 2040 | } |
2013 | 2041 | ||
@@ -2790,6 +2818,7 @@ store_auto_pwm(struct device *dev, struct device_attribute *attr, | |||
2790 | case nct6106: | 2818 | case nct6106: |
2791 | case nct6779: | 2819 | case nct6779: |
2792 | case nct6791: | 2820 | case nct6791: |
2821 | case nct6792: | ||
2793 | nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], | 2822 | nct6775_write_value(data, data->REG_CRITICAL_PWM[nr], |
2794 | val); | 2823 | val); |
2795 | reg = nct6775_read_value(data, | 2824 | reg = nct6775_read_value(data, |
@@ -2997,6 +3026,7 @@ static ssize_t | |||
2997 | show_vid(struct device *dev, struct device_attribute *attr, char *buf) | 3026 | show_vid(struct device *dev, struct device_attribute *attr, char *buf) |
2998 | { | 3027 | { |
2999 | struct nct6775_data *data = dev_get_drvdata(dev); | 3028 | struct nct6775_data *data = dev_get_drvdata(dev); |
3029 | |||
3000 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); | 3030 | return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm)); |
3001 | } | 3031 | } |
3002 | 3032 | ||
@@ -3202,7 +3232,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data) | |||
3202 | pwm4pin = false; | 3232 | pwm4pin = false; |
3203 | pwm5pin = false; | 3233 | pwm5pin = false; |
3204 | pwm6pin = false; | 3234 | pwm6pin = false; |
3205 | } else { /* NCT6779D or NCT6791D */ | 3235 | } else { /* NCT6779D, NCT6791D, or NCT6792D */ |
3206 | regval = superio_inb(sioreg, 0x1c); | 3236 | regval = superio_inb(sioreg, 0x1c); |
3207 | 3237 | ||
3208 | fan3pin = !(regval & (1 << 5)); | 3238 | fan3pin = !(regval & (1 << 5)); |
@@ -3215,7 +3245,7 @@ nct6775_check_fan_inputs(struct nct6775_data *data) | |||
3215 | 3245 | ||
3216 | fan4min = fan4pin; | 3246 | fan4min = fan4pin; |
3217 | 3247 | ||
3218 | if (data->kind == nct6791) { | 3248 | if (data->kind == nct6791 || data->kind == nct6792) { |
3219 | regval = superio_inb(sioreg, 0x2d); | 3249 | regval = superio_inb(sioreg, 0x2d); |
3220 | fan6pin = (regval & (1 << 1)); | 3250 | fan6pin = (regval & (1 << 1)); |
3221 | pwm6pin = (regval & (1 << 0)); | 3251 | pwm6pin = (regval & (1 << 0)); |
@@ -3588,6 +3618,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3588 | 3618 | ||
3589 | break; | 3619 | break; |
3590 | case nct6791: | 3620 | case nct6791: |
3621 | case nct6792: | ||
3591 | data->in_num = 15; | 3622 | data->in_num = 15; |
3592 | data->pwm_num = 6; | 3623 | data->pwm_num = 6; |
3593 | data->auto_pwm_num = 4; | 3624 | data->auto_pwm_num = 4; |
@@ -3650,12 +3681,20 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3650 | data->REG_WEIGHT_TEMP[1] = NCT6791_REG_WEIGHT_TEMP_STEP_TOL; | 3681 | data->REG_WEIGHT_TEMP[1] = NCT6791_REG_WEIGHT_TEMP_STEP_TOL; |
3651 | data->REG_WEIGHT_TEMP[2] = NCT6791_REG_WEIGHT_TEMP_BASE; | 3682 | data->REG_WEIGHT_TEMP[2] = NCT6791_REG_WEIGHT_TEMP_BASE; |
3652 | data->REG_ALARM = NCT6791_REG_ALARM; | 3683 | data->REG_ALARM = NCT6791_REG_ALARM; |
3653 | data->REG_BEEP = NCT6776_REG_BEEP; | 3684 | if (data->kind == nct6791) |
3685 | data->REG_BEEP = NCT6776_REG_BEEP; | ||
3686 | else | ||
3687 | data->REG_BEEP = NCT6792_REG_BEEP; | ||
3654 | 3688 | ||
3655 | reg_temp = NCT6779_REG_TEMP; | 3689 | reg_temp = NCT6779_REG_TEMP; |
3656 | reg_temp_mon = NCT6779_REG_TEMP_MON; | ||
3657 | num_reg_temp = ARRAY_SIZE(NCT6779_REG_TEMP); | 3690 | num_reg_temp = ARRAY_SIZE(NCT6779_REG_TEMP); |
3658 | num_reg_temp_mon = ARRAY_SIZE(NCT6779_REG_TEMP_MON); | 3691 | if (data->kind == nct6791) { |
3692 | reg_temp_mon = NCT6779_REG_TEMP_MON; | ||
3693 | num_reg_temp_mon = ARRAY_SIZE(NCT6779_REG_TEMP_MON); | ||
3694 | } else { | ||
3695 | reg_temp_mon = NCT6792_REG_TEMP_MON; | ||
3696 | num_reg_temp_mon = ARRAY_SIZE(NCT6792_REG_TEMP_MON); | ||
3697 | } | ||
3659 | reg_temp_over = NCT6779_REG_TEMP_OVER; | 3698 | reg_temp_over = NCT6779_REG_TEMP_OVER; |
3660 | reg_temp_hyst = NCT6779_REG_TEMP_HYST; | 3699 | reg_temp_hyst = NCT6779_REG_TEMP_HYST; |
3661 | reg_temp_config = NCT6779_REG_TEMP_CONFIG; | 3700 | reg_temp_config = NCT6779_REG_TEMP_CONFIG; |
@@ -3854,6 +3893,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3854 | case nct6106: | 3893 | case nct6106: |
3855 | case nct6779: | 3894 | case nct6779: |
3856 | case nct6791: | 3895 | case nct6791: |
3896 | case nct6792: | ||
3857 | break; | 3897 | break; |
3858 | } | 3898 | } |
3859 | 3899 | ||
@@ -3885,6 +3925,7 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3885 | tmp |= 0x3e; | 3925 | tmp |= 0x3e; |
3886 | break; | 3926 | break; |
3887 | case nct6791: | 3927 | case nct6791: |
3928 | case nct6792: | ||
3888 | tmp |= 0x7e; | 3929 | tmp |= 0x7e; |
3889 | break; | 3930 | break; |
3890 | } | 3931 | } |
@@ -3972,7 +4013,7 @@ static int nct6775_resume(struct device *dev) | |||
3972 | mutex_lock(&data->update_lock); | 4013 | mutex_lock(&data->update_lock); |
3973 | data->bank = 0xff; /* Force initial bank selection */ | 4014 | data->bank = 0xff; /* Force initial bank selection */ |
3974 | 4015 | ||
3975 | if (data->kind == nct6791) { | 4016 | if (data->kind == nct6791 || data->kind == nct6792) { |
3976 | err = superio_enter(data->sioreg); | 4017 | err = superio_enter(data->sioreg); |
3977 | if (err) | 4018 | if (err) |
3978 | goto abort; | 4019 | goto abort; |
@@ -4052,6 +4093,7 @@ static const char * const nct6775_sio_names[] __initconst = { | |||
4052 | "NCT6776D/F", | 4093 | "NCT6776D/F", |
4053 | "NCT6779D", | 4094 | "NCT6779D", |
4054 | "NCT6791D", | 4095 | "NCT6791D", |
4096 | "NCT6792D", | ||
4055 | }; | 4097 | }; |
4056 | 4098 | ||
4057 | /* nct6775_find() looks for a '627 in the Super-I/O config space */ | 4099 | /* nct6775_find() looks for a '627 in the Super-I/O config space */ |
@@ -4086,6 +4128,9 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) | |||
4086 | case SIO_NCT6791_ID: | 4128 | case SIO_NCT6791_ID: |
4087 | sio_data->kind = nct6791; | 4129 | sio_data->kind = nct6791; |
4088 | break; | 4130 | break; |
4131 | case SIO_NCT6792_ID: | ||
4132 | sio_data->kind = nct6792; | ||
4133 | break; | ||
4089 | default: | 4134 | default: |
4090 | if (val != 0xffff) | 4135 | if (val != 0xffff) |
4091 | pr_debug("unsupported chip ID: 0x%04x\n", val); | 4136 | pr_debug("unsupported chip ID: 0x%04x\n", val); |
@@ -4111,7 +4156,7 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) | |||
4111 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); | 4156 | superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); |
4112 | } | 4157 | } |
4113 | 4158 | ||
4114 | if (sio_data->kind == nct6791) | 4159 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792) |
4115 | nct6791_enable_io_mapping(sioaddr); | 4160 | nct6791_enable_io_mapping(sioaddr); |
4116 | 4161 | ||
4117 | superio_exit(sioaddr); | 4162 | superio_exit(sioaddr); |
@@ -4221,7 +4266,7 @@ static void __exit sensors_nct6775_exit(void) | |||
4221 | } | 4266 | } |
4222 | 4267 | ||
4223 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); | 4268 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
4224 | MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D driver"); | 4269 | MODULE_DESCRIPTION("NCT6106D/NCT6775F/NCT6776F/NCT6779D/NCT6791D/NCT6792D driver"); |
4225 | MODULE_LICENSE("GPL"); | 4270 | MODULE_LICENSE("GPL"); |
4226 | 4271 | ||
4227 | module_init(sensors_nct6775_init); | 4272 | module_init(sensors_nct6775_init); |