aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-01-07 10:37:30 -0500
committerJean Delvare <khali@linux-fr.org>2009-01-07 10:37:30 -0500
commit30453018655a3acd5f59e793da55a2f969ed9c32 (patch)
tree7fb09f75f62dab037a84de7a47d88ee2eea817fa
parent4901062f78401f09ef0296466172905c93575ddd (diff)
hwmon: (f71882fg) Fix auto_channels_temp temp numbering with f8000
Adjust auto_channels_temp show and store functions for different numbering of temps between f8000 and other supported models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/hwmon/f71882fg.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index f4998bf82ca5..0ef7265336ba 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1615,8 +1615,9 @@ static ssize_t show_pwm_auto_point_channel(struct device *dev,
1615 int result; 1615 int result;
1616 struct f71882fg_data *data = f71882fg_update_device(dev); 1616 struct f71882fg_data *data = f71882fg_update_device(dev);
1617 int nr = to_sensor_dev_attr_2(devattr)->index; 1617 int nr = to_sensor_dev_attr_2(devattr)->index;
1618 int temp_start = (data->type == f8000) ? 0 : 1;
1618 1619
1619 result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - 1); 1620 result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - temp_start);
1620 1621
1621 return sprintf(buf, "%d\n", result); 1622 return sprintf(buf, "%d\n", result);
1622} 1623}
@@ -1627,20 +1628,23 @@ static ssize_t store_pwm_auto_point_channel(struct device *dev,
1627{ 1628{
1628 struct f71882fg_data *data = dev_get_drvdata(dev); 1629 struct f71882fg_data *data = dev_get_drvdata(dev);
1629 int nr = to_sensor_dev_attr_2(devattr)->index; 1630 int nr = to_sensor_dev_attr_2(devattr)->index;
1631 int temp_start = (data->type == f8000) ? 0 : 1;
1630 long val = simple_strtol(buf, NULL, 10); 1632 long val = simple_strtol(buf, NULL, 10);
1633
1631 switch (val) { 1634 switch (val) {
1632 case 1: 1635 case 1:
1633 val = 1; 1636 val = 0;
1634 break; 1637 break;
1635 case 2: 1638 case 2:
1636 val = 2; 1639 val = 1;
1637 break; 1640 break;
1638 case 4: 1641 case 4:
1639 val = 3; 1642 val = 2;
1640 break; 1643 break;
1641 default: 1644 default:
1642 return -EINVAL; 1645 return -EINVAL;
1643 } 1646 }
1647 val += temp_start;
1644 mutex_lock(&data->update_lock); 1648 mutex_lock(&data->update_lock);
1645 data->pwm_auto_point_mapping[nr] = 1649 data->pwm_auto_point_mapping[nr] =
1646 f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr)); 1650 f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr));