1 // SPDX-License-Identifier: GPL-2.0+
3 // max8998.c - Voltage regulator driver for the Maxim 8998
5 // Copyright (C) 2009-2010 Samsung Electronics
6 // Kyungmin Park <kyungmin.park@samsung.com>
7 // Marek Szyprowski <m.szyprowski@samsung.com>
9 #include <linux/module.h>
10 #include <linux/init.h>
11 #include <linux/i2c.h>
12 #include <linux/err.h>
13 #include <linux/gpio.h>
14 #include <linux/slab.h>
15 #include <linux/interrupt.h>
16 #include <linux/mutex.h>
18 #include <linux/of_gpio.h>
19 #include <linux/platform_device.h>
20 #include <linux/regulator/driver.h>
21 #include <linux/regulator/of_regulator.h>
22 #include <linux/mfd/max8998.h>
23 #include <linux/mfd/max8998-private.h>
27 struct max8998_dev
*iodev
;
29 u8 buck1_vol
[4]; /* voltages for selection */
31 unsigned int buck1_idx
; /* index to last changed voltage */
33 unsigned int buck2_idx
;
36 static int max8998_get_enable_register(struct regulator_dev
*rdev
,
39 int ldo
= rdev_get_id(rdev
);
42 case MAX8998_LDO2
... MAX8998_LDO5
:
43 *reg
= MAX8998_REG_ONOFF1
;
44 *shift
= 3 - (ldo
- MAX8998_LDO2
);
46 case MAX8998_LDO6
... MAX8998_LDO13
:
47 *reg
= MAX8998_REG_ONOFF2
;
48 *shift
= 7 - (ldo
- MAX8998_LDO6
);
50 case MAX8998_LDO14
... MAX8998_LDO17
:
51 *reg
= MAX8998_REG_ONOFF3
;
52 *shift
= 7 - (ldo
- MAX8998_LDO14
);
54 case MAX8998_BUCK1
... MAX8998_BUCK4
:
55 *reg
= MAX8998_REG_ONOFF1
;
56 *shift
= 7 - (ldo
- MAX8998_BUCK1
);
58 case MAX8998_EN32KHZ_AP
... MAX8998_ENVICHG
:
59 *reg
= MAX8998_REG_ONOFF4
;
60 *shift
= 7 - (ldo
- MAX8998_EN32KHZ_AP
);
62 case MAX8998_ESAFEOUT1
... MAX8998_ESAFEOUT2
:
63 *reg
= MAX8998_REG_CHGR2
;
64 *shift
= 7 - (ldo
- MAX8998_ESAFEOUT1
);
73 static int max8998_ldo_is_enabled(struct regulator_dev
*rdev
)
75 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
76 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
77 int ret
, reg
, shift
= 8;
80 ret
= max8998_get_enable_register(rdev
, ®
, &shift
);
84 ret
= max8998_read_reg(i2c
, reg
, &val
);
88 return val
& (1 << shift
);
91 static int max8998_ldo_enable(struct regulator_dev
*rdev
)
93 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
94 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
95 int reg
, shift
= 8, ret
;
97 ret
= max8998_get_enable_register(rdev
, ®
, &shift
);
101 return max8998_update_reg(i2c
, reg
, 1<<shift
, 1<<shift
);
104 static int max8998_ldo_disable(struct regulator_dev
*rdev
)
106 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
107 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
108 int reg
, shift
= 8, ret
;
110 ret
= max8998_get_enable_register(rdev
, ®
, &shift
);
114 return max8998_update_reg(i2c
, reg
, 0, 1<<shift
);
117 static int max8998_get_voltage_register(struct regulator_dev
*rdev
,
118 int *_reg
, int *_shift
, int *_mask
)
120 int ldo
= rdev_get_id(rdev
);
121 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
122 int reg
, shift
= 0, mask
= 0xff;
125 case MAX8998_LDO2
... MAX8998_LDO3
:
126 reg
= MAX8998_REG_LDO2_LDO3
;
128 if (ldo
== MAX8998_LDO2
)
133 case MAX8998_LDO4
... MAX8998_LDO7
:
134 reg
= MAX8998_REG_LDO4
+ (ldo
- MAX8998_LDO4
);
136 case MAX8998_LDO8
... MAX8998_LDO9
:
137 reg
= MAX8998_REG_LDO8_LDO9
;
139 if (ldo
== MAX8998_LDO8
)
144 case MAX8998_LDO10
... MAX8998_LDO11
:
145 reg
= MAX8998_REG_LDO10_LDO11
;
146 if (ldo
== MAX8998_LDO10
) {
154 case MAX8998_LDO12
... MAX8998_LDO17
:
155 reg
= MAX8998_REG_LDO12
+ (ldo
- MAX8998_LDO12
);
158 reg
= MAX8998_REG_BUCK1_VOLTAGE1
+ max8998
->buck1_idx
;
161 reg
= MAX8998_REG_BUCK2_VOLTAGE1
+ max8998
->buck2_idx
;
164 reg
= MAX8998_REG_BUCK3
;
167 reg
= MAX8998_REG_BUCK4
;
180 static int max8998_get_voltage_sel(struct regulator_dev
*rdev
)
182 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
183 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
184 int reg
, shift
= 0, mask
, ret
;
187 ret
= max8998_get_voltage_register(rdev
, ®
, &shift
, &mask
);
191 ret
= max8998_read_reg(i2c
, reg
, &val
);
201 static int max8998_set_voltage_ldo_sel(struct regulator_dev
*rdev
,
204 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
205 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
206 int reg
, shift
= 0, mask
, ret
;
208 ret
= max8998_get_voltage_register(rdev
, ®
, &shift
, &mask
);
212 ret
= max8998_update_reg(i2c
, reg
, selector
<<shift
, mask
<<shift
);
217 static inline void buck1_gpio_set(int gpio1
, int gpio2
, int v
)
219 gpio_set_value(gpio1
, v
& 0x1);
220 gpio_set_value(gpio2
, (v
>> 1) & 0x1);
223 static inline void buck2_gpio_set(int gpio
, int v
)
225 gpio_set_value(gpio
, v
& 0x1);
228 static int max8998_set_voltage_buck_sel(struct regulator_dev
*rdev
,
231 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
232 struct max8998_platform_data
*pdata
= max8998
->iodev
->pdata
;
233 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
234 int buck
= rdev_get_id(rdev
);
235 int reg
, shift
= 0, mask
, ret
, j
;
236 static u8 buck1_last_val
;
238 ret
= max8998_get_voltage_register(rdev
, ®
, &shift
, &mask
);
244 dev_dbg(max8998
->dev
,
245 "BUCK1, selector:%d, buck1_vol1:%d, buck1_vol2:%d\n"
246 "buck1_vol3:%d, buck1_vol4:%d\n",
247 selector
, max8998
->buck1_vol
[0], max8998
->buck1_vol
[1],
248 max8998
->buck1_vol
[2], max8998
->buck1_vol
[3]);
250 if (gpio_is_valid(pdata
->buck1_set1
) &&
251 gpio_is_valid(pdata
->buck1_set2
)) {
253 /* check if requested voltage */
254 /* value is already defined */
255 for (j
= 0; j
< ARRAY_SIZE(max8998
->buck1_vol
); j
++) {
256 if (max8998
->buck1_vol
[j
] == selector
) {
257 max8998
->buck1_idx
= j
;
258 buck1_gpio_set(pdata
->buck1_set1
,
259 pdata
->buck1_set2
, j
);
264 if (pdata
->buck_voltage_lock
)
267 /* no predefine regulator found */
268 max8998
->buck1_idx
= (buck1_last_val
% 2) + 2;
269 dev_dbg(max8998
->dev
, "max8998->buck1_idx:%d\n",
271 max8998
->buck1_vol
[max8998
->buck1_idx
] = selector
;
272 ret
= max8998_get_voltage_register(rdev
, ®
,
275 ret
= max8998_write_reg(i2c
, reg
, selector
);
276 buck1_gpio_set(pdata
->buck1_set1
,
277 pdata
->buck1_set2
, max8998
->buck1_idx
);
280 dev_dbg(max8998
->dev
, "%s: SET1:%d, SET2:%d\n",
281 i2c
->name
, gpio_get_value(pdata
->buck1_set1
),
282 gpio_get_value(pdata
->buck1_set2
));
285 ret
= max8998_write_reg(i2c
, reg
, selector
);
290 dev_dbg(max8998
->dev
,
291 "BUCK2, selector:%d buck2_vol1:%d, buck2_vol2:%d\n",
292 selector
, max8998
->buck2_vol
[0], max8998
->buck2_vol
[1]);
293 if (gpio_is_valid(pdata
->buck2_set3
)) {
295 /* check if requested voltage */
296 /* value is already defined */
297 for (j
= 0; j
< ARRAY_SIZE(max8998
->buck2_vol
); j
++) {
298 if (max8998
->buck2_vol
[j
] == selector
) {
299 max8998
->buck2_idx
= j
;
300 buck2_gpio_set(pdata
->buck2_set3
, j
);
305 if (pdata
->buck_voltage_lock
)
308 max8998_get_voltage_register(rdev
,
309 ®
, &shift
, &mask
);
310 ret
= max8998_write_reg(i2c
, reg
, selector
);
311 max8998
->buck2_vol
[max8998
->buck2_idx
] = selector
;
312 buck2_gpio_set(pdata
->buck2_set3
, max8998
->buck2_idx
);
314 dev_dbg(max8998
->dev
, "%s: SET3:%d\n", i2c
->name
,
315 gpio_get_value(pdata
->buck2_set3
));
317 ret
= max8998_write_reg(i2c
, reg
, selector
);
323 ret
= max8998_update_reg(i2c
, reg
, selector
<<shift
,
331 static int max8998_set_voltage_buck_time_sel(struct regulator_dev
*rdev
,
332 unsigned int old_selector
,
333 unsigned int new_selector
)
335 struct max8998_data
*max8998
= rdev_get_drvdata(rdev
);
336 struct i2c_client
*i2c
= max8998
->iodev
->i2c
;
337 int buck
= rdev_get_id(rdev
);
341 if (buck
< MAX8998_BUCK1
|| buck
> MAX8998_BUCK4
)
344 /* Voltage stabilization */
345 ret
= max8998_read_reg(i2c
, MAX8998_REG_ONOFF4
, &val
);
349 /* lp3974 hasn't got ENRAMP bit - ramp is assumed as true */
350 /* MAX8998 has ENRAMP bit implemented, so test it*/
351 if (max8998
->iodev
->type
== TYPE_MAX8998
&& !(val
& MAX8998_ENRAMP
))
354 difference
= (new_selector
- old_selector
) * rdev
->desc
->uV_step
/ 1000;
356 return DIV_ROUND_UP(difference
, (val
& 0x0f) + 1);
361 static const struct regulator_ops max8998_ldo_ops
= {
362 .list_voltage
= regulator_list_voltage_linear
,
363 .map_voltage
= regulator_map_voltage_linear
,
364 .is_enabled
= max8998_ldo_is_enabled
,
365 .enable
= max8998_ldo_enable
,
366 .disable
= max8998_ldo_disable
,
367 .get_voltage_sel
= max8998_get_voltage_sel
,
368 .set_voltage_sel
= max8998_set_voltage_ldo_sel
,
371 static const struct regulator_ops max8998_buck_ops
= {
372 .list_voltage
= regulator_list_voltage_linear
,
373 .map_voltage
= regulator_map_voltage_linear
,
374 .is_enabled
= max8998_ldo_is_enabled
,
375 .enable
= max8998_ldo_enable
,
376 .disable
= max8998_ldo_disable
,
377 .get_voltage_sel
= max8998_get_voltage_sel
,
378 .set_voltage_sel
= max8998_set_voltage_buck_sel
,
379 .set_voltage_time_sel
= max8998_set_voltage_buck_time_sel
,
382 static const struct regulator_ops max8998_others_ops
= {
383 .is_enabled
= max8998_ldo_is_enabled
,
384 .enable
= max8998_ldo_enable
,
385 .disable
= max8998_ldo_disable
,
388 #define MAX8998_LINEAR_REG(_name, _ops, _min, _step, _max) \
391 .id = MAX8998_##_name, \
394 .uV_step = (_step), \
395 .n_voltages = ((_max) - (_min)) / (_step) + 1, \
396 .type = REGULATOR_VOLTAGE, \
397 .owner = THIS_MODULE, \
400 #define MAX8998_OTHERS_REG(_name, _id) \
404 .ops = &max8998_others_ops, \
405 .type = REGULATOR_VOLTAGE, \
406 .owner = THIS_MODULE, \
409 static const struct regulator_desc regulators
[] = {
410 MAX8998_LINEAR_REG(LDO2
, &max8998_ldo_ops
, 800000, 50000, 1300000),
411 MAX8998_LINEAR_REG(LDO3
, &max8998_ldo_ops
, 800000, 50000, 1300000),
412 MAX8998_LINEAR_REG(LDO4
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
413 MAX8998_LINEAR_REG(LDO5
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
414 MAX8998_LINEAR_REG(LDO6
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
415 MAX8998_LINEAR_REG(LDO7
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
416 MAX8998_LINEAR_REG(LDO8
, &max8998_ldo_ops
, 3000000, 100000, 3600000),
417 MAX8998_LINEAR_REG(LDO9
, &max8998_ldo_ops
, 2800000, 100000, 3100000),
418 MAX8998_LINEAR_REG(LDO10
, &max8998_ldo_ops
, 950000, 50000, 1300000),
419 MAX8998_LINEAR_REG(LDO11
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
420 MAX8998_LINEAR_REG(LDO12
, &max8998_ldo_ops
, 800000, 100000, 3300000),
421 MAX8998_LINEAR_REG(LDO13
, &max8998_ldo_ops
, 800000, 100000, 3300000),
422 MAX8998_LINEAR_REG(LDO14
, &max8998_ldo_ops
, 1200000, 100000, 3300000),
423 MAX8998_LINEAR_REG(LDO15
, &max8998_ldo_ops
, 1200000, 100000, 3300000),
424 MAX8998_LINEAR_REG(LDO16
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
425 MAX8998_LINEAR_REG(LDO17
, &max8998_ldo_ops
, 1600000, 100000, 3600000),
426 MAX8998_LINEAR_REG(BUCK1
, &max8998_buck_ops
, 750000, 25000, 1525000),
427 MAX8998_LINEAR_REG(BUCK2
, &max8998_buck_ops
, 750000, 25000, 1525000),
428 MAX8998_LINEAR_REG(BUCK3
, &max8998_buck_ops
, 1600000, 100000, 3600000),
429 MAX8998_LINEAR_REG(BUCK4
, &max8998_buck_ops
, 800000, 100000, 2300000),
430 MAX8998_OTHERS_REG(EN32KHz
-AP
, MAX8998_EN32KHZ_AP
),
431 MAX8998_OTHERS_REG(EN32KHz
-CP
, MAX8998_EN32KHZ_CP
),
432 MAX8998_OTHERS_REG(ENVICHG
, MAX8998_ENVICHG
),
433 MAX8998_OTHERS_REG(ESAFEOUT1
, MAX8998_ESAFEOUT1
),
434 MAX8998_OTHERS_REG(ESAFEOUT2
, MAX8998_ESAFEOUT2
),
437 static int max8998_pmic_dt_parse_dvs_gpio(struct max8998_dev
*iodev
,
438 struct max8998_platform_data
*pdata
,
439 struct device_node
*pmic_np
)
443 gpio
= of_get_named_gpio(pmic_np
, "max8998,pmic-buck1-dvs-gpios", 0);
444 if (!gpio_is_valid(gpio
)) {
445 dev_err(iodev
->dev
, "invalid buck1 gpio[0]: %d\n", gpio
);
448 pdata
->buck1_set1
= gpio
;
450 gpio
= of_get_named_gpio(pmic_np
, "max8998,pmic-buck1-dvs-gpios", 1);
451 if (!gpio_is_valid(gpio
)) {
452 dev_err(iodev
->dev
, "invalid buck1 gpio[1]: %d\n", gpio
);
455 pdata
->buck1_set2
= gpio
;
457 gpio
= of_get_named_gpio(pmic_np
, "max8998,pmic-buck2-dvs-gpio", 0);
458 if (!gpio_is_valid(gpio
)) {
459 dev_err(iodev
->dev
, "invalid buck 2 gpio: %d\n", gpio
);
462 pdata
->buck2_set3
= gpio
;
467 static int max8998_pmic_dt_parse_pdata(struct max8998_dev
*iodev
,
468 struct max8998_platform_data
*pdata
)
470 struct device_node
*pmic_np
= iodev
->dev
->of_node
;
471 struct device_node
*regulators_np
, *reg_np
;
472 struct max8998_regulator_data
*rdata
;
476 regulators_np
= of_get_child_by_name(pmic_np
, "regulators");
477 if (!regulators_np
) {
478 dev_err(iodev
->dev
, "could not find regulators sub-node\n");
482 /* count the number of regulators to be supported in pmic */
483 pdata
->num_regulators
= of_get_child_count(regulators_np
);
485 rdata
= devm_kcalloc(iodev
->dev
,
486 pdata
->num_regulators
, sizeof(*rdata
),
489 of_node_put(regulators_np
);
493 pdata
->regulators
= rdata
;
494 for (i
= 0; i
< ARRAY_SIZE(regulators
); ++i
) {
495 reg_np
= of_get_child_by_name(regulators_np
,
500 rdata
->id
= regulators
[i
].id
;
501 rdata
->initdata
= of_get_regulator_init_data(iodev
->dev
,
504 rdata
->reg_node
= reg_np
;
507 pdata
->num_regulators
= rdata
- pdata
->regulators
;
510 of_node_put(regulators_np
);
512 ret
= max8998_pmic_dt_parse_dvs_gpio(iodev
, pdata
, pmic_np
);
516 if (of_find_property(pmic_np
, "max8998,pmic-buck-voltage-lock", NULL
))
517 pdata
->buck_voltage_lock
= true;
519 ret
= of_property_read_u32(pmic_np
,
520 "max8998,pmic-buck1-default-dvs-idx",
521 &pdata
->buck1_default_idx
);
522 if (!ret
&& pdata
->buck1_default_idx
>= 4) {
523 pdata
->buck1_default_idx
= 0;
524 dev_warn(iodev
->dev
, "invalid value for default dvs index, using 0 instead\n");
527 ret
= of_property_read_u32(pmic_np
,
528 "max8998,pmic-buck2-default-dvs-idx",
529 &pdata
->buck2_default_idx
);
530 if (!ret
&& pdata
->buck2_default_idx
>= 2) {
531 pdata
->buck2_default_idx
= 0;
532 dev_warn(iodev
->dev
, "invalid value for default dvs index, using 0 instead\n");
535 ret
= of_property_read_u32_array(pmic_np
,
536 "max8998,pmic-buck1-dvs-voltage",
537 pdata
->buck1_voltage
,
538 ARRAY_SIZE(pdata
->buck1_voltage
));
540 dev_err(iodev
->dev
, "buck1 voltages not specified\n");
544 ret
= of_property_read_u32_array(pmic_np
,
545 "max8998,pmic-buck2-dvs-voltage",
546 pdata
->buck2_voltage
,
547 ARRAY_SIZE(pdata
->buck2_voltage
));
549 dev_err(iodev
->dev
, "buck2 voltages not specified\n");
556 static int max8998_pmic_probe(struct platform_device
*pdev
)
558 struct max8998_dev
*iodev
= dev_get_drvdata(pdev
->dev
.parent
);
559 struct max8998_platform_data
*pdata
= iodev
->pdata
;
560 struct regulator_config config
= { };
561 struct regulator_dev
*rdev
;
562 struct max8998_data
*max8998
;
563 struct i2c_client
*i2c
;
568 dev_err(pdev
->dev
.parent
, "No platform init data supplied\n");
572 if (IS_ENABLED(CONFIG_OF
) && iodev
->dev
->of_node
) {
573 ret
= max8998_pmic_dt_parse_pdata(iodev
, pdata
);
578 max8998
= devm_kzalloc(&pdev
->dev
, sizeof(struct max8998_data
),
583 max8998
->dev
= &pdev
->dev
;
584 max8998
->iodev
= iodev
;
585 max8998
->num_regulators
= pdata
->num_regulators
;
586 platform_set_drvdata(pdev
, max8998
);
587 i2c
= max8998
->iodev
->i2c
;
589 max8998
->buck1_idx
= pdata
->buck1_default_idx
;
590 max8998
->buck2_idx
= pdata
->buck2_default_idx
;
593 /* For unused GPIO NOT marked as -1 (thereof equal to 0) WARN_ON */
594 /* will be displayed */
596 /* Check if MAX8998 voltage selection GPIOs are defined */
597 if (gpio_is_valid(pdata
->buck1_set1
) &&
598 gpio_is_valid(pdata
->buck1_set2
)) {
599 /* Check if SET1 is not equal to 0 */
600 if (!pdata
->buck1_set1
) {
602 "MAX8998 SET1 GPIO defined as 0 !\n");
603 WARN_ON(!pdata
->buck1_set1
);
606 /* Check if SET2 is not equal to 0 */
607 if (!pdata
->buck1_set2
) {
609 "MAX8998 SET2 GPIO defined as 0 !\n");
610 WARN_ON(!pdata
->buck1_set2
);
614 gpio_request(pdata
->buck1_set1
, "MAX8998 BUCK1_SET1");
615 gpio_direction_output(pdata
->buck1_set1
,
616 max8998
->buck1_idx
& 0x1);
619 gpio_request(pdata
->buck1_set2
, "MAX8998 BUCK1_SET2");
620 gpio_direction_output(pdata
->buck1_set2
,
621 (max8998
->buck1_idx
>> 1) & 0x1);
623 /* Set predefined values for BUCK1 registers */
624 for (v
= 0; v
< ARRAY_SIZE(pdata
->buck1_voltage
); ++v
) {
625 int index
= MAX8998_BUCK1
- MAX8998_LDO2
;
628 while (regulators
[index
].min_uV
+
629 regulators
[index
].uV_step
* i
630 < pdata
->buck1_voltage
[v
])
633 max8998
->buck1_vol
[v
] = i
;
634 ret
= max8998_write_reg(i2c
,
635 MAX8998_REG_BUCK1_VOLTAGE1
+ v
, i
);
641 if (gpio_is_valid(pdata
->buck2_set3
)) {
642 /* Check if SET3 is not equal to 0 */
643 if (!pdata
->buck2_set3
) {
645 "MAX8998 SET3 GPIO defined as 0 !\n");
646 WARN_ON(!pdata
->buck2_set3
);
649 gpio_request(pdata
->buck2_set3
, "MAX8998 BUCK2_SET3");
650 gpio_direction_output(pdata
->buck2_set3
,
651 max8998
->buck2_idx
& 0x1);
653 /* Set predefined values for BUCK2 registers */
654 for (v
= 0; v
< ARRAY_SIZE(pdata
->buck2_voltage
); ++v
) {
655 int index
= MAX8998_BUCK2
- MAX8998_LDO2
;
658 while (regulators
[index
].min_uV
+
659 regulators
[index
].uV_step
* i
660 < pdata
->buck2_voltage
[v
])
663 max8998
->buck2_vol
[v
] = i
;
664 ret
= max8998_write_reg(i2c
,
665 MAX8998_REG_BUCK2_VOLTAGE1
+ v
, i
);
671 for (i
= 0; i
< pdata
->num_regulators
; i
++) {
672 int index
= pdata
->regulators
[i
].id
- MAX8998_LDO2
;
674 config
.dev
= max8998
->dev
;
675 config
.of_node
= pdata
->regulators
[i
].reg_node
;
676 config
.init_data
= pdata
->regulators
[i
].initdata
;
677 config
.driver_data
= max8998
;
679 rdev
= devm_regulator_register(&pdev
->dev
, ®ulators
[index
],
683 dev_err(max8998
->dev
, "regulator %s init failed (%d)\n",
684 regulators
[index
].name
, ret
);
692 static const struct platform_device_id max8998_pmic_id
[] = {
693 { "max8998-pmic", TYPE_MAX8998
},
694 { "lp3974-pmic", TYPE_LP3974
},
697 MODULE_DEVICE_TABLE(platform
, max8998_pmic_id
);
699 static struct platform_driver max8998_pmic_driver
= {
701 .name
= "max8998-pmic",
703 .probe
= max8998_pmic_probe
,
704 .id_table
= max8998_pmic_id
,
707 static int __init
max8998_pmic_init(void)
709 return platform_driver_register(&max8998_pmic_driver
);
711 subsys_initcall(max8998_pmic_init
);
713 static void __exit
max8998_pmic_cleanup(void)
715 platform_driver_unregister(&max8998_pmic_driver
);
717 module_exit(max8998_pmic_cleanup
);
719 MODULE_DESCRIPTION("MAXIM 8998 voltage regulator driver");
720 MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>");
721 MODULE_LICENSE("GPL");