aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/regulator/tps65090.txt122
-rw-r--r--drivers/mfd/tps65090.c22
2 files changed, 141 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/regulator/tps65090.txt b/Documentation/devicetree/bindings/regulator/tps65090.txt
new file mode 100644
index 000000000000..313a60ba61d8
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/tps65090.txt
@@ -0,0 +1,122 @@
1TPS65090 regulators
2
3Required properties:
4- compatible: "ti,tps65090"
5- reg: I2C slave address
6- interrupts: the interrupt outputs of the controller
7- regulators: A node that houses a sub-node for each regulator within the
8 device. Each sub-node is identified using the node's name, with valid
9 values listed below. The content of each sub-node is defined by the
10 standard binding for regulators; see regulator.txt.
11 dcdc[1-3], fet[1-7] and ldo[1-2] respectively.
12- vsys[1-3]-supply: The input supply for DCDC[1-3] respectively.
13- infet[1-7]-supply: The input supply for FET[1-7] respectively.
14- vsys-l[1-2]-supply: The input supply for LDO[1-2] respectively.
15
16Optional properties:
17- ti,enable-ext-control: This is applicable for DCDC1, DCDC2 and DCDC3.
18 If DCDCs are externally controlled then this property should be there.
19- "dcdc-ext-control-gpios: This is applicable for DCDC1, DCDC2 and DCDC3.
20 If DCDCs are externally controlled and if it is from GPIO then GPIO
21 number should be provided. If it is externally controlled and no GPIO
22 entry then driver will just configure this rails as external control
23 and will not provide any enable/disable APIs.
24
25Each regulator is defined using the standard binding for regulators.
26
27Example:
28
29 tps65090@48 {
30 compatible = "ti,tps65090";
31 reg = <0x48>;
32 interrupts = <0 88 0x4>;
33
34 vsys1-supply = <&some_reg>;
35 vsys2-supply = <&some_reg>;
36 vsys3-supply = <&some_reg>;
37 infet1-supply = <&some_reg>;
38 infet2-supply = <&some_reg>;
39 infet3-supply = <&some_reg>;
40 infet4-supply = <&some_reg>;
41 infet5-supply = <&some_reg>;
42 infet6-supply = <&some_reg>;
43 infet7-supply = <&some_reg>;
44 vsys_l1-supply = <&some_reg>;
45 vsys_l2-supply = <&some_reg>;
46
47 regulators {
48 dcdc1 {
49 regulator-name = "dcdc1";
50 regulator-boot-on;
51 regulator-always-on;
52 ti,enable-ext-control;
53 dcdc-ext-control-gpios = <&gpio 10 0>;
54 };
55
56 dcdc2 {
57 regulator-name = "dcdc2";
58 regulator-boot-on;
59 regulator-always-on;
60 };
61
62 dcdc3 {
63 regulator-name = "dcdc3";
64 regulator-boot-on;
65 regulator-always-on;
66 };
67
68 fet1 {
69 regulator-name = "fet1";
70 regulator-boot-on;
71 regulator-always-on;
72 };
73
74 fet2 {
75 regulator-name = "fet2";
76 regulator-boot-on;
77 regulator-always-on;
78 };
79
80 fet3 {
81 regulator-name = "fet3";
82 regulator-boot-on;
83 regulator-always-on;
84 };
85
86 fet4 {
87 regulator-name = "fet4";
88 regulator-boot-on;
89 regulator-always-on;
90 };
91
92 fet5 {
93 regulator-name = "fet5";
94 regulator-boot-on;
95 regulator-always-on;
96 };
97
98 fet6 {
99 regulator-name = "fet6";
100 regulator-boot-on;
101 regulator-always-on;
102 };
103
104 fet7 {
105 regulator-name = "fet7";
106 regulator-boot-on;
107 regulator-always-on;
108 };
109
110 ldo1 {
111 regulator-name = "ldo1";
112 regulator-boot-on;
113 regulator-always-on;
114 };
115
116 ldo2 {
117 regulator-name = "ldo2";
118 regulator-boot-on;
119 regulator-always-on;
120 };
121 };
122 };
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index 8d12a8e00d9c..b49654587ce5 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -25,6 +25,8 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/mfd/core.h> 26#include <linux/mfd/core.h>
27#include <linux/mfd/tps65090.h> 27#include <linux/mfd/tps65090.h>
28#include <linux/of.h>
29#include <linux/of_device.h>
28#include <linux/err.h> 30#include <linux/err.h>
29 31
30#define NUM_INT_REG 2 32#define NUM_INT_REG 2
@@ -148,18 +150,31 @@ static const struct regmap_config tps65090_regmap_config = {
148 .volatile_reg = is_volatile_reg, 150 .volatile_reg = is_volatile_reg,
149}; 151};
150 152
153#ifdef CONFIG_OF
154static const struct of_device_id tps65090_of_match[] = {
155 { .compatible = "ti,tps65090",},
156 {},
157};
158MODULE_DEVICE_TABLE(of, tps65090_of_match);
159#endif
160
151static int tps65090_i2c_probe(struct i2c_client *client, 161static int tps65090_i2c_probe(struct i2c_client *client,
152 const struct i2c_device_id *id) 162 const struct i2c_device_id *id)
153{ 163{
154 struct tps65090_platform_data *pdata = client->dev.platform_data; 164 struct tps65090_platform_data *pdata = client->dev.platform_data;
165 int irq_base = 0;
155 struct tps65090 *tps65090; 166 struct tps65090 *tps65090;
156 int ret; 167 int ret;
157 168
158 if (!pdata) { 169 if (!pdata && !client->dev.of_node) {
159 dev_err(&client->dev, "tps65090 requires platform data\n"); 170 dev_err(&client->dev,
171 "tps65090 requires platform data or of_node\n");
160 return -EINVAL; 172 return -EINVAL;
161 } 173 }
162 174
175 if (pdata)
176 irq_base = pdata->irq_base;
177
163 tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL); 178 tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL);
164 if (!tps65090) { 179 if (!tps65090) {
165 dev_err(&client->dev, "mem alloc for tps65090 failed\n"); 180 dev_err(&client->dev, "mem alloc for tps65090 failed\n");
@@ -178,7 +193,7 @@ static int tps65090_i2c_probe(struct i2c_client *client,
178 193
179 if (client->irq) { 194 if (client->irq) {
180 ret = regmap_add_irq_chip(tps65090->rmap, client->irq, 195 ret = regmap_add_irq_chip(tps65090->rmap, client->irq,
181 IRQF_ONESHOT | IRQF_TRIGGER_LOW, pdata->irq_base, 196 IRQF_ONESHOT | IRQF_TRIGGER_LOW, irq_base,
182 &tps65090_irq_chip, &tps65090->irq_data); 197 &tps65090_irq_chip, &tps65090->irq_data);
183 if (ret) { 198 if (ret) {
184 dev_err(&client->dev, 199 dev_err(&client->dev,
@@ -247,6 +262,7 @@ static struct i2c_driver tps65090_driver = {
247 .driver = { 262 .driver = {
248 .name = "tps65090", 263 .name = "tps65090",
249 .owner = THIS_MODULE, 264 .owner = THIS_MODULE,
265 .of_match_table = of_match_ptr(tps65090_of_match),
250 .pm = &tps65090_pm_ops, 266 .pm = &tps65090_pm_ops,
251 }, 267 },
252 .probe = tps65090_i2c_probe, 268 .probe = tps65090_i2c_probe,