1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Hardware monitoring driver for Maxim MAX34440/MAX34441
5 * Copyright (c) 2011 Ericsson AB.
6 * Copyright (c) 2012 Guenter Roeck
9 #include <linux/bitops.h>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/err.h>
14 #include <linux/i2c.h>
17 enum chips
{ max34440
, max34441
, max34446
, max34451
, max34460
, max34461
};
19 #define MAX34440_MFR_VOUT_PEAK 0xd4
20 #define MAX34440_MFR_IOUT_PEAK 0xd5
21 #define MAX34440_MFR_TEMPERATURE_PEAK 0xd6
22 #define MAX34440_MFR_VOUT_MIN 0xd7
24 #define MAX34446_MFR_POUT_PEAK 0xe0
25 #define MAX34446_MFR_POUT_AVG 0xe1
26 #define MAX34446_MFR_IOUT_AVG 0xe2
27 #define MAX34446_MFR_TEMPERATURE_AVG 0xe3
29 #define MAX34440_STATUS_OC_WARN BIT(0)
30 #define MAX34440_STATUS_OC_FAULT BIT(1)
31 #define MAX34440_STATUS_OT_FAULT BIT(5)
32 #define MAX34440_STATUS_OT_WARN BIT(6)
35 * The whole max344* family have IOUT_OC_WARN_LIMIT and IOUT_OC_FAULT_LIMIT
36 * swapped from the standard pmbus spec addresses.
38 #define MAX34440_IOUT_OC_WARN_LIMIT 0x46
39 #define MAX34440_IOUT_OC_FAULT_LIMIT 0x4A
41 #define MAX34451_MFR_CHANNEL_CONFIG 0xe4
42 #define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
44 struct max34440_data
{
46 struct pmbus_driver_info info
;
49 #define to_max34440_data(x) container_of(x, struct max34440_data, info)
51 static const struct i2c_device_id max34440_id
[];
53 static int max34440_read_word_data(struct i2c_client
*client
, int page
,
57 const struct pmbus_driver_info
*info
= pmbus_get_driver_info(client
);
58 const struct max34440_data
*data
= to_max34440_data(info
);
61 case PMBUS_IOUT_OC_FAULT_LIMIT
:
62 ret
= pmbus_read_word_data(client
, page
, phase
,
63 MAX34440_IOUT_OC_FAULT_LIMIT
);
65 case PMBUS_IOUT_OC_WARN_LIMIT
:
66 ret
= pmbus_read_word_data(client
, page
, phase
,
67 MAX34440_IOUT_OC_WARN_LIMIT
);
69 case PMBUS_VIRT_READ_VOUT_MIN
:
70 ret
= pmbus_read_word_data(client
, page
, phase
,
71 MAX34440_MFR_VOUT_MIN
);
73 case PMBUS_VIRT_READ_VOUT_MAX
:
74 ret
= pmbus_read_word_data(client
, page
, phase
,
75 MAX34440_MFR_VOUT_PEAK
);
77 case PMBUS_VIRT_READ_IOUT_AVG
:
78 if (data
->id
!= max34446
&& data
->id
!= max34451
)
80 ret
= pmbus_read_word_data(client
, page
, phase
,
81 MAX34446_MFR_IOUT_AVG
);
83 case PMBUS_VIRT_READ_IOUT_MAX
:
84 ret
= pmbus_read_word_data(client
, page
, phase
,
85 MAX34440_MFR_IOUT_PEAK
);
87 case PMBUS_VIRT_READ_POUT_AVG
:
88 if (data
->id
!= max34446
)
90 ret
= pmbus_read_word_data(client
, page
, phase
,
91 MAX34446_MFR_POUT_AVG
);
93 case PMBUS_VIRT_READ_POUT_MAX
:
94 if (data
->id
!= max34446
)
96 ret
= pmbus_read_word_data(client
, page
, phase
,
97 MAX34446_MFR_POUT_PEAK
);
99 case PMBUS_VIRT_READ_TEMP_AVG
:
100 if (data
->id
!= max34446
&& data
->id
!= max34460
&&
101 data
->id
!= max34461
)
103 ret
= pmbus_read_word_data(client
, page
, phase
,
104 MAX34446_MFR_TEMPERATURE_AVG
);
106 case PMBUS_VIRT_READ_TEMP_MAX
:
107 ret
= pmbus_read_word_data(client
, page
, phase
,
108 MAX34440_MFR_TEMPERATURE_PEAK
);
110 case PMBUS_VIRT_RESET_POUT_HISTORY
:
111 if (data
->id
!= max34446
)
115 case PMBUS_VIRT_RESET_VOUT_HISTORY
:
116 case PMBUS_VIRT_RESET_IOUT_HISTORY
:
117 case PMBUS_VIRT_RESET_TEMP_HISTORY
:
127 static int max34440_write_word_data(struct i2c_client
*client
, int page
,
130 const struct pmbus_driver_info
*info
= pmbus_get_driver_info(client
);
131 const struct max34440_data
*data
= to_max34440_data(info
);
135 case PMBUS_IOUT_OC_FAULT_LIMIT
:
136 ret
= pmbus_write_word_data(client
, page
, MAX34440_IOUT_OC_FAULT_LIMIT
,
139 case PMBUS_IOUT_OC_WARN_LIMIT
:
140 ret
= pmbus_write_word_data(client
, page
, MAX34440_IOUT_OC_WARN_LIMIT
,
143 case PMBUS_VIRT_RESET_POUT_HISTORY
:
144 ret
= pmbus_write_word_data(client
, page
,
145 MAX34446_MFR_POUT_PEAK
, 0);
148 ret
= pmbus_write_word_data(client
, page
,
149 MAX34446_MFR_POUT_AVG
, 0);
151 case PMBUS_VIRT_RESET_VOUT_HISTORY
:
152 ret
= pmbus_write_word_data(client
, page
,
153 MAX34440_MFR_VOUT_MIN
, 0x7fff);
156 ret
= pmbus_write_word_data(client
, page
,
157 MAX34440_MFR_VOUT_PEAK
, 0);
159 case PMBUS_VIRT_RESET_IOUT_HISTORY
:
160 ret
= pmbus_write_word_data(client
, page
,
161 MAX34440_MFR_IOUT_PEAK
, 0);
162 if (!ret
&& (data
->id
== max34446
|| data
->id
== max34451
))
163 ret
= pmbus_write_word_data(client
, page
,
164 MAX34446_MFR_IOUT_AVG
, 0);
167 case PMBUS_VIRT_RESET_TEMP_HISTORY
:
168 ret
= pmbus_write_word_data(client
, page
,
169 MAX34440_MFR_TEMPERATURE_PEAK
,
171 if (!ret
&& data
->id
== max34446
)
172 ret
= pmbus_write_word_data(client
, page
,
173 MAX34446_MFR_TEMPERATURE_AVG
, 0);
182 static int max34440_read_byte_data(struct i2c_client
*client
, int page
, int reg
)
188 ret
= pmbus_set_page(client
, page
, 0xff);
194 case PMBUS_STATUS_IOUT
:
195 mfg_status
= pmbus_read_word_data(client
, 0, 0xff,
196 PMBUS_STATUS_MFR_SPECIFIC
);
199 if (mfg_status
& MAX34440_STATUS_OC_WARN
)
200 ret
|= PB_IOUT_OC_WARNING
;
201 if (mfg_status
& MAX34440_STATUS_OC_FAULT
)
202 ret
|= PB_IOUT_OC_FAULT
;
204 case PMBUS_STATUS_TEMPERATURE
:
205 mfg_status
= pmbus_read_word_data(client
, 0, 0xff,
206 PMBUS_STATUS_MFR_SPECIFIC
);
209 if (mfg_status
& MAX34440_STATUS_OT_WARN
)
210 ret
|= PB_TEMP_OT_WARNING
;
211 if (mfg_status
& MAX34440_STATUS_OT_FAULT
)
212 ret
|= PB_TEMP_OT_FAULT
;
221 static int max34451_set_supported_funcs(struct i2c_client
*client
,
222 struct max34440_data
*data
)
225 * Each of the channel 0-15 can be configured to monitor the following
226 * functions based on MFR_CHANNEL_CONFIG[5:0]
227 * 0x10: Sequencing + voltage monitoring (only valid for PAGES 0–11)
228 * 0x20: Voltage monitoring (no sequencing)
229 * 0x21: Voltage read only
230 * 0x22: Current monitoring
231 * 0x23: Current read only
232 * 0x30: General-purpose input active low
233 * 0x34: General-purpose input active high
239 for (page
= 0; page
< 16; page
++) {
240 rv
= i2c_smbus_write_byte_data(client
, PMBUS_PAGE
, page
);
244 rv
= i2c_smbus_read_word_data(client
,
245 MAX34451_MFR_CHANNEL_CONFIG
);
249 switch (rv
& MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK
) {
252 data
->info
.func
[page
] = PMBUS_HAVE_VOUT
|
253 PMBUS_HAVE_STATUS_VOUT
;
256 data
->info
.func
[page
] = PMBUS_HAVE_VOUT
;
259 data
->info
.func
[page
] = PMBUS_HAVE_IOUT
|
260 PMBUS_HAVE_STATUS_IOUT
;
263 data
->info
.func
[page
] = PMBUS_HAVE_IOUT
;
273 static struct pmbus_driver_info max34440_info
[] = {
276 .format
[PSC_VOLTAGE_IN
] = direct
,
277 .format
[PSC_VOLTAGE_OUT
] = direct
,
278 .format
[PSC_TEMPERATURE
] = direct
,
279 .format
[PSC_CURRENT_OUT
] = direct
,
280 .m
[PSC_VOLTAGE_IN
] = 1,
281 .b
[PSC_VOLTAGE_IN
] = 0,
282 .R
[PSC_VOLTAGE_IN
] = 3, /* R = 0 in datasheet reflects mV */
283 .m
[PSC_VOLTAGE_OUT
] = 1,
284 .b
[PSC_VOLTAGE_OUT
] = 0,
285 .R
[PSC_VOLTAGE_OUT
] = 3, /* R = 0 in datasheet reflects mV */
286 .m
[PSC_CURRENT_OUT
] = 1,
287 .b
[PSC_CURRENT_OUT
] = 0,
288 .R
[PSC_CURRENT_OUT
] = 3, /* R = 0 in datasheet reflects mA */
289 .m
[PSC_TEMPERATURE
] = 1,
290 .b
[PSC_TEMPERATURE
] = 0,
291 .R
[PSC_TEMPERATURE
] = 2,
292 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
293 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
294 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
295 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
296 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
297 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
298 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
299 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
300 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
301 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
302 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
303 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
304 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
305 .func
[7] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
306 .func
[8] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
307 .func
[9] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
308 .func
[10] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
309 .func
[11] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
310 .func
[12] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
311 .func
[13] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
312 .read_byte_data
= max34440_read_byte_data
,
313 .read_word_data
= max34440_read_word_data
,
314 .write_word_data
= max34440_write_word_data
,
318 .format
[PSC_VOLTAGE_IN
] = direct
,
319 .format
[PSC_VOLTAGE_OUT
] = direct
,
320 .format
[PSC_TEMPERATURE
] = direct
,
321 .format
[PSC_CURRENT_OUT
] = direct
,
322 .format
[PSC_FAN
] = direct
,
323 .m
[PSC_VOLTAGE_IN
] = 1,
324 .b
[PSC_VOLTAGE_IN
] = 0,
325 .R
[PSC_VOLTAGE_IN
] = 3,
326 .m
[PSC_VOLTAGE_OUT
] = 1,
327 .b
[PSC_VOLTAGE_OUT
] = 0,
328 .R
[PSC_VOLTAGE_OUT
] = 3,
329 .m
[PSC_CURRENT_OUT
] = 1,
330 .b
[PSC_CURRENT_OUT
] = 0,
331 .R
[PSC_CURRENT_OUT
] = 3,
332 .m
[PSC_TEMPERATURE
] = 1,
333 .b
[PSC_TEMPERATURE
] = 0,
334 .R
[PSC_TEMPERATURE
] = 2,
338 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
339 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
340 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
341 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
342 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
343 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
344 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
345 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
346 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
347 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
348 .func
[5] = PMBUS_HAVE_FAN12
| PMBUS_HAVE_STATUS_FAN12
,
349 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
350 .func
[7] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
351 .func
[8] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
352 .func
[9] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
353 .func
[10] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
354 .func
[11] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
355 .read_byte_data
= max34440_read_byte_data
,
356 .read_word_data
= max34440_read_word_data
,
357 .write_word_data
= max34440_write_word_data
,
361 .format
[PSC_VOLTAGE_IN
] = direct
,
362 .format
[PSC_VOLTAGE_OUT
] = direct
,
363 .format
[PSC_TEMPERATURE
] = direct
,
364 .format
[PSC_CURRENT_OUT
] = direct
,
365 .format
[PSC_POWER
] = direct
,
366 .m
[PSC_VOLTAGE_IN
] = 1,
367 .b
[PSC_VOLTAGE_IN
] = 0,
368 .R
[PSC_VOLTAGE_IN
] = 3,
369 .m
[PSC_VOLTAGE_OUT
] = 1,
370 .b
[PSC_VOLTAGE_OUT
] = 0,
371 .R
[PSC_VOLTAGE_OUT
] = 3,
372 .m
[PSC_CURRENT_OUT
] = 1,
373 .b
[PSC_CURRENT_OUT
] = 0,
374 .R
[PSC_CURRENT_OUT
] = 3,
378 .m
[PSC_TEMPERATURE
] = 1,
379 .b
[PSC_TEMPERATURE
] = 0,
380 .R
[PSC_TEMPERATURE
] = 2,
381 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
382 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_POUT
,
383 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
384 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
385 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
386 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_POUT
,
387 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
388 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
389 .func
[4] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
390 .func
[5] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
391 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
392 .read_byte_data
= max34440_read_byte_data
,
393 .read_word_data
= max34440_read_word_data
,
394 .write_word_data
= max34440_write_word_data
,
398 .format
[PSC_VOLTAGE_OUT
] = direct
,
399 .format
[PSC_TEMPERATURE
] = direct
,
400 .format
[PSC_CURRENT_OUT
] = direct
,
401 .m
[PSC_VOLTAGE_OUT
] = 1,
402 .b
[PSC_VOLTAGE_OUT
] = 0,
403 .R
[PSC_VOLTAGE_OUT
] = 3,
404 .m
[PSC_CURRENT_OUT
] = 1,
405 .b
[PSC_CURRENT_OUT
] = 0,
406 .R
[PSC_CURRENT_OUT
] = 2,
407 .m
[PSC_TEMPERATURE
] = 1,
408 .b
[PSC_TEMPERATURE
] = 0,
409 .R
[PSC_TEMPERATURE
] = 2,
410 /* func 0-15 is set dynamically before probing */
411 .func
[16] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
412 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
413 .func
[18] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
414 .func
[19] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
415 .func
[20] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
416 .read_word_data
= max34440_read_word_data
,
417 .write_word_data
= max34440_write_word_data
,
421 .format
[PSC_VOLTAGE_OUT
] = direct
,
422 .format
[PSC_TEMPERATURE
] = direct
,
423 .m
[PSC_VOLTAGE_OUT
] = 1,
424 .b
[PSC_VOLTAGE_OUT
] = 0,
425 .R
[PSC_VOLTAGE_OUT
] = 3,
426 .m
[PSC_TEMPERATURE
] = 1,
427 .b
[PSC_TEMPERATURE
] = 0,
428 .R
[PSC_TEMPERATURE
] = 2,
429 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
430 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
431 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
432 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
433 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
434 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
435 .func
[6] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
436 .func
[7] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
437 .func
[8] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
438 .func
[9] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
439 .func
[10] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
440 .func
[11] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
441 .func
[13] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
442 .func
[14] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
443 .func
[15] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
444 .func
[16] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
445 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
446 .read_word_data
= max34440_read_word_data
,
447 .write_word_data
= max34440_write_word_data
,
451 .format
[PSC_VOLTAGE_OUT
] = direct
,
452 .format
[PSC_TEMPERATURE
] = direct
,
453 .m
[PSC_VOLTAGE_OUT
] = 1,
454 .b
[PSC_VOLTAGE_OUT
] = 0,
455 .R
[PSC_VOLTAGE_OUT
] = 3,
456 .m
[PSC_TEMPERATURE
] = 1,
457 .b
[PSC_TEMPERATURE
] = 0,
458 .R
[PSC_TEMPERATURE
] = 2,
459 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
460 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
461 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
462 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
463 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
464 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
465 .func
[6] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
466 .func
[7] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
467 .func
[8] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
468 .func
[9] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
469 .func
[10] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
470 .func
[11] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
471 .func
[12] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
472 .func
[13] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
473 .func
[14] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
474 .func
[15] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
475 /* page 16 is reserved */
476 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
477 .func
[18] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
478 .func
[19] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
479 .func
[20] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
480 .func
[21] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
481 .read_word_data
= max34440_read_word_data
,
482 .write_word_data
= max34440_write_word_data
,
486 static int max34440_probe(struct i2c_client
*client
)
488 struct max34440_data
*data
;
491 data
= devm_kzalloc(&client
->dev
, sizeof(struct max34440_data
),
495 data
->id
= i2c_match_id(max34440_id
, client
)->driver_data
;
496 data
->info
= max34440_info
[data
->id
];
498 if (data
->id
== max34451
) {
499 rv
= max34451_set_supported_funcs(client
, data
);
504 return pmbus_do_probe(client
, &data
->info
);
507 static const struct i2c_device_id max34440_id
[] = {
508 {"max34440", max34440
},
509 {"max34441", max34441
},
510 {"max34446", max34446
},
511 {"max34451", max34451
},
512 {"max34460", max34460
},
513 {"max34461", max34461
},
516 MODULE_DEVICE_TABLE(i2c
, max34440_id
);
518 /* This is the driver that will be inserted */
519 static struct i2c_driver max34440_driver
= {
523 .probe
= max34440_probe
,
524 .id_table
= max34440_id
,
527 module_i2c_driver(max34440_driver
);
529 MODULE_AUTHOR("Guenter Roeck");
530 MODULE_DESCRIPTION("PMBus driver for Maxim MAX34440/MAX34441");
531 MODULE_LICENSE("GPL");
532 MODULE_IMPORT_NS("PMBUS");