提交 dbd712c2 编写于 作者: G Guenter Roeck

hwmon: (pmbus/ltc2978) Fix peak attribute handling

Peak attributes were not initialized and cleared correctly.
Also, temp2_max is only supported on page 0 and thus does not need to be
an array.
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org # 3.2+
Acked-by: NJean Delvare <khali@linux-fr.org>
上级 6d21a416
...@@ -62,7 +62,7 @@ struct ltc2978_data { ...@@ -62,7 +62,7 @@ struct ltc2978_data {
int temp_min, temp_max; int temp_min, temp_max;
int vout_min[8], vout_max[8]; int vout_min[8], vout_max[8];
int iout_max[2]; int iout_max[2];
int temp2_max[2]; int temp2_max;
struct pmbus_driver_info info; struct pmbus_driver_info info;
}; };
...@@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) ...@@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg)
ret = pmbus_read_word_data(client, page, ret = pmbus_read_word_data(client, page,
LTC3880_MFR_TEMPERATURE2_PEAK); LTC3880_MFR_TEMPERATURE2_PEAK);
if (ret >= 0) { if (ret >= 0) {
if (lin11_to_val(ret) if (lin11_to_val(ret) > lin11_to_val(data->temp2_max))
> lin11_to_val(data->temp2_max[page])) data->temp2_max = ret;
data->temp2_max[page] = ret; ret = data->temp2_max;
ret = data->temp2_max[page];
} }
break; break;
case PMBUS_VIRT_READ_VIN_MIN: case PMBUS_VIRT_READ_VIN_MIN:
...@@ -248,11 +247,11 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, ...@@ -248,11 +247,11 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
switch (reg) { switch (reg) {
case PMBUS_VIRT_RESET_IOUT_HISTORY: case PMBUS_VIRT_RESET_IOUT_HISTORY:
data->iout_max[page] = 0x7fff; data->iout_max[page] = 0x7c00;
ret = ltc2978_clear_peaks(client, page, data->id); ret = ltc2978_clear_peaks(client, page, data->id);
break; break;
case PMBUS_VIRT_RESET_TEMP2_HISTORY: case PMBUS_VIRT_RESET_TEMP2_HISTORY:
data->temp2_max[page] = 0x7fff; data->temp2_max = 0x7c00;
ret = ltc2978_clear_peaks(client, page, data->id); ret = ltc2978_clear_peaks(client, page, data->id);
break; break;
case PMBUS_VIRT_RESET_VOUT_HISTORY: case PMBUS_VIRT_RESET_VOUT_HISTORY:
...@@ -262,12 +261,12 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, ...@@ -262,12 +261,12 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
break; break;
case PMBUS_VIRT_RESET_VIN_HISTORY: case PMBUS_VIRT_RESET_VIN_HISTORY:
data->vin_min = 0x7bff; data->vin_min = 0x7bff;
data->vin_max = 0; data->vin_max = 0x7c00;
ret = ltc2978_clear_peaks(client, page, data->id); ret = ltc2978_clear_peaks(client, page, data->id);
break; break;
case PMBUS_VIRT_RESET_TEMP_HISTORY: case PMBUS_VIRT_RESET_TEMP_HISTORY:
data->temp_min = 0x7bff; data->temp_min = 0x7bff;
data->temp_max = 0x7fff; data->temp_max = 0x7c00;
ret = ltc2978_clear_peaks(client, page, data->id); ret = ltc2978_clear_peaks(client, page, data->id);
break; break;
default: default:
...@@ -321,10 +320,11 @@ static int ltc2978_probe(struct i2c_client *client, ...@@ -321,10 +320,11 @@ static int ltc2978_probe(struct i2c_client *client,
info = &data->info; info = &data->info;
info->write_word_data = ltc2978_write_word_data; info->write_word_data = ltc2978_write_word_data;
data->vout_min[0] = 0xffff;
data->vin_min = 0x7bff; data->vin_min = 0x7bff;
data->vin_max = 0x7c00;
data->temp_min = 0x7bff; data->temp_min = 0x7bff;
data->temp_max = 0x7fff; data->temp_max = 0x7c00;
data->temp2_max = 0x7c00;
switch (id->driver_data) { switch (id->driver_data) {
case ltc2978: case ltc2978:
...@@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_client *client, ...@@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_client *client,
for (i = 1; i < 8; i++) { for (i = 1; i < 8; i++) {
info->func[i] = PMBUS_HAVE_VOUT info->func[i] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT; | PMBUS_HAVE_STATUS_VOUT;
data->vout_min[i] = 0xffff;
} }
break; break;
case ltc3880: case ltc3880:
...@@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_client *client, ...@@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_client *client,
| PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_POUT | PMBUS_HAVE_POUT
| PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
data->vout_min[1] = 0xffff; data->iout_max[0] = 0x7c00;
data->iout_max[1] = 0x7c00;
break; break;
default: default:
return -ENODEV; return -ENODEV;
} }
for (i = 0; i < info->pages; i++)
data->vout_min[i] = 0xffff;
return pmbus_do_probe(client, id, info); return pmbus_do_probe(client, id, info);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册