diff options
-rw-r--r-- | Documentation/hwmon/ltc2978 | 134 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/Kconfig | 4 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/ltc2978.c | 149 |
3 files changed, 218 insertions, 69 deletions
diff --git a/Documentation/hwmon/ltc2978 b/Documentation/hwmon/ltc2978 index dcb10be36e7f..dc0d08c61305 100644 --- a/Documentation/hwmon/ltc2978 +++ b/Documentation/hwmon/ltc2978 | |||
@@ -2,6 +2,10 @@ Kernel driver ltc2978 | |||
2 | ===================== | 2 | ===================== |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Linear Technology LTC2974 | ||
6 | Prefix: 'ltc2974' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: http://www.linear.com/product/ltc2974 | ||
5 | * Linear Technology LTC2978 | 9 | * Linear Technology LTC2978 |
6 | Prefix: 'ltc2978' | 10 | Prefix: 'ltc2978' |
7 | Addresses scanned: - | 11 | Addresses scanned: - |
@@ -10,6 +14,10 @@ Supported chips: | |||
10 | Prefix: 'ltc3880' | 14 | Prefix: 'ltc3880' |
11 | Addresses scanned: - | 15 | Addresses scanned: - |
12 | Datasheet: http://www.linear.com/product/ltc3880 | 16 | Datasheet: http://www.linear.com/product/ltc3880 |
17 | * Linear Technology LTC3883 | ||
18 | Prefix: 'ltc3883' | ||
19 | Addresses scanned: - | ||
20 | Datasheet: http://www.linear.com/product/ltc3883 | ||
13 | 21 | ||
14 | Author: Guenter Roeck <linux@roeck-us.net> | 22 | Author: Guenter Roeck <linux@roeck-us.net> |
15 | 23 | ||
@@ -17,9 +25,9 @@ Author: Guenter Roeck <linux@roeck-us.net> | |||
17 | Description | 25 | Description |
18 | ----------- | 26 | ----------- |
19 | 27 | ||
20 | The LTC2978 is an octal power supply monitor, supervisor, sequencer and | 28 | LTC2974 is a quad digital power supply manager. LTC2978 is an octal power supply |
21 | margin controller. The LTC3880 is a dual, PolyPhase DC/DC synchronous | 29 | monitor. LTC3880 is a dual output poly-phase step-down DC/DC controller. LTC3883 |
22 | step-down switching regulator controller. | 30 | is a single phase step-down DC/DC controller. |
23 | 31 | ||
24 | 32 | ||
25 | Usage Notes | 33 | Usage Notes |
@@ -41,60 +49,90 @@ Sysfs attributes | |||
41 | in1_label "vin" | 49 | in1_label "vin" |
42 | in1_input Measured input voltage. | 50 | in1_input Measured input voltage. |
43 | in1_min Minimum input voltage. | 51 | in1_min Minimum input voltage. |
44 | in1_max Maximum input voltage. LTC2978 only. | 52 | in1_max Maximum input voltage. LTC2974 and LTC2978 only. |
45 | in1_lcrit Critical minimum input voltage. LTC2978 only. | 53 | in1_lcrit Critical minimum input voltage. LTC2974 and LTC2978 |
54 | only. | ||
46 | in1_crit Critical maximum input voltage. | 55 | in1_crit Critical maximum input voltage. |
47 | in1_min_alarm Input voltage low alarm. | 56 | in1_min_alarm Input voltage low alarm. |
48 | in1_max_alarm Input voltage high alarm. LTC2978 only. | 57 | in1_max_alarm Input voltage high alarm. LTC2974 and LTC2978 only. |
49 | in1_lcrit_alarm Input voltage critical low alarm. LTC2978 only. | 58 | in1_lcrit_alarm Input voltage critical low alarm. LTC2974 and LTC2978 |
59 | only. | ||
50 | in1_crit_alarm Input voltage critical high alarm. | 60 | in1_crit_alarm Input voltage critical high alarm. |
51 | in1_lowest Lowest input voltage. LTC2978 only. | 61 | in1_lowest Lowest input voltage. LTC2974 and LTC2978 only. |
52 | in1_highest Highest input voltage. | 62 | in1_highest Highest input voltage. |
53 | in1_reset_history Reset input voltage history. | 63 | in1_reset_history Reset input voltage history. |
54 | 64 | ||
55 | in[2-9]_label "vout[1-8]". Channels 3 to 9 on LTC2978 only. | 65 | in[N]_label "vout[1-8]". |
56 | in[2-9]_input Measured output voltage. | 66 | LTC2974: N=2-5 |
57 | in[2-9]_min Minimum output voltage. | 67 | LTC2978: N=2-9 |
58 | in[2-9]_max Maximum output voltage. | 68 | LTC3880: N=2-3 |
59 | in[2-9]_lcrit Critical minimum output voltage. | 69 | LTC3883: N=2 |
60 | in[2-9]_crit Critical maximum output voltage. | 70 | in[N]_input Measured output voltage. |
61 | in[2-9]_min_alarm Output voltage low alarm. | 71 | in[N]_min Minimum output voltage. |
62 | in[2-9]_max_alarm Output voltage high alarm. | 72 | in[N]_max Maximum output voltage. |
63 | in[2-9]_lcrit_alarm Output voltage critical low alarm. | 73 | in[N]_lcrit Critical minimum output voltage. |
64 | in[2-9]_crit_alarm Output voltage critical high alarm. | 74 | in[N]_crit Critical maximum output voltage. |
65 | in[2-9]_lowest Lowest output voltage. LTC2978 only. | 75 | in[N]_min_alarm Output voltage low alarm. |
66 | in[2-9]_highest Lowest output voltage. | 76 | in[N]_max_alarm Output voltage high alarm. |
67 | in[2-9]_reset_history Reset output voltage history. | 77 | in[N]_lcrit_alarm Output voltage critical low alarm. |
68 | 78 | in[N]_crit_alarm Output voltage critical high alarm. | |
69 | temp[1-3]_input Measured temperature. | 79 | in[N]_lowest Lowest output voltage. LTC2974 and LTC2978 only. |
80 | in[N]_highest Highest output voltage. | ||
81 | in[N]_reset_history Reset output voltage history. | ||
82 | |||
83 | temp[N]_input Measured temperature. | ||
84 | On LTC2974, temp[1-4] report external temperatures, | ||
85 | and temp5 reports the chip temperature. | ||
70 | On LTC2978, only one temperature measurement is | 86 | On LTC2978, only one temperature measurement is |
71 | supported and reports the chip temperature. | 87 | supported and reports the chip temperature. |
72 | On LTC3880, temp1 and temp2 report external | 88 | On LTC3880, temp1 and temp2 report external |
73 | temperatures, and temp3 reports the chip | 89 | temperatures, and temp3 reports the chip temperature. |
74 | temperature. | 90 | On LTC3883, temp1 reports an external temperature, |
75 | temp[1-3]_min Mimimum temperature. LTC2978 only. | 91 | and temp2 reports the chip temperature. |
76 | temp[1-3]_max Maximum temperature. | 92 | temp[N]_min Mimimum temperature. LTC2974 and LTC2978 only. |
77 | temp[1-3]_lcrit Critical low temperature. | 93 | temp[N]_max Maximum temperature. |
78 | temp[1-3]_crit Critical high temperature. | 94 | temp[N]_lcrit Critical low temperature. |
79 | temp[1-3]_min_alarm Temperature low alarm. LTC2978 only. | 95 | temp[N]_crit Critical high temperature. |
80 | temp[1-3]_max_alarm Temperature high alarm. | 96 | temp[N]_min_alarm Temperature low alarm. LTC2974 and LTC2978 only. |
81 | temp[1-3]_lcrit_alarm Temperature critical low alarm. | 97 | temp[N]_max_alarm Temperature high alarm. |
82 | temp[1-3]_crit_alarm Temperature critical high alarm. | 98 | temp[N]_lcrit_alarm Temperature critical low alarm. |
83 | temp[1-3]_lowest Lowest measured temperature. LTC2978 only. | 99 | temp[N]_crit_alarm Temperature critical high alarm. |
84 | temp[1-3]_highest Highest measured temperature. | 100 | temp[N]_lowest Lowest measured temperature. LTC2974 and LTC2978 only. |
85 | temp[1-3]_reset_history Reset temperature history. | 101 | Not supported for chip temperature sensor on LTC2974. |
86 | 102 | temp[N]_highest Highest measured temperature. Not supported for chip | |
87 | power[1-2]_label "pout[1-2]". LTC3880 only. | 103 | temperature sensor on LTC2974. |
88 | power[1-2]_input Measured power. | 104 | temp[N]_reset_history Reset temperature history. Not supported for chip |
89 | 105 | temperature sensor on LTC2974. | |
90 | curr1_label "iin". LTC3880 only. | 106 | |
107 | power1_label "pin". LTC3883 only. | ||
108 | power1_input Measured input power. | ||
109 | |||
110 | power[N]_label "pout[1-4]". | ||
111 | LTC2974: N=1-4 | ||
112 | LTC2978: Not supported | ||
113 | LTC3880: N=1-2 | ||
114 | LTC3883: N=2 | ||
115 | power[N]_input Measured output power. | ||
116 | |||
117 | curr1_label "iin". LTC3880 and LTC3883 only. | ||
91 | curr1_input Measured input current. | 118 | curr1_input Measured input current. |
92 | curr1_max Maximum input current. | 119 | curr1_max Maximum input current. |
93 | curr1_max_alarm Input current high alarm. | 120 | curr1_max_alarm Input current high alarm. |
94 | 121 | curr1_highest Highest input current. LTC3883 only. | |
95 | curr[2-3]_label "iout[1-2]". LTC3880 only. | 122 | curr1_reset_history Reset input current history. LTC3883 only. |
96 | curr[2-3]_input Measured output current. | 123 | |
97 | curr[2-3]_max Maximum output current. | 124 | curr[N]_label "iout[1-4]". |
98 | curr[2-3]_crit Critical output current. | 125 | LTC2974: N=1-4 |
99 | curr[2-3]_max_alarm Output current high alarm. | 126 | LTC2978: not supported |
100 | curr[2-3]_crit_alarm Output current critical high alarm. | 127 | LTC3880: N=2-3 |
128 | LTC3883: N=2 | ||
129 | curr[N]_input Measured output current. | ||
130 | curr[N]_max Maximum output current. | ||
131 | curr[N]_crit Critical high output current. | ||
132 | curr[N]_lcrit Critical low output current. LTC2974 only. | ||
133 | curr[N]_max_alarm Output current high alarm. | ||
134 | curr[N]_crit_alarm Output current critical high alarm. | ||
135 | curr[N]_lcrit_alarm Output current critical low alarm. LTC2974 only. | ||
136 | curr[N]_lowest Lowest output current. LTC2974 only. | ||
137 | curr[N]_highest Highest output current. | ||
138 | curr[N]_reset_history Reset output current history. | ||
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 4f9eb0af5229..b1adad60d6ad 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig | |||
@@ -48,11 +48,11 @@ config SENSORS_LM25066 | |||
48 | be called lm25066. | 48 | be called lm25066. |
49 | 49 | ||
50 | config SENSORS_LTC2978 | 50 | config SENSORS_LTC2978 |
51 | tristate "Linear Technologies LTC2978 and LTC3880" | 51 | tristate "Linear Technologies LTC2974, LTC2978, LTC3880, and LTC3883" |
52 | default n | 52 | default n |
53 | help | 53 | help |
54 | If you say yes here you get hardware monitoring support for Linear | 54 | If you say yes here you get hardware monitoring support for Linear |
55 | Technology LTC2978 and LTC3880. | 55 | Technology LTC2974, LTC2978, LTC3880, and LTC3883. |
56 | 56 | ||
57 | This driver can also be built as a module. If so, the module will | 57 | This driver can also be built as a module. If so, the module will |
58 | be called ltc2978. | 58 | be called ltc2978. |
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c index 945f7eced409..586a89ef9e0f 100644 --- a/drivers/hwmon/pmbus/ltc2978.c +++ b/drivers/hwmon/pmbus/ltc2978.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Hardware monitoring driver for LTC2978 and LTC3880 | 2 | * Hardware monitoring driver for LTC2974, LTC2978, LTC3880, and LTC3883 |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Ericsson AB. | 4 | * Copyright (c) 2011 Ericsson AB. |
5 | * Copyright (c) 2013 Guenter Roeck | ||
5 | * | 6 | * |
6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -26,31 +27,43 @@ | |||
26 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
27 | #include "pmbus.h" | 28 | #include "pmbus.h" |
28 | 29 | ||
29 | enum chips { ltc2978, ltc3880 }; | 30 | enum chips { ltc2974, ltc2978, ltc3880, ltc3883 }; |
30 | 31 | ||
31 | /* LTC2978 and LTC3880 */ | 32 | /* Common for all chips */ |
32 | #define LTC2978_MFR_VOUT_PEAK 0xdd | 33 | #define LTC2978_MFR_VOUT_PEAK 0xdd |
33 | #define LTC2978_MFR_VIN_PEAK 0xde | 34 | #define LTC2978_MFR_VIN_PEAK 0xde |
34 | #define LTC2978_MFR_TEMPERATURE_PEAK 0xdf | 35 | #define LTC2978_MFR_TEMPERATURE_PEAK 0xdf |
35 | #define LTC2978_MFR_SPECIAL_ID 0xe7 | 36 | #define LTC2978_MFR_SPECIAL_ID 0xe7 |
36 | 37 | ||
37 | /* LTC2978 only */ | 38 | /* LTC2974 and LTC2978 */ |
38 | #define LTC2978_MFR_VOUT_MIN 0xfb | 39 | #define LTC2978_MFR_VOUT_MIN 0xfb |
39 | #define LTC2978_MFR_VIN_MIN 0xfc | 40 | #define LTC2978_MFR_VIN_MIN 0xfc |
40 | #define LTC2978_MFR_TEMPERATURE_MIN 0xfd | 41 | #define LTC2978_MFR_TEMPERATURE_MIN 0xfd |
41 | 42 | ||
42 | /* LTC3880 only */ | 43 | /* LTC2974 only */ |
44 | #define LTC2974_MFR_IOUT_PEAK 0xd7 | ||
45 | #define LTC2974_MFR_IOUT_MIN 0xd8 | ||
46 | |||
47 | /* LTC3880 and LTC3883 */ | ||
43 | #define LTC3880_MFR_IOUT_PEAK 0xd7 | 48 | #define LTC3880_MFR_IOUT_PEAK 0xd7 |
44 | #define LTC3880_MFR_CLEAR_PEAKS 0xe3 | 49 | #define LTC3880_MFR_CLEAR_PEAKS 0xe3 |
45 | #define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 | 50 | #define LTC3880_MFR_TEMPERATURE2_PEAK 0xf4 |
46 | 51 | ||
52 | /* LTC3883 only */ | ||
53 | #define LTC3883_MFR_IIN_PEAK 0xe1 | ||
54 | |||
55 | #define LTC2974_ID 0x0212 | ||
47 | #define LTC2978_ID_REV1 0x0121 | 56 | #define LTC2978_ID_REV1 0x0121 |
48 | #define LTC2978_ID_REV2 0x0122 | 57 | #define LTC2978_ID_REV2 0x0122 |
49 | #define LTC3880_ID 0x4000 | 58 | #define LTC3880_ID 0x4000 |
50 | #define LTC3880_ID_MASK 0xff00 | 59 | #define LTC3880_ID_MASK 0xff00 |
60 | #define LTC3883_ID 0x4300 | ||
61 | #define LTC3883_ID_MASK 0xff00 | ||
51 | 62 | ||
63 | #define LTC2974_NUM_PAGES 4 | ||
52 | #define LTC2978_NUM_PAGES 8 | 64 | #define LTC2978_NUM_PAGES 8 |
53 | #define LTC3880_NUM_PAGES 2 | 65 | #define LTC3880_NUM_PAGES 2 |
66 | #define LTC3883_NUM_PAGES 1 | ||
54 | 67 | ||
55 | /* | 68 | /* |
56 | * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which | 69 | * LTC2978 clears peak data whenever the CLEAR_FAULTS command is executed, which |
@@ -63,9 +76,10 @@ enum chips { ltc2978, ltc3880 }; | |||
63 | struct ltc2978_data { | 76 | struct ltc2978_data { |
64 | enum chips id; | 77 | enum chips id; |
65 | u16 vin_min, vin_max; | 78 | u16 vin_min, vin_max; |
66 | u16 temp_min, temp_max[LTC3880_NUM_PAGES]; | 79 | u16 temp_min[LTC2974_NUM_PAGES], temp_max[LTC2974_NUM_PAGES]; |
67 | u16 vout_min[LTC2978_NUM_PAGES], vout_max[LTC2978_NUM_PAGES]; | 80 | u16 vout_min[LTC2978_NUM_PAGES], vout_max[LTC2978_NUM_PAGES]; |
68 | u16 iout_max[LTC3880_NUM_PAGES]; | 81 | u16 iout_min[LTC2974_NUM_PAGES], iout_max[LTC2974_NUM_PAGES]; |
82 | u16 iin_max; | ||
69 | u16 temp2_max; | 83 | u16 temp2_max; |
70 | struct pmbus_driver_info info; | 84 | struct pmbus_driver_info info; |
71 | }; | 85 | }; |
@@ -171,9 +185,9 @@ static int ltc2978_read_word_data(struct i2c_client *client, int page, int reg) | |||
171 | LTC2978_MFR_TEMPERATURE_MIN); | 185 | LTC2978_MFR_TEMPERATURE_MIN); |
172 | if (ret >= 0) { | 186 | if (ret >= 0) { |
173 | if (lin11_to_val(ret) | 187 | if (lin11_to_val(ret) |
174 | < lin11_to_val(data->temp_min)) | 188 | < lin11_to_val(data->temp_min[page])) |
175 | data->temp_min = ret; | 189 | data->temp_min[page] = ret; |
176 | ret = data->temp_min; | 190 | ret = data->temp_min[page]; |
177 | } | 191 | } |
178 | break; | 192 | break; |
179 | case PMBUS_VIRT_READ_IOUT_MAX: | 193 | case PMBUS_VIRT_READ_IOUT_MAX: |
@@ -189,6 +203,41 @@ static int ltc2978_read_word_data(struct i2c_client *client, int page, int reg) | |||
189 | return ret; | 203 | return ret; |
190 | } | 204 | } |
191 | 205 | ||
206 | static int ltc2974_read_word_data(struct i2c_client *client, int page, int reg) | ||
207 | { | ||
208 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); | ||
209 | struct ltc2978_data *data = to_ltc2978_data(info); | ||
210 | int ret; | ||
211 | |||
212 | switch (reg) { | ||
213 | case PMBUS_VIRT_READ_IOUT_MAX: | ||
214 | ret = pmbus_read_word_data(client, page, LTC2974_MFR_IOUT_PEAK); | ||
215 | if (ret >= 0) { | ||
216 | if (lin11_to_val(ret) | ||
217 | > lin11_to_val(data->iout_max[page])) | ||
218 | data->iout_max[page] = ret; | ||
219 | ret = data->iout_max[page]; | ||
220 | } | ||
221 | break; | ||
222 | case PMBUS_VIRT_READ_IOUT_MIN: | ||
223 | ret = pmbus_read_word_data(client, page, LTC2974_MFR_IOUT_MIN); | ||
224 | if (ret >= 0) { | ||
225 | if (lin11_to_val(ret) | ||
226 | < lin11_to_val(data->iout_min[page])) | ||
227 | data->iout_min[page] = ret; | ||
228 | ret = data->iout_min[page]; | ||
229 | } | ||
230 | break; | ||
231 | case PMBUS_VIRT_RESET_IOUT_HISTORY: | ||
232 | ret = 0; | ||
233 | break; | ||
234 | default: | ||
235 | ret = ltc2978_read_word_data(client, page, reg); | ||
236 | break; | ||
237 | } | ||
238 | return ret; | ||
239 | } | ||
240 | |||
192 | static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) | 241 | static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) |
193 | { | 242 | { |
194 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); | 243 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
@@ -230,15 +279,41 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg) | |||
230 | return ret; | 279 | return ret; |
231 | } | 280 | } |
232 | 281 | ||
282 | static int ltc3883_read_word_data(struct i2c_client *client, int page, int reg) | ||
283 | { | ||
284 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); | ||
285 | struct ltc2978_data *data = to_ltc2978_data(info); | ||
286 | int ret; | ||
287 | |||
288 | switch (reg) { | ||
289 | case PMBUS_VIRT_READ_IIN_MAX: | ||
290 | ret = pmbus_read_word_data(client, page, LTC3883_MFR_IIN_PEAK); | ||
291 | if (ret >= 0) { | ||
292 | if (lin11_to_val(ret) | ||
293 | > lin11_to_val(data->iin_max)) | ||
294 | data->iin_max = ret; | ||
295 | ret = data->iin_max; | ||
296 | } | ||
297 | break; | ||
298 | case PMBUS_VIRT_RESET_IIN_HISTORY: | ||
299 | ret = 0; | ||
300 | break; | ||
301 | default: | ||
302 | ret = ltc3880_read_word_data(client, page, reg); | ||
303 | break; | ||
304 | } | ||
305 | return ret; | ||
306 | } | ||
307 | |||
233 | static int ltc2978_clear_peaks(struct i2c_client *client, int page, | 308 | static int ltc2978_clear_peaks(struct i2c_client *client, int page, |
234 | enum chips id) | 309 | enum chips id) |
235 | { | 310 | { |
236 | int ret; | 311 | int ret; |
237 | 312 | ||
238 | if (id == ltc2978) | 313 | if (id == ltc3880 || id == ltc3883) |
239 | ret = pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); | ||
240 | else | ||
241 | ret = pmbus_write_byte(client, 0, LTC3880_MFR_CLEAR_PEAKS); | 314 | ret = pmbus_write_byte(client, 0, LTC3880_MFR_CLEAR_PEAKS); |
315 | else | ||
316 | ret = pmbus_write_byte(client, page, PMBUS_CLEAR_FAULTS); | ||
242 | 317 | ||
243 | return ret; | 318 | return ret; |
244 | } | 319 | } |
@@ -251,8 +326,13 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
251 | int ret; | 326 | int ret; |
252 | 327 | ||
253 | switch (reg) { | 328 | switch (reg) { |
329 | case PMBUS_VIRT_RESET_IIN_HISTORY: | ||
330 | data->iin_max = 0x7c00; | ||
331 | ret = ltc2978_clear_peaks(client, page, data->id); | ||
332 | break; | ||
254 | case PMBUS_VIRT_RESET_IOUT_HISTORY: | 333 | case PMBUS_VIRT_RESET_IOUT_HISTORY: |
255 | data->iout_max[page] = 0x7c00; | 334 | data->iout_max[page] = 0x7c00; |
335 | data->iout_min[page] = 0xfbff; | ||
256 | ret = ltc2978_clear_peaks(client, page, data->id); | 336 | ret = ltc2978_clear_peaks(client, page, data->id); |
257 | break; | 337 | break; |
258 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: | 338 | case PMBUS_VIRT_RESET_TEMP2_HISTORY: |
@@ -270,7 +350,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
270 | ret = ltc2978_clear_peaks(client, page, data->id); | 350 | ret = ltc2978_clear_peaks(client, page, data->id); |
271 | break; | 351 | break; |
272 | case PMBUS_VIRT_RESET_TEMP_HISTORY: | 352 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
273 | data->temp_min = 0x7bff; | 353 | data->temp_min[page] = 0x7bff; |
274 | data->temp_max[page] = 0x7c00; | 354 | data->temp_max[page] = 0x7c00; |
275 | ret = ltc2978_clear_peaks(client, page, data->id); | 355 | ret = ltc2978_clear_peaks(client, page, data->id); |
276 | break; | 356 | break; |
@@ -282,8 +362,10 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page, | |||
282 | } | 362 | } |
283 | 363 | ||
284 | static const struct i2c_device_id ltc2978_id[] = { | 364 | static const struct i2c_device_id ltc2978_id[] = { |
365 | {"ltc2974", ltc2974}, | ||
285 | {"ltc2978", ltc2978}, | 366 | {"ltc2978", ltc2978}, |
286 | {"ltc3880", ltc3880}, | 367 | {"ltc3880", ltc3880}, |
368 | {"ltc3883", ltc3883}, | ||
287 | {} | 369 | {} |
288 | }; | 370 | }; |
289 | MODULE_DEVICE_TABLE(i2c, ltc2978_id); | 371 | MODULE_DEVICE_TABLE(i2c, ltc2978_id); |
@@ -308,10 +390,14 @@ static int ltc2978_probe(struct i2c_client *client, | |||
308 | if (chip_id < 0) | 390 | if (chip_id < 0) |
309 | return chip_id; | 391 | return chip_id; |
310 | 392 | ||
311 | if (chip_id == LTC2978_ID_REV1 || chip_id == LTC2978_ID_REV2) { | 393 | if (chip_id == LTC2974_ID) { |
394 | data->id = ltc2974; | ||
395 | } else if (chip_id == LTC2978_ID_REV1 || chip_id == LTC2978_ID_REV2) { | ||
312 | data->id = ltc2978; | 396 | data->id = ltc2978; |
313 | } else if ((chip_id & LTC3880_ID_MASK) == LTC3880_ID) { | 397 | } else if ((chip_id & LTC3880_ID_MASK) == LTC3880_ID) { |
314 | data->id = ltc3880; | 398 | data->id = ltc3880; |
399 | } else if ((chip_id & LTC3883_ID_MASK) == LTC3883_ID) { | ||
400 | data->id = ltc3883; | ||
315 | } else { | 401 | } else { |
316 | dev_err(&client->dev, "Unsupported chip ID 0x%x\n", chip_id); | 402 | dev_err(&client->dev, "Unsupported chip ID 0x%x\n", chip_id); |
317 | return -ENODEV; | 403 | return -ENODEV; |
@@ -329,12 +415,29 @@ static int ltc2978_probe(struct i2c_client *client, | |||
329 | data->vin_max = 0x7c00; | 415 | data->vin_max = 0x7c00; |
330 | for (i = 0; i < ARRAY_SIZE(data->vout_min); i++) | 416 | for (i = 0; i < ARRAY_SIZE(data->vout_min); i++) |
331 | data->vout_min[i] = 0xffff; | 417 | data->vout_min[i] = 0xffff; |
332 | data->temp_min = 0x7bff; | 418 | for (i = 0; i < ARRAY_SIZE(data->iout_min); i++) |
419 | data->iout_min[i] = 0xfbff; | ||
420 | for (i = 0; i < ARRAY_SIZE(data->iout_max); i++) | ||
421 | data->iout_max[i] = 0x7c00; | ||
422 | for (i = 0; i < ARRAY_SIZE(data->temp_min); i++) | ||
423 | data->temp_min[i] = 0x7bff; | ||
333 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) | 424 | for (i = 0; i < ARRAY_SIZE(data->temp_max); i++) |
334 | data->temp_max[i] = 0x7c00; | 425 | data->temp_max[i] = 0x7c00; |
335 | data->temp2_max = 0x7c00; | 426 | data->temp2_max = 0x7c00; |
336 | 427 | ||
337 | switch (data->id) { | 428 | switch (data->id) { |
429 | case ltc2974: | ||
430 | info->read_word_data = ltc2974_read_word_data; | ||
431 | info->pages = LTC2974_NUM_PAGES; | ||
432 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT | ||
433 | | PMBUS_HAVE_TEMP2; | ||
434 | for (i = 0; i < info->pages; i++) { | ||
435 | info->func[i] |= PMBUS_HAVE_VOUT | ||
436 | | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_POUT | ||
437 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP | ||
438 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; | ||
439 | } | ||
440 | break; | ||
338 | case ltc2978: | 441 | case ltc2978: |
339 | info->read_word_data = ltc2978_read_word_data; | 442 | info->read_word_data = ltc2978_read_word_data; |
340 | info->pages = LTC2978_NUM_PAGES; | 443 | info->pages = LTC2978_NUM_PAGES; |
@@ -359,8 +462,16 @@ static int ltc2978_probe(struct i2c_client *client, | |||
359 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | 462 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
360 | | PMBUS_HAVE_POUT | 463 | | PMBUS_HAVE_POUT |
361 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; | 464 | | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; |
362 | data->iout_max[0] = 0x7c00; | 465 | break; |
363 | data->iout_max[1] = 0x7c00; | 466 | case ltc3883: |
467 | info->read_word_data = ltc3883_read_word_data; | ||
468 | info->pages = LTC3883_NUM_PAGES; | ||
469 | info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | ||
470 | | PMBUS_HAVE_STATUS_INPUT | ||
471 | | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | ||
472 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | ||
473 | | PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | PMBUS_HAVE_TEMP | ||
474 | | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_STATUS_TEMP; | ||
364 | break; | 475 | break; |
365 | default: | 476 | default: |
366 | return -ENODEV; | 477 | return -ENODEV; |
@@ -381,5 +492,5 @@ static struct i2c_driver ltc2978_driver = { | |||
381 | module_i2c_driver(ltc2978_driver); | 492 | module_i2c_driver(ltc2978_driver); |
382 | 493 | ||
383 | MODULE_AUTHOR("Guenter Roeck"); | 494 | MODULE_AUTHOR("Guenter Roeck"); |
384 | MODULE_DESCRIPTION("PMBus driver for LTC2978 and LTC3880"); | 495 | MODULE_DESCRIPTION("PMBus driver for LTC2974, LTC2978, LTC3880, and LTC3883"); |
385 | MODULE_LICENSE("GPL"); | 496 | MODULE_LICENSE("GPL"); |