2 * Hardware monitoring driver for Maxim MAX16064
4 * Copyright (c) 2011 Ericsson AB.
6 * 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 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <linux/kernel.h>
22 #include <linux/module.h>
23 #include <linux/init.h>
24 #include <linux/err.h>
25 #include <linux/i2c.h>
28 static struct pmbus_driver_info max16064_info
= {
30 .direct
[PSC_VOLTAGE_IN
] = true,
31 .direct
[PSC_VOLTAGE_OUT
] = true,
32 .direct
[PSC_TEMPERATURE
] = true,
33 .m
[PSC_VOLTAGE_IN
] = 19995,
34 .b
[PSC_VOLTAGE_IN
] = 0,
35 .R
[PSC_VOLTAGE_IN
] = -1,
36 .m
[PSC_VOLTAGE_OUT
] = 19995,
37 .b
[PSC_VOLTAGE_OUT
] = 0,
38 .R
[PSC_VOLTAGE_OUT
] = -1,
39 .m
[PSC_TEMPERATURE
] = -7612,
40 .b
[PSC_TEMPERATURE
] = 335,
41 .R
[PSC_TEMPERATURE
] = -3,
42 .func
[0] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_TEMP
43 | PMBUS_HAVE_STATUS_VOUT
| PMBUS_HAVE_STATUS_TEMP
,
44 .func
[1] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
45 .func
[2] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
46 .func
[3] = PMBUS_HAVE_VOUT
| PMBUS_HAVE_STATUS_VOUT
,
49 static int max16064_probe(struct i2c_client
*client
,
50 const struct i2c_device_id
*id
)
52 return pmbus_do_probe(client
, id
, &max16064_info
);
55 static int max16064_remove(struct i2c_client
*client
)
57 return pmbus_do_remove(client
);
60 static const struct i2c_device_id max16064_id
[] = {
65 MODULE_DEVICE_TABLE(i2c
, max16064_id
);
67 /* This is the driver that will be inserted */
68 static struct i2c_driver max16064_driver
= {
72 .probe
= max16064_probe
,
73 .remove
= max16064_remove
,
74 .id_table
= max16064_id
,
77 static int __init
max16064_init(void)
79 return i2c_add_driver(&max16064_driver
);
82 static void __exit
max16064_exit(void)
84 i2c_del_driver(&max16064_driver
);
87 MODULE_AUTHOR("Guenter Roeck");
88 MODULE_DESCRIPTION("PMBus driver for Maxim MAX16064");
89 MODULE_LICENSE("GPL");
90 module_init(max16064_init
);
91 module_exit(max16064_exit
);