diff options
Diffstat (limited to 'drivers/hwmon/dme1737.c')
-rw-r--r-- | drivers/hwmon/dme1737.c | 297 |
1 files changed, 184 insertions, 113 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 7673f65877e1..5e2cf0aef480 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -48,6 +48,11 @@ static unsigned short force_id; | |||
48 | module_param(force_id, ushort, 0); | 48 | module_param(force_id, ushort, 0); |
49 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 49 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
50 | 50 | ||
51 | static int probe_all_addr; | ||
52 | module_param(probe_all_addr, bool, 0); | ||
53 | MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC " | ||
54 | "addresses"); | ||
55 | |||
51 | /* Addresses to scan */ | 56 | /* Addresses to scan */ |
52 | static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; | 57 | static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; |
53 | 58 | ||
@@ -176,6 +181,7 @@ struct dme1737_data { | |||
176 | int valid; /* !=0 if following fields are valid */ | 181 | int valid; /* !=0 if following fields are valid */ |
177 | unsigned long last_update; /* in jiffies */ | 182 | unsigned long last_update; /* in jiffies */ |
178 | unsigned long last_vbat; /* in jiffies */ | 183 | unsigned long last_vbat; /* in jiffies */ |
184 | enum chips type; | ||
179 | 185 | ||
180 | u8 vid; | 186 | u8 vid; |
181 | u8 pwm_rr_en; | 187 | u8 pwm_rr_en; |
@@ -210,20 +216,27 @@ struct dme1737_data { | |||
210 | }; | 216 | }; |
211 | 217 | ||
212 | /* Nominal voltage values */ | 218 | /* Nominal voltage values */ |
213 | static const int IN_NOMINAL[] = {5000, 2250, 3300, 5000, 12000, 3300, 3300}; | 219 | static const int IN_NOMINAL_DME1737[] = {5000, 2250, 3300, 5000, 12000, 3300, |
220 | 3300}; | ||
221 | static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300, | ||
222 | 3300}; | ||
223 | #define IN_NOMINAL(ix, type) (((type) == dme1737) ? \ | ||
224 | IN_NOMINAL_DME1737[(ix)] : \ | ||
225 | IN_NOMINAL_SCH311x[(ix)]) | ||
214 | 226 | ||
215 | /* Voltage input | 227 | /* Voltage input |
216 | * Voltage inputs have 16 bits resolution, limit values have 8 bits | 228 | * Voltage inputs have 16 bits resolution, limit values have 8 bits |
217 | * resolution. */ | 229 | * resolution. */ |
218 | static inline int IN_FROM_REG(int reg, int ix, int res) | 230 | static inline int IN_FROM_REG(int reg, int ix, int res, int type) |
219 | { | 231 | { |
220 | return (reg * IN_NOMINAL[ix] + (3 << (res - 3))) / (3 << (res - 2)); | 232 | return (reg * IN_NOMINAL(ix, type) + (3 << (res - 3))) / |
233 | (3 << (res - 2)); | ||
221 | } | 234 | } |
222 | 235 | ||
223 | static inline int IN_TO_REG(int val, int ix) | 236 | static inline int IN_TO_REG(int val, int ix, int type) |
224 | { | 237 | { |
225 | return SENSORS_LIMIT((val * 192 + IN_NOMINAL[ix] / 2) / | 238 | return SENSORS_LIMIT((val * 192 + IN_NOMINAL(ix, type) / 2) / |
226 | IN_NOMINAL[ix], 0, 255); | 239 | IN_NOMINAL(ix, type), 0, 255); |
227 | } | 240 | } |
228 | 241 | ||
229 | /* Temperature input | 242 | /* Temperature input |
@@ -722,13 +735,13 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr, | |||
722 | 735 | ||
723 | switch (fn) { | 736 | switch (fn) { |
724 | case SYS_IN_INPUT: | 737 | case SYS_IN_INPUT: |
725 | res = IN_FROM_REG(data->in[ix], ix, 16); | 738 | res = IN_FROM_REG(data->in[ix], ix, 16, data->type); |
726 | break; | 739 | break; |
727 | case SYS_IN_MIN: | 740 | case SYS_IN_MIN: |
728 | res = IN_FROM_REG(data->in_min[ix], ix, 8); | 741 | res = IN_FROM_REG(data->in_min[ix], ix, 8, data->type); |
729 | break; | 742 | break; |
730 | case SYS_IN_MAX: | 743 | case SYS_IN_MAX: |
731 | res = IN_FROM_REG(data->in_max[ix], ix, 8); | 744 | res = IN_FROM_REG(data->in_max[ix], ix, 8, data->type); |
732 | break; | 745 | break; |
733 | case SYS_IN_ALARM: | 746 | case SYS_IN_ALARM: |
734 | res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01; | 747 | res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01; |
@@ -755,12 +768,12 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr, | |||
755 | mutex_lock(&data->update_lock); | 768 | mutex_lock(&data->update_lock); |
756 | switch (fn) { | 769 | switch (fn) { |
757 | case SYS_IN_MIN: | 770 | case SYS_IN_MIN: |
758 | data->in_min[ix] = IN_TO_REG(val, ix); | 771 | data->in_min[ix] = IN_TO_REG(val, ix, data->type); |
759 | dme1737_write(client, DME1737_REG_IN_MIN(ix), | 772 | dme1737_write(client, DME1737_REG_IN_MIN(ix), |
760 | data->in_min[ix]); | 773 | data->in_min[ix]); |
761 | break; | 774 | break; |
762 | case SYS_IN_MAX: | 775 | case SYS_IN_MAX: |
763 | data->in_max[ix] = IN_TO_REG(val, ix); | 776 | data->in_max[ix] = IN_TO_REG(val, ix, data->type); |
764 | dme1737_write(client, DME1737_REG_IN_MAX(ix), | 777 | dme1737_write(client, DME1737_REG_IN_MAX(ix), |
765 | data->in_max[ix]); | 778 | data->in_max[ix]); |
766 | break; | 779 | break; |
@@ -1501,9 +1514,9 @@ SENSOR_DEVICE_ATTR_PWM_1TO3(3); | |||
1501 | /* PWMs 5-6 */ | 1514 | /* PWMs 5-6 */ |
1502 | 1515 | ||
1503 | #define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \ | 1516 | #define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \ |
1504 | static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO | S_IWUSR, \ | 1517 | static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO, \ |
1505 | show_pwm, set_pwm, SYS_PWM, ix-1); \ | 1518 | show_pwm, set_pwm, SYS_PWM, ix-1); \ |
1506 | static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \ | 1519 | static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO, \ |
1507 | show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \ | 1520 | show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \ |
1508 | static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \ | 1521 | static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \ |
1509 | show_pwm, NULL, SYS_PWM_ENABLE, ix-1) | 1522 | show_pwm, NULL, SYS_PWM_ENABLE, ix-1) |
@@ -1517,91 +1530,75 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm); | |||
1517 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); | 1530 | static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); |
1518 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); /* for ISA devices */ | 1531 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); /* for ISA devices */ |
1519 | 1532 | ||
1520 | #define SENSOR_DEV_ATTR_IN(ix) \ | ||
1521 | &sensor_dev_attr_in##ix##_input.dev_attr.attr, \ | ||
1522 | &sensor_dev_attr_in##ix##_min.dev_attr.attr, \ | ||
1523 | &sensor_dev_attr_in##ix##_max.dev_attr.attr, \ | ||
1524 | &sensor_dev_attr_in##ix##_alarm.dev_attr.attr | ||
1525 | |||
1526 | /* These attributes are read-writeable only if the chip is *not* locked */ | ||
1527 | #define SENSOR_DEV_ATTR_TEMP_LOCK(ix) \ | ||
1528 | &sensor_dev_attr_temp##ix##_offset.dev_attr.attr | ||
1529 | |||
1530 | #define SENSOR_DEV_ATTR_TEMP(ix) \ | ||
1531 | SENSOR_DEV_ATTR_TEMP_LOCK(ix), \ | ||
1532 | &sensor_dev_attr_temp##ix##_input.dev_attr.attr, \ | ||
1533 | &sensor_dev_attr_temp##ix##_min.dev_attr.attr, \ | ||
1534 | &sensor_dev_attr_temp##ix##_max.dev_attr.attr, \ | ||
1535 | &sensor_dev_attr_temp##ix##_alarm.dev_attr.attr, \ | ||
1536 | &sensor_dev_attr_temp##ix##_fault.dev_attr.attr | ||
1537 | |||
1538 | /* These attributes are read-writeable only if the chip is *not* locked */ | ||
1539 | #define SENSOR_DEV_ATTR_ZONE_LOCK(ix) \ | ||
1540 | &sensor_dev_attr_zone##ix##_auto_point1_temp_hyst.dev_attr.attr, \ | ||
1541 | &sensor_dev_attr_zone##ix##_auto_point1_temp.dev_attr.attr, \ | ||
1542 | &sensor_dev_attr_zone##ix##_auto_point2_temp.dev_attr.attr, \ | ||
1543 | &sensor_dev_attr_zone##ix##_auto_point3_temp.dev_attr.attr | ||
1544 | |||
1545 | #define SENSOR_DEV_ATTR_ZONE(ix) \ | ||
1546 | SENSOR_DEV_ATTR_ZONE_LOCK(ix), \ | ||
1547 | &sensor_dev_attr_zone##ix##_auto_channels_temp.dev_attr.attr | ||
1548 | |||
1549 | #define SENSOR_DEV_ATTR_FAN_1TO4(ix) \ | ||
1550 | &sensor_dev_attr_fan##ix##_input.dev_attr.attr, \ | ||
1551 | &sensor_dev_attr_fan##ix##_min.dev_attr.attr, \ | ||
1552 | &sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \ | ||
1553 | &sensor_dev_attr_fan##ix##_type.dev_attr.attr | ||
1554 | |||
1555 | #define SENSOR_DEV_ATTR_FAN_5TO6(ix) \ | ||
1556 | &sensor_dev_attr_fan##ix##_input.dev_attr.attr, \ | ||
1557 | &sensor_dev_attr_fan##ix##_min.dev_attr.attr, \ | ||
1558 | &sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \ | ||
1559 | &sensor_dev_attr_fan##ix##_max.dev_attr.attr | ||
1560 | |||
1561 | /* These attributes are read-writeable only if the chip is *not* locked */ | ||
1562 | #define SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix) \ | ||
1563 | &sensor_dev_attr_pwm##ix##_freq.dev_attr.attr, \ | ||
1564 | &sensor_dev_attr_pwm##ix##_enable.dev_attr.attr, \ | ||
1565 | &sensor_dev_attr_pwm##ix##_ramp_rate.dev_attr.attr, \ | ||
1566 | &sensor_dev_attr_pwm##ix##_auto_channels_zone.dev_attr.attr, \ | ||
1567 | &sensor_dev_attr_pwm##ix##_auto_pwm_min.dev_attr.attr, \ | ||
1568 | &sensor_dev_attr_pwm##ix##_auto_point1_pwm.dev_attr.attr | ||
1569 | |||
1570 | #define SENSOR_DEV_ATTR_PWM_1TO3(ix) \ | ||
1571 | SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix), \ | ||
1572 | &sensor_dev_attr_pwm##ix.dev_attr.attr, \ | ||
1573 | &sensor_dev_attr_pwm##ix##_auto_point2_pwm.dev_attr.attr | ||
1574 | |||
1575 | /* These attributes are read-writeable only if the chip is *not* locked */ | ||
1576 | #define SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix) \ | ||
1577 | &sensor_dev_attr_pwm##ix.dev_attr.attr, \ | ||
1578 | &sensor_dev_attr_pwm##ix##_freq.dev_attr.attr | ||
1579 | |||
1580 | #define SENSOR_DEV_ATTR_PWM_5TO6(ix) \ | ||
1581 | SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix), \ | ||
1582 | &sensor_dev_attr_pwm##ix##_enable.dev_attr.attr | ||
1583 | |||
1584 | /* This struct holds all the attributes that are always present and need to be | 1533 | /* This struct holds all the attributes that are always present and need to be |
1585 | * created unconditionally. The attributes that need modification of their | 1534 | * created unconditionally. The attributes that need modification of their |
1586 | * permissions are created read-only and write permissions are added or removed | 1535 | * permissions are created read-only and write permissions are added or removed |
1587 | * on the fly when required */ | 1536 | * on the fly when required */ |
1588 | static struct attribute *dme1737_attr[] ={ | 1537 | static struct attribute *dme1737_attr[] ={ |
1589 | /* Voltages */ | 1538 | /* Voltages */ |
1590 | SENSOR_DEV_ATTR_IN(0), | 1539 | &sensor_dev_attr_in0_input.dev_attr.attr, |
1591 | SENSOR_DEV_ATTR_IN(1), | 1540 | &sensor_dev_attr_in0_min.dev_attr.attr, |
1592 | SENSOR_DEV_ATTR_IN(2), | 1541 | &sensor_dev_attr_in0_max.dev_attr.attr, |
1593 | SENSOR_DEV_ATTR_IN(3), | 1542 | &sensor_dev_attr_in0_alarm.dev_attr.attr, |
1594 | SENSOR_DEV_ATTR_IN(4), | 1543 | &sensor_dev_attr_in1_input.dev_attr.attr, |
1595 | SENSOR_DEV_ATTR_IN(5), | 1544 | &sensor_dev_attr_in1_min.dev_attr.attr, |
1596 | SENSOR_DEV_ATTR_IN(6), | 1545 | &sensor_dev_attr_in1_max.dev_attr.attr, |
1546 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
1547 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
1548 | &sensor_dev_attr_in2_min.dev_attr.attr, | ||
1549 | &sensor_dev_attr_in2_max.dev_attr.attr, | ||
1550 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
1551 | &sensor_dev_attr_in3_input.dev_attr.attr, | ||
1552 | &sensor_dev_attr_in3_min.dev_attr.attr, | ||
1553 | &sensor_dev_attr_in3_max.dev_attr.attr, | ||
1554 | &sensor_dev_attr_in3_alarm.dev_attr.attr, | ||
1555 | &sensor_dev_attr_in4_input.dev_attr.attr, | ||
1556 | &sensor_dev_attr_in4_min.dev_attr.attr, | ||
1557 | &sensor_dev_attr_in4_max.dev_attr.attr, | ||
1558 | &sensor_dev_attr_in4_alarm.dev_attr.attr, | ||
1559 | &sensor_dev_attr_in5_input.dev_attr.attr, | ||
1560 | &sensor_dev_attr_in5_min.dev_attr.attr, | ||
1561 | &sensor_dev_attr_in5_max.dev_attr.attr, | ||
1562 | &sensor_dev_attr_in5_alarm.dev_attr.attr, | ||
1563 | &sensor_dev_attr_in6_input.dev_attr.attr, | ||
1564 | &sensor_dev_attr_in6_min.dev_attr.attr, | ||
1565 | &sensor_dev_attr_in6_max.dev_attr.attr, | ||
1566 | &sensor_dev_attr_in6_alarm.dev_attr.attr, | ||
1597 | /* Temperatures */ | 1567 | /* Temperatures */ |
1598 | SENSOR_DEV_ATTR_TEMP(1), | 1568 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
1599 | SENSOR_DEV_ATTR_TEMP(2), | 1569 | &sensor_dev_attr_temp1_min.dev_attr.attr, |
1600 | SENSOR_DEV_ATTR_TEMP(3), | 1570 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
1571 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
1572 | &sensor_dev_attr_temp1_fault.dev_attr.attr, | ||
1573 | &sensor_dev_attr_temp1_offset.dev_attr.attr, | ||
1574 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
1575 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
1576 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
1577 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
1578 | &sensor_dev_attr_temp2_fault.dev_attr.attr, | ||
1579 | &sensor_dev_attr_temp2_offset.dev_attr.attr, | ||
1580 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
1581 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
1582 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
1583 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
1584 | &sensor_dev_attr_temp3_fault.dev_attr.attr, | ||
1585 | &sensor_dev_attr_temp3_offset.dev_attr.attr, | ||
1601 | /* Zones */ | 1586 | /* Zones */ |
1602 | SENSOR_DEV_ATTR_ZONE(1), | 1587 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, |
1603 | SENSOR_DEV_ATTR_ZONE(2), | 1588 | &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr, |
1604 | SENSOR_DEV_ATTR_ZONE(3), | 1589 | &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr, |
1590 | &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr, | ||
1591 | &sensor_dev_attr_zone1_auto_channels_temp.dev_attr.attr, | ||
1592 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, | ||
1593 | &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr, | ||
1594 | &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr, | ||
1595 | &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr, | ||
1596 | &sensor_dev_attr_zone2_auto_channels_temp.dev_attr.attr, | ||
1597 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, | ||
1598 | &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr, | ||
1599 | &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr, | ||
1600 | &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr, | ||
1601 | &sensor_dev_attr_zone3_auto_channels_temp.dev_attr.attr, | ||
1605 | /* Misc */ | 1602 | /* Misc */ |
1606 | &dev_attr_vrm.attr, | 1603 | &dev_attr_vrm.attr, |
1607 | &dev_attr_cpu0_vid.attr, | 1604 | &dev_attr_cpu0_vid.attr, |
@@ -1616,23 +1613,48 @@ static const struct attribute_group dme1737_group = { | |||
1616 | * Their creation depends on the chip configuration which is determined during | 1613 | * Their creation depends on the chip configuration which is determined during |
1617 | * module load. */ | 1614 | * module load. */ |
1618 | static struct attribute *dme1737_attr_pwm1[] = { | 1615 | static struct attribute *dme1737_attr_pwm1[] = { |
1619 | SENSOR_DEV_ATTR_PWM_1TO3(1), | 1616 | &sensor_dev_attr_pwm1.dev_attr.attr, |
1617 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, | ||
1618 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
1619 | &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr, | ||
1620 | &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr, | ||
1621 | &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr, | ||
1622 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
1623 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | ||
1620 | NULL | 1624 | NULL |
1621 | }; | 1625 | }; |
1622 | static struct attribute *dme1737_attr_pwm2[] = { | 1626 | static struct attribute *dme1737_attr_pwm2[] = { |
1623 | SENSOR_DEV_ATTR_PWM_1TO3(2), | 1627 | &sensor_dev_attr_pwm2.dev_attr.attr, |
1628 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, | ||
1629 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | ||
1630 | &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr, | ||
1631 | &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr, | ||
1632 | &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr, | ||
1633 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | ||
1634 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | ||
1624 | NULL | 1635 | NULL |
1625 | }; | 1636 | }; |
1626 | static struct attribute *dme1737_attr_pwm3[] = { | 1637 | static struct attribute *dme1737_attr_pwm3[] = { |
1627 | SENSOR_DEV_ATTR_PWM_1TO3(3), | 1638 | &sensor_dev_attr_pwm3.dev_attr.attr, |
1639 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, | ||
1640 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | ||
1641 | &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr, | ||
1642 | &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr, | ||
1643 | &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr, | ||
1644 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | ||
1645 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | ||
1628 | NULL | 1646 | NULL |
1629 | }; | 1647 | }; |
1630 | static struct attribute *dme1737_attr_pwm5[] = { | 1648 | static struct attribute *dme1737_attr_pwm5[] = { |
1631 | SENSOR_DEV_ATTR_PWM_5TO6(5), | 1649 | &sensor_dev_attr_pwm5.dev_attr.attr, |
1650 | &sensor_dev_attr_pwm5_freq.dev_attr.attr, | ||
1651 | &sensor_dev_attr_pwm5_enable.dev_attr.attr, | ||
1632 | NULL | 1652 | NULL |
1633 | }; | 1653 | }; |
1634 | static struct attribute *dme1737_attr_pwm6[] = { | 1654 | static struct attribute *dme1737_attr_pwm6[] = { |
1635 | SENSOR_DEV_ATTR_PWM_5TO6(6), | 1655 | &sensor_dev_attr_pwm6.dev_attr.attr, |
1656 | &sensor_dev_attr_pwm6_freq.dev_attr.attr, | ||
1657 | &sensor_dev_attr_pwm6_enable.dev_attr.attr, | ||
1636 | NULL | 1658 | NULL |
1637 | }; | 1659 | }; |
1638 | 1660 | ||
@@ -1649,27 +1671,45 @@ static const struct attribute_group dme1737_pwm_group[] = { | |||
1649 | * Their creation depends on the chip configuration which is determined during | 1671 | * Their creation depends on the chip configuration which is determined during |
1650 | * module load. */ | 1672 | * module load. */ |
1651 | static struct attribute *dme1737_attr_fan1[] = { | 1673 | static struct attribute *dme1737_attr_fan1[] = { |
1652 | SENSOR_DEV_ATTR_FAN_1TO4(1), | 1674 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
1675 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
1676 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
1677 | &sensor_dev_attr_fan1_type.dev_attr.attr, | ||
1653 | NULL | 1678 | NULL |
1654 | }; | 1679 | }; |
1655 | static struct attribute *dme1737_attr_fan2[] = { | 1680 | static struct attribute *dme1737_attr_fan2[] = { |
1656 | SENSOR_DEV_ATTR_FAN_1TO4(2), | 1681 | &sensor_dev_attr_fan2_input.dev_attr.attr, |
1682 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
1683 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
1684 | &sensor_dev_attr_fan2_type.dev_attr.attr, | ||
1657 | NULL | 1685 | NULL |
1658 | }; | 1686 | }; |
1659 | static struct attribute *dme1737_attr_fan3[] = { | 1687 | static struct attribute *dme1737_attr_fan3[] = { |
1660 | SENSOR_DEV_ATTR_FAN_1TO4(3), | 1688 | &sensor_dev_attr_fan3_input.dev_attr.attr, |
1689 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
1690 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
1691 | &sensor_dev_attr_fan3_type.dev_attr.attr, | ||
1661 | NULL | 1692 | NULL |
1662 | }; | 1693 | }; |
1663 | static struct attribute *dme1737_attr_fan4[] = { | 1694 | static struct attribute *dme1737_attr_fan4[] = { |
1664 | SENSOR_DEV_ATTR_FAN_1TO4(4), | 1695 | &sensor_dev_attr_fan4_input.dev_attr.attr, |
1696 | &sensor_dev_attr_fan4_min.dev_attr.attr, | ||
1697 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | ||
1698 | &sensor_dev_attr_fan4_type.dev_attr.attr, | ||
1665 | NULL | 1699 | NULL |
1666 | }; | 1700 | }; |
1667 | static struct attribute *dme1737_attr_fan5[] = { | 1701 | static struct attribute *dme1737_attr_fan5[] = { |
1668 | SENSOR_DEV_ATTR_FAN_5TO6(5), | 1702 | &sensor_dev_attr_fan5_input.dev_attr.attr, |
1703 | &sensor_dev_attr_fan5_min.dev_attr.attr, | ||
1704 | &sensor_dev_attr_fan5_alarm.dev_attr.attr, | ||
1705 | &sensor_dev_attr_fan5_max.dev_attr.attr, | ||
1669 | NULL | 1706 | NULL |
1670 | }; | 1707 | }; |
1671 | static struct attribute *dme1737_attr_fan6[] = { | 1708 | static struct attribute *dme1737_attr_fan6[] = { |
1672 | SENSOR_DEV_ATTR_FAN_5TO6(6), | 1709 | &sensor_dev_attr_fan6_input.dev_attr.attr, |
1710 | &sensor_dev_attr_fan6_min.dev_attr.attr, | ||
1711 | &sensor_dev_attr_fan6_alarm.dev_attr.attr, | ||
1712 | &sensor_dev_attr_fan6_max.dev_attr.attr, | ||
1673 | NULL | 1713 | NULL |
1674 | }; | 1714 | }; |
1675 | 1715 | ||
@@ -1686,13 +1726,22 @@ static const struct attribute_group dme1737_fan_group[] = { | |||
1686 | * writeable if the chip is *not* locked. Otherwise they stay read-only. */ | 1726 | * writeable if the chip is *not* locked. Otherwise they stay read-only. */ |
1687 | static struct attribute *dme1737_attr_lock[] = { | 1727 | static struct attribute *dme1737_attr_lock[] = { |
1688 | /* Temperatures */ | 1728 | /* Temperatures */ |
1689 | SENSOR_DEV_ATTR_TEMP_LOCK(1), | 1729 | &sensor_dev_attr_temp1_offset.dev_attr.attr, |
1690 | SENSOR_DEV_ATTR_TEMP_LOCK(2), | 1730 | &sensor_dev_attr_temp2_offset.dev_attr.attr, |
1691 | SENSOR_DEV_ATTR_TEMP_LOCK(3), | 1731 | &sensor_dev_attr_temp3_offset.dev_attr.attr, |
1692 | /* Zones */ | 1732 | /* Zones */ |
1693 | SENSOR_DEV_ATTR_ZONE_LOCK(1), | 1733 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, |
1694 | SENSOR_DEV_ATTR_ZONE_LOCK(2), | 1734 | &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr, |
1695 | SENSOR_DEV_ATTR_ZONE_LOCK(3), | 1735 | &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr, |
1736 | &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr, | ||
1737 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, | ||
1738 | &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr, | ||
1739 | &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr, | ||
1740 | &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr, | ||
1741 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, | ||
1742 | &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr, | ||
1743 | &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr, | ||
1744 | &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr, | ||
1696 | NULL | 1745 | NULL |
1697 | }; | 1746 | }; |
1698 | 1747 | ||
@@ -1704,23 +1753,40 @@ static const struct attribute_group dme1737_lock_group = { | |||
1704 | * writeable if the chip is *not* locked and the respective PWM is available. | 1753 | * writeable if the chip is *not* locked and the respective PWM is available. |
1705 | * Otherwise they stay read-only. */ | 1754 | * Otherwise they stay read-only. */ |
1706 | static struct attribute *dme1737_attr_pwm1_lock[] = { | 1755 | static struct attribute *dme1737_attr_pwm1_lock[] = { |
1707 | SENSOR_DEV_ATTR_PWM_1TO3_LOCK(1), | 1756 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, |
1757 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
1758 | &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr, | ||
1759 | &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr, | ||
1760 | &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr, | ||
1761 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
1708 | NULL | 1762 | NULL |
1709 | }; | 1763 | }; |
1710 | static struct attribute *dme1737_attr_pwm2_lock[] = { | 1764 | static struct attribute *dme1737_attr_pwm2_lock[] = { |
1711 | SENSOR_DEV_ATTR_PWM_1TO3_LOCK(2), | 1765 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, |
1766 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | ||
1767 | &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr, | ||
1768 | &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr, | ||
1769 | &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr, | ||
1770 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | ||
1712 | NULL | 1771 | NULL |
1713 | }; | 1772 | }; |
1714 | static struct attribute *dme1737_attr_pwm3_lock[] = { | 1773 | static struct attribute *dme1737_attr_pwm3_lock[] = { |
1715 | SENSOR_DEV_ATTR_PWM_1TO3_LOCK(3), | 1774 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, |
1775 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | ||
1776 | &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr, | ||
1777 | &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr, | ||
1778 | &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr, | ||
1779 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | ||
1716 | NULL | 1780 | NULL |
1717 | }; | 1781 | }; |
1718 | static struct attribute *dme1737_attr_pwm5_lock[] = { | 1782 | static struct attribute *dme1737_attr_pwm5_lock[] = { |
1719 | SENSOR_DEV_ATTR_PWM_5TO6_LOCK(5), | 1783 | &sensor_dev_attr_pwm5.dev_attr.attr, |
1784 | &sensor_dev_attr_pwm5_freq.dev_attr.attr, | ||
1720 | NULL | 1785 | NULL |
1721 | }; | 1786 | }; |
1722 | static struct attribute *dme1737_attr_pwm6_lock[] = { | 1787 | static struct attribute *dme1737_attr_pwm6_lock[] = { |
1723 | SENSOR_DEV_ATTR_PWM_5TO6_LOCK(6), | 1788 | &sensor_dev_attr_pwm6.dev_attr.attr, |
1789 | &sensor_dev_attr_pwm6_freq.dev_attr.attr, | ||
1724 | NULL | 1790 | NULL |
1725 | }; | 1791 | }; |
1726 | 1792 | ||
@@ -2109,6 +2175,7 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address, | |||
2109 | 2175 | ||
2110 | kind = dme1737; | 2176 | kind = dme1737; |
2111 | name = "dme1737"; | 2177 | name = "dme1737"; |
2178 | data->type = kind; | ||
2112 | 2179 | ||
2113 | /* Fill in the remaining client fields and put it into the global | 2180 | /* Fill in the remaining client fields and put it into the global |
2114 | * list */ | 2181 | * list */ |
@@ -2301,6 +2368,7 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev) | |||
2301 | err = -ENODEV; | 2368 | err = -ENODEV; |
2302 | goto exit_kfree; | 2369 | goto exit_kfree; |
2303 | } | 2370 | } |
2371 | data->type = -1; | ||
2304 | 2372 | ||
2305 | /* Fill in the remaining client fields and initialize the mutex */ | 2373 | /* Fill in the remaining client fields and initialize the mutex */ |
2306 | strlcpy(client->name, "sch311x", I2C_NAME_SIZE); | 2374 | strlcpy(client->name, "sch311x", I2C_NAME_SIZE); |
@@ -2377,7 +2445,10 @@ static int __init dme1737_init(void) | |||
2377 | } | 2445 | } |
2378 | 2446 | ||
2379 | if (dme1737_isa_detect(0x2e, &addr) && | 2447 | if (dme1737_isa_detect(0x2e, &addr) && |
2380 | dme1737_isa_detect(0x4e, &addr)) { | 2448 | dme1737_isa_detect(0x4e, &addr) && |
2449 | (!probe_all_addr || | ||
2450 | (dme1737_isa_detect(0x162e, &addr) && | ||
2451 | dme1737_isa_detect(0x164e, &addr)))) { | ||
2381 | /* Return 0 if we didn't find an ISA device */ | 2452 | /* Return 0 if we didn't find an ISA device */ |
2382 | return 0; | 2453 | return 0; |
2383 | } | 2454 | } |