diff options
| -rw-r--r-- | drivers/hwmon/dme1737.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 2c2cb1ec94c5..27d62574284f 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
| @@ -572,7 +572,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) | |||
| 572 | 572 | ||
| 573 | /* Sample register contents every 1 sec */ | 573 | /* Sample register contents every 1 sec */ |
| 574 | if (time_after(jiffies, data->last_update + HZ) || !data->valid) { | 574 | if (time_after(jiffies, data->last_update + HZ) || !data->valid) { |
| 575 | if (data->type != sch5027) { | 575 | if (data->type == dme1737) { |
| 576 | data->vid = dme1737_read(data, DME1737_REG_VID) & | 576 | data->vid = dme1737_read(data, DME1737_REG_VID) & |
| 577 | 0x3f; | 577 | 0x3f; |
| 578 | } | 578 | } |
| @@ -1621,9 +1621,6 @@ static struct attribute *dme1737_misc_attr[] = { | |||
| 1621 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, | 1621 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, |
| 1622 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, | 1622 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, |
| 1623 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, | 1623 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, |
| 1624 | /* Misc */ | ||
| 1625 | &dev_attr_vrm.attr, | ||
| 1626 | &dev_attr_cpu0_vid.attr, | ||
| 1627 | NULL | 1624 | NULL |
| 1628 | }; | 1625 | }; |
| 1629 | 1626 | ||
| @@ -1631,6 +1628,18 @@ static const struct attribute_group dme1737_misc_group = { | |||
| 1631 | .attrs = dme1737_misc_attr, | 1628 | .attrs = dme1737_misc_attr, |
| 1632 | }; | 1629 | }; |
| 1633 | 1630 | ||
| 1631 | /* The following struct holds VID-related attributes. Their creation | ||
| 1632 | depends on the chip type which is determined during module load. */ | ||
| 1633 | static struct attribute *dme1737_vid_attr[] = { | ||
| 1634 | &dev_attr_vrm.attr, | ||
| 1635 | &dev_attr_cpu0_vid.attr, | ||
| 1636 | NULL | ||
| 1637 | }; | ||
| 1638 | |||
| 1639 | static const struct attribute_group dme1737_vid_group = { | ||
| 1640 | .attrs = dme1737_vid_attr, | ||
| 1641 | }; | ||
| 1642 | |||
| 1634 | /* The following structs hold the PWM attributes, some of which are optional. | 1643 | /* The following structs hold the PWM attributes, some of which are optional. |
| 1635 | * Their creation depends on the chip configuration which is determined during | 1644 | * Their creation depends on the chip configuration which is determined during |
| 1636 | * module load. */ | 1645 | * module load. */ |
| @@ -1902,6 +1911,9 @@ static void dme1737_remove_files(struct device *dev) | |||
| 1902 | if (data->type != sch5027) { | 1911 | if (data->type != sch5027) { |
| 1903 | sysfs_remove_group(&dev->kobj, &dme1737_misc_group); | 1912 | sysfs_remove_group(&dev->kobj, &dme1737_misc_group); |
| 1904 | } | 1913 | } |
| 1914 | if (data->type == dme1737) { | ||
| 1915 | sysfs_remove_group(&dev->kobj, &dme1737_vid_group); | ||
| 1916 | } | ||
| 1905 | 1917 | ||
| 1906 | sysfs_remove_group(&dev->kobj, &dme1737_group); | 1918 | sysfs_remove_group(&dev->kobj, &dme1737_group); |
| 1907 | 1919 | ||
| @@ -1933,6 +1945,13 @@ static int dme1737_create_files(struct device *dev) | |||
| 1933 | goto exit_remove; | 1945 | goto exit_remove; |
| 1934 | } | 1946 | } |
| 1935 | 1947 | ||
| 1948 | /* Create VID-related sysfs attributes */ | ||
| 1949 | if ((data->type == dme1737) && | ||
| 1950 | (err = sysfs_create_group(&dev->kobj, | ||
| 1951 | &dme1737_vid_group))) { | ||
| 1952 | goto exit_remove; | ||
| 1953 | } | ||
| 1954 | |||
| 1936 | /* Create fan sysfs attributes */ | 1955 | /* Create fan sysfs attributes */ |
| 1937 | for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { | 1956 | for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { |
| 1938 | if (data->has_fan & (1 << ix)) { | 1957 | if (data->has_fan & (1 << ix)) { |
| @@ -2127,7 +2146,7 @@ static int dme1737_init_device(struct device *dev) | |||
| 2127 | data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ | 2146 | data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ |
| 2128 | 2147 | ||
| 2129 | /* Set VRM */ | 2148 | /* Set VRM */ |
| 2130 | if (data->type != sch5027) { | 2149 | if (data->type == dme1737) { |
| 2131 | data->vrm = vid_which_vrm(); | 2150 | data->vrm = vid_which_vrm(); |
| 2132 | } | 2151 | } |
| 2133 | 2152 | ||
