aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2011-07-08 13:43:57 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-07-28 23:16:17 -0400
commit03e9bd8dbcee60c2e22fd54f9f28f0d32da218c3 (patch)
tree0e55d78c814798f6467ad0c293fe9d365f78b7be
parent98591dbe633eace43a20ffa2907861fbef97237b (diff)
hwmon: (pmbus) Add client driver for LM25066, LM5064, and LM5066
PMBus client driver supporting National Semiconductor LM25066, LM5064, and LM5066. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
-rw-r--r--Documentation/hwmon/lm2506690
-rw-r--r--drivers/hwmon/pmbus/Kconfig10
-rw-r--r--drivers/hwmon/pmbus/Makefile1
-rw-r--r--drivers/hwmon/pmbus/lm25066.c340
-rw-r--r--drivers/hwmon/pmbus/pmbus.h1
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c3
6 files changed, 444 insertions, 1 deletions
<
diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066
new file mode 100644
index 000000000000..a21db81c4591
--- /dev/null
+++ b/Documentation/hwmon/lm25066
@@ -0,0 +1,90 @@
1Kernel driver max8688
2=====================
3
4Supported chips:
5 * National Semiconductor LM25066
6 Prefix: 'lm25066'
7 Addresses scanned: -
8 Datasheets:
9 http://www.national.com/pf/LM/LM25066.html
10 http://www.national.com/pf/LM/LM25066A.html
11 * National Semiconductor LM5064
12 Prefix: 'lm5064'
13 Addresses scanned: -
14 Datasheet:
15 http://www.national.com/pf/LM/LM5064.html
16 * National Semiconductor LM5066
17 Prefix: 'lm5066'
18 Addresses scanned: -
19 Datasheet:
20 http://www.national.com/pf/LM/LM5066.html
21
22Author: Guenter Roeck <guenter.roeck@ericsson.com>
23
24
25Description
26-----------
27
28This driver supports hardware montoring for National Semiconductor LM25066,
29LM5064, and LM5064 Power Management, Monitoring, Control, and Protection ICs.
30
31The driver is a client driver to the core PMBus driver. Please see
32Documentation/hwmon/pmbus for details on PMBus client drivers.
33
34
35Usage Notes
36-----------
37
38This driver does not auto-detect devices. You will have to instantiate the
39devices explicitly. Please see Documentation/i2c/instantiating-devices for
40details.
41
42
43Platform data support
44---------------------
45
46The driver supports standard PMBus driver platform data.
47
48
49Sysfs entries
50-------------
51
52The following attributes are supported. Limits are read-write; all other
53attributes are read-only.
54
55in1_label "vin"
56in1_input Measured input voltage.
57in1_average Average measured input voltage.
58in1_min Minimum input voltage.
59in1_max Maximum input voltage.
60in1_min_alarm Input voltage low alarm.
61in1_max_alarm Input voltage high alarm.
62
63in2_label "vout1"
64in2_input Measured output voltage.
65in2_average Average measured output voltage.
66in2_min Minimum output voltage.
67in2_min_alarm Output voltage low alarm.
68
69in3_label "vout2"
70in3_input Measured voltage on vaux pin
71
72curr1_label "iin"
73curr1_input Measured input current.
74curr1_average Average measured input current.
75curr1_max Maximum input current.
76curr1_max_alarm Input current high alarm.
77
78power1_label "pin"
79power1_input Measured input power.
80power1_average Average measured input power.
81power1_max Maximum input power limit.
82power1_alarm Input power alarm
83power1_input_highest Historical maximum power.
84power1_reset_history Write any value to reset maximum power history.
85
86temp1_input Measured temperature.
87temp1_max Maximum temperature.
88temp1_crit Critical high temperature.
89temp1_max_alarm Chip temperature high alarm.
90temp1_crit_alarm Chip temperature critical high alarm.
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 0a822a45085d..c9237b9dcff2 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -35,6 +35,16 @@ config SENSORS_ADM1275
35 This driver can also be built as a module. If so, the module will 35 This driver can also be built as a module. If so, the module will
36 be called adm1275. 36 be called adm1275.
37 37
38config SENSORS_LM25066
39 tristate "National Semiconductor LM25066 and compatibles"
40 default n
41 help
42 If you say yes here you get hardware monitoring support for National
43 Semiconductor LM25066, LM5064, and LM5066.
44
45 This driver can also be built as a module. If so, the module will
46 be called lm25066.
47
38config SENSORS_MAX16064 48config SENSORS_MAX16064
39 tristate "Maxim MAX16064" 49 tristate "Maxim MAX16064"
40 default n 50 default n
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 0178f81829d0..623eedb1ed9a 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -5,6 +5,7 @@
5obj-$(CONFIG_PMBUS) += pmbus_core.o 5obj-$(CONFIG_PMBUS) += pmbus_core.o
6obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o 6obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o
7obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o 7obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o
8obj-$(CONFIG_SENSORS_LM25066) += lm25066.o
8obj-$(CONFIG_SENSORS_MAX16064) += max16064.o 9obj-$(CONFIG_SENSORS_MAX16064) += max16064.o
9obj-$(CONFIG_SENSORS_MAX34440) += max34440.o 10obj-$(CONFIG_SENSORS_MAX34440) += max34440.o
10obj-$(CONFIG_SENSORS_MAX8688) += max8688.o 11obj-$(CONFIG_SENSORS_MAX8688) += max8688.o
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
new file mode 100644
index 000000000000..d4bc114572de
--- /dev/null
+++ b/drivers/hwmon/pmbus/lm25066.c
@@ -0,0 +1,340 @@
1/*
2 * Hardware monitoring driver for LM25066 / LM5064 / LM5066
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/slab.h>
26#include <linux/i2c.h>
27#include "pmbus.h"
28
29enum chips { lm25066, lm5064, lm5066 };
30
31#define LM25066_READ_VAUX 0xd0
32#define LM25066_MFR_READ_IIN 0xd1
33#define LM25066_MFR_READ_PIN 0xd2
34#define LM25066_MFR_IIN_OC_WARN_LIMIT 0xd3
35#define LM25066_MFR_PIN_OP_WARN_LIMIT 0xd4
36#define LM25066_READ_PIN_PEAK 0xd5
37#define LM25066_CLEAR_PIN_PEAK 0xd6
38#define LM25066_DEVICE_SETUP 0xd9
39#define LM25066_READ_AVG_VIN 0xdc
40#define LM25066_READ_AVG_VOUT 0xdd
41#define LM25066_READ_AVG_IIN 0xde
42#define LM25066_READ_AVG_PIN 0xdf
43
44#define LM25066_DEV_SETUP_CL (1 << 4) /* Current limit */
45
46struct lm25066_data {
47 int id;
48 struct pmbus_driver_info info;
49};
50
51#define to_lm25066_data(x) container_of(x, struct lm25066_data, info)
52
53static int lm25066_read_word_data(struct i2c_client *client, int page, int reg)
54{
55 const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
56 const struct lm25066_data *data = to_lm25066_data(info);
57 int ret;
58
59 if (page > 1)
60 return -EINVAL;
61
62 /* Map READ_VAUX into READ_VOUT register on page 1 */
63 if (page == 1) {