blob: bf80748f1ccc2a80ab014ae84bde52696e117a41 [file] [log] [blame]
Axel Linfd2f02f2019-05-03 13:36:37 +08001// SPDX-License-Identifier: GPL-2.0+
2//
3// da9211-regulator.c - Regulator device driver for DA9211/DA9212
4// /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
5// Copyright (C) 2015 Dialog Semiconductor Ltd.
James Ban1028a372014-07-14 13:48:45 +09006
7#include <linux/err.h>
James Ban1028a372014-07-14 13:48:45 +09008#include <linux/i2c.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/slab.h>
12#include <linux/regulator/driver.h>
13#include <linux/regulator/machine.h>
14#include <linux/regmap.h>
15#include <linux/irq.h>
16#include <linux/interrupt.h>
Linus Walleij11da04af2018-02-12 14:17:02 +010017#include <linux/gpio/consumer.h>
James Banbf3baca2014-08-27 11:47:07 +090018#include <linux/regulator/of_regulator.h>
James Ban1028a372014-07-14 13:48:45 +090019#include <linux/regulator/da9211.h>
20#include "da9211-regulator.h"
21
James Ban005547e2014-08-08 14:27:04 +090022/* DEVICE IDs */
23#define DA9211_DEVICE_ID 0x22
24#define DA9213_DEVICE_ID 0x23
James Ban7bd39352015-06-30 13:39:39 +090025#define DA9215_DEVICE_ID 0x24
James Ban005547e2014-08-08 14:27:04 +090026
James Ban1028a372014-07-14 13:48:45 +090027#define DA9211_BUCK_MODE_SLEEP 1
28#define DA9211_BUCK_MODE_SYNC 2
29#define DA9211_BUCK_MODE_AUTO 3
30
31/* DA9211 REGULATOR IDs */
32#define DA9211_ID_BUCKA 0
33#define DA9211_ID_BUCKB 1
34
35struct da9211 {
36 struct device *dev;
37 struct regmap *regmap;
38 struct da9211_pdata *pdata;
39 struct regulator_dev *rdev[DA9211_MAX_REGULATORS];
40 int num_regulator;
41 int chip_irq;
James Ban005547e2014-08-08 14:27:04 +090042 int chip_id;
James Ban1028a372014-07-14 13:48:45 +090043};
44
45static const struct regmap_range_cfg da9211_regmap_range[] = {
46 {
47 .selector_reg = DA9211_REG_PAGE_CON,
48 .selector_mask = DA9211_REG_PAGE_MASK,
49 .selector_shift = DA9211_REG_PAGE_SHIFT,
50 .window_start = 0,
51 .window_len = 256,
52 .range_min = 0,
James Ban005547e2014-08-08 14:27:04 +090053 .range_max = 5*128,
James Ban1028a372014-07-14 13:48:45 +090054 },
55};
56
57static const struct regmap_config da9211_regmap_config = {
58 .reg_bits = 8,
59 .val_bits = 8,
James Ban005547e2014-08-08 14:27:04 +090060 .max_register = 5 * 128,
James Ban1028a372014-07-14 13:48:45 +090061 .ranges = da9211_regmap_range,
62 .num_ranges = ARRAY_SIZE(da9211_regmap_range),
63};
64
65/* Default limits measured in millivolts and milliamps */
66#define DA9211_MIN_MV 300
67#define DA9211_MAX_MV 1570
68#define DA9211_STEP_MV 10
69
James Ban005547e2014-08-08 14:27:04 +090070/* Current limits for DA9211 buck (uA) indices
71 * corresponds with register values
72 */
James Ban1028a372014-07-14 13:48:45 +090073static const int da9211_current_limits[] = {
74 2000000, 2200000, 2400000, 2600000, 2800000, 3000000, 3200000, 3400000,
75 3600000, 3800000, 4000000, 4200000, 4400000, 4600000, 4800000, 5000000
76};
James Ban005547e2014-08-08 14:27:04 +090077/* Current limits for DA9213 buck (uA) indices
78 * corresponds with register values
79 */
80static const int da9213_current_limits[] = {
81 3000000, 3200000, 3400000, 3600000, 3800000, 4000000, 4200000, 4400000,
82 4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
83};
James Ban7bd39352015-06-30 13:39:39 +090084/* Current limits for DA9215 buck (uA) indices
85 * corresponds with register values
86 */
87static const int da9215_current_limits[] = {
88 4000000, 4200000, 4400000, 4600000, 4800000, 5000000, 5200000, 5400000,
89 5600000, 5800000, 6000000, 6200000, 6400000, 6600000, 6800000, 7000000
90};
James Ban1028a372014-07-14 13:48:45 +090091
92static unsigned int da9211_buck_get_mode(struct regulator_dev *rdev)
93{
94 int id = rdev_get_id(rdev);
95 struct da9211 *chip = rdev_get_drvdata(rdev);
96 unsigned int data;
97 int ret, mode = 0;
98
99 ret = regmap_read(chip->regmap, DA9211_REG_BUCKA_CONF+id, &data);
100 if (ret < 0)
101 return ret;
102
103 switch (data & 0x03) {
104 case DA9211_BUCK_MODE_SYNC:
105 mode = REGULATOR_MODE_FAST;
106 break;
107 case DA9211_BUCK_MODE_AUTO:
108 mode = REGULATOR_MODE_NORMAL;
109 break;
110 case DA9211_BUCK_MODE_SLEEP:
111 mode = REGULATOR_MODE_STANDBY;
112 break;
113 }
114
115 return mode;
116}
117
118static int da9211_buck_set_mode(struct regulator_dev *rdev,
119 unsigned int mode)
120{
121 int id = rdev_get_id(rdev);
122 struct da9211 *chip = rdev_get_drvdata(rdev);
123 int val = 0;
124
125 switch (mode) {
126 case REGULATOR_MODE_FAST:
127 val = DA9211_BUCK_MODE_SYNC;
128 break;
129 case REGULATOR_MODE_NORMAL:
130 val = DA9211_BUCK_MODE_AUTO;
131 break;
132 case REGULATOR_MODE_STANDBY:
133 val = DA9211_BUCK_MODE_SLEEP;
134 break;
135 }
136
137 return regmap_update_bits(chip->regmap, DA9211_REG_BUCKA_CONF+id,
138 0x03, val);
139}
140
141static int da9211_set_current_limit(struct regulator_dev *rdev, int min,
142 int max)
143{
144 int id = rdev_get_id(rdev);
145 struct da9211 *chip = rdev_get_drvdata(rdev);
James Ban005547e2014-08-08 14:27:04 +0900146 int i, max_size;
147 const int *current_limits;
148
149 switch (chip->chip_id) {
150 case DA9211:
151 current_limits = da9211_current_limits;
152 max_size = ARRAY_SIZE(da9211_current_limits)-1;
153 break;
154 case DA9213:
155 current_limits = da9213_current_limits;
156 max_size = ARRAY_SIZE(da9213_current_limits)-1;
157 break;
James Ban7bd39352015-06-30 13:39:39 +0900158 case DA9215:
159 current_limits = da9215_current_limits;
160 max_size = ARRAY_SIZE(da9215_current_limits)-1;
161 break;
James Ban005547e2014-08-08 14:27:04 +0900162 default:
163 return -EINVAL;
164 }
James Ban1028a372014-07-14 13:48:45 +0900165
166 /* search for closest to maximum */
James Ban005547e2014-08-08 14:27:04 +0900167 for (i = max_size; i >= 0; i--) {
168 if (min <= current_limits[i] &&
169 max >= current_limits[i]) {
James Ban1028a372014-07-14 13:48:45 +0900170 return regmap_update_bits(chip->regmap,
171 DA9211_REG_BUCK_ILIM,
172 (0x0F << id*4), (i << id*4));
173 }
174 }
175
176 return -EINVAL;
177}
178
179static int da9211_get_current_limit(struct regulator_dev *rdev)
180{
181 int id = rdev_get_id(rdev);
182 struct da9211 *chip = rdev_get_drvdata(rdev);
183 unsigned int data;
184 int ret;
James Ban005547e2014-08-08 14:27:04 +0900185 const int *current_limits;
186
187 switch (chip->chip_id) {
188 case DA9211:
189 current_limits = da9211_current_limits;
190 break;
191 case DA9213:
192 current_limits = da9213_current_limits;
193 break;
James Ban7bd39352015-06-30 13:39:39 +0900194 case DA9215:
195 current_limits = da9215_current_limits;
196 break;
James Ban005547e2014-08-08 14:27:04 +0900197 default:
198 return -EINVAL;
199 }
James Ban1028a372014-07-14 13:48:45 +0900200
201 ret = regmap_read(chip->regmap, DA9211_REG_BUCK_ILIM, &data);
202 if (ret < 0)
203 return ret;
204
James Ban005547e2014-08-08 14:27:04 +0900205 /* select one of 16 values: 0000 (2000mA or 3000mA)
206 * to 1111 (5000mA or 6000mA).
207 */
James Ban1028a372014-07-14 13:48:45 +0900208 data = (data >> id*4) & 0x0F;
James Ban005547e2014-08-08 14:27:04 +0900209 return current_limits[data];
James Ban1028a372014-07-14 13:48:45 +0900210}
211
Julia Lawall71242b42015-12-19 16:07:09 +0100212static const struct regulator_ops da9211_buck_ops = {
James Ban1028a372014-07-14 13:48:45 +0900213 .get_mode = da9211_buck_get_mode,
214 .set_mode = da9211_buck_set_mode,
215 .enable = regulator_enable_regmap,
216 .disable = regulator_disable_regmap,
217 .is_enabled = regulator_is_enabled_regmap,
218 .set_voltage_sel = regulator_set_voltage_sel_regmap,
219 .get_voltage_sel = regulator_get_voltage_sel_regmap,
220 .list_voltage = regulator_list_voltage_linear,
221 .set_current_limit = da9211_set_current_limit,
222 .get_current_limit = da9211_get_current_limit,
223};
224
225#define DA9211_BUCK(_id) \
226{\
227 .name = #_id,\
228 .ops = &da9211_buck_ops,\
229 .type = REGULATOR_VOLTAGE,\
230 .id = DA9211_ID_##_id,\
231 .n_voltages = (DA9211_MAX_MV - DA9211_MIN_MV) / DA9211_STEP_MV + 1,\
232 .min_uV = (DA9211_MIN_MV * 1000),\
233 .uV_step = (DA9211_STEP_MV * 1000),\
234 .enable_reg = DA9211_REG_BUCKA_CONT + DA9211_ID_##_id,\
235 .enable_mask = DA9211_BUCKA_EN,\
236 .vsel_reg = DA9211_REG_VBUCKA_A + DA9211_ID_##_id * 2,\
237 .vsel_mask = DA9211_VBUCK_MASK,\
238 .owner = THIS_MODULE,\
239}
240
241static struct regulator_desc da9211_regulators[] = {
242 DA9211_BUCK(BUCKA),
243 DA9211_BUCK(BUCKB),
244};
245
James Banbf3baca2014-08-27 11:47:07 +0900246#ifdef CONFIG_OF
247static struct of_regulator_match da9211_matches[] = {
248 [DA9211_ID_BUCKA] = { .name = "BUCKA" },
249 [DA9211_ID_BUCKB] = { .name = "BUCKB" },
250 };
251
252static struct da9211_pdata *da9211_parse_regulators_dt(
253 struct device *dev)
254{
255 struct da9211_pdata *pdata;
256 struct device_node *node;
257 int i, num, n;
258
259 node = of_get_child_by_name(dev->of_node, "regulators");
260 if (!node) {
261 dev_err(dev, "regulators node not found\n");
262 return ERR_PTR(-ENODEV);
263 }
264
265 num = of_regulator_match(dev, node, da9211_matches,
266 ARRAY_SIZE(da9211_matches));
267 of_node_put(node);
268 if (num < 0) {
269 dev_err(dev, "Failed to match regulators\n");
270 return ERR_PTR(-EINVAL);
271 }
272
273 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
274 if (!pdata)
275 return ERR_PTR(-ENOMEM);
276
277 pdata->num_buck = num;
278
279 n = 0;
280 for (i = 0; i < ARRAY_SIZE(da9211_matches); i++) {
281 if (!da9211_matches[i].init_data)
282 continue;
283
284 pdata->init_data[n] = da9211_matches[i].init_data;
James Ban076c3b82015-01-16 12:13:27 +0900285 pdata->reg_node[n] = da9211_matches[i].of_node;
Linus Walleij11da04af2018-02-12 14:17:02 +0100286 pdata->gpiod_ren[n] = devm_gpiod_get_from_of_node(dev,
Linus Walleij63239e42018-10-15 11:02:40 +0200287 da9211_matches[i].of_node,
Dmitry Torokhov5eda8e92019-09-10 10:02:46 -0700288 "enable-gpios",
Linus Walleij63239e42018-10-15 11:02:40 +0200289 0,
290 GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
291 "da9211-enable");
Waibel Georg025bf3772019-06-20 21:37:08 +0000292 if (IS_ERR(pdata->gpiod_ren[n]))
293 pdata->gpiod_ren[n] = NULL;
James Banbf3baca2014-08-27 11:47:07 +0900294 n++;
Fengguang Wuc2a946e2014-08-29 12:41:59 +0100295 }
James Banbf3baca2014-08-27 11:47:07 +0900296
297 return pdata;
298}
299#else
300static struct da9211_pdata *da9211_parse_regulators_dt(
301 struct device *dev)
302{
303 return ERR_PTR(-ENODEV);
304}
305#endif
306
James Ban1028a372014-07-14 13:48:45 +0900307static irqreturn_t da9211_irq_handler(int irq, void *data)
308{
309 struct da9211 *chip = data;
310 int reg_val, err, ret = IRQ_NONE;
311
312 err = regmap_read(chip->regmap, DA9211_REG_EVENT_B, &reg_val);
313 if (err < 0)
314 goto error_i2c;
315
316 if (reg_val & DA9211_E_OV_CURR_A) {
Steve Twiss65378de2019-02-26 15:27:57 +0000317 regulator_lock(chip->rdev[0]);
James Ban1028a372014-07-14 13:48:45 +0900318 regulator_notifier_call_chain(chip->rdev[0],
Geert Uytterhoevena46a0732015-02-23 17:12:16 +0100319 REGULATOR_EVENT_OVER_CURRENT, NULL);
Steve Twiss65378de2019-02-26 15:27:57 +0000320 regulator_unlock(chip->rdev[0]);
James Ban1028a372014-07-14 13:48:45 +0900321
322 err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
323 DA9211_E_OV_CURR_A);
324 if (err < 0)
325 goto error_i2c;
326
327 ret = IRQ_HANDLED;
328 }
329
330 if (reg_val & DA9211_E_OV_CURR_B) {
Steve Twiss65378de2019-02-26 15:27:57 +0000331 regulator_lock(chip->rdev[1]);
James Ban1028a372014-07-14 13:48:45 +0900332 regulator_notifier_call_chain(chip->rdev[1],
Geert Uytterhoevena46a0732015-02-23 17:12:16 +0100333 REGULATOR_EVENT_OVER_CURRENT, NULL);
Steve Twiss65378de2019-02-26 15:27:57 +0000334 regulator_unlock(chip->rdev[1]);
James Ban1028a372014-07-14 13:48:45 +0900335
336 err = regmap_write(chip->regmap, DA9211_REG_EVENT_B,
337 DA9211_E_OV_CURR_B);
338 if (err < 0)
339 goto error_i2c;
340
341 ret = IRQ_HANDLED;
342 }
343
344 return ret;
345
346error_i2c:
347 dev_err(chip->dev, "I2C error : %d\n", err);
348 return IRQ_NONE;
349}
350
351static int da9211_regulator_init(struct da9211 *chip)
352{
353 struct regulator_config config = { };
354 int i, ret;
355 unsigned int data;
356
357 ret = regmap_read(chip->regmap, DA9211_REG_CONFIG_E, &data);
358 if (ret < 0) {
Geert Uytterhoeven767e8aa2015-02-23 17:11:07 +0100359 dev_err(chip->dev, "Failed to read CONFIG_E reg: %d\n", ret);
Axel Lin516c1512014-07-20 19:19:35 +0800360 return ret;
James Ban1028a372014-07-14 13:48:45 +0900361 }
362
363 data &= DA9211_SLAVE_SEL;
364 /* If configuration for 1/2 bucks is different between platform data
365 * and the register, driver should exit.
366 */
James Ban7bd39352015-06-30 13:39:39 +0900367 if (chip->pdata->num_buck == 1 && data == 0x00)
368 chip->num_regulator = 1;
369 else if (chip->pdata->num_buck == 2 && data != 0x00)
370 chip->num_regulator = 2;
371 else {
James Ban1028a372014-07-14 13:48:45 +0900372 dev_err(chip->dev, "Configuration is mismatched\n");
Axel Lin516c1512014-07-20 19:19:35 +0800373 return -EINVAL;
James Ban1028a372014-07-14 13:48:45 +0900374 }
375
376 for (i = 0; i < chip->num_regulator; i++) {
James Banbf3baca2014-08-27 11:47:07 +0900377 config.init_data = chip->pdata->init_data[i];
James Ban1028a372014-07-14 13:48:45 +0900378 config.dev = chip->dev;
379 config.driver_data = chip;
380 config.regmap = chip->regmap;
James Ban076c3b82015-01-16 12:13:27 +0900381 config.of_node = chip->pdata->reg_node[i];
James Ban1028a372014-07-14 13:48:45 +0900382
Linus Walleij11da04af2018-02-12 14:17:02 +0100383 if (chip->pdata->gpiod_ren[i])
384 config.ena_gpiod = chip->pdata->gpiod_ren[i];
385 else
386 config.ena_gpiod = NULL;
James Ban8c7dd8b2015-01-28 09:28:08 +0900387
Linus Walleijb23328d2018-12-06 13:43:48 +0100388 /*
389 * Hand the GPIO descriptor management over to the regulator
390 * core, remove it from GPIO devres management.
391 */
392 if (config.ena_gpiod)
393 devm_gpiod_unhinge(chip->dev, config.ena_gpiod);
James Ban1028a372014-07-14 13:48:45 +0900394 chip->rdev[i] = devm_regulator_register(chip->dev,
395 &da9211_regulators[i], &config);
396 if (IS_ERR(chip->rdev[i])) {
397 dev_err(chip->dev,
398 "Failed to register DA9211 regulator\n");
Axel Lin516c1512014-07-20 19:19:35 +0800399 return PTR_ERR(chip->rdev[i]);
James Ban1028a372014-07-14 13:48:45 +0900400 }
401
402 if (chip->chip_irq != 0) {
403 ret = regmap_update_bits(chip->regmap,
James Ban4e7089f2014-09-29 16:59:20 +0900404 DA9211_REG_MASK_B, DA9211_M_OV_CURR_A << i, 0);
James Ban1028a372014-07-14 13:48:45 +0900405 if (ret < 0) {
406 dev_err(chip->dev,
407 "Failed to update mask reg: %d\n", ret);
Axel Lin516c1512014-07-20 19:19:35 +0800408 return ret;
James Ban1028a372014-07-14 13:48:45 +0900409 }
410 }
411 }
412
413 return 0;
James Ban1028a372014-07-14 13:48:45 +0900414}
James Banbf3baca2014-08-27 11:47:07 +0900415
James Ban1028a372014-07-14 13:48:45 +0900416/*
417 * I2C driver interface functions
418 */
419static int da9211_i2c_probe(struct i2c_client *i2c,
420 const struct i2c_device_id *id)
421{
422 struct da9211 *chip;
423 int error, ret;
James Ban005547e2014-08-08 14:27:04 +0900424 unsigned int data;
James Ban1028a372014-07-14 13:48:45 +0900425
426 chip = devm_kzalloc(&i2c->dev, sizeof(struct da9211), GFP_KERNEL);
Axel Lin1d3e6a62014-08-17 18:34:48 +0800427 if (!chip)
428 return -ENOMEM;
James Ban1028a372014-07-14 13:48:45 +0900429
430 chip->dev = &i2c->dev;
431 chip->regmap = devm_regmap_init_i2c(i2c, &da9211_regmap_config);
432 if (IS_ERR(chip->regmap)) {
433 error = PTR_ERR(chip->regmap);
James Ban005547e2014-08-08 14:27:04 +0900434 dev_err(chip->dev, "Failed to allocate register map: %d\n",
James Ban1028a372014-07-14 13:48:45 +0900435 error);
436 return error;
437 }
438
439 i2c_set_clientdata(i2c, chip);
440
441 chip->pdata = i2c->dev.platform_data;
James Ban005547e2014-08-08 14:27:04 +0900442
443 ret = regmap_read(chip->regmap, DA9211_REG_DEVICE_ID, &data);
444 if (ret < 0) {
445 dev_err(chip->dev, "Failed to read DEVICE_ID reg: %d\n", ret);
446 return ret;
447 }
448
449 switch (data) {
450 case DA9211_DEVICE_ID:
451 chip->chip_id = DA9211;
452 break;
453 case DA9213_DEVICE_ID:
454 chip->chip_id = DA9213;
455 break;
James Ban7bd39352015-06-30 13:39:39 +0900456 case DA9215_DEVICE_ID:
457 chip->chip_id = DA9215;
458 break;
James Ban005547e2014-08-08 14:27:04 +0900459 default:
460 dev_err(chip->dev, "Unsupported device id = 0x%x.\n", data);
James Ban1028a372014-07-14 13:48:45 +0900461 return -ENODEV;
462 }
463
James Banbf3baca2014-08-27 11:47:07 +0900464 if (!chip->pdata)
465 chip->pdata = da9211_parse_regulators_dt(chip->dev);
466
467 if (IS_ERR(chip->pdata)) {
468 dev_err(chip->dev, "No regulators defined for the platform\n");
469 return PTR_ERR(chip->pdata);
470 }
471
James Ban1028a372014-07-14 13:48:45 +0900472 chip->chip_irq = i2c->irq;
473
474 if (chip->chip_irq != 0) {
475 ret = devm_request_threaded_irq(chip->dev, chip->chip_irq, NULL,
476 da9211_irq_handler,
477 IRQF_TRIGGER_LOW|IRQF_ONESHOT,
478 "da9211", chip);
479 if (ret != 0) {
480 dev_err(chip->dev, "Failed to request IRQ: %d\n",
481 chip->chip_irq);
482 return ret;
483 }
484 } else {
485 dev_warn(chip->dev, "No IRQ configured\n");
486 }
487
488 ret = da9211_regulator_init(chip);
489
490 if (ret < 0)
James Ban005547e2014-08-08 14:27:04 +0900491 dev_err(chip->dev, "Failed to initialize regulator: %d\n", ret);
James Ban1028a372014-07-14 13:48:45 +0900492
493 return ret;
494}
495
James Ban1028a372014-07-14 13:48:45 +0900496static const struct i2c_device_id da9211_i2c_id[] = {
Axel Lin6a52f562014-09-05 09:12:55 +0800497 {"da9211", DA9211},
James Ban7524c1c2016-06-29 16:49:32 +0900498 {"da9212", DA9212},
Axel Lin6a52f562014-09-05 09:12:55 +0800499 {"da9213", DA9213},
James Ban707ce9e2017-10-30 11:32:38 +0900500 {"da9223", DA9223},
James Ban7524c1c2016-06-29 16:49:32 +0900501 {"da9214", DA9214},
James Ban707ce9e2017-10-30 11:32:38 +0900502 {"da9224", DA9224},
James Ban7bd39352015-06-30 13:39:39 +0900503 {"da9215", DA9215},
James Ban707ce9e2017-10-30 11:32:38 +0900504 {"da9225", DA9225},
James Ban1028a372014-07-14 13:48:45 +0900505 {},
506};
James Ban1028a372014-07-14 13:48:45 +0900507MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
508
Axel Lin6a52f562014-09-05 09:12:55 +0800509#ifdef CONFIG_OF
510static const struct of_device_id da9211_dt_ids[] = {
511 { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
James Ban7524c1c2016-06-29 16:49:32 +0900512 { .compatible = "dlg,da9212", .data = &da9211_i2c_id[1] },
513 { .compatible = "dlg,da9213", .data = &da9211_i2c_id[2] },
James Ban707ce9e2017-10-30 11:32:38 +0900514 { .compatible = "dlg,da9223", .data = &da9211_i2c_id[3] },
515 { .compatible = "dlg,da9214", .data = &da9211_i2c_id[4] },
516 { .compatible = "dlg,da9224", .data = &da9211_i2c_id[5] },
517 { .compatible = "dlg,da9215", .data = &da9211_i2c_id[6] },
518 { .compatible = "dlg,da9225", .data = &da9211_i2c_id[7] },
Axel Lin6a52f562014-09-05 09:12:55 +0800519 {},
520};
521MODULE_DEVICE_TABLE(of, da9211_dt_ids);
522#endif
523
James Ban1028a372014-07-14 13:48:45 +0900524static struct i2c_driver da9211_regulator_driver = {
525 .driver = {
526 .name = "da9211",
Axel Lin6a52f562014-09-05 09:12:55 +0800527 .of_match_table = of_match_ptr(da9211_dt_ids),
James Ban1028a372014-07-14 13:48:45 +0900528 },
529 .probe = da9211_i2c_probe,
James Ban1028a372014-07-14 13:48:45 +0900530 .id_table = da9211_i2c_id,
531};
532
533module_i2c_driver(da9211_regulator_driver);
534
535MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
James Ban707ce9e2017-10-30 11:32:38 +0900536MODULE_DESCRIPTION("DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225 regulator driver");
James Ban7bd39352015-06-30 13:39:39 +0900537MODULE_LICENSE("GPL");