diff options
-rw-r--r-- | drivers/hwmon/Kconfig | 10 | ||||
-rw-r--r-- | drivers/hwmon/Makefile | 1 | ||||
-rw-r--r-- | drivers/hwmon/max16064.c | 91 |
3 files changed, 102 insertions, 0 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 521f191fcbe3..de91d7d6a38e 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -779,6 +779,16 @@ config SENSORS_PMBUS | |||
779 | This driver can also be built as a module. If so, the module will | 779 | This driver can also be built as a module. If so, the module will |
780 | be called pmbus. | 780 | be called pmbus. |
781 | 781 | ||
782 | config SENSORS_MAX16064 | ||
783 | tristate "Maxim MAX16064" | ||
784 | default n | ||
785 | help | ||
786 | If you say yes here you get hardware monitoring support for Maxim | ||
787 | MAX16064. | ||
788 | |||
789 | This driver can also be built as a module. If so, the module will | ||
790 | be called max16064. | ||
791 | |||
782 | config SENSORS_MAX8688 | 792 | config SENSORS_MAX8688 |
783 | tristate "Maxim MAX8688" | 793 | tristate "Maxim MAX8688" |
784 | default n | 794 | default n |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 0e7cf92d1b56..9788fe248c68 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -117,6 +117,7 @@ obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o | |||
117 | # PMBus drivers | 117 | # PMBus drivers |
118 | obj-$(CONFIG_PMBUS) += pmbus_core.o | 118 | obj-$(CONFIG_PMBUS) += pmbus_core.o |
119 | obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o | 119 | obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o |
120 | obj-$(CONFIG_SENSORS_MAX16064) += max16064.o | ||
120 | obj-$(CONFIG_SENSORS_MAX8688) += max8688.o | 121 | obj-$(CONFIG_SENSORS_MAX8688) += max8688.o |
121 | 122 | ||
122 | ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) | 123 | ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) |
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); | ||