diff options
author | Zhu, Richard \(NSN - CN/Beijing\) <richard.zhu@nsn.com> | 2014-07-01 03:14:23 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-04 10:01:38 -0400 |
commit | a8bfeceb0c1400b9331c00f6969afa6cb82d5d4a (patch) | |
tree | b0774f9e62c7af6ae14f9da24e334208e8ab2d1e | |
parent | 012cb5e257dcce524ee6207e50ca494d8a2b6013 (diff) |
hwmon: (pmbus) Add tps40422 front-end driver
For TI power management chip TPS40422, READ_TEMPERATURE_2 command is supported on
page 1 of the chip, but the original driver(pmbus.c) only tried to detect this command
on page 0, this will lead to a result that the temperature sensor in page 1 couldn't
be detected. This change is to isolate the tps40422 driver from pmbus.c into a solo
front-end driver.
Signed-off-by: Zhu Laiwen <richard.zhu@nsn.com>
[Guenter Roeck: Dropped unnecessary license text (fixes checkpatch warning)]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | Documentation/hwmon/pmbus | 5 | ||||
-rw-r--r-- | Documentation/hwmon/tps40422 | 64 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/Kconfig | 13 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/Makefile | 1 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/pmbus.c | 1 | ||||
-rw-r--r-- | drivers/hwmon/pmbus/tps40422.c | 64 |
6 files changed, 142 insertions, 6 deletions
diff --git a/Documentation/hwmon/pmbus b/Documentation/hwmon/pmbus index cf756ed48ff9..a3557da8f5b4 100644 --- a/Documentation/hwmon/pmbus +++ b/Documentation/hwmon/pmbus | |||
@@ -23,12 +23,11 @@ Supported chips: | |||
23 | http://www.lineagepower.com/oem/pdf/PDT012A0X.pdf | 23 | http://www.lineagepower.com/oem/pdf/PDT012A0X.pdf |
24 | http://www.lineagepower.com/oem/pdf/UDT020A0X.pdf | 24 | http://www.lineagepower.com/oem/pdf/UDT020A0X.pdf |
25 | http://www.lineagepower.com/oem/pdf/MDT040A0X.pdf | 25 | http://www.lineagepower.com/oem/pdf/MDT040A0X.pdf |
26 | * Texas Instruments TPS40400, TPS40422 | 26 | * Texas Instruments TPS40400 |
27 | Prefixes: 'tps40400', 'tps40422' | 27 | Prefixes: 'tps40400' |
28 | Addresses scanned: - | 28 | Addresses scanned: - |
29 | Datasheets: | 29 | Datasheets: |
30 | http://www.ti.com/lit/gpn/tps40400 | 30 | http://www.ti.com/lit/gpn/tps40400 |
31 | http://www.ti.com/lit/gpn/tps40422 | ||
32 | * Generic PMBus devices | 31 | * Generic PMBus devices |
33 | Prefix: 'pmbus' | 32 | Prefix: 'pmbus' |
34 | Addresses scanned: - | 33 | Addresses scanned: - |
diff --git a/Documentation/hwmon/tps40422 b/Documentation/hwmon/tps40422 new file mode 100644 index 000000000000..24bb0688d515 --- /dev/null +++ b/Documentation/hwmon/tps40422 | |||
@@ -0,0 +1,64 @@ | |||
1 | Kernel driver tps40422 | ||
2 | ====================== | ||
3 | |||
4 | Supported chips: | ||
5 | * TI TPS40422 | ||
6 | Prefix: 'tps40422' | ||
7 | Addresses scanned: - | ||
8 | Datasheet: http://www.ti.com/lit/gpn/tps40422 | ||
9 | |||
10 | Author: Zhu Laiwen <richard.zhu@nsn.com> | ||
11 | |||
12 | |||
13 | Description | ||
14 | ----------- | ||
15 | |||
16 | This driver supports TI TPS40422 Dual-Output or Two-Phase Synchronous Buck | ||
17 | Controller with PMBus | ||
18 | |||
19 | The driver is a client driver to the core PMBus driver. | ||
20 | Please see Documentation/hwmon/pmbus for details on PMBus client drivers. | ||
21 | |||
22 | |||
23 | Usage Notes | ||
24 | ----------- | ||
25 | |||
26 | This driver does not auto-detect devices. You will have to instantiate the | ||
27 | devices explicitly. Please see Documentation/i2c/instantiating-devices for | ||
28 | details. | ||
29 | |||
30 | |||
31 | Platform data support | ||
32 | --------------------- | ||
33 | |||
34 | The driver supports standard PMBus driver platform data. | ||
35 | |||
36 | |||
37 | Sysfs entries | ||
38 | ------------- | ||
39 | |||
40 | The following attributes are supported. | ||
41 | |||
42 | in[1-2]_label "vout[1-2]" | ||
43 | in[1-2]_input Measured voltage. From READ_VOUT register. | ||
44 | in[1-2]_alarm voltage alarm. | ||
45 | |||
46 | curr[1-2]_input Measured current. From READ_IOUT register. | ||
47 | curr[1-2]_label "iout[1-2]" | ||
48 | curr1_max Maximum current. From IOUT_OC_WARN_LIMIT register. | ||
49 | curr1_crit Critical maximum current. From IOUT_OC_FAULT_LIMIT register. | ||
50 | curr1_max_alarm Current high alarm. From IOUT_OC_WARN_LIMIT status. | ||
51 | curr1_crit_alarm Current critical high alarm. From IOUT_OC_FAULT status. | ||
52 | curr2_alarm Current high alarm. From IOUT_OC_WARNING status. | ||
53 | |||
54 | temp1_input Measured temperature. From READ_TEMPERATURE_2 register on page 0. | ||
55 | temp1_max Maximum temperature. From OT_WARN_LIMIT register. | ||
56 | temp1_crit Critical high temperature. From OT_FAULT_LIMIT register. | ||
57 | temp1_max_alarm Chip temperature high alarm. Set by comparing | ||
58 | READ_TEMPERATURE_2 on page 0 with OT_WARN_LIMIT if TEMP_OT_WARNING | ||
59 | status is set. | ||
60 | temp1_crit_alarm Chip temperature critical high alarm. Set by comparing | ||
61 | READ_TEMPERATURE_2 on page 0 with OT_FAULT_LIMIT if TEMP_OT_FAULT | ||
62 | status is set. | ||
63 | temp2_input Measured temperature. From READ_TEMPERATURE_2 register on page 1. | ||
64 | temp2_alarm Chip temperature alarm on page 1. | ||
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig index 39cc63edfbb0..6e1e4935fc62 100644 --- a/drivers/hwmon/pmbus/Kconfig +++ b/drivers/hwmon/pmbus/Kconfig | |||
@@ -20,8 +20,7 @@ config SENSORS_PMBUS | |||
20 | help | 20 | help |
21 | If you say yes here you get hardware monitoring support for generic | 21 | If you say yes here you get hardware monitoring support for generic |
22 | PMBus devices, including but not limited to ADP4000, BMR453, BMR454, | 22 | PMBus devices, including but not limited to ADP4000, BMR453, BMR454, |
23 | MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, UDT020, TPS40400, | 23 | MDT040, NCP4200, NCP4208, PDT003, PDT006, PDT012, UDT020, and TPS40400. |
24 | and TPS40422. | ||
25 | 24 | ||
26 | This driver can also be built as a module. If so, the module will | 25 | This driver can also be built as a module. If so, the module will |
27 | be called pmbus. | 26 | be called pmbus. |
@@ -87,6 +86,16 @@ config SENSORS_MAX8688 | |||
87 | This driver can also be built as a module. If so, the module will | 86 | This driver can also be built as a module. If so, the module will |
88 | be called max8688. | 87 | be called max8688. |
89 | 88 | ||
89 | config SENSORS_TPS40422 | ||
90 | tristate "TI TPS40422" | ||
91 | default n | ||
92 | help | ||
93 | If you say yes here you get hardware monitoring support for TI | ||
94 | TPS40422. | ||
95 | |||
96 | This driver can also be built as a module. If so, the module will | ||
97 | be called tps40422. | ||
98 | |||
90 | config SENSORS_UCD9000 | 99 | config SENSORS_UCD9000 |
91 | tristate "TI UCD90120, UCD90124, UCD9090, UCD90910" | 100 | tristate "TI UCD90120, UCD90124, UCD9090, UCD90910" |
92 | default n | 101 | default n |
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile index 789376c85dbb..1454293e985c 100644 --- a/drivers/hwmon/pmbus/Makefile +++ b/drivers/hwmon/pmbus/Makefile | |||
@@ -10,6 +10,7 @@ obj-$(CONFIG_SENSORS_LTC2978) += ltc2978.o | |||
10 | obj-$(CONFIG_SENSORS_MAX16064) += max16064.o | 10 | obj-$(CONFIG_SENSORS_MAX16064) += max16064.o |
11 | obj-$(CONFIG_SENSORS_MAX34440) += max34440.o | 11 | obj-$(CONFIG_SENSORS_MAX34440) += max34440.o |
12 | obj-$(CONFIG_SENSORS_MAX8688) += max8688.o | 12 | obj-$(CONFIG_SENSORS_MAX8688) += max8688.o |
13 | obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o | ||
13 | obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o | 14 | obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o |
14 | obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o | 15 | obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o |
15 | obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o | 16 | obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o |
diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c index 7e91700131a7..554d0249dcde 100644 --- a/drivers/hwmon/pmbus/pmbus.c +++ b/drivers/hwmon/pmbus/pmbus.c | |||
@@ -193,7 +193,6 @@ static const struct i2c_device_id pmbus_id[] = { | |||
193 | {"pdt012", 1}, | 193 | {"pdt012", 1}, |
194 | {"pmbus", 0}, | 194 | {"pmbus", 0}, |
195 | {"tps40400", 1}, | 195 | {"tps40400", 1}, |
196 | {"tps40422", 2}, | ||
197 | {"udt020", 1}, | 196 | {"udt020", 1}, |
198 | {} | 197 | {} |
199 | }; | 198 | }; |
diff --git a/drivers/hwmon/pmbus/tps40422.c b/drivers/hwmon/pmbus/tps40422.c new file mode 100644 index 000000000000..32803825d47e --- /dev/null +++ b/drivers/hwmon/pmbus/tps40422.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Hardware monitoring driver for TI TPS40422 | ||
3 | * | ||
4 | * Copyright (c) 2014 Nokia Solutions and Networks. | ||
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 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/err.h> | ||
21 | #include <linux/i2c.h> | ||
22 | #include "pmbus.h" | ||
23 | |||
24 | static struct pmbus_driver_info tps40422_info = { | ||
25 | .pages = 2, | ||
26 | .format[PSC_VOLTAGE_IN] = linear, | ||
27 | .format[PSC_VOLTAGE_OUT] = linear, | ||
28 | .format[PSC_TEMPERATURE] = linear, | ||
29 | .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2 | ||
30 | | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP | ||
31 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, | ||
32 | .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2 | ||
33 | | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP | ||
34 | | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT, | ||
35 | }; | ||
36 | |||
37 | static int tps40422_probe(struct i2c_client *client, | ||
38 | const struct i2c_device_id *id) | ||
39 | { | ||
40 | return pmbus_do_probe(client, id, &tps40422_info); | ||
41 | } | ||
42 | |||
43 | static const struct i2c_device_id tps40422_id[] = { | ||
44 | {"tps40422", 0}, | ||
45 | {} | ||
46 | }; | ||
47 | |||
48 | MODULE_DEVICE_TABLE(i2c, tps40422_id); | ||
49 | |||
50 | /* This is the driver that will be inserted */ | ||
51 | static struct i2c_driver tps40422_driver = { | ||
52 | .driver = { | ||
53 | .name = "tps40422", | ||
54 | }, | ||
55 | .probe = tps40422_probe, | ||
56 | .remove = pmbus_do_remove, | ||
57 | .id_table = tps40422_id, | ||
58 | }; | ||
59 | |||
60 | module_i2c_driver(tps40422_driver); | ||
61 | |||
62 | MODULE_AUTHOR("Zhu Laiwen <richard.zhu@nsn.com>"); | ||
63 | MODULE_DESCRIPTION("PMBus driver for TI TPS40422"); | ||
64 | MODULE_LICENSE("GPL"); | ||