diff options
| author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-07-08 13:43:57 -0400 |
|---|---|---|
| committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-07-28 23:16:17 -0400 |
| commit | 03e9bd8dbcee60c2e22fd54f9f28f0d32da218c3 (patch) | |
| tree | 0e55d78c814798f6467ad0c293fe9d365f78b7be | |
| parent | 98591dbe633eace43a20ffa2907861fbef97237b (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/lm25066 | 90 | ||||
| -rw-r--r-- | drivers/hwmon/pmbus/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/hwmon/pmbus/Makefile | 1 | ||||
| -rw-r--r-- | drivers/hwmon/pmbus/lm25066.c | 340 | ||||
| -rw-r--r-- | drivers/hwmon/pmbus/pmbus.h | 1 | ||||
| -rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 3 |
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 @@ | |||
| 1 | Kernel driver max8688 | ||
| 2 | ===================== | ||
| 3 | |||
| 4 | Supported 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 | |||
| 22 | Author: Guenter Roeck <guenter.roeck@ericsson.com> | ||
| 23 | |||
| 24 | |||
| 25 | Description | ||
| 26 | ----------- | ||
| 27 | |||
| 28 | This driver supports hardware montoring for National Semiconductor LM25066, | ||
| 29 | LM5064, and LM5064 Power Management, Monitoring, Control, and Protection ICs. | ||
| 30 | |||
| 31 | The driver is a client driver to the core PMBus driver. Please see | ||
| 32 | Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
| 33 | |||
| 34 | |||
| 35 | Usage Notes | ||
| 36 | ----------- | ||
| 37 | |||
| 38 | This driver does not auto-detect devices. You will have to instantiate the | ||
| 39 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
| 40 | details. | ||
| 41 | |||
| 42 | |||
| 43 | Platform data support | ||
| 44 | --------------------- | ||
| 45 | |||
| 46 | The driver supports standard PMBus driver platform data. | ||
| 47 | |||
| 48 | |||
| 49 | Sysfs entries | ||
| 50 | ------------- | ||
| 51 | |||
| 52 | The following attributes are supported. Limits are read-write; all other | ||
| 53 | attributes are read-only. | ||
| 54 | |||
| 55 | in1_label "vin" | ||
| 56 | in1_input Measured input voltage. | ||
| 57 | in1_average Average measured input voltage. | ||
| 58 | in1_min Minimum input voltage. | ||
| 59 | in1_max Maximum input voltage. | ||
| 60 | in1_min_alarm Input voltage low alarm. | ||
| 61 | in1_max_alarm Input voltage high alarm. | ||
| 62 | |||
| 63 | in2_label "vout1" | ||
| 64 | in2_input Measured output voltage. | ||
| 65 | in2_average Average measured output voltage. | ||
| 66 | in2_min Minimum output voltage. | ||
| 67 | in2_min_alarm Output voltage low alarm. | ||
| 68 | |||
| 69 | in3_label "vout2" | ||
| 70 | in3_input Measured voltage on vaux pin | ||
| 71 | |||
| 72 | curr1_label "iin" | ||
| 73 | curr1_input Measured input current. | ||
| 74 | curr1_average Average measured input current. | ||
| 75 | curr1_max Maximum input current. | ||
| 76 | curr1_max_alarm Input current high alarm. | ||
| 77 | |||
| 78 | power1_label "pin" | ||
| 79 | power1_input Measured input power. | ||
| 80 | power1_average Average measured input power. | ||
| 81 | power1_max Maximum input power limit. | ||
| 82 | power1_alarm Input power alarm | ||
| 83 | power1_input_highest Historical maximum power. | ||
| 84 | power1_reset_history Write any value to reset maximum power history. | ||
| 85 | |||
| 86 | temp1_input Measured temperature. | ||
| 87 | temp1_max Maximum temperature. | ||
| 88 | temp1_crit Critical high temperature. | ||
| 89 | temp1_max_alarm Chip temperature high alarm. | ||
| 90 | temp1_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 | ||
| 38 | config 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 | |||
| 38 | config SENSORS_MAX16064 | 48 | config 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 @@ | |||
| 5 | obj-$(CONFIG_PMBUS) += pmbus_core.o | 5 | obj-$(CONFIG_PMBUS) += pmbus_core.o |
| 6 | obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o | 6 | obj-$(CONFIG_SENSORS_PMBUS) += pmbus.o |
| 7 | obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o | 7 | obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o |
| 8 | obj-$(CONFIG_SENSORS_LM25066) += lm25066.o | ||
| 8 | obj-$(CONFIG_SENSORS_MAX16064) += max16064.o | 9 | obj-$(CONFIG_SENSORS_MAX16064) += max16064.o |
| 9 | obj-$(CONFIG_SENSORS_MAX34440) += max34440.o | 10 | obj-$(CONFIG_SENSORS_MAX34440) += max34440.o |
| 10 | obj-$(CONFIG_SENSORS_MAX8688) += max8688.o | 11 | obj-$(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 | |||
| 29 | enum 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 | |||
| 46 | struct 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 | |||
| 53 | static 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) { | <||
