diff options
-rw-r--r-- | drivers/hwmon/pmbus/ltc2978.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 6d6130752f94..945f7eced409 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -49,6 +49,9 @@ enum chips { ltc2978, ltc3880 }; | |||
49 | #define LTC3880_ID 0x4000 | 49 | #define LTC3880_ID 0x4000 |
50 | #define LTC3880_ID_MASK 0xff00 | 50 | #define LTC3880_ID_MASK 0xff00 |
51 | 51 | ||
52 | #define LTC2978_NUM_PAGES 8 | ||
53 | #define LTC3880_NUM_PAGES 2 | ||
54 | |||
52 | /* | 55 | /* |
53 | * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which | 56 | * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which |
54 | * happens pretty much each time chip data is updated. Raw peak data therefore | 57 | * happens pretty much each time chip data is updated. Raw peak data therefore |
@@ -56,13 +59,14 @@ enum chips { ltc2978, ltc3880 }; | |||
56 | * internal cache of measured peak data, which is only cleared if an explicit | 59 | * internal cache of measured peak data, which is only cleared if an explicit |
57 | * "clear peak" command is executed for the sensor in question. | 60 | * "clear peak" command is executed for the sensor in question. |
58 | */ | 61 | */ |
62 | |||
59 | struct ltc2978_data { | 63 | struct ltc2978_data { |
60 | enum chips id; | 64 | enum chips id; |
61 | int vin_min, vin_max; | 65 | u16 vin_min, vin_max; |
62 | int temp_min, temp_max[2]; | 66 | u16 temp_min, temp_max[LTC3880_NUM_PAGES]; |
63 | int vout_min[8], vout_max[8]; | 67 | u16 vout_min[LTC2978_NUM_PAGES], vout_max[LTC2978_NUM_PAGES]; |
64 | int iout_max[2]; | 68 | u16 iout_max[LTC3880_NUM_PAGES]; |
65 | int temp2_max; | 69 | u16 temp2_max; |
66 | struct pmbus_driver_info info; | 70 | struct pmbus_driver_info info; |
67 | }; | 71 | }; |
68 | 72 | ||
@@ -323,6 +327,8 @@ static int ltc2978_probe(struct i2c_client *client, | |||
323 | 327 | ||
324 | data->vin_min = 0x7bff; | 328 | data->vin_min = 0x7bff; |
325 | data->vin_max = 0x7c00; | 329 | data->vin_max = 0x7c00; |
330 | for (i = 0; i < ARRAY_SIZE(data->vout_min); i++) | ||
331 | data->vout_min[i] = 0xffff; | ||
326 | data->temp_min = 0x7bff; | 332 | data->temp_min = 0x7bff; |
327 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) | 333 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) |
328 | data->temp_max[i] = 0x7c00; | 334 | data->temp_max[i] = 0x7c00; |
@@ -331,18 +337,18 @@ static int ltc2978_probe(struct i2c_client *client, | |||
331 | switch (data->id) { | 337 | switch (data->id) { |
332 | case ltc2978: | 338 | case ltc2978: |
333 | info->read_word_data = ltc2978_read_word_data; | 339 | info->read_word_data = ltc2978_read_word_data; |
334 | info->pages = 8; | 340 | info->pages = LTC2978_NUM_PAGES; |
335 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT | 341 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT |
336 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | 342 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
337 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; | 343 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; |
338 | for (i = 1; i < 8; i++) { | 344 | for (i = 1; i < LTC2978_NUM_PAGES; i++) { |
339 | info->func[i] = PMBUS_HAVE_VOUT | 345 | info->func[i] = PMBUS_HAVE_VOUT |
340 | | PMBUS_HAVE_STATUS_VOUT; | 346 | | PMBUS_HAVE_STATUS_VOUT; |
341 | } | 347 | } |
342 | break; | 348 | break; |
343 | case ltc3880: | 349 | case ltc3880: |
344 | info->read_word_data = ltc3880_read_word_data; | 350 | info->read_word_data = ltc3880_read_word_data; |
345 | info->pages = 2; | 351 | info->pages = LTC3880_NUM_PAGES; |
346 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | 352 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN |
347 | | PMBUS_HAVE_STATUS_INPUT | 353 | | PMBUS_HAVE_STATUS_INPUT |
348 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | 354 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
@@ -359,9 +365,6 @@ static int ltc2978_probe(struct i2c_client *client, | |||
359 | default: | 365 | default: |
360 | return -ENODEV; | 366 | return -ENODEV; |
361 | } | 367 | } |
362 | for (i = 0; i < info->pages; i++) | ||
363 | data->vout_min[i] = 0xffff; | ||
364 | |||
365 | return pmbus_do_probe(client, id, info); | 368 | return pmbus_do_probe(client, id, info); |
366 | } | 369 | } |
367 | 370 | ||