提交 30453018 编写于 作者: H Hans de Goede 提交者: Jean Delvare

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: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
上级 4901062f
...@@ -1615,8 +1615,9 @@ static ssize_t show_pwm_auto_point_channel(struct device *dev, ...@@ -1615,8 +1615,9 @@ static ssize_t show_pwm_auto_point_channel(struct device *dev,
int result; int result;
struct f71882fg_data *data = f71882fg_update_device(dev); struct f71882fg_data *data = f71882fg_update_device(dev);
int nr = to_sensor_dev_attr_2(devattr)->index; int nr = to_sensor_dev_attr_2(devattr)->index;
int temp_start = (data->type == f8000) ? 0 : 1;
result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - 1); result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - temp_start);
return sprintf(buf, "%d\n", result); return sprintf(buf, "%d\n", result);
} }
...@@ -1627,20 +1628,23 @@ static ssize_t store_pwm_auto_point_channel(struct device *dev, ...@@ -1627,20 +1628,23 @@ static ssize_t store_pwm_auto_point_channel(struct device *dev,
{ {
struct f71882fg_data *data = dev_get_drvdata(dev); struct f71882fg_data *data = dev_get_drvdata(dev);
int nr = to_sensor_dev_attr_2(devattr)->index; int nr = to_sensor_dev_attr_2(devattr)->index;
int temp_start = (data->type == f8000) ? 0 : 1;
long val = simple_strtol(buf, NULL, 10); long val = simple_strtol(buf, NULL, 10);
switch (val) { switch (val) {
case 1: case 1:
val = 1; val = 0;
break; break;
case 2: case 2:
val = 2; val = 1;
break; break;
case 4: case 4:
val = 3; val = 2;
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
val += temp_start;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
data->pwm_auto_point_mapping[nr] = data->pwm_auto_point_mapping[nr] =
f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr)); f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册