2 * Hardware monitoring driver for Maxim MAX34440/MAX34441
4 * Copyright (c) 2011 Ericsson AB.
5 * Copyright (c) 2012 Guenter Roeck
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <linux/bitops.h>
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/init.h>
26 #include <linux/err.h>
27 #include <linux/i2c.h>
30 enum chips
{ max34440
, max34441
, max34446
, max34451
, max34460
, max34461
};
32 #define MAX34440_MFR_VOUT_PEAK 0xd4
33 #define MAX34440_MFR_IOUT_PEAK 0xd5
34 #define MAX34440_MFR_TEMPERATURE_PEAK 0xd6
35 #define MAX34440_MFR_VOUT_MIN 0xd7
37 #define MAX34446_MFR_POUT_PEAK 0xe0
38 #define MAX34446_MFR_POUT_AVG 0xe1
39 #define MAX34446_MFR_IOUT_AVG 0xe2
40 #define MAX34446_MFR_TEMPERATURE_AVG 0xe3
42 #define MAX34440_STATUS_OC_WARN BIT(0)
43 #define MAX34440_STATUS_OC_FAULT BIT(1)
44 #define MAX34440_STATUS_OT_FAULT BIT(5)
45 #define MAX34440_STATUS_OT_WARN BIT(6)
47 #define MAX34451_MFR_CHANNEL_CONFIG 0xe4
48 #define MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK 0x3f
50 struct max34440_data
{
52 struct pmbus_driver_info info
;
55 #define to_max34440_data(x) container_of(x, struct max34440_data, info)
57 static int max34440_read_word_data(struct i2c_client
*client
, int page
, int reg
)
60 const struct pmbus_driver_info
*info
= pmbus_get_driver_info(client
);
61 const struct max34440_data
*data
= to_max34440_data(info
);
64 case PMBUS_VIRT_READ_VOUT_MIN
:
65 ret
= pmbus_read_word_data(client
, page
,
66 MAX34440_MFR_VOUT_MIN
);
68 case PMBUS_VIRT_READ_VOUT_MAX
:
69 ret
= pmbus_read_word_data(client
, page
,
70 MAX34440_MFR_VOUT_PEAK
);
72 case PMBUS_VIRT_READ_IOUT_AVG
:
73 if (data
->id
!= max34446
&& data
->id
!= max34451
)
75 ret
= pmbus_read_word_data(client
, page
,
76 MAX34446_MFR_IOUT_AVG
);
78 case PMBUS_VIRT_READ_IOUT_MAX
:
79 ret
= pmbus_read_word_data(client
, page
,
80 MAX34440_MFR_IOUT_PEAK
);
82 case PMBUS_VIRT_READ_POUT_AVG
:
83 if (data
->id
!= max34446
)
85 ret
= pmbus_read_word_data(client
, page
,
86 MAX34446_MFR_POUT_AVG
);
88 case PMBUS_VIRT_READ_POUT_MAX
:
89 if (data
->id
!= max34446
)
91 ret
= pmbus_read_word_data(client
, page
,
92 MAX34446_MFR_POUT_PEAK
);
94 case PMBUS_VIRT_READ_TEMP_AVG
:
95 if (data
->id
!= max34446
&& data
->id
!= max34460
&&
98 ret
= pmbus_read_word_data(client
, page
,
99 MAX34446_MFR_TEMPERATURE_AVG
);
101 case PMBUS_VIRT_READ_TEMP_MAX
:
102 ret
= pmbus_read_word_data(client
, page
,
103 MAX34440_MFR_TEMPERATURE_PEAK
);
105 case PMBUS_VIRT_RESET_POUT_HISTORY
:
106 if (data
->id
!= max34446
)
110 case PMBUS_VIRT_RESET_VOUT_HISTORY
:
111 case PMBUS_VIRT_RESET_IOUT_HISTORY
:
112 case PMBUS_VIRT_RESET_TEMP_HISTORY
:
122 static int max34440_write_word_data(struct i2c_client
*client
, int page
,
125 const struct pmbus_driver_info
*info
= pmbus_get_driver_info(client
);
126 const struct max34440_data
*data
= to_max34440_data(info
);
130 case PMBUS_VIRT_RESET_POUT_HISTORY
:
131 ret
= pmbus_write_word_data(client
, page
,
132 MAX34446_MFR_POUT_PEAK
, 0);
135 ret
= pmbus_write_word_data(client
, page
,
136 MAX34446_MFR_POUT_AVG
, 0);
138 case PMBUS_VIRT_RESET_VOUT_HISTORY
:
139 ret
= pmbus_write_word_data(client
, page
,
140 MAX34440_MFR_VOUT_MIN
, 0x7fff);
143 ret
= pmbus_write_word_data(client
, page
,
144 MAX34440_MFR_VOUT_PEAK
, 0);
146 case PMBUS_VIRT_RESET_IOUT_HISTORY
:
147 ret
= pmbus_write_word_data(client
, page
,
148 MAX34440_MFR_IOUT_PEAK
, 0);
149 if (!ret
&& (data
->id
== max34446
|| data
->id
== max34451
))
150 ret
= pmbus_write_word_data(client
, page
,
151 MAX34446_MFR_IOUT_AVG
, 0);
154 case PMBUS_VIRT_RESET_TEMP_HISTORY
:
155 ret
= pmbus_write_word_data(client
, page
,
156 MAX34440_MFR_TEMPERATURE_PEAK
,
158 if (!ret
&& data
->id
== max34446
)
159 ret
= pmbus_write_word_data(client
, page
,
160 MAX34446_MFR_TEMPERATURE_AVG
, 0);
169 static int max34440_read_byte_data(struct i2c_client
*client
, int page
, int reg
)
175 ret
= pmbus_set_page(client
, page
);
181 case PMBUS_STATUS_IOUT
:
182 mfg_status
= pmbus_read_word_data(client
, 0,
183 PMBUS_STATUS_MFR_SPECIFIC
);
186 if (mfg_status
& MAX34440_STATUS_OC_WARN
)
187 ret
|= PB_IOUT_OC_WARNING
;
188 if (mfg_status
& MAX34440_STATUS_OC_FAULT
)
189 ret
|= PB_IOUT_OC_FAULT
;
191 case PMBUS_STATUS_TEMPERATURE
:
192 mfg_status
= pmbus_read_word_data(client
, 0,
193 PMBUS_STATUS_MFR_SPECIFIC
);
196 if (mfg_status
& MAX34440_STATUS_OT_WARN
)
197 ret
|= PB_TEMP_OT_WARNING
;
198 if (mfg_status
& MAX34440_STATUS_OT_FAULT
)
199 ret
|= PB_TEMP_OT_FAULT
;
208 static int max34451_set_supported_funcs(struct i2c_client
*client
,
209 struct max34440_data
*data
)
212 * Each of the channel 0-15 can be configured to monitor the following
213 * functions based on MFR_CHANNEL_CONFIG[5:0]
214 * 0x10: Sequencing + voltage monitoring (only valid for PAGES 0–11)
215 * 0x20: Voltage monitoring (no sequencing)
216 * 0x21: Voltage read only
217 * 0x22: Current monitoring
218 * 0x23: Current read only
219 * 0x30: General-purpose input active low
220 * 0x34: General-purpose input active high
226 for (page
= 0; page
< 16; page
++) {
227 rv
= i2c_smbus_write_byte_data(client
, PMBUS_PAGE
, page
);
231 rv
= i2c_smbus_read_word_data(client
,
232 MAX34451_MFR_CHANNEL_CONFIG
);
236 switch (rv
& MAX34451_MFR_CHANNEL_CONFIG_SEL_MASK
) {
239 data
->info
.func
[page
] = PMBUS_HAVE_VOUT
|
240 PMBUS_HAVE_STATUS_VOUT
;
243 data
->info
.func
[page
] = PMBUS_HAVE_VOUT
;
246 data
->info
.func
[page
] = PMBUS_HAVE_IOUT
|
247 PMBUS_HAVE_STATUS_IOUT
;
250 data
->info
.func
[page
] = PMBUS_HAVE_IOUT
;
260 static struct pmbus_driver_info max34440_info
[] = {
263 .format
[PSC_VOLTAGE_IN
] = direct
,
264 .format
[PSC_VOLTAGE_OUT
] = direct
,
265 .format
[PSC_TEMPERATURE
] = direct
,
266 .format
[PSC_CURRENT_OUT
] = direct
,
267 .m
[PSC_VOLTAGE_IN
] = 1,
268 .b
[PSC_VOLTAGE_IN
] = 0,
269 .R
[PSC_VOLTAGE_IN
] = 3, /* R = 0 in datasheet reflects mV */
270 .m
[PSC_VOLTAGE_OUT
] = 1,
271 .b
[PSC_VOLTAGE_OUT
] = 0,
272 .R
[PSC_VOLTAGE_OUT
] = 3, /* R = 0 in datasheet reflects mV */
273 .m
[PSC_CURRENT_OUT
] = 1,
274 .b
[PSC_CURRENT_OUT
] = 0,
275 .R
[PSC_CURRENT_OUT
] = 3, /* R = 0 in datasheet reflects mA */
276 .m
[PSC_TEMPERATURE
] = 1,
277 .b
[PSC_TEMPERATURE
] = 0,
278 .R
[PSC_TEMPERATURE
] = 2,
279 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
280 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
281 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
282 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
283 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
284 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
285 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
286 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
287 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
288 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
289 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
290 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
291 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
292 .func
[7] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
293 .func
[8] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
294 .func
[9] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
295 .func
[10] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
296 .func
[11] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
297 .func
[12] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
298 .func
[13] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
299 .read_byte_data
= max34440_read_byte_data
,
300 .read_word_data
= max34440_read_word_data
,
301 .write_word_data
= max34440_write_word_data
,
305 .format
[PSC_VOLTAGE_IN
] = direct
,
306 .format
[PSC_VOLTAGE_OUT
] = direct
,
307 .format
[PSC_TEMPERATURE
] = direct
,
308 .format
[PSC_CURRENT_OUT
] = direct
,
309 .format
[PSC_FAN
] = direct
,
310 .m
[PSC_VOLTAGE_IN
] = 1,
311 .b
[PSC_VOLTAGE_IN
] = 0,
312 .R
[PSC_VOLTAGE_IN
] = 3,
313 .m
[PSC_VOLTAGE_OUT
] = 1,
314 .b
[PSC_VOLTAGE_OUT
] = 0,
315 .R
[PSC_VOLTAGE_OUT
] = 3,
316 .m
[PSC_CURRENT_OUT
] = 1,
317 .b
[PSC_CURRENT_OUT
] = 0,
318 .R
[PSC_CURRENT_OUT
] = 3,
319 .m
[PSC_TEMPERATURE
] = 1,
320 .b
[PSC_TEMPERATURE
] = 0,
321 .R
[PSC_TEMPERATURE
] = 2,
325 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
326 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
327 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
328 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
329 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
330 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
331 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
332 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
333 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
334 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
335 .func
[5] = PMBUS_HAVE_FAN12
| PMBUS_HAVE_STATUS_FAN12
,
336 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
337 .func
[7] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
338 .func
[8] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
339 .func
[9] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
340 .func
[10] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
341 .func
[11] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
342 .read_byte_data
= max34440_read_byte_data
,
343 .read_word_data
= max34440_read_word_data
,
344 .write_word_data
= max34440_write_word_data
,
348 .format
[PSC_VOLTAGE_IN
] = direct
,
349 .format
[PSC_VOLTAGE_OUT
] = direct
,
350 .format
[PSC_TEMPERATURE
] = direct
,
351 .format
[PSC_CURRENT_OUT
] = direct
,
352 .format
[PSC_POWER
] = direct
,
353 .m
[PSC_VOLTAGE_IN
] = 1,
354 .b
[PSC_VOLTAGE_IN
] = 0,
355 .R
[PSC_VOLTAGE_IN
] = 3,
356 .m
[PSC_VOLTAGE_OUT
] = 1,
357 .b
[PSC_VOLTAGE_OUT
] = 0,
358 .R
[PSC_VOLTAGE_OUT
] = 3,
359 .m
[PSC_CURRENT_OUT
] = 1,
360 .b
[PSC_CURRENT_OUT
] = 0,
361 .R
[PSC_CURRENT_OUT
] = 3,
365 .m
[PSC_TEMPERATURE
] = 1,
366 .b
[PSC_TEMPERATURE
] = 0,
367 .R
[PSC_TEMPERATURE
] = 2,
368 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
369 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_POUT
,
370 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
371 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
372 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
373 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_POUT
,
374 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
375 | PMBUS_HAVE_IOUT
| PMBUS_HAVE_STATUS_IOUT
,
376 .func
[4] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
377 .func
[5] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
378 .func
[6] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
379 .read_byte_data
= max34440_read_byte_data
,
380 .read_word_data
= max34440_read_word_data
,
381 .write_word_data
= max34440_write_word_data
,
385 .format
[PSC_VOLTAGE_OUT
] = direct
,
386 .format
[PSC_TEMPERATURE
] = direct
,
387 .format
[PSC_CURRENT_OUT
] = direct
,
388 .m
[PSC_VOLTAGE_OUT
] = 1,
389 .b
[PSC_VOLTAGE_OUT
] = 0,
390 .R
[PSC_VOLTAGE_OUT
] = 3,
391 .m
[PSC_CURRENT_OUT
] = 1,
392 .b
[PSC_CURRENT_OUT
] = 0,
393 .R
[PSC_CURRENT_OUT
] = 2,
394 .m
[PSC_TEMPERATURE
] = 1,
395 .b
[PSC_TEMPERATURE
] = 0,
396 .R
[PSC_TEMPERATURE
] = 2,
397 /* func 0-15 is set dynamically before probing */
398 .func
[16] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
399 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
400 .func
[18] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
401 .func
[19] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
402 .func
[20] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
403 .read_byte_data
= max34440_read_byte_data
,
404 .read_word_data
= max34440_read_word_data
,
405 .write_word_data
= max34440_write_word_data
,
409 .format
[PSC_VOLTAGE_OUT
] = direct
,
410 .format
[PSC_TEMPERATURE
] = direct
,
411 .m
[PSC_VOLTAGE_OUT
] = 1,
412 .b
[PSC_VOLTAGE_OUT
] = 0,
413 .R
[PSC_VOLTAGE_OUT
] = 3,
414 .m
[PSC_TEMPERATURE
] = 1,
415 .b
[PSC_TEMPERATURE
] = 0,
416 .R
[PSC_TEMPERATURE
] = 2,
417 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
418 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
419 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
420 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
421 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
422 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
423 .func
[6] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
424 .func
[7] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
425 .func
[8] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
426 .func
[9] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
427 .func
[10] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
428 .func
[11] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
429 .func
[13] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
430 .func
[14] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
431 .func
[15] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
432 .func
[16] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
433 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
434 .read_byte_data
= max34440_read_byte_data
,
435 .read_word_data
= max34440_read_word_data
,
436 .write_word_data
= max34440_write_word_data
,
440 .format
[PSC_VOLTAGE_OUT
] = direct
,
441 .format
[PSC_TEMPERATURE
] = direct
,
442 .m
[PSC_VOLTAGE_OUT
] = 1,
443 .b
[PSC_VOLTAGE_OUT
] = 0,
444 .R
[PSC_VOLTAGE_OUT
] = 3,
445 .m
[PSC_TEMPERATURE
] = 1,
446 .b
[PSC_TEMPERATURE
] = 0,
447 .R
[PSC_TEMPERATURE
] = 2,
448 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
449 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
450 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
451 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
452 .func
[4] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
453 .func
[5] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
454 .func
[6] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
455 .func
[7] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
456 .func
[8] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
457 .func
[9] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
458 .func
[10] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
459 .func
[11] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
460 .func
[12] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
461 .func
[13] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
462 .func
[14] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
463 .func
[15] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
464 /* page 16 is reserved */
465 .func
[17] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
466 .func
[18] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
467 .func
[19] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
468 .func
[20] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
469 .func
[21] = PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
470 .read_byte_data
= max34440_read_byte_data
,
471 .read_word_data
= max34440_read_word_data
,
472 .write_word_data
= max34440_write_word_data
,
476 static int max34440_probe(struct i2c_client
*client
,
477 const struct i2c_device_id
*id
)
479 struct max34440_data
*data
;
482 data
= devm_kzalloc(&client
->dev
, sizeof(struct max34440_data
),
486 data
->id
= id
->driver_data
;
487 data
->info
= max34440_info
[id
->driver_data
];
489 if (data
->id
== max34451
) {
490 rv
= max34451_set_supported_funcs(client
, data
);
495 return pmbus_do_probe(client
, id
, &data
->info
);
498 static const struct i2c_device_id max34440_id
[] = {
499 {"max34440", max34440
},
500 {"max34441", max34441
},
501 {"max34446", max34446
},
502 {"max34451", max34451
},
503 {"max34460", max34460
},
504 {"max34461", max34461
},
507 MODULE_DEVICE_TABLE(i2c
, max34440_id
);
509 /* This is the driver that will be inserted */
510 static struct i2c_driver max34440_driver
= {
514 .probe
= max34440_probe
,
515 .remove
= pmbus_do_remove
,
516 .id_table
= max34440_id
,
519 module_i2c_driver(max34440_driver
);
521 MODULE_AUTHOR("Guenter Roeck");
522 MODULE_DESCRIPTION("PMBus driver for Maxim MAX34440/MAX34441");
523 MODULE_LICENSE("GPL");