blob: 19d75848655311c4afb7d343a5ce5b1242610627 [file] [log] [blame]
Kim, Miloaf8b5fc2012-06-19 07:08:22 +00001/*
2 * Copyright 2012 Texas Instruments
3 *
4 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/slab.h>
14#include <linux/i2c.h>
15#include <linux/regmap.h>
16#include <linux/err.h>
17#include <linux/gpio.h>
18#include <linux/regulator/lp872x.h>
19#include <linux/regulator/driver.h>
20#include <linux/platform_device.h>
Kim, Milo00fd6e62013-05-20 12:36:07 +000021#include <linux/of.h>
22#include <linux/of_gpio.h>
23#include <linux/regulator/of_regulator.h>
Kim, Miloaf8b5fc2012-06-19 07:08:22 +000024
25/* Registers : LP8720/8725 shared */
26#define LP872X_GENERAL_CFG 0x00
27#define LP872X_LDO1_VOUT 0x01
28#define LP872X_LDO2_VOUT 0x02
29#define LP872X_LDO3_VOUT 0x03
30#define LP872X_LDO4_VOUT 0x04
31#define LP872X_LDO5_VOUT 0x05
32
33/* Registers : LP8720 */
34#define LP8720_BUCK_VOUT1 0x06
35#define LP8720_BUCK_VOUT2 0x07
36#define LP8720_ENABLE 0x08
37
38/* Registers : LP8725 */
39#define LP8725_LILO1_VOUT 0x06
40#define LP8725_LILO2_VOUT 0x07
41#define LP8725_BUCK1_VOUT1 0x08
42#define LP8725_BUCK1_VOUT2 0x09
43#define LP8725_BUCK2_VOUT1 0x0A
44#define LP8725_BUCK2_VOUT2 0x0B
45#define LP8725_BUCK_CTRL 0x0C
46#define LP8725_LDO_CTRL 0x0D
47
48/* Mask/shift : LP8720/LP8725 shared */
49#define LP872X_VOUT_M 0x1F
50#define LP872X_START_DELAY_M 0xE0
51#define LP872X_START_DELAY_S 5
52#define LP872X_EN_LDO1_M BIT(0)
53#define LP872X_EN_LDO2_M BIT(1)
54#define LP872X_EN_LDO3_M BIT(2)
55#define LP872X_EN_LDO4_M BIT(3)
56#define LP872X_EN_LDO5_M BIT(4)
57
58/* Mask/shift : LP8720 */
59#define LP8720_TIMESTEP_S 0 /* Addr 00h */
60#define LP8720_TIMESTEP_M BIT(0)
61#define LP8720_EXT_DVS_M BIT(2)
62#define LP8720_BUCK_FPWM_S 5 /* Addr 07h */
63#define LP8720_BUCK_FPWM_M BIT(5)
64#define LP8720_EN_BUCK_M BIT(5) /* Addr 08h */
65#define LP8720_DVS_SEL_M BIT(7)
66
67/* Mask/shift : LP8725 */
68#define LP8725_TIMESTEP_M 0xC0 /* Addr 00h */
69#define LP8725_TIMESTEP_S 6
70#define LP8725_BUCK1_EN_M BIT(0)
71#define LP8725_DVS1_M BIT(2)
72#define LP8725_DVS2_M BIT(3)
73#define LP8725_BUCK2_EN_M BIT(4)
74#define LP8725_BUCK_CL_M 0xC0 /* Addr 09h, 0Bh */
75#define LP8725_BUCK_CL_S 6
76#define LP8725_BUCK1_FPWM_S 1 /* Addr 0Ch */
77#define LP8725_BUCK1_FPWM_M BIT(1)
78#define LP8725_BUCK2_FPWM_S 5
79#define LP8725_BUCK2_FPWM_M BIT(5)
80#define LP8725_EN_LILO1_M BIT(5) /* Addr 0Dh */
81#define LP8725_EN_LILO2_M BIT(6)
82
83/* PWM mode */
84#define LP872X_FORCE_PWM 1
85#define LP872X_AUTO_PWM 0
86
87#define LP8720_NUM_REGULATORS 6
88#define LP8725_NUM_REGULATORS 9
89#define EXTERN_DVS_USED 0
90#define MAX_DELAY 6
91
Kim, Milob158fba2012-09-05 04:39:16 +000092/* Default DVS Mode */
93#define LP8720_DEFAULT_DVS 0
94#define LP8725_DEFAULT_DVS BIT(2)
95
Kim, Miloaf8b5fc2012-06-19 07:08:22 +000096/* dump registers in regmap-debugfs */
97#define MAX_REGISTERS 0x0F
98
99enum lp872x_id {
100 LP8720,
101 LP8725,
102};
103
104struct lp872x {
105 struct regmap *regmap;
106 struct device *dev;
107 enum lp872x_id chipid;
108 struct lp872x_platform_data *pdata;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000109 int num_regulators;
110 enum lp872x_dvs_state dvs_pin;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000111};
112
113/* LP8720/LP8725 shared voltage table for LDOs */
114static const unsigned int lp872x_ldo_vtbl[] = {
115 1200000, 1250000, 1300000, 1350000, 1400000, 1450000, 1500000, 1550000,
116 1600000, 1650000, 1700000, 1750000, 1800000, 1850000, 1900000, 2000000,
117 2100000, 2200000, 2300000, 2400000, 2500000, 2600000, 2650000, 2700000,
118 2750000, 2800000, 2850000, 2900000, 2950000, 3000000, 3100000, 3300000,
119};
120
121/* LP8720 LDO4 voltage table */
122static const unsigned int lp8720_ldo4_vtbl[] = {
123 800000, 850000, 900000, 1000000, 1100000, 1200000, 1250000, 1300000,
124 1350000, 1400000, 1450000, 1500000, 1550000, 1600000, 1650000, 1700000,
125 1750000, 1800000, 1850000, 1900000, 2000000, 2100000, 2200000, 2300000,
126 2400000, 2500000, 2600000, 2650000, 2700000, 2750000, 2800000, 2850000,
127};
128
129/* LP8725 LILO(Low Input Low Output) voltage table */
130static const unsigned int lp8725_lilo_vtbl[] = {
131 800000, 850000, 900000, 950000, 1000000, 1050000, 1100000, 1150000,
132 1200000, 1250000, 1300000, 1350000, 1400000, 1500000, 1600000, 1700000,
133 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000,
134 2600000, 2700000, 2800000, 2850000, 2900000, 3000000, 3100000, 3300000,
135};
136
137/* LP8720 BUCK voltage table */
138#define EXT_R 0 /* external resistor divider */
139static const unsigned int lp8720_buck_vtbl[] = {
140 EXT_R, 800000, 850000, 900000, 950000, 1000000, 1050000, 1100000,
141 1150000, 1200000, 1250000, 1300000, 1350000, 1400000, 1450000, 1500000,
142 1550000, 1600000, 1650000, 1700000, 1750000, 1800000, 1850000, 1900000,
143 1950000, 2000000, 2050000, 2100000, 2150000, 2200000, 2250000, 2300000,
144};
145
146/* LP8725 BUCK voltage table */
147static const unsigned int lp8725_buck_vtbl[] = {
148 800000, 850000, 900000, 950000, 1000000, 1050000, 1100000, 1150000,
149 1200000, 1250000, 1300000, 1350000, 1400000, 1500000, 1600000, 1700000,
150 1750000, 1800000, 1850000, 1900000, 2000000, 2100000, 2200000, 2300000,
151 2400000, 2500000, 2600000, 2700000, 2800000, 2850000, 2900000, 3000000,
152};
153
154/* LP8725 BUCK current limit */
155static const unsigned int lp8725_buck_uA[] = {
156 460000, 780000, 1050000, 1370000,
157};
158
159static int lp872x_read_byte(struct lp872x *lp, u8 addr, u8 *data)
160{
161 int ret;
162 unsigned int val;
163
164 ret = regmap_read(lp->regmap, addr, &val);
165 if (ret < 0) {
166 dev_err(lp->dev, "failed to read 0x%.2x\n", addr);
167 return ret;
168 }
169
170 *data = (u8)val;
171 return 0;
172}
173
174static inline int lp872x_write_byte(struct lp872x *lp, u8 addr, u8 data)
175{
176 return regmap_write(lp->regmap, addr, data);
177}
178
179static inline int lp872x_update_bits(struct lp872x *lp, u8 addr,
180 unsigned int mask, u8 data)
181{
182 return regmap_update_bits(lp->regmap, addr, mask, data);
183}
184
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000185static int lp872x_get_timestep_usec(struct lp872x *lp)
186{
187 enum lp872x_id chip = lp->chipid;
188 u8 val, mask, shift;
189 int *time_usec, size, ret;
190 int lp8720_time_usec[] = { 25, 50 };
191 int lp8725_time_usec[] = { 32, 64, 128, 256 };
192
193 switch (chip) {
194 case LP8720:
195 mask = LP8720_TIMESTEP_M;
196 shift = LP8720_TIMESTEP_S;
197 time_usec = &lp8720_time_usec[0];
198 size = ARRAY_SIZE(lp8720_time_usec);
199 break;
200 case LP8725:
201 mask = LP8725_TIMESTEP_M;
202 shift = LP8725_TIMESTEP_S;
203 time_usec = &lp8725_time_usec[0];
204 size = ARRAY_SIZE(lp8725_time_usec);
205 break;
206 default:
207 return -EINVAL;
208 }
209
210 ret = lp872x_read_byte(lp, LP872X_GENERAL_CFG, &val);
211 if (ret)
Sachin Kamatad5ec6c2014-02-18 16:11:02 +0530212 return ret;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000213
214 val = (val & mask) >> shift;
215 if (val >= size)
216 return -EINVAL;
217
218 return *(time_usec + val);
219}
220
221static int lp872x_regulator_enable_time(struct regulator_dev *rdev)
222{
223 struct lp872x *lp = rdev_get_drvdata(rdev);
Axel Lin2c129922012-12-08 09:56:48 +0800224 enum lp872x_regulator_id rid = rdev_get_id(rdev);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000225 int time_step_us = lp872x_get_timestep_usec(lp);
Axel Lin2c129922012-12-08 09:56:48 +0800226 int ret;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000227 u8 addr, val;
228
229 if (time_step_us < 0)
Sachin Kamatad5ec6c2014-02-18 16:11:02 +0530230 return time_step_us;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000231
Axel Lin2c129922012-12-08 09:56:48 +0800232 switch (rid) {
233 case LP8720_ID_LDO1 ... LP8720_ID_BUCK:
234 addr = LP872X_LDO1_VOUT + rid;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000235 break;
Axel Lin2c129922012-12-08 09:56:48 +0800236 case LP8725_ID_LDO1 ... LP8725_ID_BUCK1:
237 addr = LP872X_LDO1_VOUT + rid - LP8725_ID_BASE;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000238 break;
239 case LP8725_ID_BUCK2:
240 addr = LP8725_BUCK2_VOUT1;
241 break;
242 default:
243 return -EINVAL;
244 }
245
246 ret = lp872x_read_byte(lp, addr, &val);
247 if (ret)
248 return ret;
249
250 val = (val & LP872X_START_DELAY_M) >> LP872X_START_DELAY_S;
251
252 return val > MAX_DELAY ? 0 : val * time_step_us;
253}
254
Kim, Milo9d6da6f2012-09-05 04:39:33 +0000255static void lp872x_set_dvs(struct lp872x *lp, enum lp872x_dvs_sel dvs_sel,
256 int gpio)
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000257{
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000258 enum lp872x_dvs_state state;
259
260 state = dvs_sel == SEL_V1 ? DVS_HIGH : DVS_LOW;
261 gpio_set_value(gpio, state);
262 lp->dvs_pin = state;
263}
264
265static u8 lp872x_select_buck_vout_addr(struct lp872x *lp,
266 enum lp872x_regulator_id buck)
267{
268 u8 val, addr;
269
270 if (lp872x_read_byte(lp, LP872X_GENERAL_CFG, &val))
271 return 0;
272
273 switch (buck) {
274 case LP8720_ID_BUCK:
275 if (val & LP8720_EXT_DVS_M) {
276 addr = (lp->dvs_pin == DVS_HIGH) ?
277 LP8720_BUCK_VOUT1 : LP8720_BUCK_VOUT2;
278 } else {
279 if (lp872x_read_byte(lp, LP8720_ENABLE, &val))
280 return 0;
281
282 addr = val & LP8720_DVS_SEL_M ?
283 LP8720_BUCK_VOUT1 : LP8720_BUCK_VOUT2;
284 }
285 break;
286 case LP8725_ID_BUCK1:
287 if (val & LP8725_DVS1_M)
288 addr = LP8725_BUCK1_VOUT1;
289 else
290 addr = (lp->dvs_pin == DVS_HIGH) ?
291 LP8725_BUCK1_VOUT1 : LP8725_BUCK1_VOUT2;
292 break;
293 case LP8725_ID_BUCK2:
294 addr = val & LP8725_DVS2_M ?
295 LP8725_BUCK2_VOUT1 : LP8725_BUCK2_VOUT2;
296 break;
297 default:
298 return 0;
299 }
300
301 return addr;
302}
303
304static bool lp872x_is_valid_buck_addr(u8 addr)
305{
306 switch (addr) {
307 case LP8720_BUCK_VOUT1:
308 case LP8720_BUCK_VOUT2:
309 case LP8725_BUCK1_VOUT1:
310 case LP8725_BUCK1_VOUT2:
311 case LP8725_BUCK2_VOUT1:
312 case LP8725_BUCK2_VOUT2:
313 return true;
314 default:
315 return false;
316 }
317}
318
319static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,
320 unsigned selector)
321{
322 struct lp872x *lp = rdev_get_drvdata(rdev);
323 enum lp872x_regulator_id buck = rdev_get_id(rdev);
324 u8 addr, mask = LP872X_VOUT_M;
Kim, Milo9d6da6f2012-09-05 04:39:33 +0000325 struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000326
327 if (dvs && gpio_is_valid(dvs->gpio))
Kim, Milo9d6da6f2012-09-05 04:39:33 +0000328 lp872x_set_dvs(lp, dvs->vsel, dvs->gpio);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000329
330 addr = lp872x_select_buck_vout_addr(lp, buck);
331 if (!lp872x_is_valid_buck_addr(addr))
332 return -EINVAL;
333
334 return lp872x_update_bits(lp, addr, mask, selector);
335}
336
337static int lp872x_buck_get_voltage_sel(struct regulator_dev *rdev)
338{
339 struct lp872x *lp = rdev_get_drvdata(rdev);
340 enum lp872x_regulator_id buck = rdev_get_id(rdev);
341 u8 addr, val;
342 int ret;
343
344 addr = lp872x_select_buck_vout_addr(lp, buck);
345 if (!lp872x_is_valid_buck_addr(addr))
346 return -EINVAL;
347
348 ret = lp872x_read_byte(lp, addr, &val);
349 if (ret)
350 return ret;
351
352 return val & LP872X_VOUT_M;
353}
354
355static int lp8725_buck_set_current_limit(struct regulator_dev *rdev,
356 int min_uA, int max_uA)
357{
358 struct lp872x *lp = rdev_get_drvdata(rdev);
359 enum lp872x_regulator_id buck = rdev_get_id(rdev);
Axel Lin4e1d67e2012-08-08 20:22:35 +0800360 int i;
361 u8 addr;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000362
363 switch (buck) {
364 case LP8725_ID_BUCK1:
365 addr = LP8725_BUCK1_VOUT2;
366 break;
367 case LP8725_ID_BUCK2:
368 addr = LP8725_BUCK2_VOUT2;
369 break;
370 default:
371 return -EINVAL;
372 }
373
Milo Kim37a6f432013-07-03 10:30:57 +0900374 for (i = ARRAY_SIZE(lp8725_buck_uA) - 1; i >= 0; i--) {
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000375 if (lp8725_buck_uA[i] >= min_uA &&
376 lp8725_buck_uA[i] <= max_uA)
Axel Lin4e1d67e2012-08-08 20:22:35 +0800377 return lp872x_update_bits(lp, addr,
378 LP8725_BUCK_CL_M,
379 i << LP8725_BUCK_CL_S);
380 }
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000381
Axel Lin4e1d67e2012-08-08 20:22:35 +0800382 return -EINVAL;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000383}
384
385static int lp8725_buck_get_current_limit(struct regulator_dev *rdev)
386{
387 struct lp872x *lp = rdev_get_drvdata(rdev);
388 enum lp872x_regulator_id buck = rdev_get_id(rdev);
389 u8 addr, val;
390 int ret;
391
392 switch (buck) {
393 case LP8725_ID_BUCK1:
394 addr = LP8725_BUCK1_VOUT2;
395 break;
396 case LP8725_ID_BUCK2:
397 addr = LP8725_BUCK2_VOUT2;
398 break;
399 default:
400 return -EINVAL;
401 }
402
403 ret = lp872x_read_byte(lp, addr, &val);
404 if (ret)
405 return ret;
406
407 val = (val & LP8725_BUCK_CL_M) >> LP8725_BUCK_CL_S;
408
409 return (val < ARRAY_SIZE(lp8725_buck_uA)) ?
410 lp8725_buck_uA[val] : -EINVAL;
411}
412
413static int lp872x_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
414{
415 struct lp872x *lp = rdev_get_drvdata(rdev);
416 enum lp872x_regulator_id buck = rdev_get_id(rdev);
417 u8 addr, mask, shift, val;
418
419 switch (buck) {
420 case LP8720_ID_BUCK:
421 addr = LP8720_BUCK_VOUT2;
422 mask = LP8720_BUCK_FPWM_M;
423 shift = LP8720_BUCK_FPWM_S;
424 break;
425 case LP8725_ID_BUCK1:
426 addr = LP8725_BUCK_CTRL;
427 mask = LP8725_BUCK1_FPWM_M;
428 shift = LP8725_BUCK1_FPWM_S;
429 break;
430 case LP8725_ID_BUCK2:
431 addr = LP8725_BUCK_CTRL;
432 mask = LP8725_BUCK2_FPWM_M;
433 shift = LP8725_BUCK2_FPWM_S;
434 break;
435 default:
436 return -EINVAL;
437 }
438
439 if (mode == REGULATOR_MODE_FAST)
440 val = LP872X_FORCE_PWM << shift;
441 else if (mode == REGULATOR_MODE_NORMAL)
442 val = LP872X_AUTO_PWM << shift;
443 else
444 return -EINVAL;
445
446 return lp872x_update_bits(lp, addr, mask, val);
447}
448
449static unsigned int lp872x_buck_get_mode(struct regulator_dev *rdev)
450{
451 struct lp872x *lp = rdev_get_drvdata(rdev);
452 enum lp872x_regulator_id buck = rdev_get_id(rdev);
453 u8 addr, mask, val;
454 int ret;
455
456 switch (buck) {
457 case LP8720_ID_BUCK:
458 addr = LP8720_BUCK_VOUT2;
459 mask = LP8720_BUCK_FPWM_M;
460 break;
461 case LP8725_ID_BUCK1:
462 addr = LP8725_BUCK_CTRL;
463 mask = LP8725_BUCK1_FPWM_M;
464 break;
465 case LP8725_ID_BUCK2:
466 addr = LP8725_BUCK_CTRL;
467 mask = LP8725_BUCK2_FPWM_M;
468 break;
469 default:
470 return -EINVAL;
471 }
472
473 ret = lp872x_read_byte(lp, addr, &val);
474 if (ret)
475 return ret;
476
477 return val & mask ? REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL;
478}
479
480static struct regulator_ops lp872x_ldo_ops = {
481 .list_voltage = regulator_list_voltage_table,
Axel Lina32f9e02013-04-24 20:44:47 +0800482 .map_voltage = regulator_map_voltage_ascend,
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000483 .set_voltage_sel = regulator_set_voltage_sel_regmap,
484 .get_voltage_sel = regulator_get_voltage_sel_regmap,
485 .enable = regulator_enable_regmap,
486 .disable = regulator_disable_regmap,
487 .is_enabled = regulator_is_enabled_regmap,
488 .enable_time = lp872x_regulator_enable_time,
489};
490
491static struct regulator_ops lp8720_buck_ops = {
492 .list_voltage = regulator_list_voltage_table,
Axel Lina32f9e02013-04-24 20:44:47 +0800493 .map_voltage = regulator_map_voltage_ascend,
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000494 .set_voltage_sel = lp872x_buck_set_voltage_sel,
495 .get_voltage_sel = lp872x_buck_get_voltage_sel,
496 .enable = regulator_enable_regmap,
497 .disable = regulator_disable_regmap,
498 .is_enabled = regulator_is_enabled_regmap,
499 .enable_time = lp872x_regulator_enable_time,
500 .set_mode = lp872x_buck_set_mode,
501 .get_mode = lp872x_buck_get_mode,
502};
503
504static struct regulator_ops lp8725_buck_ops = {
505 .list_voltage = regulator_list_voltage_table,
Axel Lina32f9e02013-04-24 20:44:47 +0800506 .map_voltage = regulator_map_voltage_ascend,
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000507 .set_voltage_sel = lp872x_buck_set_voltage_sel,
508 .get_voltage_sel = lp872x_buck_get_voltage_sel,
509 .enable = regulator_enable_regmap,
510 .disable = regulator_disable_regmap,
511 .is_enabled = regulator_is_enabled_regmap,
512 .enable_time = lp872x_regulator_enable_time,
513 .set_mode = lp872x_buck_set_mode,
514 .get_mode = lp872x_buck_get_mode,
515 .set_current_limit = lp8725_buck_set_current_limit,
516 .get_current_limit = lp8725_buck_get_current_limit,
517};
518
519static struct regulator_desc lp8720_regulator_desc[] = {
520 {
521 .name = "ldo1",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100522 .of_match = of_match_ptr("ldo1"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000523 .id = LP8720_ID_LDO1,
524 .ops = &lp872x_ldo_ops,
525 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
526 .volt_table = lp872x_ldo_vtbl,
527 .type = REGULATOR_VOLTAGE,
528 .owner = THIS_MODULE,
529 .vsel_reg = LP872X_LDO1_VOUT,
530 .vsel_mask = LP872X_VOUT_M,
531 .enable_reg = LP8720_ENABLE,
532 .enable_mask = LP872X_EN_LDO1_M,
533 },
534 {
535 .name = "ldo2",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100536 .of_match = of_match_ptr("ldo2"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000537 .id = LP8720_ID_LDO2,
538 .ops = &lp872x_ldo_ops,
539 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
540 .volt_table = lp872x_ldo_vtbl,
541 .type = REGULATOR_VOLTAGE,
542 .owner = THIS_MODULE,
543 .vsel_reg = LP872X_LDO2_VOUT,
544 .vsel_mask = LP872X_VOUT_M,
545 .enable_reg = LP8720_ENABLE,
546 .enable_mask = LP872X_EN_LDO2_M,
547 },
548 {
549 .name = "ldo3",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100550 .of_match = of_match_ptr("ldo3"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000551 .id = LP8720_ID_LDO3,
552 .ops = &lp872x_ldo_ops,
553 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
554 .volt_table = lp872x_ldo_vtbl,
555 .type = REGULATOR_VOLTAGE,
556 .owner = THIS_MODULE,
557 .vsel_reg = LP872X_LDO3_VOUT,
558 .vsel_mask = LP872X_VOUT_M,
559 .enable_reg = LP8720_ENABLE,
560 .enable_mask = LP872X_EN_LDO3_M,
561 },
562 {
563 .name = "ldo4",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100564 .of_match = of_match_ptr("ldo4"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000565 .id = LP8720_ID_LDO4,
566 .ops = &lp872x_ldo_ops,
567 .n_voltages = ARRAY_SIZE(lp8720_ldo4_vtbl),
568 .volt_table = lp8720_ldo4_vtbl,
569 .type = REGULATOR_VOLTAGE,
570 .owner = THIS_MODULE,
571 .vsel_reg = LP872X_LDO4_VOUT,
572 .vsel_mask = LP872X_VOUT_M,
573 .enable_reg = LP8720_ENABLE,
574 .enable_mask = LP872X_EN_LDO4_M,
575 },
576 {
577 .name = "ldo5",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100578 .of_match = of_match_ptr("ldo5"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000579 .id = LP8720_ID_LDO5,
580 .ops = &lp872x_ldo_ops,
581 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
582 .volt_table = lp872x_ldo_vtbl,
583 .type = REGULATOR_VOLTAGE,
584 .owner = THIS_MODULE,
585 .vsel_reg = LP872X_LDO5_VOUT,
586 .vsel_mask = LP872X_VOUT_M,
587 .enable_reg = LP8720_ENABLE,
588 .enable_mask = LP872X_EN_LDO5_M,
589 },
590 {
591 .name = "buck",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100592 .of_match = of_match_ptr("buck"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000593 .id = LP8720_ID_BUCK,
594 .ops = &lp8720_buck_ops,
595 .n_voltages = ARRAY_SIZE(lp8720_buck_vtbl),
596 .volt_table = lp8720_buck_vtbl,
597 .type = REGULATOR_VOLTAGE,
598 .owner = THIS_MODULE,
599 .enable_reg = LP8720_ENABLE,
600 .enable_mask = LP8720_EN_BUCK_M,
601 },
602};
603
604static struct regulator_desc lp8725_regulator_desc[] = {
605 {
606 .name = "ldo1",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100607 .of_match = of_match_ptr("ldo1"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000608 .id = LP8725_ID_LDO1,
609 .ops = &lp872x_ldo_ops,
610 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
611 .volt_table = lp872x_ldo_vtbl,
612 .type = REGULATOR_VOLTAGE,
613 .owner = THIS_MODULE,
614 .vsel_reg = LP872X_LDO1_VOUT,
615 .vsel_mask = LP872X_VOUT_M,
616 .enable_reg = LP8725_LDO_CTRL,
617 .enable_mask = LP872X_EN_LDO1_M,
618 },
619 {
620 .name = "ldo2",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100621 .of_match = of_match_ptr("ldo2"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000622 .id = LP8725_ID_LDO2,
623 .ops = &lp872x_ldo_ops,
624 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
625 .volt_table = lp872x_ldo_vtbl,
626 .type = REGULATOR_VOLTAGE,
627 .owner = THIS_MODULE,
628 .vsel_reg = LP872X_LDO2_VOUT,
629 .vsel_mask = LP872X_VOUT_M,
630 .enable_reg = LP8725_LDO_CTRL,
631 .enable_mask = LP872X_EN_LDO2_M,
632 },
633 {
634 .name = "ldo3",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100635 .of_match = of_match_ptr("ldo3"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000636 .id = LP8725_ID_LDO3,
637 .ops = &lp872x_ldo_ops,
638 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
639 .volt_table = lp872x_ldo_vtbl,
640 .type = REGULATOR_VOLTAGE,
641 .owner = THIS_MODULE,
642 .vsel_reg = LP872X_LDO3_VOUT,
643 .vsel_mask = LP872X_VOUT_M,
644 .enable_reg = LP8725_LDO_CTRL,
645 .enable_mask = LP872X_EN_LDO3_M,
646 },
647 {
648 .name = "ldo4",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100649 .of_match = of_match_ptr("ldo4"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000650 .id = LP8725_ID_LDO4,
651 .ops = &lp872x_ldo_ops,
652 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
653 .volt_table = lp872x_ldo_vtbl,
654 .type = REGULATOR_VOLTAGE,
655 .owner = THIS_MODULE,
656 .vsel_reg = LP872X_LDO4_VOUT,
657 .vsel_mask = LP872X_VOUT_M,
658 .enable_reg = LP8725_LDO_CTRL,
659 .enable_mask = LP872X_EN_LDO4_M,
660 },
661 {
662 .name = "ldo5",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100663 .of_match = of_match_ptr("ldo5"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000664 .id = LP8725_ID_LDO5,
665 .ops = &lp872x_ldo_ops,
666 .n_voltages = ARRAY_SIZE(lp872x_ldo_vtbl),
667 .volt_table = lp872x_ldo_vtbl,
668 .type = REGULATOR_VOLTAGE,
669 .owner = THIS_MODULE,
670 .vsel_reg = LP872X_LDO5_VOUT,
671 .vsel_mask = LP872X_VOUT_M,
672 .enable_reg = LP8725_LDO_CTRL,
673 .enable_mask = LP872X_EN_LDO5_M,
674 },
675 {
676 .name = "lilo1",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100677 .of_match = of_match_ptr("lilo1"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000678 .id = LP8725_ID_LILO1,
679 .ops = &lp872x_ldo_ops,
680 .n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
681 .volt_table = lp8725_lilo_vtbl,
682 .type = REGULATOR_VOLTAGE,
683 .owner = THIS_MODULE,
684 .vsel_reg = LP8725_LILO1_VOUT,
685 .vsel_mask = LP872X_VOUT_M,
686 .enable_reg = LP8725_LDO_CTRL,
687 .enable_mask = LP8725_EN_LILO1_M,
688 },
689 {
690 .name = "lilo2",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100691 .of_match = of_match_ptr("lilo2"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000692 .id = LP8725_ID_LILO2,
693 .ops = &lp872x_ldo_ops,
694 .n_voltages = ARRAY_SIZE(lp8725_lilo_vtbl),
695 .volt_table = lp8725_lilo_vtbl,
696 .type = REGULATOR_VOLTAGE,
697 .owner = THIS_MODULE,
698 .vsel_reg = LP8725_LILO2_VOUT,
699 .vsel_mask = LP872X_VOUT_M,
700 .enable_reg = LP8725_LDO_CTRL,
701 .enable_mask = LP8725_EN_LILO2_M,
702 },
703 {
704 .name = "buck1",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100705 .of_match = of_match_ptr("buck1"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000706 .id = LP8725_ID_BUCK1,
707 .ops = &lp8725_buck_ops,
708 .n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
709 .volt_table = lp8725_buck_vtbl,
710 .type = REGULATOR_VOLTAGE,
711 .owner = THIS_MODULE,
712 .enable_reg = LP872X_GENERAL_CFG,
713 .enable_mask = LP8725_BUCK1_EN_M,
714 },
715 {
716 .name = "buck2",
Paul Kocialkowski1f97fe42015-12-23 11:58:34 +0100717 .of_match = of_match_ptr("buck2"),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000718 .id = LP8725_ID_BUCK2,
719 .ops = &lp8725_buck_ops,
720 .n_voltages = ARRAY_SIZE(lp8725_buck_vtbl),
721 .volt_table = lp8725_buck_vtbl,
722 .type = REGULATOR_VOLTAGE,
723 .owner = THIS_MODULE,
724 .enable_reg = LP872X_GENERAL_CFG,
725 .enable_mask = LP8725_BUCK2_EN_M,
726 },
727};
728
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000729static int lp872x_init_dvs(struct lp872x *lp)
730{
731 int ret, gpio;
Kim, Milob158fba2012-09-05 04:39:16 +0000732 struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000733 enum lp872x_dvs_state pinstate;
Kim, Milob158fba2012-09-05 04:39:16 +0000734 u8 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M };
735 u8 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS };
736
737 if (!dvs)
738 goto set_default_dvs_mode;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000739
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000740 gpio = dvs->gpio;
741 if (!gpio_is_valid(gpio)) {
Kim, Milo00fd6e62013-05-20 12:36:07 +0000742 dev_warn(lp->dev, "invalid gpio: %d\n", gpio);
743 goto set_default_dvs_mode;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000744 }
745
746 pinstate = dvs->init_state;
747 ret = devm_gpio_request_one(lp->dev, gpio, pinstate, "LP872X DVS");
748 if (ret) {
749 dev_err(lp->dev, "gpio request err: %d\n", ret);
750 return ret;
751 }
752
753 lp->dvs_pin = pinstate;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000754
755 return 0;
Kim, Milob158fba2012-09-05 04:39:16 +0000756
757set_default_dvs_mode:
758 return lp872x_update_bits(lp, LP872X_GENERAL_CFG, mask[lp->chipid],
759 default_dvs_mode[lp->chipid]);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000760}
761
762static int lp872x_config(struct lp872x *lp)
763{
764 struct lp872x_platform_data *pdata = lp->pdata;
765 int ret;
766
Kim, Milo86b3fef2012-09-05 04:39:23 +0000767 if (!pdata || !pdata->update_config)
768 goto init_dvs;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000769
770 ret = lp872x_write_byte(lp, LP872X_GENERAL_CFG, pdata->general_config);
771 if (ret)
772 return ret;
773
Kim, Milo86b3fef2012-09-05 04:39:23 +0000774init_dvs:
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000775 return lp872x_init_dvs(lp);
776}
777
778static struct regulator_init_data
Axel Lin5bae0622012-07-15 16:57:12 +0800779*lp872x_find_regulator_init_data(int id, struct lp872x *lp)
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000780{
Kim, Milo9ffaa862012-09-05 04:39:11 +0000781 struct lp872x_platform_data *pdata = lp->pdata;
Axel Lin5bae0622012-07-15 16:57:12 +0800782 int i;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000783
Kim, Milo9ffaa862012-09-05 04:39:11 +0000784 if (!pdata)
785 return NULL;
786
Axel Lin5bae0622012-07-15 16:57:12 +0800787 for (i = 0; i < lp->num_regulators; i++) {
Kim, Milo9ffaa862012-09-05 04:39:11 +0000788 if (pdata->regulator_data[i].id == id)
789 return pdata->regulator_data[i].init_data;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000790 }
791
Axel Lin5bae0622012-07-15 16:57:12 +0800792 return NULL;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000793}
794
795static int lp872x_regulator_register(struct lp872x *lp)
796{
797 struct regulator_desc *desc;
798 struct regulator_config cfg = { };
799 struct regulator_dev *rdev;
Jingoo Haned6025342013-09-30 09:54:34 +0900800 int i;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000801
Milo Kim37a6f432013-07-03 10:30:57 +0900802 for (i = 0; i < lp->num_regulators; i++) {
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000803 desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] :
804 &lp8725_regulator_desc[i];
805
806 cfg.dev = lp->dev;
Axel Lin5bae0622012-07-15 16:57:12 +0800807 cfg.init_data = lp872x_find_regulator_init_data(desc->id, lp);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000808 cfg.driver_data = lp;
809 cfg.regmap = lp->regmap;
810
Jingoo Haned6025342013-09-30 09:54:34 +0900811 rdev = devm_regulator_register(lp->dev, desc, &cfg);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000812 if (IS_ERR(rdev)) {
813 dev_err(lp->dev, "regulator register err");
Jingoo Haned6025342013-09-30 09:54:34 +0900814 return PTR_ERR(rdev);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000815 }
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000816 }
817
818 return 0;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000819}
820
821static const struct regmap_config lp872x_regmap_config = {
822 .reg_bits = 8,
823 .val_bits = 8,
824 .max_register = MAX_REGISTERS,
825};
826
Kim, Milo00fd6e62013-05-20 12:36:07 +0000827#ifdef CONFIG_OF
828
829#define LP872X_VALID_OPMODE (REGULATOR_MODE_FAST | REGULATOR_MODE_NORMAL)
830
831static struct of_regulator_match lp8720_matches[] = {
832 { .name = "ldo1", .driver_data = (void *)LP8720_ID_LDO1, },
833 { .name = "ldo2", .driver_data = (void *)LP8720_ID_LDO2, },
834 { .name = "ldo3", .driver_data = (void *)LP8720_ID_LDO3, },
835 { .name = "ldo4", .driver_data = (void *)LP8720_ID_LDO4, },
836 { .name = "ldo5", .driver_data = (void *)LP8720_ID_LDO5, },
837 { .name = "buck", .driver_data = (void *)LP8720_ID_BUCK, },
838};
839
840static struct of_regulator_match lp8725_matches[] = {
841 { .name = "ldo1", .driver_data = (void *)LP8725_ID_LDO1, },
842 { .name = "ldo2", .driver_data = (void *)LP8725_ID_LDO2, },
843 { .name = "ldo3", .driver_data = (void *)LP8725_ID_LDO3, },
844 { .name = "ldo4", .driver_data = (void *)LP8725_ID_LDO4, },
845 { .name = "ldo5", .driver_data = (void *)LP8725_ID_LDO5, },
846 { .name = "lilo1", .driver_data = (void *)LP8725_ID_LILO1, },
847 { .name = "lilo2", .driver_data = (void *)LP8725_ID_LILO2, },
848 { .name = "buck1", .driver_data = (void *)LP8725_ID_BUCK1, },
849 { .name = "buck2", .driver_data = (void *)LP8725_ID_BUCK2, },
850};
851
852static struct lp872x_platform_data
853*lp872x_populate_pdata_from_dt(struct device *dev, enum lp872x_id which)
854{
855 struct device_node *np = dev->of_node;
856 struct lp872x_platform_data *pdata;
857 struct of_regulator_match *match;
Kim, Milo00fd6e62013-05-20 12:36:07 +0000858 int num_matches;
859 int count;
860 int i;
861 u8 dvs_state;
862
863 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
864 if (!pdata)
Milo Kim804486b2015-08-25 14:54:12 +0900865 return ERR_PTR(-ENOMEM);
Kim, Milo00fd6e62013-05-20 12:36:07 +0000866
867 of_property_read_u8(np, "ti,general-config", &pdata->general_config);
868 if (of_find_property(np, "ti,update-config", NULL))
869 pdata->update_config = true;
870
871 pdata->dvs = devm_kzalloc(dev, sizeof(struct lp872x_dvs), GFP_KERNEL);
872 if (!pdata->dvs)
Milo Kim804486b2015-08-25 14:54:12 +0900873 return ERR_PTR(-ENOMEM);
Kim, Milo00fd6e62013-05-20 12:36:07 +0000874
875 pdata->dvs->gpio = of_get_named_gpio(np, "ti,dvs-gpio", 0);
876 of_property_read_u8(np, "ti,dvs-vsel", (u8 *)&pdata->dvs->vsel);
877 of_property_read_u8(np, "ti,dvs-state", &dvs_state);
878 pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
879
880 if (of_get_child_count(np) == 0)
881 goto out;
882
883 switch (which) {
884 case LP8720:
885 match = lp8720_matches;
886 num_matches = ARRAY_SIZE(lp8720_matches);
887 break;
888 case LP8725:
889 match = lp8725_matches;
890 num_matches = ARRAY_SIZE(lp8725_matches);
891 break;
892 default:
893 goto out;
894 }
895
896 count = of_regulator_match(dev, np, match, num_matches);
897 if (count <= 0)
898 goto out;
899
900 for (i = 0; i < num_matches; i++) {
Milo Kim37a6f432013-07-03 10:30:57 +0900901 pdata->regulator_data[i].id =
902 (enum lp872x_regulator_id)match[i].driver_data;
Kim, Milo00fd6e62013-05-20 12:36:07 +0000903 pdata->regulator_data[i].init_data = match[i].init_data;
Kim, Milo00fd6e62013-05-20 12:36:07 +0000904 }
905out:
906 return pdata;
907}
908#else
909static struct lp872x_platform_data
910*lp872x_populate_pdata_from_dt(struct device *dev, enum lp872x_id which)
911{
912 return NULL;
913}
914#endif
915
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000916static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
917{
918 struct lp872x *lp;
Milo Kimd9ffae12015-08-25 14:54:11 +0900919 struct lp872x_platform_data *pdata;
Axel Lin8538c402015-01-26 10:25:13 +0800920 int ret;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000921 const int lp872x_num_regulators[] = {
922 [LP8720] = LP8720_NUM_REGULATORS,
923 [LP8725] = LP8725_NUM_REGULATORS,
924 };
925
Milo Kim804486b2015-08-25 14:54:12 +0900926 if (cl->dev.of_node) {
Milo Kimd9ffae12015-08-25 14:54:11 +0900927 pdata = lp872x_populate_pdata_from_dt(&cl->dev,
Kim, Milo00fd6e62013-05-20 12:36:07 +0000928 (enum lp872x_id)id->driver_data);
Milo Kim804486b2015-08-25 14:54:12 +0900929 if (IS_ERR(pdata))
930 return PTR_ERR(pdata);
931 } else {
Milo Kimd9ffae12015-08-25 14:54:11 +0900932 pdata = dev_get_platdata(&cl->dev);
Milo Kim804486b2015-08-25 14:54:12 +0900933 }
Kim, Milo00fd6e62013-05-20 12:36:07 +0000934
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000935 lp = devm_kzalloc(&cl->dev, sizeof(struct lp872x), GFP_KERNEL);
936 if (!lp)
Axel Lin8538c402015-01-26 10:25:13 +0800937 return -ENOMEM;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000938
Axel Lin8538c402015-01-26 10:25:13 +0800939 lp->num_regulators = lp872x_num_regulators[id->driver_data];
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000940
941 lp->regmap = devm_regmap_init_i2c(cl, &lp872x_regmap_config);
942 if (IS_ERR(lp->regmap)) {
943 ret = PTR_ERR(lp->regmap);
944 dev_err(&cl->dev, "regmap init i2c err: %d\n", ret);
Axel Lin8538c402015-01-26 10:25:13 +0800945 return ret;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000946 }
947
948 lp->dev = &cl->dev;
Milo Kimd9ffae12015-08-25 14:54:11 +0900949 lp->pdata = pdata;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000950 lp->chipid = id->driver_data;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000951 i2c_set_clientdata(cl, lp);
952
953 ret = lp872x_config(lp);
954 if (ret)
Axel Lin8538c402015-01-26 10:25:13 +0800955 return ret;
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000956
957 return lp872x_regulator_register(lp);
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000958}
959
Kim, Milo00fd6e62013-05-20 12:36:07 +0000960static const struct of_device_id lp872x_dt_ids[] = {
961 { .compatible = "ti,lp8720", },
962 { .compatible = "ti,lp8725", },
963 { }
964};
965MODULE_DEVICE_TABLE(of, lp872x_dt_ids);
966
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000967static const struct i2c_device_id lp872x_ids[] = {
968 {"lp8720", LP8720},
969 {"lp8725", LP8725},
970 { }
971};
972MODULE_DEVICE_TABLE(i2c, lp872x_ids);
973
974static struct i2c_driver lp872x_driver = {
975 .driver = {
976 .name = "lp872x",
Kim, Milo00fd6e62013-05-20 12:36:07 +0000977 .of_match_table = of_match_ptr(lp872x_dt_ids),
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000978 },
979 .probe = lp872x_probe,
Kim, Miloaf8b5fc2012-06-19 07:08:22 +0000980 .id_table = lp872x_ids,
981};
982
983module_i2c_driver(lp872x_driver);
984
985MODULE_DESCRIPTION("TI/National Semiconductor LP872x PMU Regulator Driver");
986MODULE_AUTHOR("Milo Kim");
987MODULE_LICENSE("GPL");