diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-01-26 23:14:26 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-03-15 01:39:07 -0400 |
commit | dcb7d0668b178deec81db128b9fbab29190063c4 (patch) | |
tree | f03d55f209649f0ced6b51e5b17d6883cd98f833 /drivers/hwmon/max16064.c | |
parent | 8ea3238ba16fbf06ff20b2979f894dc88383584a (diff) |
hwmon: (pmbus) Add support for Maxim MAX16064
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Diffstat (limited to 'drivers/hwmon/max16064.c')
-rw-r--r-- | drivers/hwmon/max16064.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/drivers/hwmon/max16064.c b/drivers/hwmon/max16064.c new file mode 100644 index 000000000000..1d6d717060d3 --- /dev/null +++ b/drivers/hwmon/max16064.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * Hardware monitoring driver for Maxim MAX16064 | ||
3 | * | ||
4 | * Copyright (c) 2011 Ericsson AB. | ||
5 | * | ||
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. | ||
10 | * | ||
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. | ||
15 | * | ||
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. | ||
19 | */ | ||
20 | |||
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> | ||
26 | #include "pmbus.h" | ||
27 | |||
28 | static struct pmbus_driver_info max16064_info = { | ||
29 | .pages = 4, | ||
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, | ||
47 | }; | ||
48 | |||
49 | static int max16064_probe(struct i2c_client *client, | ||
50 | const struct i2c_device_id *id) | ||
51 | { | ||
52 | return pmbus_do_probe(client, id, &max16064_info); | ||
53 | } | ||
54 | |||
55 | static int max16064_remove(struct i2c_client *client) | ||
56 | { | ||
57 | return pmbus_do_remove(client); | ||
58 | } | ||
59 | |||
60 | static const struct i2c_device_id max16064_id[] = { | ||
61 | {"max16064", 0}, | ||
62 | {} | ||
63 | }; | ||
64 | |||
65 | MODULE_DEVICE_TABLE(i2c, max16064_id); | ||
66 | |||
67 | /* This is the driver that will be inserted */ | ||
68 | static struct i2c_driver max16064_driver = { | ||
69 | .driver = { | ||
70 | .name = "max16064", | ||
71 | }, | ||
72 | .probe = max16064_probe, | ||
73 | .remove = max16064_remove, | ||
74 | .id_table = max16064_id, | ||
75 | }; | ||
76 | |||
77 | static int __init max16064_init(void) | ||
78 | { | ||
79 | return i2c_add_driver(&max16064_driver); | ||
80 | } | ||
81 | |||
82 | static void __exit max16064_exit(void) | ||
83 | { | ||
84 | i2c_del_driver(&max16064_driver); | ||
85 | } | ||
86 | |||
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); | ||