aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1026.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adm1026.c')
-rw-r--r--drivers/hwmon/adm1026.c70
1 files changed, 50 insertions, 20 deletions
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index a20af03f4fc6..8002f68240c4 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1507,14 +1507,6 @@ static struct attribute *adm1026_attributes[] = {
1507 &sensor_dev_attr_in7_max.dev_attr.attr, 1507 &sensor_dev_attr_in7_max.dev_attr.attr,
1508 &sensor_dev_attr_in7_min.dev_attr.attr, 1508 &sensor_dev_attr_in7_min.dev_attr.attr,
1509 &sensor_dev_attr_in7_alarm.dev_attr.attr, 1509 &sensor_dev_attr_in7_alarm.dev_attr.attr,
1510 &sensor_dev_attr_in8_input.dev_attr.attr,
1511 &sensor_dev_attr_in8_max.dev_attr.attr,
1512 &sensor_dev_attr_in8_min.dev_attr.attr,
1513 &sensor_dev_attr_in8_alarm.dev_attr.attr,
1514 &sensor_dev_attr_in9_input.dev_attr.attr,
1515 &sensor_dev_attr_in9_max.dev_attr.attr,
1516 &sensor_dev_attr_in9_min.dev_attr.attr,
1517 &sensor_dev_attr_in9_alarm.dev_attr.attr,
1518 &sensor_dev_attr_in10_input.dev_attr.attr, 1510 &sensor_dev_attr_in10_input.dev_attr.attr,
1519 &sensor_dev_attr_in10_max.dev_attr.attr, 1511 &sensor_dev_attr_in10_max.dev_attr.attr,
1520 &sensor_dev_attr_in10_min.dev_attr.attr, 1512 &sensor_dev_attr_in10_min.dev_attr.attr,
@@ -1583,28 +1575,18 @@ static struct attribute *adm1026_attributes[] = {
1583 &sensor_dev_attr_temp2_max.dev_attr.attr, 1575 &sensor_dev_attr_temp2_max.dev_attr.attr,
1584 &sensor_dev_attr_temp2_min.dev_attr.attr, 1576 &sensor_dev_attr_temp2_min.dev_attr.attr,
1585 &sensor_dev_attr_temp2_alarm.dev_attr.attr, 1577 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
1586 &sensor_dev_attr_temp3_input.dev_attr.attr,
1587 &sensor_dev_attr_temp3_max.dev_attr.attr,
1588 &sensor_dev_attr_temp3_min.dev_attr.attr,
1589 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1590 &sensor_dev_attr_temp1_offset.dev_attr.attr, 1578 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1591 &sensor_dev_attr_temp2_offset.dev_attr.attr, 1579 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1592 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1593 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, 1580 &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr,
1594 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr, 1581 &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr,
1595 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
1596 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr, 1582 &sensor_dev_attr_temp1_auto_point1_temp_hyst.dev_attr.attr,
1597 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr.attr, 1583 &sensor_dev_attr_temp2_auto_point1_temp_hyst.dev_attr.attr,
1598 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr.attr,
1599 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr, 1584 &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr,
1600 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr, 1585 &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr,
1601 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
1602 &sensor_dev_attr_temp1_crit.dev_attr.attr, 1586 &sensor_dev_attr_temp1_crit.dev_attr.attr,
1603 &sensor_dev_attr_temp2_crit.dev_attr.attr, 1587 &sensor_dev_attr_temp2_crit.dev_attr.attr,
1604 &sensor_dev_attr_temp3_crit.dev_attr.attr,
1605 &dev_attr_temp1_crit_enable.attr, 1588 &dev_attr_temp1_crit_enable.attr,
1606 &dev_attr_temp2_crit_enable.attr, 1589 &dev_attr_temp2_crit_enable.attr,
1607 &dev_attr_temp3_crit_enable.attr,
1608 &dev_attr_cpu0_vid.attr, 1590 &dev_attr_cpu0_vid.attr,
1609 &dev_attr_vrm.attr, 1591 &dev_attr_vrm.attr,
1610 &dev_attr_alarms.attr, 1592 &dev_attr_alarms.attr,
@@ -1619,10 +1601,8 @@ static struct attribute *adm1026_attributes[] = {
1619 &dev_attr_pwm3_enable.attr, 1601 &dev_attr_pwm3_enable.attr,
1620 &dev_attr_temp1_auto_point1_pwm.attr, 1602 &dev_attr_temp1_auto_point1_pwm.attr,
1621 &dev_attr_temp2_auto_point1_pwm.attr, 1603 &dev_attr_temp2_auto_point1_pwm.attr,
1622 &dev_attr_temp3_auto_point1_pwm.attr,
1623 &dev_attr_temp1_auto_point2_pwm.attr, 1604 &dev_attr_temp1_auto_point2_pwm.attr,
1624 &dev_attr_temp2_auto_point2_pwm.attr, 1605 &dev_attr_temp2_auto_point2_pwm.attr,
1625 &dev_attr_temp3_auto_point2_pwm.attr,
1626 &dev_attr_analog_out.attr, 1606 &dev_attr_analog_out.attr,
1627 NULL 1607 NULL
1628}; 1608};
@@ -1631,6 +1611,40 @@ static const struct attribute_group adm1026_group = {
1631 .attrs = adm1026_attributes, 1611 .attrs = adm1026_attributes,
1632}; 1612};
1633 1613
1614static struct attribute *adm1026_attributes_temp3[] = {
1615 &sensor_dev_attr_temp3_input.dev_attr.attr,
1616 &sensor_dev_attr_temp3_max.dev_attr.attr,
1617 &sensor_dev_attr_temp3_min.dev_attr.attr,
1618 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1619 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1620 &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr,
1621 &sensor_dev_attr_temp3_auto_point1_temp_hyst.dev_attr.attr,
1622 &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr,
1623 &sensor_dev_attr_temp3_crit.dev_attr.attr,
1624 &dev_attr_temp3_crit_enable.attr,
1625 &dev_attr_temp3_auto_point1_pwm.attr,
1626 &dev_attr_temp3_auto_point2_pwm.attr,
1627};
1628
1629static const struct attribute_group adm1026_group_temp3 = {
1630 .attrs = adm1026_attributes_temp3,
1631};
1632
1633static struct attribute *adm1026_attributes_in8_9[] = {
1634 &sensor_dev_attr_in8_input.dev_attr.attr,
1635 &sensor_dev_attr_in8_max.dev_attr.attr,
1636 &sensor_dev_attr_in8_min.dev_attr.attr,
1637 &sensor_dev_attr_in8_alarm.dev_attr.attr,
1638 &sensor_dev_attr_in9_input.dev_attr.attr,
1639 &sensor_dev_attr_in9_max.dev_attr.attr,
1640 &sensor_dev_attr_in9_min.dev_attr.attr,
1641 &sensor_dev_attr_in9_alarm.dev_attr.attr,
1642};
1643
1644static const struct attribute_group adm1026_group_in8_9 = {
1645 .attrs = adm1026_attributes_in8_9,
1646};
1647
1634static int adm1026_detect(struct i2c_adapter *adapter, int address, 1648static int adm1026_detect(struct i2c_adapter *adapter, int address,
1635 int kind) 1649 int kind)
1636{ 1650{
@@ -1733,6 +1747,14 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
1733 /* Register sysfs hooks */ 1747 /* Register sysfs hooks */
1734 if ((err = sysfs_create_group(&client->dev.kobj, &adm1026_group))) 1748 if ((err = sysfs_create_group(&client->dev.kobj, &adm1026_group)))
1735 goto exitdetach; 1749 goto exitdetach;
1750 if (data->config1 & CFG1_AIN8_9)
1751 err = sysfs_create_group(&client->dev.kobj,
1752 &adm1026_group_in8_9);
1753 else
1754 err = sysfs_create_group(&client->dev.kobj,
1755 &adm1026_group_temp3);
1756 if (err)
1757 goto exitremove;
1736 1758
1737 data->hwmon_dev = hwmon_device_register(&client->dev); 1759 data->hwmon_dev = hwmon_device_register(&client->dev);
1738 if (IS_ERR(data->hwmon_dev)) { 1760 if (IS_ERR(data->hwmon_dev)) {
@@ -1745,6 +1767,10 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
1745 /* Error out and cleanup code */ 1767 /* Error out and cleanup code */
1746exitremove: 1768exitremove:
1747 sysfs_remove_group(&client->dev.kobj, &adm1026_group); 1769 sysfs_remove_group(&client->dev.kobj, &adm1026_group);
1770 if (data->config1 & CFG1_AIN8_9)
1771 sysfs_remove_group(&client->dev.kobj, &adm1026_group_in8_9);
1772 else
1773 sysfs_remove_group(&client->dev.kobj, &adm1026_group_temp3);
1748exitdetach: 1774exitdetach:
1749 i2c_detach_client(client); 1775 i2c_detach_client(client);
1750exitfree: 1776exitfree:
@@ -1758,6 +1784,10 @@ static int adm1026_detach_client(struct i2c_client *client)
1758 struct adm1026_data *data = i2c_get_clientdata(client); 1784 struct adm1026_data *data = i2c_get_clientdata(client);
1759 hwmon_device_unregister(data->hwmon_dev); 1785 hwmon_device_unregister(data->hwmon_dev);
1760 sysfs_remove_group(&client->dev.kobj, &adm1026_group); 1786 sysfs_remove_group(&client->dev.kobj, &adm1026_group);
1787 if (data->config1 & CFG1_AIN8_9)
1788 sysfs_remove_group(&client->dev.kobj, &adm1026_group_in8_9);
1789 else
1790 sysfs_remove_group(&client->dev.kobj, &adm1026_group_temp3);
1761 i2c_detach_client(client); 1791 i2c_detach_client(client);
1762 kfree(data); 1792 kfree(data);
1763 return 0; 1793 return 0;