2 * wm8350.c -- Voltage and current regulation for the Wolfson WM8350 PMIC
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
6 * Author: Liam Girdwood
7 * linux@wolfsonmicro.com
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
15 #include <linux/module.h>
16 #include <linux/moduleparam.h>
17 #include <linux/init.h>
18 #include <linux/bitops.h>
19 #include <linux/err.h>
20 #include <linux/i2c.h>
21 #include <linux/mfd/wm8350/core.h>
22 #include <linux/mfd/wm8350/pmic.h>
23 #include <linux/platform_device.h>
24 #include <linux/regulator/driver.h>
25 #include <linux/regulator/machine.h>
27 /* Maximum value possible for VSEL */
28 #define WM8350_DCDC_MAX_VSEL 0x66
31 static const int isink_cur
[] = {
98 static int get_isink_val(int min_uA
, int max_uA
, u16
*setting
)
102 for (i
= ARRAY_SIZE(isink_cur
) - 1; i
>= 0; i
--) {
103 if (min_uA
<= isink_cur
[i
] && max_uA
>= isink_cur
[i
]) {
111 static inline int wm8350_ldo_val_to_mvolts(unsigned int val
)
114 return (val
* 50) + 900;
116 return ((val
- 16) * 100) + 1800;
120 static inline unsigned int wm8350_ldo_mvolts_to_val(int mV
)
123 return (mV
- 900) / 50;
125 return ((mV
- 1800) / 100) + 16;
128 static inline int wm8350_dcdc_val_to_mvolts(unsigned int val
)
130 return (val
* 25) + 850;
133 static inline unsigned int wm8350_dcdc_mvolts_to_val(int mV
)
135 return (mV
- 850) / 25;
138 static int wm8350_isink_set_current(struct regulator_dev
*rdev
, int min_uA
,
141 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
142 int isink
= rdev_get_id(rdev
);
146 ret
= get_isink_val(min_uA
, max_uA
, &setting
);
152 val
= wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_A
) &
153 ~WM8350_CS1_ISEL_MASK
;
154 wm8350_reg_write(wm8350
, WM8350_CURRENT_SINK_DRIVER_A
,
158 val
= wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_B
) &
159 ~WM8350_CS1_ISEL_MASK
;
160 wm8350_reg_write(wm8350
, WM8350_CURRENT_SINK_DRIVER_B
,
170 static int wm8350_isink_get_current(struct regulator_dev
*rdev
)
172 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
173 int isink
= rdev_get_id(rdev
);
178 val
= wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_A
) &
179 WM8350_CS1_ISEL_MASK
;
182 val
= wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_B
) &
183 WM8350_CS1_ISEL_MASK
;
189 return (isink_cur
[val
] + 50) / 100;
192 /* turn on ISINK followed by DCDC */
193 static int wm8350_isink_enable(struct regulator_dev
*rdev
)
195 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
196 int isink
= rdev_get_id(rdev
);
200 switch (wm8350
->pmic
.isink_A_dcdc
) {
203 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_7
,
205 wm8350_set_bits(wm8350
, WM8350_CSA_FLASH_CONTROL
,
207 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
,
208 1 << (wm8350
->pmic
.isink_A_dcdc
-
216 switch (wm8350
->pmic
.isink_B_dcdc
) {
219 wm8350_set_bits(wm8350
, WM8350_POWER_MGMT_7
,
221 wm8350_set_bits(wm8350
, WM8350_CSB_FLASH_CONTROL
,
223 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
,
224 1 << (wm8350
->pmic
.isink_B_dcdc
-
237 static int wm8350_isink_disable(struct regulator_dev
*rdev
)
239 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
240 int isink
= rdev_get_id(rdev
);
244 switch (wm8350
->pmic
.isink_A_dcdc
) {
247 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
,
248 1 << (wm8350
->pmic
.isink_A_dcdc
-
250 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_7
,
258 switch (wm8350
->pmic
.isink_B_dcdc
) {
261 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
,
262 1 << (wm8350
->pmic
.isink_B_dcdc
-
264 wm8350_clear_bits(wm8350
, WM8350_POWER_MGMT_7
,
277 static int wm8350_isink_is_enabled(struct regulator_dev
*rdev
)
279 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
280 int isink
= rdev_get_id(rdev
);
284 return wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_A
) &
287 return wm8350_reg_read(wm8350
, WM8350_CURRENT_SINK_DRIVER_B
) &
293 int wm8350_isink_set_flash(struct wm8350
*wm8350
, int isink
, u16 mode
,
294 u16 trigger
, u16 duration
, u16 on_ramp
, u16 off_ramp
,
299 wm8350_reg_write(wm8350
, WM8350_CSA_FLASH_CONTROL
,
300 (mode
? WM8350_CS1_FLASH_MODE
: 0) |
301 (trigger
? WM8350_CS1_TRIGSRC
: 0) |
302 duration
| on_ramp
| off_ramp
| drive
);
305 wm8350_reg_write(wm8350
, WM8350_CSB_FLASH_CONTROL
,
306 (mode
? WM8350_CS2_FLASH_MODE
: 0) |
307 (trigger
? WM8350_CS2_TRIGSRC
: 0) |
308 duration
| on_ramp
| off_ramp
| drive
);
315 EXPORT_SYMBOL_GPL(wm8350_isink_set_flash
);
317 static int wm8350_dcdc_set_voltage(struct regulator_dev
*rdev
, int min_uV
,
320 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
321 int volt_reg
, dcdc
= rdev_get_id(rdev
), mV
,
322 min_mV
= min_uV
/ 1000, max_mV
= max_uV
/ 1000;
325 if (min_mV
< 850 || min_mV
> 4025)
327 if (max_mV
< 850 || max_mV
> 4025)
330 /* step size is 25mV */
331 mV
= (min_mV
- 826) / 25;
332 if (wm8350_dcdc_val_to_mvolts(mV
) > max_mV
)
334 BUG_ON(wm8350_dcdc_val_to_mvolts(mV
) < min_mV
);
338 volt_reg
= WM8350_DCDC1_CONTROL
;
341 volt_reg
= WM8350_DCDC3_CONTROL
;
344 volt_reg
= WM8350_DCDC4_CONTROL
;
347 volt_reg
= WM8350_DCDC6_CONTROL
;
355 /* all DCDCs have same mV bits */
356 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_DC1_VSEL_MASK
;
357 wm8350_reg_write(wm8350
, volt_reg
, val
| mV
);
361 static int wm8350_dcdc_get_voltage(struct regulator_dev
*rdev
)
363 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
364 int volt_reg
, dcdc
= rdev_get_id(rdev
);
369 volt_reg
= WM8350_DCDC1_CONTROL
;
372 volt_reg
= WM8350_DCDC3_CONTROL
;
375 volt_reg
= WM8350_DCDC4_CONTROL
;
378 volt_reg
= WM8350_DCDC6_CONTROL
;
386 /* all DCDCs have same mV bits */
387 val
= wm8350_reg_read(wm8350
, volt_reg
) & WM8350_DC1_VSEL_MASK
;
388 return wm8350_dcdc_val_to_mvolts(val
) * 1000;
391 static int wm8350_dcdc_list_voltage(struct regulator_dev
*rdev
,
394 if (selector
> WM8350_DCDC_MAX_VSEL
)
396 return wm8350_dcdc_val_to_mvolts(selector
) * 1000;
399 static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev
*rdev
, int uV
)
401 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
402 int volt_reg
, mV
= uV
/ 1000, dcdc
= rdev_get_id(rdev
);
405 dev_dbg(wm8350
->dev
, "%s %d mV %d\n", __func__
, dcdc
, mV
);
407 if (mV
&& (mV
< 850 || mV
> 4025)) {
409 "DCDC%d suspend voltage %d mV out of range\n",
418 volt_reg
= WM8350_DCDC1_LOW_POWER
;
421 volt_reg
= WM8350_DCDC3_LOW_POWER
;
424 volt_reg
= WM8350_DCDC4_LOW_POWER
;
427 volt_reg
= WM8350_DCDC6_LOW_POWER
;
435 /* all DCDCs have same mV bits */
436 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_DC1_VSEL_MASK
;
437 wm8350_reg_write(wm8350
, volt_reg
,
438 val
| wm8350_dcdc_mvolts_to_val(mV
));
442 static int wm8350_dcdc_set_suspend_enable(struct regulator_dev
*rdev
)
444 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
445 int dcdc
= rdev_get_id(rdev
);
450 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
)
451 & ~WM8350_DCDC_HIB_MODE_MASK
;
452 wm8350_reg_write(wm8350
, WM8350_DCDC1_LOW_POWER
,
453 wm8350
->pmic
.dcdc1_hib_mode
);
456 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
)
457 & ~WM8350_DCDC_HIB_MODE_MASK
;
458 wm8350_reg_write(wm8350
, WM8350_DCDC3_LOW_POWER
,
459 wm8350
->pmic
.dcdc3_hib_mode
);
462 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
)
463 & ~WM8350_DCDC_HIB_MODE_MASK
;
464 wm8350_reg_write(wm8350
, WM8350_DCDC4_LOW_POWER
,
465 wm8350
->pmic
.dcdc4_hib_mode
);
468 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
)
469 & ~WM8350_DCDC_HIB_MODE_MASK
;
470 wm8350_reg_write(wm8350
, WM8350_DCDC6_LOW_POWER
,
471 wm8350
->pmic
.dcdc6_hib_mode
);
482 static int wm8350_dcdc_set_suspend_disable(struct regulator_dev
*rdev
)
484 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
485 int dcdc
= rdev_get_id(rdev
);
490 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
);
491 wm8350
->pmic
.dcdc1_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
492 wm8350_reg_write(wm8350
, WM8350_DCDC1_LOW_POWER
,
493 WM8350_DCDC_HIB_MODE_DIS
);
496 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
);
497 wm8350
->pmic
.dcdc3_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
498 wm8350_reg_write(wm8350
, WM8350_DCDC3_LOW_POWER
,
499 WM8350_DCDC_HIB_MODE_DIS
);
502 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
);
503 wm8350
->pmic
.dcdc4_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
504 wm8350_reg_write(wm8350
, WM8350_DCDC4_LOW_POWER
,
505 WM8350_DCDC_HIB_MODE_DIS
);
508 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
);
509 wm8350
->pmic
.dcdc6_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
510 wm8350_reg_write(wm8350
, WM8350_DCDC6_LOW_POWER
,
511 WM8350_DCDC_HIB_MODE_DIS
);
522 static int wm8350_dcdc25_set_suspend_enable(struct regulator_dev
*rdev
)
524 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
525 int dcdc
= rdev_get_id(rdev
);
530 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
531 & ~WM8350_DC2_HIB_MODE_MASK
;
532 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
533 WM8350_DC2_HIB_MODE_ACTIVE
);
536 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
537 & ~WM8350_DC2_HIB_MODE_MASK
;
538 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
539 WM8350_DC5_HIB_MODE_ACTIVE
);
547 static int wm8350_dcdc25_set_suspend_disable(struct regulator_dev
*rdev
)
549 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
550 int dcdc
= rdev_get_id(rdev
);
555 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
556 & ~WM8350_DC2_HIB_MODE_MASK
;
557 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
558 WM8350_DC2_HIB_MODE_DISABLE
);
561 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
562 & ~WM8350_DC2_HIB_MODE_MASK
;
563 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
564 WM8350_DC2_HIB_MODE_DISABLE
);
572 static int wm8350_dcdc_set_suspend_mode(struct regulator_dev
*rdev
,
575 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
576 int dcdc
= rdev_get_id(rdev
);
581 hib_mode
= &wm8350
->pmic
.dcdc1_hib_mode
;
584 hib_mode
= &wm8350
->pmic
.dcdc3_hib_mode
;
587 hib_mode
= &wm8350
->pmic
.dcdc4_hib_mode
;
590 hib_mode
= &wm8350
->pmic
.dcdc6_hib_mode
;
599 case REGULATOR_MODE_NORMAL
:
600 *hib_mode
= WM8350_DCDC_HIB_MODE_IMAGE
;
602 case REGULATOR_MODE_IDLE
:
603 *hib_mode
= WM8350_DCDC_HIB_MODE_STANDBY
;
605 case REGULATOR_MODE_STANDBY
:
606 *hib_mode
= WM8350_DCDC_HIB_MODE_LDO_IM
;
615 static int wm8350_ldo_set_suspend_voltage(struct regulator_dev
*rdev
, int uV
)
617 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
618 int volt_reg
, mV
= uV
/ 1000, ldo
= rdev_get_id(rdev
);
621 dev_dbg(wm8350
->dev
, "%s %d mV %d\n", __func__
, ldo
, mV
);
623 if (mV
< 900 || mV
> 3300) {
624 dev_err(wm8350
->dev
, "LDO%d voltage %d mV out of range\n",
631 volt_reg
= WM8350_LDO1_LOW_POWER
;
634 volt_reg
= WM8350_LDO2_LOW_POWER
;
637 volt_reg
= WM8350_LDO3_LOW_POWER
;
640 volt_reg
= WM8350_LDO4_LOW_POWER
;
646 /* all LDOs have same mV bits */
647 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_VSEL_MASK
;
648 wm8350_reg_write(wm8350
, volt_reg
,
649 val
| wm8350_ldo_mvolts_to_val(mV
));
653 static int wm8350_ldo_set_suspend_enable(struct regulator_dev
*rdev
)
655 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
656 int volt_reg
, ldo
= rdev_get_id(rdev
);
661 volt_reg
= WM8350_LDO1_LOW_POWER
;
664 volt_reg
= WM8350_LDO2_LOW_POWER
;
667 volt_reg
= WM8350_LDO3_LOW_POWER
;
670 volt_reg
= WM8350_LDO4_LOW_POWER
;
676 /* all LDOs have same mV bits */
677 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_HIB_MODE_MASK
;
678 wm8350_reg_write(wm8350
, volt_reg
, val
);
682 static int wm8350_ldo_set_suspend_disable(struct regulator_dev
*rdev
)
684 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
685 int volt_reg
, ldo
= rdev_get_id(rdev
);
690 volt_reg
= WM8350_LDO1_LOW_POWER
;
693 volt_reg
= WM8350_LDO2_LOW_POWER
;
696 volt_reg
= WM8350_LDO3_LOW_POWER
;
699 volt_reg
= WM8350_LDO4_LOW_POWER
;
705 /* all LDOs have same mV bits */
706 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_HIB_MODE_MASK
;
707 wm8350_reg_write(wm8350
, volt_reg
, WM8350_LDO1_HIB_MODE_DIS
);
711 static int wm8350_ldo_set_voltage(struct regulator_dev
*rdev
, int min_uV
,
714 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
715 int volt_reg
, ldo
= rdev_get_id(rdev
), mV
, min_mV
= min_uV
/ 1000,
716 max_mV
= max_uV
/ 1000;
719 if (min_mV
< 900 || min_mV
> 3300)
721 if (max_mV
< 900 || max_mV
> 3300)
725 /* step size is 50mV < 1800mV */
726 mV
= (min_mV
- 851) / 50;
727 if (wm8350_ldo_val_to_mvolts(mV
) > max_mV
)
729 BUG_ON(wm8350_ldo_val_to_mvolts(mV
) < min_mV
);
731 /* step size is 100mV > 1800mV */
732 mV
= ((min_mV
- 1701) / 100) + 16;
733 if (wm8350_ldo_val_to_mvolts(mV
) > max_mV
)
735 BUG_ON(wm8350_ldo_val_to_mvolts(mV
) < min_mV
);
740 volt_reg
= WM8350_LDO1_CONTROL
;
743 volt_reg
= WM8350_LDO2_CONTROL
;
746 volt_reg
= WM8350_LDO3_CONTROL
;
749 volt_reg
= WM8350_LDO4_CONTROL
;
755 /* all LDOs have same mV bits */
756 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_VSEL_MASK
;
757 wm8350_reg_write(wm8350
, volt_reg
, val
| mV
);
761 static int wm8350_ldo_get_voltage(struct regulator_dev
*rdev
)
763 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
764 int volt_reg
, ldo
= rdev_get_id(rdev
);
769 volt_reg
= WM8350_LDO1_CONTROL
;
772 volt_reg
= WM8350_LDO2_CONTROL
;
775 volt_reg
= WM8350_LDO3_CONTROL
;
778 volt_reg
= WM8350_LDO4_CONTROL
;
784 /* all LDOs have same mV bits */
785 val
= wm8350_reg_read(wm8350
, volt_reg
) & WM8350_LDO1_VSEL_MASK
;
786 return wm8350_ldo_val_to_mvolts(val
) * 1000;
789 static int wm8350_ldo_list_voltage(struct regulator_dev
*rdev
,
792 if (selector
> WM8350_LDO1_VSEL_MASK
)
794 return wm8350_ldo_val_to_mvolts(selector
) * 1000;
797 int wm8350_dcdc_set_slot(struct wm8350
*wm8350
, int dcdc
, u16 start
,
803 dev_dbg(wm8350
->dev
, "%s %d start %d stop %d\n",
804 __func__
, dcdc
, start
, stop
);
807 if (start
> 15 || stop
> 15)
812 slot_reg
= WM8350_DCDC1_TIMEOUTS
;
815 slot_reg
= WM8350_DCDC2_TIMEOUTS
;
818 slot_reg
= WM8350_DCDC3_TIMEOUTS
;
821 slot_reg
= WM8350_DCDC4_TIMEOUTS
;
824 slot_reg
= WM8350_DCDC5_TIMEOUTS
;
827 slot_reg
= WM8350_DCDC6_TIMEOUTS
;
833 val
= wm8350_reg_read(wm8350
, slot_reg
) &
834 ~(WM8350_DC1_ENSLOT_MASK
| WM8350_DC1_SDSLOT_MASK
|
835 WM8350_DC1_ERRACT_MASK
);
836 wm8350_reg_write(wm8350
, slot_reg
,
837 val
| (start
<< WM8350_DC1_ENSLOT_SHIFT
) |
838 (stop
<< WM8350_DC1_SDSLOT_SHIFT
) |
839 (fault
<< WM8350_DC1_ERRACT_SHIFT
));
843 EXPORT_SYMBOL_GPL(wm8350_dcdc_set_slot
);
845 int wm8350_ldo_set_slot(struct wm8350
*wm8350
, int ldo
, u16 start
, u16 stop
)
850 dev_dbg(wm8350
->dev
, "%s %d start %d stop %d\n",
851 __func__
, ldo
, start
, stop
);
854 if (start
> 15 || stop
> 15)
859 slot_reg
= WM8350_LDO1_TIMEOUTS
;
862 slot_reg
= WM8350_LDO2_TIMEOUTS
;
865 slot_reg
= WM8350_LDO3_TIMEOUTS
;
868 slot_reg
= WM8350_LDO4_TIMEOUTS
;
874 val
= wm8350_reg_read(wm8350
, slot_reg
) & ~WM8350_LDO1_SDSLOT_MASK
;
875 wm8350_reg_write(wm8350
, slot_reg
, val
| ((start
<< 10) | (stop
<< 6)));
878 EXPORT_SYMBOL_GPL(wm8350_ldo_set_slot
);
880 int wm8350_dcdc25_set_mode(struct wm8350
*wm8350
, int dcdc
, u16 mode
,
881 u16 ilim
, u16 ramp
, u16 feedback
)
885 dev_dbg(wm8350
->dev
, "%s %d mode: %s %s\n", __func__
, dcdc
,
886 mode
? "normal" : "boost", ilim
? "low" : "normal");
890 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
891 & ~(WM8350_DC2_MODE_MASK
| WM8350_DC2_ILIM_MASK
|
892 WM8350_DC2_RMP_MASK
| WM8350_DC2_FBSRC_MASK
);
893 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
894 (mode
<< WM8350_DC2_MODE_SHIFT
) |
895 (ilim
<< WM8350_DC2_ILIM_SHIFT
) |
896 (ramp
<< WM8350_DC2_RMP_SHIFT
) |
897 (feedback
<< WM8350_DC2_FBSRC_SHIFT
));
900 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
901 & ~(WM8350_DC5_MODE_MASK
| WM8350_DC5_ILIM_MASK
|
902 WM8350_DC5_RMP_MASK
| WM8350_DC5_FBSRC_MASK
);
903 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
904 (mode
<< WM8350_DC5_MODE_SHIFT
) |
905 (ilim
<< WM8350_DC5_ILIM_SHIFT
) |
906 (ramp
<< WM8350_DC5_RMP_SHIFT
) |
907 (feedback
<< WM8350_DC5_FBSRC_SHIFT
));
915 EXPORT_SYMBOL_GPL(wm8350_dcdc25_set_mode
);
917 static int wm8350_dcdc_enable(struct regulator_dev
*rdev
)
919 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
920 int dcdc
= rdev_get_id(rdev
);
923 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
926 shift
= dcdc
- WM8350_DCDC_1
;
927 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
931 static int wm8350_dcdc_disable(struct regulator_dev
*rdev
)
933 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
934 int dcdc
= rdev_get_id(rdev
);
937 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
940 shift
= dcdc
- WM8350_DCDC_1
;
941 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
946 static int wm8350_ldo_enable(struct regulator_dev
*rdev
)
948 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
949 int ldo
= rdev_get_id(rdev
);
952 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
955 shift
= (ldo
- WM8350_LDO_1
) + 8;
956 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
960 static int wm8350_ldo_disable(struct regulator_dev
*rdev
)
962 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
963 int ldo
= rdev_get_id(rdev
);
966 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
969 shift
= (ldo
- WM8350_LDO_1
) + 8;
970 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
974 static int force_continuous_enable(struct wm8350
*wm8350
, int dcdc
, int enable
)
980 reg
= WM8350_DCDC1_FORCE_PWM
;
983 reg
= WM8350_DCDC3_FORCE_PWM
;
986 reg
= WM8350_DCDC4_FORCE_PWM
;
989 reg
= WM8350_DCDC6_FORCE_PWM
;
996 ret
= wm8350_set_bits(wm8350
, reg
,
997 WM8350_DCDC1_FORCE_PWM_ENA
);
999 ret
= wm8350_clear_bits(wm8350
, reg
,
1000 WM8350_DCDC1_FORCE_PWM_ENA
);
1004 static int wm8350_dcdc_set_mode(struct regulator_dev
*rdev
, unsigned int mode
)
1006 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1007 int dcdc
= rdev_get_id(rdev
);
1010 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
1013 if (dcdc
== WM8350_DCDC_2
|| dcdc
== WM8350_DCDC_5
)
1016 val
= 1 << (dcdc
- WM8350_DCDC_1
);
1019 case REGULATOR_MODE_FAST
:
1020 /* force continuous mode */
1021 wm8350_set_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1022 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1023 force_continuous_enable(wm8350
, dcdc
, 1);
1025 case REGULATOR_MODE_NORMAL
:
1026 /* active / pulse skipping */
1027 wm8350_set_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1028 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1029 force_continuous_enable(wm8350
, dcdc
, 0);
1031 case REGULATOR_MODE_IDLE
:
1033 force_continuous_enable(wm8350
, dcdc
, 0);
1034 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1035 wm8350_clear_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1037 case REGULATOR_MODE_STANDBY
:
1039 force_continuous_enable(wm8350
, dcdc
, 0);
1040 wm8350_set_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1047 static unsigned int wm8350_dcdc_get_mode(struct regulator_dev
*rdev
)
1049 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1050 int dcdc
= rdev_get_id(rdev
);
1051 u16 mask
, sleep
, active
, force
;
1052 int mode
= REGULATOR_MODE_NORMAL
;
1057 reg
= WM8350_DCDC1_FORCE_PWM
;
1060 reg
= WM8350_DCDC3_FORCE_PWM
;
1063 reg
= WM8350_DCDC4_FORCE_PWM
;
1066 reg
= WM8350_DCDC6_FORCE_PWM
;
1072 mask
= 1 << (dcdc
- WM8350_DCDC_1
);
1073 active
= wm8350_reg_read(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
) & mask
;
1074 force
= wm8350_reg_read(wm8350
, reg
) & WM8350_DCDC1_FORCE_PWM_ENA
;
1075 sleep
= wm8350_reg_read(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
) & mask
;
1077 dev_dbg(wm8350
->dev
, "mask %x active %x sleep %x force %x",
1078 mask
, active
, sleep
, force
);
1080 if (active
&& !sleep
) {
1082 mode
= REGULATOR_MODE_FAST
;
1084 mode
= REGULATOR_MODE_NORMAL
;
1085 } else if (!active
&& !sleep
)
1086 mode
= REGULATOR_MODE_IDLE
;
1088 mode
= REGULATOR_MODE_STANDBY
;
1093 static unsigned int wm8350_ldo_get_mode(struct regulator_dev
*rdev
)
1095 return REGULATOR_MODE_NORMAL
;
1098 struct wm8350_dcdc_efficiency
{
1104 static const struct wm8350_dcdc_efficiency dcdc1_6_efficiency
[] = {
1105 {0, 10000, REGULATOR_MODE_STANDBY
}, /* 0 - 10mA - LDO */
1106 {10000, 100000, REGULATOR_MODE_IDLE
}, /* 10mA - 100mA - Standby */
1107 {100000, 1000000, REGULATOR_MODE_NORMAL
}, /* > 100mA - Active */
1108 {-1, -1, REGULATOR_MODE_NORMAL
},
1111 static const struct wm8350_dcdc_efficiency dcdc3_4_efficiency
[] = {
1112 {0, 10000, REGULATOR_MODE_STANDBY
}, /* 0 - 10mA - LDO */
1113 {10000, 100000, REGULATOR_MODE_IDLE
}, /* 10mA - 100mA - Standby */
1114 {100000, 800000, REGULATOR_MODE_NORMAL
}, /* > 100mA - Active */
1115 {-1, -1, REGULATOR_MODE_NORMAL
},
1118 static unsigned int get_mode(int uA
, const struct wm8350_dcdc_efficiency
*eff
)
1122 while (eff
[i
].uA_load_min
!= -1) {
1123 if (uA
>= eff
[i
].uA_load_min
&& uA
<= eff
[i
].uA_load_max
)
1126 return REGULATOR_MODE_NORMAL
;
1129 /* Query the regulator for it's most efficient mode @ uV,uA
1130 * WM8350 regulator efficiency is pretty similar over
1131 * different input and output uV.
1133 static unsigned int wm8350_dcdc_get_optimum_mode(struct regulator_dev
*rdev
,
1134 int input_uV
, int output_uV
,
1137 int dcdc
= rdev_get_id(rdev
), mode
;
1142 mode
= get_mode(output_uA
, dcdc1_6_efficiency
);
1146 mode
= get_mode(output_uA
, dcdc3_4_efficiency
);
1149 mode
= REGULATOR_MODE_NORMAL
;
1155 static int wm8350_dcdc_is_enabled(struct regulator_dev
*rdev
)
1157 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1158 int dcdc
= rdev_get_id(rdev
), shift
;
1160 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
1163 shift
= dcdc
- WM8350_DCDC_1
;
1164 return wm8350_reg_read(wm8350
, WM8350_DCDC_LDO_REQUESTED
)
1168 static int wm8350_ldo_is_enabled(struct regulator_dev
*rdev
)
1170 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1171 int ldo
= rdev_get_id(rdev
), shift
;
1173 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
1176 shift
= (ldo
- WM8350_LDO_1
) + 8;
1177 return wm8350_reg_read(wm8350
, WM8350_DCDC_LDO_REQUESTED
)
1181 static struct regulator_ops wm8350_dcdc_ops
= {
1182 .set_voltage
= wm8350_dcdc_set_voltage
,
1183 .get_voltage
= wm8350_dcdc_get_voltage
,
1184 .list_voltage
= wm8350_dcdc_list_voltage
,
1185 .enable
= wm8350_dcdc_enable
,
1186 .disable
= wm8350_dcdc_disable
,
1187 .get_mode
= wm8350_dcdc_get_mode
,
1188 .set_mode
= wm8350_dcdc_set_mode
,
1189 .get_optimum_mode
= wm8350_dcdc_get_optimum_mode
,
1190 .is_enabled
= wm8350_dcdc_is_enabled
,
1191 .set_suspend_voltage
= wm8350_dcdc_set_suspend_voltage
,
1192 .set_suspend_enable
= wm8350_dcdc_set_suspend_enable
,
1193 .set_suspend_disable
= wm8350_dcdc_set_suspend_disable
,
1194 .set_suspend_mode
= wm8350_dcdc_set_suspend_mode
,
1197 static struct regulator_ops wm8350_dcdc2_5_ops
= {
1198 .enable
= wm8350_dcdc_enable
,
1199 .disable
= wm8350_dcdc_disable
,
1200 .is_enabled
= wm8350_dcdc_is_enabled
,
1201 .set_suspend_enable
= wm8350_dcdc25_set_suspend_enable
,
1202 .set_suspend_disable
= wm8350_dcdc25_set_suspend_disable
,
1205 static struct regulator_ops wm8350_ldo_ops
= {
1206 .set_voltage
= wm8350_ldo_set_voltage
,
1207 .get_voltage
= wm8350_ldo_get_voltage
,
1208 .list_voltage
= wm8350_ldo_list_voltage
,
1209 .enable
= wm8350_ldo_enable
,
1210 .disable
= wm8350_ldo_disable
,
1211 .is_enabled
= wm8350_ldo_is_enabled
,
1212 .get_mode
= wm8350_ldo_get_mode
,
1213 .set_suspend_voltage
= wm8350_ldo_set_suspend_voltage
,
1214 .set_suspend_enable
= wm8350_ldo_set_suspend_enable
,
1215 .set_suspend_disable
= wm8350_ldo_set_suspend_disable
,
1218 static struct regulator_ops wm8350_isink_ops
= {
1219 .set_current_limit
= wm8350_isink_set_current
,
1220 .get_current_limit
= wm8350_isink_get_current
,
1221 .enable
= wm8350_isink_enable
,
1222 .disable
= wm8350_isink_disable
,
1223 .is_enabled
= wm8350_isink_is_enabled
,
1226 static struct regulator_desc wm8350_reg
[NUM_WM8350_REGULATORS
] = {
1229 .id
= WM8350_DCDC_1
,
1230 .ops
= &wm8350_dcdc_ops
,
1231 .irq
= WM8350_IRQ_UV_DC1
,
1232 .type
= REGULATOR_VOLTAGE
,
1233 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1234 .owner
= THIS_MODULE
,
1238 .id
= WM8350_DCDC_2
,
1239 .ops
= &wm8350_dcdc2_5_ops
,
1240 .irq
= WM8350_IRQ_UV_DC2
,
1241 .type
= REGULATOR_VOLTAGE
,
1242 .owner
= THIS_MODULE
,
1246 .id
= WM8350_DCDC_3
,
1247 .ops
= &wm8350_dcdc_ops
,
1248 .irq
= WM8350_IRQ_UV_DC3
,
1249 .type
= REGULATOR_VOLTAGE
,
1250 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1251 .owner
= THIS_MODULE
,
1255 .id
= WM8350_DCDC_4
,
1256 .ops
= &wm8350_dcdc_ops
,
1257 .irq
= WM8350_IRQ_UV_DC4
,
1258 .type
= REGULATOR_VOLTAGE
,
1259 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1260 .owner
= THIS_MODULE
,
1264 .id
= WM8350_DCDC_5
,
1265 .ops
= &wm8350_dcdc2_5_ops
,
1266 .irq
= WM8350_IRQ_UV_DC5
,
1267 .type
= REGULATOR_VOLTAGE
,
1268 .owner
= THIS_MODULE
,
1272 .id
= WM8350_DCDC_6
,
1273 .ops
= &wm8350_dcdc_ops
,
1274 .irq
= WM8350_IRQ_UV_DC6
,
1275 .type
= REGULATOR_VOLTAGE
,
1276 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1277 .owner
= THIS_MODULE
,
1282 .ops
= &wm8350_ldo_ops
,
1283 .irq
= WM8350_IRQ_UV_LDO1
,
1284 .type
= REGULATOR_VOLTAGE
,
1285 .n_voltages
= WM8350_LDO1_VSEL_MASK
+ 1,
1286 .owner
= THIS_MODULE
,
1291 .ops
= &wm8350_ldo_ops
,
1292 .irq
= WM8350_IRQ_UV_LDO2
,
1293 .type
= REGULATOR_VOLTAGE
,
1294 .n_voltages
= WM8350_LDO2_VSEL_MASK
+ 1,
1295 .owner
= THIS_MODULE
,
1300 .ops
= &wm8350_ldo_ops
,
1301 .irq
= WM8350_IRQ_UV_LDO3
,
1302 .type
= REGULATOR_VOLTAGE
,
1303 .n_voltages
= WM8350_LDO3_VSEL_MASK
+ 1,
1304 .owner
= THIS_MODULE
,
1309 .ops
= &wm8350_ldo_ops
,
1310 .irq
= WM8350_IRQ_UV_LDO4
,
1311 .type
= REGULATOR_VOLTAGE
,
1312 .n_voltages
= WM8350_LDO4_VSEL_MASK
+ 1,
1313 .owner
= THIS_MODULE
,
1317 .id
= WM8350_ISINK_A
,
1318 .ops
= &wm8350_isink_ops
,
1319 .irq
= WM8350_IRQ_CS1
,
1320 .type
= REGULATOR_CURRENT
,
1321 .owner
= THIS_MODULE
,
1325 .id
= WM8350_ISINK_B
,
1326 .ops
= &wm8350_isink_ops
,
1327 .irq
= WM8350_IRQ_CS2
,
1328 .type
= REGULATOR_CURRENT
,
1329 .owner
= THIS_MODULE
,
1333 static void pmic_uv_handler(struct wm8350
*wm8350
, int irq
, void *data
)
1335 struct regulator_dev
*rdev
= (struct regulator_dev
*)data
;
1337 mutex_lock(&rdev
->mutex
);
1338 if (irq
== WM8350_IRQ_CS1
|| irq
== WM8350_IRQ_CS2
)
1339 regulator_notifier_call_chain(rdev
,
1340 REGULATOR_EVENT_REGULATION_OUT
,
1343 regulator_notifier_call_chain(rdev
,
1344 REGULATOR_EVENT_UNDER_VOLTAGE
,
1346 mutex_unlock(&rdev
->mutex
);
1349 static int wm8350_regulator_probe(struct platform_device
*pdev
)
1351 struct wm8350
*wm8350
= dev_get_drvdata(&pdev
->dev
);
1352 struct regulator_dev
*rdev
;
1356 if (pdev
->id
< WM8350_DCDC_1
|| pdev
->id
> WM8350_ISINK_B
)
1359 /* do any regulatior specific init */
1362 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
);
1363 wm8350
->pmic
.dcdc1_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1366 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
);
1367 wm8350
->pmic
.dcdc3_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1370 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
);
1371 wm8350
->pmic
.dcdc4_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1374 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
);
1375 wm8350
->pmic
.dcdc6_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1379 /* register regulator */
1380 rdev
= regulator_register(&wm8350_reg
[pdev
->id
], &pdev
->dev
,
1381 pdev
->dev
.platform_data
,
1382 dev_get_drvdata(&pdev
->dev
));
1384 dev_err(&pdev
->dev
, "failed to register %s\n",
1385 wm8350_reg
[pdev
->id
].name
);
1386 return PTR_ERR(rdev
);
1389 /* register regulator IRQ */
1390 ret
= wm8350_register_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
,
1391 pmic_uv_handler
, rdev
);
1393 regulator_unregister(rdev
);
1394 dev_err(&pdev
->dev
, "failed to register regulator %s IRQ\n",
1395 wm8350_reg
[pdev
->id
].name
);
1399 wm8350_unmask_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
);
1404 static int wm8350_regulator_remove(struct platform_device
*pdev
)
1406 struct regulator_dev
*rdev
= platform_get_drvdata(pdev
);
1407 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1409 wm8350_mask_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
);
1410 wm8350_free_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
);
1412 regulator_unregister(rdev
);
1417 int wm8350_register_regulator(struct wm8350
*wm8350
, int reg
,
1418 struct regulator_init_data
*initdata
)
1420 struct platform_device
*pdev
;
1422 if (reg
< 0 || reg
>= NUM_WM8350_REGULATORS
)
1425 if (wm8350
->pmic
.pdev
[reg
])
1428 if (reg
>= WM8350_DCDC_1
&& reg
<= WM8350_DCDC_6
&&
1429 reg
> wm8350
->pmic
.max_dcdc
)
1431 if (reg
>= WM8350_ISINK_A
&& reg
<= WM8350_ISINK_B
&&
1432 reg
> wm8350
->pmic
.max_isink
)
1435 pdev
= platform_device_alloc("wm8350-regulator", reg
);
1439 wm8350
->pmic
.pdev
[reg
] = pdev
;
1441 initdata
->driver_data
= wm8350
;
1443 pdev
->dev
.platform_data
= initdata
;
1444 pdev
->dev
.parent
= wm8350
->dev
;
1445 platform_set_drvdata(pdev
, wm8350
);
1447 ret
= platform_device_add(pdev
);
1450 dev_err(wm8350
->dev
, "Failed to register regulator %d: %d\n",
1452 platform_device_del(pdev
);
1453 wm8350
->pmic
.pdev
[reg
] = NULL
;
1458 EXPORT_SYMBOL_GPL(wm8350_register_regulator
);
1461 * wm8350_register_led - Register a WM8350 LED output
1463 * @param wm8350 The WM8350 device to configure.
1464 * @param lednum LED device index to create.
1465 * @param dcdc The DCDC to use for the LED.
1466 * @param isink The ISINK to use for the LED.
1467 * @param pdata Configuration for the LED.
1469 * The WM8350 supports the use of an ISINK together with a DCDC to
1470 * provide a power-efficient LED driver. This function registers the
1471 * regulators and instantiates the platform device for a LED. The
1472 * operating modes for the LED regulators must be configured using
1473 * wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
1474 * wm8350_dcdc_set_slot() prior to calling this function.
1476 int wm8350_register_led(struct wm8350
*wm8350
, int lednum
, int dcdc
, int isink
,
1477 struct wm8350_led_platform_data
*pdata
)
1479 struct wm8350_led
*led
;
1480 struct platform_device
*pdev
;
1483 if (lednum
>= ARRAY_SIZE(wm8350
->pmic
.led
) || lednum
< 0) {
1484 dev_err(wm8350
->dev
, "Invalid LED index %d\n", lednum
);
1488 led
= &wm8350
->pmic
.led
[lednum
];
1491 dev_err(wm8350
->dev
, "LED %d already allocated\n", lednum
);
1495 pdev
= platform_device_alloc("wm8350-led", lednum
);
1497 dev_err(wm8350
->dev
, "Failed to allocate LED %d\n", lednum
);
1501 led
->isink_consumer
.dev
= &pdev
->dev
;
1502 led
->isink_consumer
.supply
= "led_isink";
1503 led
->isink_init
.num_consumer_supplies
= 1;
1504 led
->isink_init
.consumer_supplies
= &led
->isink_consumer
;
1505 led
->isink_init
.constraints
.min_uA
= 0;
1506 led
->isink_init
.constraints
.max_uA
= pdata
->max_uA
;
1507 led
->isink_init
.constraints
.valid_ops_mask
= REGULATOR_CHANGE_CURRENT
;
1508 led
->isink_init
.constraints
.valid_modes_mask
= REGULATOR_MODE_NORMAL
;
1509 ret
= wm8350_register_regulator(wm8350
, isink
, &led
->isink_init
);
1511 platform_device_put(pdev
);
1515 led
->dcdc_consumer
.dev
= &pdev
->dev
;
1516 led
->dcdc_consumer
.supply
= "led_vcc";
1517 led
->dcdc_init
.num_consumer_supplies
= 1;
1518 led
->dcdc_init
.consumer_supplies
= &led
->dcdc_consumer
;
1519 led
->dcdc_init
.constraints
.valid_modes_mask
= REGULATOR_MODE_NORMAL
;
1520 ret
= wm8350_register_regulator(wm8350
, dcdc
, &led
->dcdc_init
);
1522 platform_device_put(pdev
);
1527 case WM8350_ISINK_A
:
1528 wm8350
->pmic
.isink_A_dcdc
= dcdc
;
1530 case WM8350_ISINK_B
:
1531 wm8350
->pmic
.isink_B_dcdc
= dcdc
;
1535 pdev
->dev
.platform_data
= pdata
;
1536 pdev
->dev
.parent
= wm8350
->dev
;
1537 ret
= platform_device_add(pdev
);
1539 dev_err(wm8350
->dev
, "Failed to register LED %d: %d\n",
1541 platform_device_put(pdev
);
1549 EXPORT_SYMBOL_GPL(wm8350_register_led
);
1551 static struct platform_driver wm8350_regulator_driver
= {
1552 .probe
= wm8350_regulator_probe
,
1553 .remove
= wm8350_regulator_remove
,
1555 .name
= "wm8350-regulator",
1559 static int __init
wm8350_regulator_init(void)
1561 return platform_driver_register(&wm8350_regulator_driver
);
1563 subsys_initcall(wm8350_regulator_init
);
1565 static void __exit
wm8350_regulator_exit(void)
1567 platform_driver_unregister(&wm8350_regulator_driver
);
1569 module_exit(wm8350_regulator_exit
);
1571 /* Module information */
1572 MODULE_AUTHOR("Liam Girdwood");
1573 MODULE_DESCRIPTION("WM8350 voltage and current regulator driver");
1574 MODULE_LICENSE("GPL");
1575 MODULE_ALIAS("platform:wm8350-regulator");