aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/pmbus/Kconfig9
-rw-r--r--drivers/hwmon/pmbus/Makefile1
-rw-r--r--drivers/hwmon/pmbus/tps53679.c113
3 files changed, 123 insertions, 0 deletions
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index 522ac37d8a69..40019325b517 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -144,6 +144,15 @@ config SENSORS_TPS40422
144 This driver can also be built as a module. If so, the module will 144 This driver can also be built as a module. If so, the module will
145 be called tps40422. 145 be called tps40422.
146 146
147config SENSORS_TPS53679
148 tristate "TI TPS53679"
149 help
150 If you say yes here you get hardware monitoring support for TI
151 TPS53679.
152
153 This driver can also be built as a module. If so, the module will
154 be called tps53679.
155
147config SENSORS_UCD9000 156config SENSORS_UCD9000
148 tristate "TI UCD90120, UCD90124, UCD90160, UCD9090, UCD90910" 157 tristate "TI UCD90120, UCD90124, UCD90160, UCD9090, UCD90910"
149 default n 158 default n
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index 737fa4efb3cc..459a6be3390e 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SENSORS_MAX20751) += max20751.o
15obj-$(CONFIG_SENSORS_MAX34440) += max34440.o 15obj-$(CONFIG_SENSORS_MAX34440) += max34440.o
16obj-$(CONFIG_SENSORS_MAX8688) += max8688.o 16obj-$(CONFIG_SENSORS_MAX8688) += max8688.o
17obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o 17obj-$(CONFIG_SENSORS_TPS40422) += tps40422.o
18obj-$(CONFIG_SENSORS_TPS53679) += tps53679.o
18obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o 19obj-$(CONFIG_SENSORS_UCD9000) += ucd9000.o
19obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o 20obj-$(CONFIG_SENSORS_UCD9200) += ucd9200.o
20obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o 21obj-$(CONFIG_SENSORS_ZL6100) += zl6100.o
diff --git a/drivers/hwmon/pmbus/tps53679.c b/drivers/hwmon/pmbus/tps53679.c
new file mode 100644
index 000000000000..85b515cd9df0
--- /dev/null
+++ b/drivers/hwmon/pmbus/tps53679.c
@@ -0,0 +1,113 @@
1/*
2 * Hardware monitoring driver for Texas Instruments TPS53679
3 *
4 * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
5 * Copyright (c) 2017 Vadim Pasternak <vadimp@mellanox.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/err.h>
19#include <linux/i2c.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include "pmbus.h"
24
25#define TPS53679_PROT_VR12_5MV 0x01 /* VR12.0 mode, 5-mV DAC */
26#define TPS53679_PROT_VR12_5_10MV 0x02 /* VR12.5 mode, 10-mV DAC */
27#define TPS53679_PROT_VR13_10MV 0x04 /* VR13.0 mode, 10-mV DAC */
28#define TPS53679_PROT_IMVP8_5MV 0x05 /* IMVP8 mode, 5-mV DAC */
29#define TPS53679_PROT_VR13_5MV 0x07 /* VR13.0 mode, 5-mV DAC */
30#define TPS53679_PAGE_NUM 2
31
32static int tps53679_identify(struct i2c_client *client,
33 struct pmbus_driver_info *info)
34{
35 u8 vout_params;
36 int ret;
37
38 /* Read the register with VOUT scaling value.*/
39 ret = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
40 if (ret < 0)
41 return ret;
42
43 vout_params = ret & GENMASK(4, 0);
44
45 switch (vout_params) {
46 case TPS53679_PROT_VR13_10MV:
47 case TPS53679_PROT_VR12_5_10MV:
48 info->vrm_version = vr13;
49 break;
50 case TPS53679_PROT_VR13_5MV:
51 case TPS53679_PROT_VR12_5MV:
52 case TPS53679_PROT_IMVP8_5MV:
53 info->vrm_version = vr12;
54 break;
55 default:
56 return -EINVAL;
57 }
58
59 return 0;
60}
61
62static struct pmbus_driver_info tps53679_info = {
63 .pages = TPS53679_PAGE_NUM,
64 .format[PSC_VOLTAGE_IN] = linear,
65 .format[PSC_VOLTAGE_OUT] = vid,
66 .format[PSC_TEMPERATURE] = linear,
67 .format[PSC_CURRENT_OUT] = linear,
68 .format[PSC_POWER] = linear,
69 .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
70 PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
71 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
72 PMBUS_HAVE_POUT,
73 .func[1] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
74 PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
75 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
76 PMBUS_HAVE_POUT,
77 .identify = tps53679_identify,
78};
79
80static int tps53679_probe(struct i2c_client *client,
81 const struct i2c_device_id *id)
82{
83 return pmbus_do_probe(client, id, &tps53679_info);
84}
85
86static const struct i2c_device_id tps53679_id[] = {
87 {"tps53679", 0},
88 {}
89};
90
91MODULE_DEVICE_TABLE(i2c, tps53679_id);
92
93static const struct of_device_id tps53679_of_match[] = {
94 {.compatible = "ti,tps53679"},
95 {}
96};
97MODULE_DEVICE_TABLE(of, tps53679_of_match);
98
99static struct i2c_driver tps53679_driver = {
100 .driver = {
101 .name = "tps53679",
102 .of_match_table = of_match_ptr(tps53679_of_match),
103 },
104 .probe = tps53679_probe,
105 .remove = pmbus_do_remove,
106 .id_table = tps53679_id,
107};
108
109module_i2c_driver(tps53679_driver);
110
111MODULE_AUTHOR("Vadim Pasternak <vadimp@mellanox.com>");
112MODULE_DESCRIPTION("PMBus driver for Texas Instruments TPS53679");
113MODULE_LICENSE("GPL");