aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/Kconfig7
-rw-r--r--drivers/regulator/arizona-ldo1.c57
-rw-r--r--drivers/regulator/arizona-micsupp.c37
-rw-r--r--drivers/regulator/max14577.c277
-rw-r--r--drivers/regulator/pbias-regulator.c76
-rw-r--r--drivers/regulator/tps6586x-regulator.c63
6 files changed, 418 insertions, 99 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 903eb37f047a..f0cc9e6dac3a 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -266,11 +266,12 @@ config REGULATOR_LP8788
266 This driver supports LP8788 voltage regulator chip. 266 This driver supports LP8788 voltage regulator chip.
267 267
268config REGULATOR_MAX14577 268config REGULATOR_MAX14577
269 tristate "Maxim 14577 regulator" 269 tristate "Maxim 14577/77836 regulator"
270 depends on MFD_MAX14577 270 depends on MFD_MAX14577
271 help 271 help
272 This driver controls a Maxim 14577 regulator via I2C bus. 272 This driver controls a Maxim MAX14577/77836 regulator via I2C bus.
273 The regulators include safeout LDO and current regulator 'CHARGER'. 273 The MAX14577 regulators include safeout LDO and charger current
274 regulator. The MAX77836 has two additional LDOs.
274 275
275config REGULATOR_MAX1586 276config REGULATOR_MAX1586
276 tristate "Maxim 1586/1587 voltage regulator" 277 tristate "Maxim 1586/1587 voltage regulator"
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index b1033d30b504..d3787e11f535 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/regulator/driver.h> 20#include <linux/regulator/driver.h>
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/regulator/of_regulator.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24 25
@@ -178,6 +179,42 @@ static const struct regulator_init_data arizona_ldo1_default = {
178 .num_consumer_supplies = 1, 179 .num_consumer_supplies = 1,
179}; 180};
180 181
182static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
183 struct regulator_config *config)
184{
185 struct arizona_pdata *pdata = &arizona->pdata;
186 struct arizona_ldo1 *ldo1 = config->driver_data;
187 struct device_node *init_node, *dcvdd_node;
188 struct regulator_init_data *init_data;
189
190 pdata->ldoena = arizona_of_get_named_gpio(arizona, "wlf,ldoena", true);
191
192 init_node = of_get_child_by_name(arizona->dev->of_node, "ldo1");
193 dcvdd_node = of_parse_phandle(arizona->dev->of_node, "DCVDD-supply", 0);
194
195 if (init_node) {
196 config->of_node = init_node;
197
198 init_data = of_get_regulator_init_data(arizona->dev, init_node);
199
200 if (init_data) {
201 init_data->consumer_supplies = &ldo1->supply;
202 init_data->num_consumer_supplies = 1;
203
204 if (dcvdd_node && dcvdd_node != init_node)
205 arizona->external_dcvdd = true;
206
207 pdata->ldo1 = init_data;
208 }
209 } else if (dcvdd_node) {
210 arizona->external_dcvdd = true;
211 }
212
213 of_node_put(dcvdd_node);
214
215 return 0;
216}
217
181static int arizona_ldo1_probe(struct platform_device *pdev) 218static int arizona_ldo1_probe(struct platform_device *pdev)
182{ 219{
183 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 220 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -186,6 +223,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
186 struct arizona_ldo1 *ldo1; 223 struct arizona_ldo1 *ldo1;
187 int ret; 224 int ret;
188 225
226 arizona->external_dcvdd = false;
227
189 ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL); 228 ldo1 = devm_kzalloc(&pdev->dev, sizeof(*ldo1), GFP_KERNEL);
190 if (!ldo1) 229 if (!ldo1)
191 return -ENOMEM; 230 return -ENOMEM;
@@ -216,6 +255,15 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
216 config.dev = arizona->dev; 255 config.dev = arizona->dev;
217 config.driver_data = ldo1; 256 config.driver_data = ldo1;
218 config.regmap = arizona->regmap; 257 config.regmap = arizona->regmap;
258
259 if (IS_ENABLED(CONFIG_OF)) {
260 if (!dev_get_platdata(arizona->dev)) {
261 ret = arizona_ldo1_of_get_pdata(arizona, &config);
262 if (ret < 0)
263 return ret;
264 }
265 }
266
219 config.ena_gpio = arizona->pdata.ldoena; 267 config.ena_gpio = arizona->pdata.ldoena;
220 268
221 if (arizona->pdata.ldo1) 269 if (arizona->pdata.ldo1)
@@ -223,6 +271,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
223 else 271 else
224 config.init_data = &ldo1->init_data; 272 config.init_data = &ldo1->init_data;
225 273
274 /*
275 * LDO1 can only be used to supply DCVDD so if it has no
276 * consumers then DCVDD is supplied externally.
277 */
278 if (config.init_data->num_consumer_supplies == 0)
279 arizona->external_dcvdd = true;
280
226 ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config); 281 ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config);
227 if (IS_ERR(ldo1->regulator)) { 282 if (IS_ERR(ldo1->regulator)) {
228 ret = PTR_ERR(ldo1->regulator); 283 ret = PTR_ERR(ldo1->regulator);
@@ -231,6 +286,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
231 return ret; 286 return ret;
232 } 287 }
233 288
289 of_node_put(config.of_node);
290
234 platform_set_drvdata(pdev, ldo1); 291 platform_set_drvdata(pdev, ldo1);
235 292
236 return 0; 293 return 0;
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index 6fdd9bf6927f..b80ebbe88bac 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/regulator/driver.h> 20#include <linux/regulator/driver.h>
21#include <linux/regulator/machine.h> 21#include <linux/regulator/machine.h>
22#include <linux/regulator/of_regulator.h>
22#include <linux/gpio.h> 23#include <linux/gpio.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/workqueue.h> 25#include <linux/workqueue.h>
@@ -195,6 +196,32 @@ static const struct regulator_init_data arizona_micsupp_ext_default = {
195 .num_consumer_supplies = 1, 196 .num_consumer_supplies = 1,
196}; 197};
197 198
199static int arizona_micsupp_of_get_pdata(struct arizona *arizona,
200 struct regulator_config *config)
201{
202 struct arizona_pdata *pdata = &arizona->pdata;
203 struct arizona_micsupp *micsupp = config->driver_data;
204 struct device_node *np;
205 struct regulator_init_data *init_data;
206
207 np = of_get_child_by_name(arizona->dev->of_node, "micvdd");
208
209 if (np) {
210 config->of_node = np;
211
212 init_data = of_get_regulator_init_data(arizona->dev, np);
213
214 if (init_data) {
215 init_data->consumer_supplies = &micsupp->supply;
216 init_data->num_consumer_supplies = 1;
217
218 pdata->micvdd = init_data;
219 }
220 }
221
222 return 0;
223}
224
198static int arizona_micsupp_probe(struct platform_device *pdev) 225static int arizona_micsupp_probe(struct platform_device *pdev)
199{ 226{
200 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 227 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -234,6 +261,14 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
234 config.driver_data = micsupp; 261 config.driver_data = micsupp;
235 config.regmap = arizona->regmap; 262 config.regmap = arizona->regmap;
236 263
264 if (IS_ENABLED(CONFIG_OF)) {
265 if (!dev_get_platdata(arizona->dev)) {
266 ret = arizona_micsupp_of_get_pdata(arizona, &config);
267 if (ret < 0)
268 return ret;
269 }
270 }
271
237 if (arizona->pdata.micvdd) 272 if (arizona->pdata.micvdd)
238 config.init_data = arizona->pdata.micvdd; 273 config.init_data = arizona->pdata.micvdd;
239 else 274 else
@@ -253,6 +288,8 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
253 return ret; 288 return ret;
254 } 289 }
255 290
291 of_node_put(config.of_node);
292
256 platform_set_drvdata(pdev, micsupp); 293 platform_set_drvdata(pdev, micsupp);
257 294
258 return 0; 295 return 0;
diff --git a/drivers/regulator/max14577.c b/drivers/regulator/max14577.c
index ed60baaeceec..5d9c605cf534 100644
--- a/drivers/regulator/max14577.c
+++ b/drivers/regulator/max14577.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * max14577.c - Regulator driver for the Maxim 14577 2 * max14577.c - Regulator driver for the Maxim 14577/77836
3 * 3 *
4 * Copyright (C) 2013,2014 Samsung Electronics 4 * Copyright (C) 2013,2014 Samsung Electronics
5 * Krzysztof Kozlowski <k.kozlowski@samsung.com> 5 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
@@ -22,6 +22,42 @@
22#include <linux/mfd/max14577-private.h> 22#include <linux/mfd/max14577-private.h>
23#include <linux/regulator/of_regulator.h> 23#include <linux/regulator/of_regulator.h>
24 24
25/*
26 * Valid limits of current for max14577 and max77836 chargers.
27 * They must correspond to MBCICHWRCL and MBCICHWRCH fields in CHGCTRL4
28 * register for given chipset.
29 */
30struct maxim_charger_current {
31 /* Minimal current, set in CHGCTRL4/MBCICHWRCL, uA */
32 unsigned int min;
33 /*
34 * Minimal current when high setting is active,
35 * set in CHGCTRL4/MBCICHWRCH, uA
36 */
37 unsigned int high_start;
38 /* Value of one step in high setting, uA */
39 unsigned int high_step;
40 /* Maximum current of high setting, uA */
41 unsigned int max;
42};
43
44/* Table of valid charger currents for different Maxim chipsets */
45static const struct maxim_charger_current maxim_charger_currents[] = {
46 [MAXIM_DEVICE_TYPE_UNKNOWN] = { 0, 0, 0, 0 },
47 [MAXIM_DEVICE_TYPE_MAX14577] = {
48 .min = MAX14577_REGULATOR_CURRENT_LIMIT_MIN,
49 .high_start = MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START,
50 .high_step = MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP,
51 .max = MAX14577_REGULATOR_CURRENT_LIMIT_MAX,
52 },
53 [MAXIM_DEVICE_TYPE_MAX77836] = {
54 .min = MAX77836_REGULATOR_CURRENT_LIMIT_MIN,
55 .high_start = MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START,
56 .high_step = MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP,
57 .max = MAX77836_REGULATOR_CURRENT_LIMIT_MAX,
58 },
59};
60
25static int max14577_reg_is_enabled(struct regulator_dev *rdev) 61static int max14577_reg_is_enabled(struct regulator_dev *rdev)
26{ 62{
27 int rid = rdev_get_id(rdev); 63 int rid = rdev_get_id(rdev);
@@ -47,6 +83,9 @@ static int max14577_reg_get_current_limit(struct regulator_dev *rdev)
47{ 83{
48 u8 reg_data; 84 u8 reg_data;
49 struct regmap *rmap = rdev->regmap; 85 struct regmap *rmap = rdev->regmap;
86 struct max14577 *max14577 = rdev_get_drvdata(rdev);
87 const struct maxim_charger_current *limits =
88 &maxim_charger_currents[max14577->dev_type];
50 89
51 if (rdev_get_id(rdev) != MAX14577_CHARGER) 90 if (rdev_get_id(rdev) != MAX14577_CHARGER)
52 return -EINVAL; 91 return -EINVAL;
@@ -54,12 +93,11 @@ static int max14577_reg_get_current_limit(struct regulator_dev *rdev)
54 max14577_read_reg(rmap, MAX14577_CHG_REG_CHG_CTRL4, &reg_data); 93 max14577_read_reg(rmap, MAX14577_CHG_REG_CHG_CTRL4, &reg_data);
55 94
56 if ((reg_data & CHGCTRL4_MBCICHWRCL_MASK) == 0) 95 if ((reg_data & CHGCTRL4_MBCICHWRCL_MASK) == 0)
57 return MAX14577_REGULATOR_CURRENT_LIMIT_MIN; 96 return limits->min;
58 97
59 reg_data = ((reg_data & CHGCTRL4_MBCICHWRCH_MASK) >> 98 reg_data = ((reg_data & CHGCTRL4_MBCICHWRCH_MASK) >>
60 CHGCTRL4_MBCICHWRCH_SHIFT); 99 CHGCTRL4_MBCICHWRCH_SHIFT);
61 return MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START + 100 return limits->high_start + reg_data * limits->high_step;
62 reg_data * MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP;
63} 101}
64 102
65static int max14577_reg_set_current_limit(struct regulator_dev *rdev, 103static int max14577_reg_set_current_limit(struct regulator_dev *rdev,
@@ -67,33 +105,39 @@ static int max14577_reg_set_current_limit(struct regulator_dev *rdev,
67{ 105{
68 int i, current_bits = 0xf; 106 int i, current_bits = 0xf;
69 u8 reg_data; 107 u8 reg_data;
108 struct max14577 *max14577 = rdev_get_drvdata(rdev);
109 const struct maxim_charger_current *limits =
110 &maxim_charger_currents[max14577->dev_type];
70 111
71 if (rdev_get_id(rdev) != MAX14577_CHARGER) 112 if (rdev_get_id(rdev) != MAX14577_CHARGER)
72 return -EINVAL; 113 return -EINVAL;
73 114
74 if (min_uA > MAX14577_REGULATOR_CURRENT_LIMIT_MAX || 115 if (min_uA > limits->max || max_uA < limits->min)
75 max_uA < MAX14577_REGULATOR_CURRENT_LIMIT_MIN)
76 return -EINVAL; 116 return -EINVAL;
77 117
78 if (max_uA < MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START) { 118 if (max_uA < limits->high_start) {
79 /* Less than 200 mA, so set 90mA (turn only Low Bit off) */ 119 /*
120 * Less than high_start,
121 * so set the minimal current (turn only Low Bit off)
122 */
80 u8 reg_data = 0x0 << CHGCTRL4_MBCICHWRCL_SHIFT; 123 u8 reg_data = 0x0 << CHGCTRL4_MBCICHWRCL_SHIFT;
81 return max14577_update_reg(rdev->regmap, 124 return max14577_update_reg(rdev->regmap,
82 MAX14577_CHG_REG_CHG_CTRL4, 125 MAX14577_CHG_REG_CHG_CTRL4,
83 CHGCTRL4_MBCICHWRCL_MASK, reg_data); 126 CHGCTRL4_MBCICHWRCL_MASK, reg_data);
84 } 127 }
85 128
86 /* max_uA is in range: <LIMIT_HIGH_START, inifinite>, so search for 129 /*
87 * valid current starting from LIMIT_MAX. */ 130 * max_uA is in range: <high_start, inifinite>, so search for
88 for (i = MAX14577_REGULATOR_CURRENT_LIMIT_MAX; 131 * valid current starting from maximum current.
89 i >= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START; 132 */
90 i -= MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP) { 133 for (i = limits->max; i >= limits->high_start; i -= limits->high_step) {
91 if (i <= max_uA) 134 if (i <= max_uA)
92 break; 135 break;
93 current_bits--; 136 current_bits--;
94 } 137 }
95 BUG_ON(current_bits < 0); /* Cannot happen */ 138 BUG_ON(current_bits < 0); /* Cannot happen */
96 /* Turn Low Bit on (use range 200mA-950 mA) */ 139
140 /* Turn Low Bit on (use range high_start-max)... */
97 reg_data = 0x1 << CHGCTRL4_MBCICHWRCL_SHIFT; 141 reg_data = 0x1 << CHGCTRL4_MBCICHWRCL_SHIFT;
98 /* and set proper High Bits */ 142 /* and set proper High Bits */
99 reg_data |= current_bits << CHGCTRL4_MBCICHWRCH_SHIFT; 143 reg_data |= current_bits << CHGCTRL4_MBCICHWRCH_SHIFT;
@@ -118,7 +162,7 @@ static struct regulator_ops max14577_charger_ops = {
118 .set_current_limit = max14577_reg_set_current_limit, 162 .set_current_limit = max14577_reg_set_current_limit,
119}; 163};
120 164
121static const struct regulator_desc supported_regulators[] = { 165static const struct regulator_desc max14577_supported_regulators[] = {
122 [MAX14577_SAFEOUT] = { 166 [MAX14577_SAFEOUT] = {
123 .name = "SAFEOUT", 167 .name = "SAFEOUT",
124 .id = MAX14577_SAFEOUT, 168 .id = MAX14577_SAFEOUT,
@@ -141,16 +185,88 @@ static const struct regulator_desc supported_regulators[] = {
141 }, 185 },
142}; 186};
143 187
188static struct regulator_ops max77836_ldo_ops = {
189 .is_enabled = regulator_is_enabled_regmap,
190 .enable = regulator_enable_regmap,
191 .disable = regulator_disable_regmap,
192 .list_voltage = regulator_list_voltage_linear,
193 .map_voltage = regulator_map_voltage_linear,
194 .get_voltage_sel = regulator_get_voltage_sel_regmap,
195 .set_voltage_sel = regulator_set_voltage_sel_regmap,
196 /* TODO: add .set_suspend_mode */
197};
198
199static const struct regulator_desc max77836_supported_regulators[] = {
200 [MAX14577_SAFEOUT] = {
201 .name = "SAFEOUT",
202 .id = MAX14577_SAFEOUT,
203 .ops = &max14577_safeout_ops,
204 .type = REGULATOR_VOLTAGE,
205 .owner = THIS_MODULE,
206 .n_voltages = 1,
207 .min_uV = MAX14577_REGULATOR_SAFEOUT_VOLTAGE,
208 .enable_reg = MAX14577_REG_CONTROL2,
209 .enable_mask = CTRL2_SFOUTORD_MASK,
210 },
211 [MAX14577_CHARGER] = {
212 .name = "CHARGER",
213 .id = MAX14577_CHARGER,
214 .ops = &max14577_charger_ops,
215 .type = REGULATOR_CURRENT,
216 .owner = THIS_MODULE,
217 .enable_reg = MAX14577_CHG_REG_CHG_CTRL2,
218 .enable_mask = CHGCTRL2_MBCHOSTEN_MASK,
219 },
220 [MAX77836_LDO1] = {
221 .name = "LDO1",
222 .id = MAX77836_LDO1,
223 .ops = &max77836_ldo_ops,
224 .type = REGULATOR_VOLTAGE,
225 .owner = THIS_MODULE,
226 .n_voltages = MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM,
227 .min_uV = MAX77836_REGULATOR_LDO_VOLTAGE_MIN,
228 .uV_step = MAX77836_REGULATOR_LDO_VOLTAGE_STEP,
229 .enable_reg = MAX77836_LDO_REG_CNFG1_LDO1,
230 .enable_mask = MAX77836_CNFG1_LDO_PWRMD_MASK,
231 .vsel_reg = MAX77836_LDO_REG_CNFG1_LDO1,
232 .vsel_mask = MAX77836_CNFG1_LDO_TV_MASK,
233 },
234 [MAX77836_LDO2] = {
235 .name = "LDO2",
236 .id = MAX77836_LDO2,
237 .ops = &max77836_ldo_ops,
238 .type = REGULATOR_VOLTAGE,
239 .owner = THIS_MODULE,
240 .n_voltages = MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM,
241 .min_uV = MAX77836_REGULATOR_LDO_VOLTAGE_MIN,
242 .uV_step = MAX77836_REGULATOR_LDO_VOLTAGE_STEP,
243 .enable_reg = MAX77836_LDO_REG_CNFG1_LDO2,
244 .enable_mask = MAX77836_CNFG1_LDO_PWRMD_MASK,
245 .vsel_reg = MAX77836_LDO_REG_CNFG1_LDO2,
246 .vsel_mask = MAX77836_CNFG1_LDO_TV_MASK,
247 },
248};
249
144#ifdef CONFIG_OF 250#ifdef CONFIG_OF
145static struct of_regulator_match max14577_regulator_matches[] = { 251static struct of_regulator_match max14577_regulator_matches[] = {
146 { .name = "SAFEOUT", }, 252 { .name = "SAFEOUT", },
147 { .name = "CHARGER", }, 253 { .name = "CHARGER", },
148}; 254};
149 255
150static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev) 256static struct of_regulator_match max77836_regulator_matches[] = {
257 { .name = "SAFEOUT", },
258 { .name = "CHARGER", },
259 { .name = "LDO1", },
260 { .name = "LDO2", },
261};
262
263static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
264 enum maxim_device_type dev_type)
151{ 265{
152 int ret; 266 int ret;
153 struct device_node *np; 267 struct device_node *np;
268 struct of_regulator_match *regulator_matches;
269 unsigned int regulator_matches_size;
154 270
155 np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators"); 271 np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
156 if (!np) { 272 if (!np) {
@@ -158,8 +274,19 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
158 return -EINVAL; 274 return -EINVAL;
159 } 275 }
160 276
161 ret = of_regulator_match(&pdev->dev, np, max14577_regulator_matches, 277 switch (dev_type) {
162 MAX14577_REG_MAX); 278 case MAXIM_DEVICE_TYPE_MAX77836:
279 regulator_matches = max77836_regulator_matches;
280 regulator_matches_size = ARRAY_SIZE(max77836_regulator_matches);
281 break;
282 case MAXIM_DEVICE_TYPE_MAX14577:
283 default:
284 regulator_matches = max14577_regulator_matches;
285 regulator_matches_size = ARRAY_SIZE(max14577_regulator_matches);
286 }
287
288 ret = of_regulator_match(&pdev->dev, np, regulator_matches,
289 regulator_matches_size);
163 if (ret < 0) 290 if (ret < 0)
164 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret); 291 dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", ret);
165 else 292 else
@@ -170,31 +297,74 @@ static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev)
170 return ret; 297 return ret;
171} 298}
172 299
173static inline struct regulator_init_data *match_init_data(int index) 300static inline struct regulator_init_data *match_init_data(int index,
301 enum maxim_device_type dev_type)
174{ 302{
175 return max14577_regulator_matches[index].init_data; 303 switch (dev_type) {
304 case MAXIM_DEVICE_TYPE_MAX77836:
305 return max77836_regulator_matches[index].init_data;
306
307 case MAXIM_DEVICE_TYPE_MAX14577:
308 default:
309 return max14577_regulator_matches[index].init_data;
310 }
176} 311}
177 312
178static inline struct device_node *match_of_node(int index) 313static inline struct device_node *match_of_node(int index,
314 enum maxim_device_type dev_type)
179{ 315{
180 return max14577_regulator_matches[index].of_node; 316 switch (dev_type) {
317 case MAXIM_DEVICE_TYPE_MAX77836:
318 return max77836_regulator_matches[index].of_node;
319
320 case MAXIM_DEVICE_TYPE_MAX14577:
321 default:
322 return max14577_regulator_matches[index].of_node;
323 }
181} 324}
182#else /* CONFIG_OF */ 325#else /* CONFIG_OF */
183static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev) 326static int max14577_regulator_dt_parse_pdata(struct platform_device *pdev,
327 enum maxim_device_type dev_type)
184{ 328{
185 return 0; 329 return 0;
186} 330}
187static inline struct regulator_init_data *match_init_data(int index) 331static inline struct regulator_init_data *match_init_data(int index,
332 enum maxim_device_type dev_type)
188{ 333{
189 return NULL; 334 return NULL;
190} 335}
191 336
192static inline struct device_node *match_of_node(int index) 337static inline struct device_node *match_of_node(int index,
338 enum maxim_device_type dev_type)
193{ 339{
194 return NULL; 340 return NULL;
195} 341}
196#endif /* CONFIG_OF */ 342#endif /* CONFIG_OF */
197 343
344/**
345 * Registers for regulators of max77836 use different I2C slave addresses so
346 * different regmaps must be used for them.
347 *
348 * Returns proper regmap for accessing regulator passed by id.
349 */
350static struct regmap *max14577_get_regmap(struct max14577 *max14577,
351 int reg_id)
352{
353 switch (max14577->dev_type) {
354 case MAXIM_DEVICE_TYPE_MAX77836:
355 switch (reg_id) {
356 case MAX77836_SAFEOUT ... MAX77836_CHARGER:
357 return max14577->regmap;
358 default:
359 /* MAX77836_LDO1 ... MAX77836_LDO2 */
360 return max14577->regmap_pmic;
361 }
362
363 case MAXIM_DEVICE_TYPE_MAX14577:
364 default:
365 return max14577->regmap;
366 }
367}
198 368
199static int max14577_regulator_probe(struct platform_device *pdev) 369static int max14577_regulator_probe(struct platform_device *pdev)
200{ 370{
@@ -202,15 +372,29 @@ static int max14577_regulator_probe(struct platform_device *pdev)
202 struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev); 372 struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev);
203 int i, ret; 373 int i, ret;
204 struct regulator_config config = {}; 374 struct regulator_config config = {};
375 const struct regulator_desc *supported_regulators;
376 unsigned int supported_regulators_size;
377 enum maxim_device_type dev_type = max14577->dev_type;
205 378
206 ret = max14577_regulator_dt_parse_pdata(pdev); 379 ret = max14577_regulator_dt_parse_pdata(pdev, dev_type);
207 if (ret) 380 if (ret)
208 return ret; 381 return ret;
209 382
383 switch (dev_type) {
384 case MAXIM_DEVICE_TYPE_MAX77836:
385 supported_regulators = max77836_supported_regulators;
386 supported_regulators_size = ARRAY_SIZE(max77836_supported_regulators);
387 break;
388 case MAXIM_DEVICE_TYPE_MAX14577:
389 default:
390 supported_regulators = max14577_supported_regulators;
391 supported_regulators_size = ARRAY_SIZE(max14577_supported_regulators);
392 }
393
210 config.dev = &pdev->dev; 394 config.dev = &pdev->dev;
211 config.regmap = max14577->regmap; 395 config.driver_data = max14577;
212 396
213 for (i = 0; i < ARRAY_SIZE(supported_regulators); i++) { 397 for (i = 0; i < supported_regulators_size; i++) {
214 struct regulator_dev *regulator; 398 struct regulator_dev *regulator;
215 /* 399 /*
216 * Index of supported_regulators[] is also the id and must 400 * Index of supported_regulators[] is also the id and must
@@ -220,17 +404,19 @@ static int max14577_regulator_probe(struct platform_device *pdev)
220 config.init_data = pdata->regulators[i].initdata; 404 config.init_data = pdata->regulators[i].initdata;
221 config.of_node = pdata->regulators[i].of_node; 405 config.of_node = pdata->regulators[i].of_node;
222 } else { 406 } else {
223 config.init_data = match_init_data(i); 407 config.init_data = match_init_data(i, dev_type);
224 config.of_node = match_of_node(i); 408 config.of_node = match_of_node(i, dev_type);
225 } 409 }
410 config.regmap = max14577_get_regmap(max14577,
411 supported_regulators[i].id);
226 412
227 regulator = devm_regulator_register(&pdev->dev, 413 regulator = devm_regulator_register(&pdev->dev,
228 &supported_regulators[i], &config); 414 &supported_regulators[i], &config);
229 if (IS_ERR(regulator)) { 415 if (IS_ERR(regulator)) {
230 ret = PTR_ERR(regulator); 416 ret = PTR_ERR(regulator);
231 dev_err(&pdev->dev, 417 dev_err(&pdev->dev,
232 "Regulator init failed for ID %d with error: %d\n", 418 "Regulator init failed for %d/%s with error: %d\n",
233 i, ret); 419 i, supported_regulators[i].name, ret);
234 return ret; 420 return ret;
235 } 421 }
236 } 422 }
@@ -238,20 +424,41 @@ static int max14577_regulator_probe(struct platform_device *pdev)
238 return ret; 424 return ret;
239} 425}
240 426
427static const struct platform_device_id max14577_regulator_id[] = {
428 { "max14577-regulator", MAXIM_DEVICE_TYPE_MAX14577, },
429 { "max77836-regulator", MAXIM_DEVICE_TYPE_MAX77836, },
430 { }
431};
432MODULE_DEVICE_TABLE(platform, max14577_regulator_id);
433
241static struct platform_driver max14577_regulator_driver = { 434static struct platform_driver max14577_regulator_driver = {
242 .driver = { 435 .driver = {
243 .owner = THIS_MODULE, 436 .owner = THIS_MODULE,
244 .name = "max14577-regulator", 437 .name = "max14577-regulator",
245 }, 438 },
246 .probe = max14577_regulator_probe, 439 .probe = max14577_regulator_probe,
440 .id_table = max14577_regulator_id,
247}; 441};
248 442
249static int __init max14577_regulator_init(void) 443static int __init max14577_regulator_init(void)
250{ 444{
445 /* Check for valid values for charger */
251 BUILD_BUG_ON(MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START + 446 BUILD_BUG_ON(MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_START +
252 MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP * 0xf != 447 MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP * 0xf !=
253 MAX14577_REGULATOR_CURRENT_LIMIT_MAX); 448 MAX14577_REGULATOR_CURRENT_LIMIT_MAX);
254 BUILD_BUG_ON(ARRAY_SIZE(supported_regulators) != MAX14577_REG_MAX); 449 BUILD_BUG_ON(MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START +
450 MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP * 0xf !=
451 MAX77836_REGULATOR_CURRENT_LIMIT_MAX);
452 /* Valid charger current values must be provided for each chipset */
453 BUILD_BUG_ON(ARRAY_SIZE(maxim_charger_currents) != MAXIM_DEVICE_TYPE_NUM);
454
455 BUILD_BUG_ON(ARRAY_SIZE(max14577_supported_regulators) != MAX14577_REGULATOR_NUM);
456 BUILD_BUG_ON(ARRAY_SIZE(max77836_supported_regulators) != MAX77836_REGULATOR_NUM);
457
458 BUILD_BUG_ON(MAX77836_REGULATOR_LDO_VOLTAGE_MIN +
459 (MAX77836_REGULATOR_LDO_VOLTAGE_STEP *
460 (MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM - 1)) !=
461 MAX77836_REGULATOR_LDO_VOLTAGE_MAX);
255 462
256 return platform_driver_register(&max14577_regulator_driver); 463 return platform_driver_register(&max14577_regulator_driver);
257} 464}
@@ -264,6 +471,6 @@ static void __exit max14577_regulator_exit(void)
264module_exit(max14577_regulator_exit); 471module_exit(max14577_regulator_exit);
265 472
266MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>"); 473MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>");
267MODULE_DESCRIPTION("MAXIM 14577 regulator driver"); 474MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver");
268MODULE_LICENSE("GPL"); 475MODULE_LICENSE("GPL");
269MODULE_ALIAS("platform:max14577-regulator"); 476MODULE_ALIAS("platform:max14577-regulator");
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index ded3b3574209..6d38be3d970c 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -38,66 +38,24 @@ struct pbias_reg_info {
38struct pbias_regulator_data { 38struct pbias_regulator_data {
39 struct regulator_desc desc; 39 struct regulator_desc desc;
40 void __iomem *pbias_addr; 40 void __iomem *pbias_addr;
41 unsigned int pbias_reg;
42 struct regulator_dev *dev; 41 struct regulator_dev *dev;
43 struct regmap *syscon; 42 struct regmap *syscon;
44 const struct pbias_reg_info *info; 43 const struct pbias_reg_info *info;
45 int voltage; 44 int voltage;
46}; 45};
47 46
48static int pbias_regulator_set_voltage(struct regulator_dev *dev, 47static const unsigned int pbias_volt_table[] = {
49 int min_uV, int max_uV, unsigned *selector) 48 1800000,
50{ 49 3000000
51 struct pbias_regulator_data *data = rdev_get_drvdata(dev); 50};
52 const struct pbias_reg_info *info = data->info;
53 int ret, vmode;
54
55 if (min_uV <= 1800000)
56 vmode = 0;
57 else if (min_uV > 1800000)
58 vmode = info->vmode;
59
60 ret = regmap_update_bits(data->syscon, data->pbias_reg,
61 info->vmode, vmode);
62
63 return ret;
64}
65
66static int pbias_regulator_get_voltage(struct regulator_dev *rdev)
67{
68 struct pbias_regulator_data *data = rdev_get_drvdata(rdev);
69 const struct pbias_reg_info *info = data->info;
70 int value, voltage;
71
72 regmap_read(data->syscon, data->pbias_reg, &value);
73 value &= info->vmode;
74
75 voltage = value ? 3000000 : 1800000;
76
77 return voltage;
78}
79 51
80static int pbias_regulator_enable(struct regulator_dev *rdev) 52static int pbias_regulator_enable(struct regulator_dev *rdev)
81{ 53{
82 struct pbias_regulator_data *data = rdev_get_drvdata(rdev); 54 struct pbias_regulator_data *data = rdev_get_drvdata(rdev);
83 const struct pbias_reg_info *info = data->info; 55 const struct pbias_reg_info *info = data->info;
84 int ret;
85
86 ret = regmap_update_bits(data->syscon, data->pbias_reg,
87 info->enable_mask, info->enable);
88
89 return ret;
90}
91
92static int pbias_regulator_disable(struct regulator_dev *rdev)
93{
94 struct pbias_regulator_data *data = rdev_get_drvdata(rdev);
95 const struct pbias_reg_info *info = data->info;
96 int ret;
97 56
98 ret = regmap_update_bits(data->syscon, data->pbias_reg, 57 return regmap_update_bits(data->syscon, rdev->desc->enable_reg,
99 info->enable_mask, 0); 58 info->enable_mask, info->enable);
100 return ret;
101} 59}
102 60
103static int pbias_regulator_is_enable(struct regulator_dev *rdev) 61static int pbias_regulator_is_enable(struct regulator_dev *rdev)
@@ -106,17 +64,18 @@ static int pbias_regulator_is_enable(struct regulator_dev *rdev)
106 const struct pbias_reg_info *info = data->info; 64 const struct pbias_reg_info *info = data->info;
107 int value; 65 int value;
108 66
109 regmap_read(data->syscon, data->pbias_reg, &value); 67 regmap_read(data->syscon, rdev->desc->enable_reg, &value);
110 68
111 return (value & info->enable_mask) == info->enable_mask; 69 return (value & info->enable_mask) == info->enable;
112} 70}
113 71
114static struct regulator_ops pbias_regulator_voltage_ops = { 72static struct regulator_ops pbias_regulator_voltage_ops = {
115 .set_voltage = pbias_regulator_set_voltage, 73 .list_voltage = regulator_list_voltage_table,
116 .get_voltage = pbias_regulator_get_voltage, 74 .get_voltage_sel = regulator_get_voltage_sel_regmap,
117 .enable = pbias_regulator_enable, 75 .set_voltage_sel = regulator_set_voltage_sel_regmap,
118 .disable = pbias_regulator_disable, 76 .enable = pbias_regulator_enable,
119 .is_enabled = pbias_regulator_is_enable, 77 .disable = regulator_disable_regmap,
78 .is_enabled = pbias_regulator_is_enable,
120}; 79};
121 80
122static const struct pbias_reg_info pbias_mmc_omap2430 = { 81static const struct pbias_reg_info pbias_mmc_omap2430 = {
@@ -192,6 +151,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)
192 if (IS_ERR(syscon)) 151 if (IS_ERR(syscon))
193 return PTR_ERR(syscon); 152 return PTR_ERR(syscon);
194 153
154 cfg.regmap = syscon;
195 cfg.dev = &pdev->dev; 155 cfg.dev = &pdev->dev;
196 156
197 for (idx = 0; idx < PBIAS_NUM_REGS && data_idx < count; idx++) { 157 for (idx = 0; idx < PBIAS_NUM_REGS && data_idx < count; idx++) {
@@ -207,15 +167,19 @@ static int pbias_regulator_probe(struct platform_device *pdev)
207 if (!res) 167 if (!res)
208 return -EINVAL; 168 return -EINVAL;
209 169
210 drvdata[data_idx].pbias_reg = res->start;
211 drvdata[data_idx].syscon = syscon; 170 drvdata[data_idx].syscon = syscon;
212 drvdata[data_idx].info = info; 171 drvdata[data_idx].info = info;
213 drvdata[data_idx].desc.name = info->name; 172 drvdata[data_idx].desc.name = info->name;
214 drvdata[data_idx].desc.owner = THIS_MODULE; 173 drvdata[data_idx].desc.owner = THIS_MODULE;
215 drvdata[data_idx].desc.type = REGULATOR_VOLTAGE; 174 drvdata[data_idx].desc.type = REGULATOR_VOLTAGE;
216 drvdata[data_idx].desc.ops = &pbias_regulator_voltage_ops; 175 drvdata[data_idx].desc.ops = &pbias_regulator_voltage_ops;
176 drvdata[data_idx].desc.volt_table = pbias_volt_table;
217 drvdata[data_idx].desc.n_voltages = 2; 177 drvdata[data_idx].desc.n_voltages = 2;
218 drvdata[data_idx].desc.enable_time = info->enable_time; 178 drvdata[data_idx].desc.enable_time = info->enable_time;
179 drvdata[data_idx].desc.vsel_reg = res->start;
180 drvdata[data_idx].desc.vsel_mask = info->vmode;
181 drvdata[data_idx].desc.enable_reg = res->start;
182 drvdata[data_idx].desc.enable_mask = info->enable_mask;
219 183
220 cfg.init_data = pbias_matches[idx].init_data; 184 cfg.init_data = pbias_matches[idx].init_data;
221 cfg.driver_data = &drvdata[data_idx]; 185 cfg.driver_data = &drvdata[data_idx];
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 32f38a63d944..e045b7fe5572 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -68,7 +68,7 @@ static inline struct device *to_tps6586x_dev(struct regulator_dev *rdev)
68 return rdev_get_dev(rdev)->parent; 68 return rdev_get_dev(rdev)->parent;
69} 69}
70 70
71static struct regulator_ops tps6586x_regulator_ops = { 71static struct regulator_ops tps6586x_rw_regulator_ops = {
72 .list_voltage = regulator_list_voltage_table, 72 .list_voltage = regulator_list_voltage_table,
73 .map_voltage = regulator_map_voltage_ascend, 73 .map_voltage = regulator_map_voltage_ascend,
74 .get_voltage_sel = regulator_get_voltage_sel_regmap, 74 .get_voltage_sel = regulator_get_voltage_sel_regmap,
@@ -79,6 +79,16 @@ static struct regulator_ops tps6586x_regulator_ops = {
79 .disable = regulator_disable_regmap, 79 .disable = regulator_disable_regmap,
80}; 80};
81 81
82static struct regulator_ops tps6586x_ro_regulator_ops = {
83 .list_voltage = regulator_list_voltage_table,
84 .map_voltage = regulator_map_voltage_ascend,
85 .get_voltage_sel = regulator_get_voltage_sel_regmap,
86
87 .is_enabled = regulator_is_enabled_regmap,
88 .enable = regulator_enable_regmap,
89 .disable = regulator_disable_regmap,
90};
91
82static struct regulator_ops tps6586x_sys_regulator_ops = { 92static struct regulator_ops tps6586x_sys_regulator_ops = {
83}; 93};
84 94
@@ -106,6 +116,13 @@ static const unsigned int tps6586x_sm2_voltages[] = {
106 4200000, 4250000, 4300000, 4350000, 4400000, 4450000, 4500000, 4550000, 116 4200000, 4250000, 4300000, 4350000, 4400000, 4450000, 4500000, 4550000,
107}; 117};
108 118
119static int tps658640_sm2_voltages[] = {
120 2150000, 2200000, 2250000, 2300000, 2350000, 2400000, 2450000, 2500000,
121 2550000, 2600000, 2650000, 2700000, 2750000, 2800000, 2850000, 2900000,
122 2950000, 3000000, 3050000, 3100000, 3150000, 3200000, 3250000, 3300000,
123 3350000, 3400000, 3450000, 3500000, 3550000, 3600000, 3650000, 3700000,
124};
125
109static const unsigned int tps658643_sm2_voltages[] = { 126static const unsigned int tps658643_sm2_voltages[] = {
110 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 127 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000,
111 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000, 128 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000,
@@ -120,12 +137,16 @@ static const unsigned int tps6586x_dvm_voltages[] = {
120 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000, 137 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000,
121}; 138};
122 139
123#define TPS6586X_REGULATOR(_id, _pin_name, vdata, vreg, shift, nbits, \ 140static int tps658640_rtc_voltages[] = {
141 2500000, 2850000, 3100000, 3300000,
142};
143
144#define TPS6586X_REGULATOR(_id, _ops, _pin_name, vdata, vreg, shift, nbits, \
124 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ 145 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
125 .desc = { \ 146 .desc = { \
126 .supply_name = _pin_name, \ 147 .supply_name = _pin_name, \
127 .name = "REG-" #_id, \ 148 .name = "REG-" #_id, \
128 .ops = &tps6586x_regulator_ops, \ 149 .ops = &tps6586x_## _ops ## _regulator_ops, \
129 .type = REGULATOR_VOLTAGE, \ 150 .type = REGULATOR_VOLTAGE, \
130 .id = TPS6586X_ID_##_id, \ 151 .id = TPS6586X_ID_##_id, \
131 .n_voltages = ARRAY_SIZE(vdata##_voltages), \ 152 .n_voltages = ARRAY_SIZE(vdata##_voltages), \
@@ -146,14 +167,21 @@ static const unsigned int tps6586x_dvm_voltages[] = {
146#define TPS6586X_LDO(_id, _pname, vdata, vreg, shift, nbits, \ 167#define TPS6586X_LDO(_id, _pname, vdata, vreg, shift, nbits, \
147 ereg0, ebit0, ereg1, ebit1) \ 168 ereg0, ebit0, ereg1, ebit1) \
148{ \ 169{ \
149 TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \ 170 TPS6586X_REGULATOR(_id, rw, _pname, vdata, vreg, shift, nbits, \
171 ereg0, ebit0, ereg1, ebit1, 0, 0) \
172}
173
174#define TPS6586X_FIXED_LDO(_id, _pname, vdata, vreg, shift, nbits, \
175 ereg0, ebit0, ereg1, ebit1) \
176{ \
177 TPS6586X_REGULATOR(_id, ro, _pname, vdata, vreg, shift, nbits, \
150 ereg0, ebit0, ereg1, ebit1, 0, 0) \ 178 ereg0, ebit0, ereg1, ebit1, 0, 0) \
151} 179}
152 180
153#define TPS6586X_DVM(_id, _pname, vdata, vreg, shift, nbits, \ 181#define TPS6586X_DVM(_id, _pname, vdata, vreg, shift, nbits, \
154 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ 182 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
155{ \ 183{ \
156 TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \ 184 TPS6586X_REGULATOR(_id, rw, _pname, vdata, vreg, shift, nbits, \
157 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ 185 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
158} 186}
159 187
@@ -207,6 +235,26 @@ static struct tps6586x_regulator tps658623_regulator[] = {
207 END, 7), 235 END, 7),
208}; 236};
209 237
238static struct tps6586x_regulator tps658640_regulator[] = {
239 TPS6586X_LDO(LDO_3, "vinldo23", tps6586x_ldo0, SUPPLYV4, 0, 3,
240 ENC, 2, END, 2),
241 TPS6586X_LDO(LDO_5, "REG-SYS", tps6586x_ldo0, SUPPLYV6, 0, 3,
242 ENE, 6, ENE, 6),
243 TPS6586X_LDO(LDO_6, "vinldo678", tps6586x_ldo0, SUPPLYV3, 0, 3,
244 ENC, 4, END, 4),
245 TPS6586X_LDO(LDO_7, "vinldo678", tps6586x_ldo0, SUPPLYV3, 3, 3,
246 ENC, 5, END, 5),
247 TPS6586X_LDO(LDO_8, "vinldo678", tps6586x_ldo0, SUPPLYV2, 5, 3,
248 ENC, 6, END, 6),
249 TPS6586X_LDO(LDO_9, "vinldo9", tps6586x_ldo0, SUPPLYV6, 3, 3,
250 ENE, 7, ENE, 7),
251 TPS6586X_LDO(SM_2, "vin-sm2", tps658640_sm2, SUPPLYV2, 0, 5,
252 ENC, 7, END, 7),
253
254 TPS6586X_FIXED_LDO(LDO_RTC, "REG-SYS", tps658640_rtc, SUPPLYV4, 3, 2,
255 V4, 7, V4, 7),
256};
257
210static struct tps6586x_regulator tps658643_regulator[] = { 258static struct tps6586x_regulator tps658643_regulator[] = {
211 TPS6586X_LDO(SM_2, "vin-sm2", tps658643_sm2, SUPPLYV2, 0, 5, ENC, 7, 259 TPS6586X_LDO(SM_2, "vin-sm2", tps658643_sm2, SUPPLYV2, 0, 5, ENC, 7,
212 END, 7), 260 END, 7),
@@ -295,6 +343,11 @@ static struct tps6586x_regulator *find_regulator_info(int id, int version)
295 table = tps658623_regulator; 343 table = tps658623_regulator;
296 num = ARRAY_SIZE(tps658623_regulator); 344 num = ARRAY_SIZE(tps658623_regulator);
297 break; 345 break;
346 case TPS658640:
347 case TPS658640v2:
348 table = tps658640_regulator;
349 num = ARRAY_SIZE(tps658640_regulator);
350 break;
298 case TPS658643: 351 case TPS658643:
299 table = tps658643_regulator; 352 table = tps658643_regulator;
300 num = ARRAY_SIZE(tps658643_regulator); 353 num = ARRAY_SIZE(tps658643_regulator);