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 static int wm8350_isink_enable_time(struct regulator_dev
*rdev
)
295 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
296 int isink
= rdev_get_id(rdev
);
301 reg
= wm8350_reg_read(wm8350
, WM8350_CSA_FLASH_CONTROL
);
304 reg
= wm8350_reg_read(wm8350
, WM8350_CSB_FLASH_CONTROL
);
310 if (reg
& WM8350_CS1_FLASH_MODE
) {
311 switch (reg
& WM8350_CS1_ON_RAMP_MASK
) {
322 switch (reg
& WM8350_CS1_ON_RAMP_MASK
) {
338 int wm8350_isink_set_flash(struct wm8350
*wm8350
, int isink
, u16 mode
,
339 u16 trigger
, u16 duration
, u16 on_ramp
, u16 off_ramp
,
344 wm8350_reg_write(wm8350
, WM8350_CSA_FLASH_CONTROL
,
345 (mode
? WM8350_CS1_FLASH_MODE
: 0) |
346 (trigger
? WM8350_CS1_TRIGSRC
: 0) |
347 duration
| on_ramp
| off_ramp
| drive
);
350 wm8350_reg_write(wm8350
, WM8350_CSB_FLASH_CONTROL
,
351 (mode
? WM8350_CS2_FLASH_MODE
: 0) |
352 (trigger
? WM8350_CS2_TRIGSRC
: 0) |
353 duration
| on_ramp
| off_ramp
| drive
);
360 EXPORT_SYMBOL_GPL(wm8350_isink_set_flash
);
362 static int wm8350_dcdc_set_voltage(struct regulator_dev
*rdev
, int min_uV
,
363 int max_uV
, unsigned *selector
)
365 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
366 int volt_reg
, dcdc
= rdev_get_id(rdev
), mV
,
367 min_mV
= min_uV
/ 1000, max_mV
= max_uV
/ 1000;
370 if (min_mV
< 850 || min_mV
> 4025)
372 if (max_mV
< 850 || max_mV
> 4025)
375 /* step size is 25mV */
376 mV
= (min_mV
- 826) / 25;
377 if (wm8350_dcdc_val_to_mvolts(mV
) > max_mV
)
379 BUG_ON(wm8350_dcdc_val_to_mvolts(mV
) < min_mV
);
383 volt_reg
= WM8350_DCDC1_CONTROL
;
386 volt_reg
= WM8350_DCDC3_CONTROL
;
389 volt_reg
= WM8350_DCDC4_CONTROL
;
392 volt_reg
= WM8350_DCDC6_CONTROL
;
402 /* all DCDCs have same mV bits */
403 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_DC1_VSEL_MASK
;
404 wm8350_reg_write(wm8350
, volt_reg
, val
| mV
);
408 static int wm8350_dcdc_get_voltage_sel(struct regulator_dev
*rdev
)
410 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
411 int volt_reg
, dcdc
= rdev_get_id(rdev
);
415 volt_reg
= WM8350_DCDC1_CONTROL
;
418 volt_reg
= WM8350_DCDC3_CONTROL
;
421 volt_reg
= WM8350_DCDC4_CONTROL
;
424 volt_reg
= WM8350_DCDC6_CONTROL
;
432 /* all DCDCs have same mV bits */
433 return wm8350_reg_read(wm8350
, volt_reg
) & WM8350_DC1_VSEL_MASK
;
436 static int wm8350_dcdc_list_voltage(struct regulator_dev
*rdev
,
439 if (selector
> WM8350_DCDC_MAX_VSEL
)
441 return wm8350_dcdc_val_to_mvolts(selector
) * 1000;
444 static int wm8350_dcdc_set_suspend_voltage(struct regulator_dev
*rdev
, int uV
)
446 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
447 int volt_reg
, mV
= uV
/ 1000, dcdc
= rdev_get_id(rdev
);
450 dev_dbg(wm8350
->dev
, "%s %d mV %d\n", __func__
, dcdc
, mV
);
452 if (mV
&& (mV
< 850 || mV
> 4025)) {
454 "DCDC%d suspend voltage %d mV out of range\n",
463 volt_reg
= WM8350_DCDC1_LOW_POWER
;
466 volt_reg
= WM8350_DCDC3_LOW_POWER
;
469 volt_reg
= WM8350_DCDC4_LOW_POWER
;
472 volt_reg
= WM8350_DCDC6_LOW_POWER
;
480 /* all DCDCs have same mV bits */
481 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_DC1_VSEL_MASK
;
482 wm8350_reg_write(wm8350
, volt_reg
,
483 val
| wm8350_dcdc_mvolts_to_val(mV
));
487 static int wm8350_dcdc_set_suspend_enable(struct regulator_dev
*rdev
)
489 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
490 int dcdc
= rdev_get_id(rdev
);
495 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
)
496 & ~WM8350_DCDC_HIB_MODE_MASK
;
497 wm8350_reg_write(wm8350
, WM8350_DCDC1_LOW_POWER
,
498 wm8350
->pmic
.dcdc1_hib_mode
);
501 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
)
502 & ~WM8350_DCDC_HIB_MODE_MASK
;
503 wm8350_reg_write(wm8350
, WM8350_DCDC3_LOW_POWER
,
504 wm8350
->pmic
.dcdc3_hib_mode
);
507 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
)
508 & ~WM8350_DCDC_HIB_MODE_MASK
;
509 wm8350_reg_write(wm8350
, WM8350_DCDC4_LOW_POWER
,
510 wm8350
->pmic
.dcdc4_hib_mode
);
513 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
)
514 & ~WM8350_DCDC_HIB_MODE_MASK
;
515 wm8350_reg_write(wm8350
, WM8350_DCDC6_LOW_POWER
,
516 wm8350
->pmic
.dcdc6_hib_mode
);
527 static int wm8350_dcdc_set_suspend_disable(struct regulator_dev
*rdev
)
529 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
530 int dcdc
= rdev_get_id(rdev
);
535 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
);
536 wm8350
->pmic
.dcdc1_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
537 wm8350_reg_write(wm8350
, WM8350_DCDC1_LOW_POWER
,
538 WM8350_DCDC_HIB_MODE_DIS
);
541 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
);
542 wm8350
->pmic
.dcdc3_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
543 wm8350_reg_write(wm8350
, WM8350_DCDC3_LOW_POWER
,
544 WM8350_DCDC_HIB_MODE_DIS
);
547 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
);
548 wm8350
->pmic
.dcdc4_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
549 wm8350_reg_write(wm8350
, WM8350_DCDC4_LOW_POWER
,
550 WM8350_DCDC_HIB_MODE_DIS
);
553 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
);
554 wm8350
->pmic
.dcdc6_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
555 wm8350_reg_write(wm8350
, WM8350_DCDC6_LOW_POWER
,
556 WM8350_DCDC_HIB_MODE_DIS
);
567 static int wm8350_dcdc25_set_suspend_enable(struct regulator_dev
*rdev
)
569 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
570 int dcdc
= rdev_get_id(rdev
);
575 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
576 & ~WM8350_DC2_HIB_MODE_MASK
;
577 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
578 WM8350_DC2_HIB_MODE_ACTIVE
);
581 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
582 & ~WM8350_DC2_HIB_MODE_MASK
;
583 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
584 WM8350_DC5_HIB_MODE_ACTIVE
);
592 static int wm8350_dcdc25_set_suspend_disable(struct regulator_dev
*rdev
)
594 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
595 int dcdc
= rdev_get_id(rdev
);
600 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
601 & ~WM8350_DC2_HIB_MODE_MASK
;
602 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
603 WM8350_DC2_HIB_MODE_DISABLE
);
606 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
607 & ~WM8350_DC2_HIB_MODE_MASK
;
608 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
609 WM8350_DC2_HIB_MODE_DISABLE
);
617 static int wm8350_dcdc_set_suspend_mode(struct regulator_dev
*rdev
,
620 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
621 int dcdc
= rdev_get_id(rdev
);
626 hib_mode
= &wm8350
->pmic
.dcdc1_hib_mode
;
629 hib_mode
= &wm8350
->pmic
.dcdc3_hib_mode
;
632 hib_mode
= &wm8350
->pmic
.dcdc4_hib_mode
;
635 hib_mode
= &wm8350
->pmic
.dcdc6_hib_mode
;
644 case REGULATOR_MODE_NORMAL
:
645 *hib_mode
= WM8350_DCDC_HIB_MODE_IMAGE
;
647 case REGULATOR_MODE_IDLE
:
648 *hib_mode
= WM8350_DCDC_HIB_MODE_STANDBY
;
650 case REGULATOR_MODE_STANDBY
:
651 *hib_mode
= WM8350_DCDC_HIB_MODE_LDO_IM
;
660 static int wm8350_ldo_set_suspend_voltage(struct regulator_dev
*rdev
, int uV
)
662 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
663 int volt_reg
, mV
= uV
/ 1000, ldo
= rdev_get_id(rdev
);
666 dev_dbg(wm8350
->dev
, "%s %d mV %d\n", __func__
, ldo
, mV
);
668 if (mV
< 900 || mV
> 3300) {
669 dev_err(wm8350
->dev
, "LDO%d voltage %d mV out of range\n",
676 volt_reg
= WM8350_LDO1_LOW_POWER
;
679 volt_reg
= WM8350_LDO2_LOW_POWER
;
682 volt_reg
= WM8350_LDO3_LOW_POWER
;
685 volt_reg
= WM8350_LDO4_LOW_POWER
;
691 /* all LDOs have same mV bits */
692 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_VSEL_MASK
;
693 wm8350_reg_write(wm8350
, volt_reg
,
694 val
| wm8350_ldo_mvolts_to_val(mV
));
698 static int wm8350_ldo_set_suspend_enable(struct regulator_dev
*rdev
)
700 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
701 int volt_reg
, ldo
= rdev_get_id(rdev
);
706 volt_reg
= WM8350_LDO1_LOW_POWER
;
709 volt_reg
= WM8350_LDO2_LOW_POWER
;
712 volt_reg
= WM8350_LDO3_LOW_POWER
;
715 volt_reg
= WM8350_LDO4_LOW_POWER
;
721 /* all LDOs have same mV bits */
722 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_HIB_MODE_MASK
;
723 wm8350_reg_write(wm8350
, volt_reg
, val
);
727 static int wm8350_ldo_set_suspend_disable(struct regulator_dev
*rdev
)
729 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
730 int volt_reg
, ldo
= rdev_get_id(rdev
);
735 volt_reg
= WM8350_LDO1_LOW_POWER
;
738 volt_reg
= WM8350_LDO2_LOW_POWER
;
741 volt_reg
= WM8350_LDO3_LOW_POWER
;
744 volt_reg
= WM8350_LDO4_LOW_POWER
;
750 /* all LDOs have same mV bits */
751 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_HIB_MODE_MASK
;
752 wm8350_reg_write(wm8350
, volt_reg
, WM8350_LDO1_HIB_MODE_DIS
);
756 static int wm8350_ldo_set_voltage(struct regulator_dev
*rdev
, int min_uV
,
757 int max_uV
, unsigned *selector
)
759 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
760 int volt_reg
, ldo
= rdev_get_id(rdev
), mV
, min_mV
= min_uV
/ 1000,
761 max_mV
= max_uV
/ 1000;
764 if (min_mV
< 900 || min_mV
> 3300)
766 if (max_mV
< 900 || max_mV
> 3300)
770 /* step size is 50mV < 1800mV */
771 mV
= (min_mV
- 851) / 50;
772 if (wm8350_ldo_val_to_mvolts(mV
) > max_mV
)
774 BUG_ON(wm8350_ldo_val_to_mvolts(mV
) < min_mV
);
776 /* step size is 100mV > 1800mV */
777 mV
= ((min_mV
- 1701) / 100) + 16;
778 if (wm8350_ldo_val_to_mvolts(mV
) > max_mV
)
780 BUG_ON(wm8350_ldo_val_to_mvolts(mV
) < min_mV
);
785 volt_reg
= WM8350_LDO1_CONTROL
;
788 volt_reg
= WM8350_LDO2_CONTROL
;
791 volt_reg
= WM8350_LDO3_CONTROL
;
794 volt_reg
= WM8350_LDO4_CONTROL
;
802 /* all LDOs have same mV bits */
803 val
= wm8350_reg_read(wm8350
, volt_reg
) & ~WM8350_LDO1_VSEL_MASK
;
804 wm8350_reg_write(wm8350
, volt_reg
, val
| mV
);
808 static int wm8350_ldo_get_voltage_sel(struct regulator_dev
*rdev
)
810 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
811 int volt_reg
, ldo
= rdev_get_id(rdev
);
815 volt_reg
= WM8350_LDO1_CONTROL
;
818 volt_reg
= WM8350_LDO2_CONTROL
;
821 volt_reg
= WM8350_LDO3_CONTROL
;
824 volt_reg
= WM8350_LDO4_CONTROL
;
830 /* all LDOs have same mV bits */
831 return wm8350_reg_read(wm8350
, volt_reg
) & WM8350_LDO1_VSEL_MASK
;
834 static int wm8350_ldo_list_voltage(struct regulator_dev
*rdev
,
837 if (selector
> WM8350_LDO1_VSEL_MASK
)
839 return wm8350_ldo_val_to_mvolts(selector
) * 1000;
842 int wm8350_dcdc_set_slot(struct wm8350
*wm8350
, int dcdc
, u16 start
,
848 dev_dbg(wm8350
->dev
, "%s %d start %d stop %d\n",
849 __func__
, dcdc
, start
, stop
);
852 if (start
> 15 || stop
> 15)
857 slot_reg
= WM8350_DCDC1_TIMEOUTS
;
860 slot_reg
= WM8350_DCDC2_TIMEOUTS
;
863 slot_reg
= WM8350_DCDC3_TIMEOUTS
;
866 slot_reg
= WM8350_DCDC4_TIMEOUTS
;
869 slot_reg
= WM8350_DCDC5_TIMEOUTS
;
872 slot_reg
= WM8350_DCDC6_TIMEOUTS
;
878 val
= wm8350_reg_read(wm8350
, slot_reg
) &
879 ~(WM8350_DC1_ENSLOT_MASK
| WM8350_DC1_SDSLOT_MASK
|
880 WM8350_DC1_ERRACT_MASK
);
881 wm8350_reg_write(wm8350
, slot_reg
,
882 val
| (start
<< WM8350_DC1_ENSLOT_SHIFT
) |
883 (stop
<< WM8350_DC1_SDSLOT_SHIFT
) |
884 (fault
<< WM8350_DC1_ERRACT_SHIFT
));
888 EXPORT_SYMBOL_GPL(wm8350_dcdc_set_slot
);
890 int wm8350_ldo_set_slot(struct wm8350
*wm8350
, int ldo
, u16 start
, u16 stop
)
895 dev_dbg(wm8350
->dev
, "%s %d start %d stop %d\n",
896 __func__
, ldo
, start
, stop
);
899 if (start
> 15 || stop
> 15)
904 slot_reg
= WM8350_LDO1_TIMEOUTS
;
907 slot_reg
= WM8350_LDO2_TIMEOUTS
;
910 slot_reg
= WM8350_LDO3_TIMEOUTS
;
913 slot_reg
= WM8350_LDO4_TIMEOUTS
;
919 val
= wm8350_reg_read(wm8350
, slot_reg
) & ~WM8350_LDO1_SDSLOT_MASK
;
920 wm8350_reg_write(wm8350
, slot_reg
, val
| ((start
<< 10) | (stop
<< 6)));
923 EXPORT_SYMBOL_GPL(wm8350_ldo_set_slot
);
925 int wm8350_dcdc25_set_mode(struct wm8350
*wm8350
, int dcdc
, u16 mode
,
926 u16 ilim
, u16 ramp
, u16 feedback
)
930 dev_dbg(wm8350
->dev
, "%s %d mode: %s %s\n", __func__
, dcdc
,
931 mode
? "normal" : "boost", ilim
? "low" : "normal");
935 val
= wm8350_reg_read(wm8350
, WM8350_DCDC2_CONTROL
)
936 & ~(WM8350_DC2_MODE_MASK
| WM8350_DC2_ILIM_MASK
|
937 WM8350_DC2_RMP_MASK
| WM8350_DC2_FBSRC_MASK
);
938 wm8350_reg_write(wm8350
, WM8350_DCDC2_CONTROL
, val
|
939 (mode
<< WM8350_DC2_MODE_SHIFT
) |
940 (ilim
<< WM8350_DC2_ILIM_SHIFT
) |
941 (ramp
<< WM8350_DC2_RMP_SHIFT
) |
942 (feedback
<< WM8350_DC2_FBSRC_SHIFT
));
945 val
= wm8350_reg_read(wm8350
, WM8350_DCDC5_CONTROL
)
946 & ~(WM8350_DC5_MODE_MASK
| WM8350_DC5_ILIM_MASK
|
947 WM8350_DC5_RMP_MASK
| WM8350_DC5_FBSRC_MASK
);
948 wm8350_reg_write(wm8350
, WM8350_DCDC5_CONTROL
, val
|
949 (mode
<< WM8350_DC5_MODE_SHIFT
) |
950 (ilim
<< WM8350_DC5_ILIM_SHIFT
) |
951 (ramp
<< WM8350_DC5_RMP_SHIFT
) |
952 (feedback
<< WM8350_DC5_FBSRC_SHIFT
));
960 EXPORT_SYMBOL_GPL(wm8350_dcdc25_set_mode
);
962 static int wm8350_dcdc_enable(struct regulator_dev
*rdev
)
964 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
965 int dcdc
= rdev_get_id(rdev
);
968 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
971 shift
= dcdc
- WM8350_DCDC_1
;
972 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
976 static int wm8350_dcdc_disable(struct regulator_dev
*rdev
)
978 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
979 int dcdc
= rdev_get_id(rdev
);
982 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
985 shift
= dcdc
- WM8350_DCDC_1
;
986 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
991 static int wm8350_ldo_enable(struct regulator_dev
*rdev
)
993 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
994 int ldo
= rdev_get_id(rdev
);
997 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
1000 shift
= (ldo
- WM8350_LDO_1
) + 8;
1001 wm8350_set_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
1005 static int wm8350_ldo_disable(struct regulator_dev
*rdev
)
1007 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1008 int ldo
= rdev_get_id(rdev
);
1011 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
1014 shift
= (ldo
- WM8350_LDO_1
) + 8;
1015 wm8350_clear_bits(wm8350
, WM8350_DCDC_LDO_REQUESTED
, 1 << shift
);
1019 static int force_continuous_enable(struct wm8350
*wm8350
, int dcdc
, int enable
)
1025 reg
= WM8350_DCDC1_FORCE_PWM
;
1028 reg
= WM8350_DCDC3_FORCE_PWM
;
1031 reg
= WM8350_DCDC4_FORCE_PWM
;
1034 reg
= WM8350_DCDC6_FORCE_PWM
;
1041 ret
= wm8350_set_bits(wm8350
, reg
,
1042 WM8350_DCDC1_FORCE_PWM_ENA
);
1044 ret
= wm8350_clear_bits(wm8350
, reg
,
1045 WM8350_DCDC1_FORCE_PWM_ENA
);
1049 static int wm8350_dcdc_set_mode(struct regulator_dev
*rdev
, unsigned int mode
)
1051 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1052 int dcdc
= rdev_get_id(rdev
);
1055 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
1058 if (dcdc
== WM8350_DCDC_2
|| dcdc
== WM8350_DCDC_5
)
1061 val
= 1 << (dcdc
- WM8350_DCDC_1
);
1064 case REGULATOR_MODE_FAST
:
1065 /* force continuous mode */
1066 wm8350_set_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1067 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1068 force_continuous_enable(wm8350
, dcdc
, 1);
1070 case REGULATOR_MODE_NORMAL
:
1071 /* active / pulse skipping */
1072 wm8350_set_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1073 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1074 force_continuous_enable(wm8350
, dcdc
, 0);
1076 case REGULATOR_MODE_IDLE
:
1078 force_continuous_enable(wm8350
, dcdc
, 0);
1079 wm8350_clear_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1080 wm8350_clear_bits(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
, val
);
1082 case REGULATOR_MODE_STANDBY
:
1084 force_continuous_enable(wm8350
, dcdc
, 0);
1085 wm8350_set_bits(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
, val
);
1092 static unsigned int wm8350_dcdc_get_mode(struct regulator_dev
*rdev
)
1094 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1095 int dcdc
= rdev_get_id(rdev
);
1096 u16 mask
, sleep
, active
, force
;
1097 int mode
= REGULATOR_MODE_NORMAL
;
1102 reg
= WM8350_DCDC1_FORCE_PWM
;
1105 reg
= WM8350_DCDC3_FORCE_PWM
;
1108 reg
= WM8350_DCDC4_FORCE_PWM
;
1111 reg
= WM8350_DCDC6_FORCE_PWM
;
1117 mask
= 1 << (dcdc
- WM8350_DCDC_1
);
1118 active
= wm8350_reg_read(wm8350
, WM8350_DCDC_ACTIVE_OPTIONS
) & mask
;
1119 force
= wm8350_reg_read(wm8350
, reg
) & WM8350_DCDC1_FORCE_PWM_ENA
;
1120 sleep
= wm8350_reg_read(wm8350
, WM8350_DCDC_SLEEP_OPTIONS
) & mask
;
1122 dev_dbg(wm8350
->dev
, "mask %x active %x sleep %x force %x",
1123 mask
, active
, sleep
, force
);
1125 if (active
&& !sleep
) {
1127 mode
= REGULATOR_MODE_FAST
;
1129 mode
= REGULATOR_MODE_NORMAL
;
1130 } else if (!active
&& !sleep
)
1131 mode
= REGULATOR_MODE_IDLE
;
1133 mode
= REGULATOR_MODE_STANDBY
;
1138 static unsigned int wm8350_ldo_get_mode(struct regulator_dev
*rdev
)
1140 return REGULATOR_MODE_NORMAL
;
1143 struct wm8350_dcdc_efficiency
{
1149 static const struct wm8350_dcdc_efficiency dcdc1_6_efficiency
[] = {
1150 {0, 10000, REGULATOR_MODE_STANDBY
}, /* 0 - 10mA - LDO */
1151 {10000, 100000, REGULATOR_MODE_IDLE
}, /* 10mA - 100mA - Standby */
1152 {100000, 1000000, REGULATOR_MODE_NORMAL
}, /* > 100mA - Active */
1153 {-1, -1, REGULATOR_MODE_NORMAL
},
1156 static const struct wm8350_dcdc_efficiency dcdc3_4_efficiency
[] = {
1157 {0, 10000, REGULATOR_MODE_STANDBY
}, /* 0 - 10mA - LDO */
1158 {10000, 100000, REGULATOR_MODE_IDLE
}, /* 10mA - 100mA - Standby */
1159 {100000, 800000, REGULATOR_MODE_NORMAL
}, /* > 100mA - Active */
1160 {-1, -1, REGULATOR_MODE_NORMAL
},
1163 static unsigned int get_mode(int uA
, const struct wm8350_dcdc_efficiency
*eff
)
1167 while (eff
[i
].uA_load_min
!= -1) {
1168 if (uA
>= eff
[i
].uA_load_min
&& uA
<= eff
[i
].uA_load_max
)
1171 return REGULATOR_MODE_NORMAL
;
1174 /* Query the regulator for it's most efficient mode @ uV,uA
1175 * WM8350 regulator efficiency is pretty similar over
1176 * different input and output uV.
1178 static unsigned int wm8350_dcdc_get_optimum_mode(struct regulator_dev
*rdev
,
1179 int input_uV
, int output_uV
,
1182 int dcdc
= rdev_get_id(rdev
), mode
;
1187 mode
= get_mode(output_uA
, dcdc1_6_efficiency
);
1191 mode
= get_mode(output_uA
, dcdc3_4_efficiency
);
1194 mode
= REGULATOR_MODE_NORMAL
;
1200 static int wm8350_dcdc_is_enabled(struct regulator_dev
*rdev
)
1202 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1203 int dcdc
= rdev_get_id(rdev
), shift
;
1205 if (dcdc
< WM8350_DCDC_1
|| dcdc
> WM8350_DCDC_6
)
1208 shift
= dcdc
- WM8350_DCDC_1
;
1209 return wm8350_reg_read(wm8350
, WM8350_DCDC_LDO_REQUESTED
)
1213 static int wm8350_ldo_is_enabled(struct regulator_dev
*rdev
)
1215 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1216 int ldo
= rdev_get_id(rdev
), shift
;
1218 if (ldo
< WM8350_LDO_1
|| ldo
> WM8350_LDO_4
)
1221 shift
= (ldo
- WM8350_LDO_1
) + 8;
1222 return wm8350_reg_read(wm8350
, WM8350_DCDC_LDO_REQUESTED
)
1226 static struct regulator_ops wm8350_dcdc_ops
= {
1227 .set_voltage
= wm8350_dcdc_set_voltage
,
1228 .get_voltage_sel
= wm8350_dcdc_get_voltage_sel
,
1229 .list_voltage
= wm8350_dcdc_list_voltage
,
1230 .enable
= wm8350_dcdc_enable
,
1231 .disable
= wm8350_dcdc_disable
,
1232 .get_mode
= wm8350_dcdc_get_mode
,
1233 .set_mode
= wm8350_dcdc_set_mode
,
1234 .get_optimum_mode
= wm8350_dcdc_get_optimum_mode
,
1235 .is_enabled
= wm8350_dcdc_is_enabled
,
1236 .set_suspend_voltage
= wm8350_dcdc_set_suspend_voltage
,
1237 .set_suspend_enable
= wm8350_dcdc_set_suspend_enable
,
1238 .set_suspend_disable
= wm8350_dcdc_set_suspend_disable
,
1239 .set_suspend_mode
= wm8350_dcdc_set_suspend_mode
,
1242 static struct regulator_ops wm8350_dcdc2_5_ops
= {
1243 .enable
= wm8350_dcdc_enable
,
1244 .disable
= wm8350_dcdc_disable
,
1245 .is_enabled
= wm8350_dcdc_is_enabled
,
1246 .set_suspend_enable
= wm8350_dcdc25_set_suspend_enable
,
1247 .set_suspend_disable
= wm8350_dcdc25_set_suspend_disable
,
1250 static struct regulator_ops wm8350_ldo_ops
= {
1251 .set_voltage
= wm8350_ldo_set_voltage
,
1252 .get_voltage_sel
= wm8350_ldo_get_voltage_sel
,
1253 .list_voltage
= wm8350_ldo_list_voltage
,
1254 .enable
= wm8350_ldo_enable
,
1255 .disable
= wm8350_ldo_disable
,
1256 .is_enabled
= wm8350_ldo_is_enabled
,
1257 .get_mode
= wm8350_ldo_get_mode
,
1258 .set_suspend_voltage
= wm8350_ldo_set_suspend_voltage
,
1259 .set_suspend_enable
= wm8350_ldo_set_suspend_enable
,
1260 .set_suspend_disable
= wm8350_ldo_set_suspend_disable
,
1263 static struct regulator_ops wm8350_isink_ops
= {
1264 .set_current_limit
= wm8350_isink_set_current
,
1265 .get_current_limit
= wm8350_isink_get_current
,
1266 .enable
= wm8350_isink_enable
,
1267 .disable
= wm8350_isink_disable
,
1268 .is_enabled
= wm8350_isink_is_enabled
,
1269 .enable_time
= wm8350_isink_enable_time
,
1272 static struct regulator_desc wm8350_reg
[NUM_WM8350_REGULATORS
] = {
1275 .id
= WM8350_DCDC_1
,
1276 .ops
= &wm8350_dcdc_ops
,
1277 .irq
= WM8350_IRQ_UV_DC1
,
1278 .type
= REGULATOR_VOLTAGE
,
1279 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1280 .owner
= THIS_MODULE
,
1284 .id
= WM8350_DCDC_2
,
1285 .ops
= &wm8350_dcdc2_5_ops
,
1286 .irq
= WM8350_IRQ_UV_DC2
,
1287 .type
= REGULATOR_VOLTAGE
,
1288 .owner
= THIS_MODULE
,
1292 .id
= WM8350_DCDC_3
,
1293 .ops
= &wm8350_dcdc_ops
,
1294 .irq
= WM8350_IRQ_UV_DC3
,
1295 .type
= REGULATOR_VOLTAGE
,
1296 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1297 .owner
= THIS_MODULE
,
1301 .id
= WM8350_DCDC_4
,
1302 .ops
= &wm8350_dcdc_ops
,
1303 .irq
= WM8350_IRQ_UV_DC4
,
1304 .type
= REGULATOR_VOLTAGE
,
1305 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1306 .owner
= THIS_MODULE
,
1310 .id
= WM8350_DCDC_5
,
1311 .ops
= &wm8350_dcdc2_5_ops
,
1312 .irq
= WM8350_IRQ_UV_DC5
,
1313 .type
= REGULATOR_VOLTAGE
,
1314 .owner
= THIS_MODULE
,
1318 .id
= WM8350_DCDC_6
,
1319 .ops
= &wm8350_dcdc_ops
,
1320 .irq
= WM8350_IRQ_UV_DC6
,
1321 .type
= REGULATOR_VOLTAGE
,
1322 .n_voltages
= WM8350_DCDC_MAX_VSEL
+ 1,
1323 .owner
= THIS_MODULE
,
1328 .ops
= &wm8350_ldo_ops
,
1329 .irq
= WM8350_IRQ_UV_LDO1
,
1330 .type
= REGULATOR_VOLTAGE
,
1331 .n_voltages
= WM8350_LDO1_VSEL_MASK
+ 1,
1332 .owner
= THIS_MODULE
,
1337 .ops
= &wm8350_ldo_ops
,
1338 .irq
= WM8350_IRQ_UV_LDO2
,
1339 .type
= REGULATOR_VOLTAGE
,
1340 .n_voltages
= WM8350_LDO2_VSEL_MASK
+ 1,
1341 .owner
= THIS_MODULE
,
1346 .ops
= &wm8350_ldo_ops
,
1347 .irq
= WM8350_IRQ_UV_LDO3
,
1348 .type
= REGULATOR_VOLTAGE
,
1349 .n_voltages
= WM8350_LDO3_VSEL_MASK
+ 1,
1350 .owner
= THIS_MODULE
,
1355 .ops
= &wm8350_ldo_ops
,
1356 .irq
= WM8350_IRQ_UV_LDO4
,
1357 .type
= REGULATOR_VOLTAGE
,
1358 .n_voltages
= WM8350_LDO4_VSEL_MASK
+ 1,
1359 .owner
= THIS_MODULE
,
1363 .id
= WM8350_ISINK_A
,
1364 .ops
= &wm8350_isink_ops
,
1365 .irq
= WM8350_IRQ_CS1
,
1366 .type
= REGULATOR_CURRENT
,
1367 .owner
= THIS_MODULE
,
1371 .id
= WM8350_ISINK_B
,
1372 .ops
= &wm8350_isink_ops
,
1373 .irq
= WM8350_IRQ_CS2
,
1374 .type
= REGULATOR_CURRENT
,
1375 .owner
= THIS_MODULE
,
1379 static irqreturn_t
pmic_uv_handler(int irq
, void *data
)
1381 struct regulator_dev
*rdev
= (struct regulator_dev
*)data
;
1382 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1384 mutex_lock(&rdev
->mutex
);
1385 if (irq
== WM8350_IRQ_CS1
|| irq
== WM8350_IRQ_CS2
)
1386 regulator_notifier_call_chain(rdev
,
1387 REGULATOR_EVENT_REGULATION_OUT
,
1390 regulator_notifier_call_chain(rdev
,
1391 REGULATOR_EVENT_UNDER_VOLTAGE
,
1393 mutex_unlock(&rdev
->mutex
);
1398 static int wm8350_regulator_probe(struct platform_device
*pdev
)
1400 struct wm8350
*wm8350
= dev_get_drvdata(&pdev
->dev
);
1401 struct regulator_dev
*rdev
;
1405 if (pdev
->id
< WM8350_DCDC_1
|| pdev
->id
> WM8350_ISINK_B
)
1408 /* do any regulatior specific init */
1411 val
= wm8350_reg_read(wm8350
, WM8350_DCDC1_LOW_POWER
);
1412 wm8350
->pmic
.dcdc1_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1415 val
= wm8350_reg_read(wm8350
, WM8350_DCDC3_LOW_POWER
);
1416 wm8350
->pmic
.dcdc3_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1419 val
= wm8350_reg_read(wm8350
, WM8350_DCDC4_LOW_POWER
);
1420 wm8350
->pmic
.dcdc4_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1423 val
= wm8350_reg_read(wm8350
, WM8350_DCDC6_LOW_POWER
);
1424 wm8350
->pmic
.dcdc6_hib_mode
= val
& WM8350_DCDC_HIB_MODE_MASK
;
1428 /* register regulator */
1429 rdev
= regulator_register(&wm8350_reg
[pdev
->id
], &pdev
->dev
,
1430 pdev
->dev
.platform_data
,
1431 dev_get_drvdata(&pdev
->dev
));
1433 dev_err(&pdev
->dev
, "failed to register %s\n",
1434 wm8350_reg
[pdev
->id
].name
);
1435 return PTR_ERR(rdev
);
1438 /* register regulator IRQ */
1439 ret
= wm8350_register_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
,
1440 pmic_uv_handler
, 0, "UV", rdev
);
1442 regulator_unregister(rdev
);
1443 dev_err(&pdev
->dev
, "failed to register regulator %s IRQ\n",
1444 wm8350_reg
[pdev
->id
].name
);
1451 static int wm8350_regulator_remove(struct platform_device
*pdev
)
1453 struct regulator_dev
*rdev
= platform_get_drvdata(pdev
);
1454 struct wm8350
*wm8350
= rdev_get_drvdata(rdev
);
1456 wm8350_free_irq(wm8350
, wm8350_reg
[pdev
->id
].irq
, rdev
);
1458 regulator_unregister(rdev
);
1463 int wm8350_register_regulator(struct wm8350
*wm8350
, int reg
,
1464 struct regulator_init_data
*initdata
)
1466 struct platform_device
*pdev
;
1468 if (reg
< 0 || reg
>= NUM_WM8350_REGULATORS
)
1471 if (wm8350
->pmic
.pdev
[reg
])
1474 if (reg
>= WM8350_DCDC_1
&& reg
<= WM8350_DCDC_6
&&
1475 reg
> wm8350
->pmic
.max_dcdc
)
1477 if (reg
>= WM8350_ISINK_A
&& reg
<= WM8350_ISINK_B
&&
1478 reg
> wm8350
->pmic
.max_isink
)
1481 pdev
= platform_device_alloc("wm8350-regulator", reg
);
1485 wm8350
->pmic
.pdev
[reg
] = pdev
;
1487 initdata
->driver_data
= wm8350
;
1489 pdev
->dev
.platform_data
= initdata
;
1490 pdev
->dev
.parent
= wm8350
->dev
;
1491 platform_set_drvdata(pdev
, wm8350
);
1493 ret
= platform_device_add(pdev
);
1496 dev_err(wm8350
->dev
, "Failed to register regulator %d: %d\n",
1498 platform_device_put(pdev
);
1499 wm8350
->pmic
.pdev
[reg
] = NULL
;
1504 EXPORT_SYMBOL_GPL(wm8350_register_regulator
);
1507 * wm8350_register_led - Register a WM8350 LED output
1509 * @param wm8350 The WM8350 device to configure.
1510 * @param lednum LED device index to create.
1511 * @param dcdc The DCDC to use for the LED.
1512 * @param isink The ISINK to use for the LED.
1513 * @param pdata Configuration for the LED.
1515 * The WM8350 supports the use of an ISINK together with a DCDC to
1516 * provide a power-efficient LED driver. This function registers the
1517 * regulators and instantiates the platform device for a LED. The
1518 * operating modes for the LED regulators must be configured using
1519 * wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
1520 * wm8350_dcdc_set_slot() prior to calling this function.
1522 int wm8350_register_led(struct wm8350
*wm8350
, int lednum
, int dcdc
, int isink
,
1523 struct wm8350_led_platform_data
*pdata
)
1525 struct wm8350_led
*led
;
1526 struct platform_device
*pdev
;
1529 if (lednum
>= ARRAY_SIZE(wm8350
->pmic
.led
) || lednum
< 0) {
1530 dev_err(wm8350
->dev
, "Invalid LED index %d\n", lednum
);
1534 led
= &wm8350
->pmic
.led
[lednum
];
1537 dev_err(wm8350
->dev
, "LED %d already allocated\n", lednum
);
1541 pdev
= platform_device_alloc("wm8350-led", lednum
);
1543 dev_err(wm8350
->dev
, "Failed to allocate LED %d\n", lednum
);
1547 led
->isink_consumer
.dev
= &pdev
->dev
;
1548 led
->isink_consumer
.supply
= "led_isink";
1549 led
->isink_init
.num_consumer_supplies
= 1;
1550 led
->isink_init
.consumer_supplies
= &led
->isink_consumer
;
1551 led
->isink_init
.constraints
.min_uA
= 0;
1552 led
->isink_init
.constraints
.max_uA
= pdata
->max_uA
;
1553 led
->isink_init
.constraints
.valid_ops_mask
1554 = REGULATOR_CHANGE_CURRENT
| REGULATOR_CHANGE_STATUS
;
1555 led
->isink_init
.constraints
.valid_modes_mask
= REGULATOR_MODE_NORMAL
;
1556 ret
= wm8350_register_regulator(wm8350
, isink
, &led
->isink_init
);
1558 platform_device_put(pdev
);
1562 led
->dcdc_consumer
.dev
= &pdev
->dev
;
1563 led
->dcdc_consumer
.supply
= "led_vcc";
1564 led
->dcdc_init
.num_consumer_supplies
= 1;
1565 led
->dcdc_init
.consumer_supplies
= &led
->dcdc_consumer
;
1566 led
->dcdc_init
.constraints
.valid_modes_mask
= REGULATOR_MODE_NORMAL
;
1567 led
->dcdc_init
.constraints
.valid_ops_mask
= REGULATOR_CHANGE_STATUS
;
1568 ret
= wm8350_register_regulator(wm8350
, dcdc
, &led
->dcdc_init
);
1570 platform_device_put(pdev
);
1575 case WM8350_ISINK_A
:
1576 wm8350
->pmic
.isink_A_dcdc
= dcdc
;
1578 case WM8350_ISINK_B
:
1579 wm8350
->pmic
.isink_B_dcdc
= dcdc
;
1583 pdev
->dev
.platform_data
= pdata
;
1584 pdev
->dev
.parent
= wm8350
->dev
;
1585 ret
= platform_device_add(pdev
);
1587 dev_err(wm8350
->dev
, "Failed to register LED %d: %d\n",
1589 platform_device_put(pdev
);
1597 EXPORT_SYMBOL_GPL(wm8350_register_led
);
1599 static struct platform_driver wm8350_regulator_driver
= {
1600 .probe
= wm8350_regulator_probe
,
1601 .remove
= wm8350_regulator_remove
,
1603 .name
= "wm8350-regulator",
1607 static int __init
wm8350_regulator_init(void)
1609 return platform_driver_register(&wm8350_regulator_driver
);
1611 subsys_initcall(wm8350_regulator_init
);
1613 static void __exit
wm8350_regulator_exit(void)
1615 platform_driver_unregister(&wm8350_regulator_driver
);
1617 module_exit(wm8350_regulator_exit
);
1619 /* Module information */
1620 MODULE_AUTHOR("Liam Girdwood");
1621 MODULE_DESCRIPTION("WM8350 voltage and current regulator driver");
1622 MODULE_LICENSE("GPL");
1623 MODULE_ALIAS("platform:wm8350-regulator");