regulator: Add WM8350 regulator support

The WM8350 features six DCDC convertors (four buck and two boost), four
LDO voltage regulators and two constant current sinks. This driver adds
support for these through the regulator API.

This driver was written by Liam Girdwood with updates for submission
from Mark Brown.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
Mark Brown 2008-10-10 15:58:15 +01:00 committed by Liam Girdwood
parent ebccec0fa4
commit da09155ac8
6 changed files with 1494 additions and 0 deletions

View file

@ -1218,6 +1218,12 @@ EXPORT_SYMBOL_GPL(wm8350_device_init);
void wm8350_device_exit(struct wm8350 *wm8350) void wm8350_device_exit(struct wm8350 *wm8350)
{ {
int i;
for (i = 0; i < ARRAY_SIZE(wm8350->pmic.pdev); i++)
if (wm8350->pmic.pdev[i] != NULL)
platform_device_unregister(wm8350->pmic.pdev[i]);
free_irq(wm8350->chip_irq, wm8350); free_irq(wm8350->chip_irq, wm8350);
flush_work(&wm8350->irq_work); flush_work(&wm8350->irq_work);
kfree(wm8350->reg_cache); kfree(wm8350->reg_cache);

View file

@ -56,6 +56,14 @@ config REGULATOR_BQ24022
charging select between 100 mA and 500 mA charging current charging select between 100 mA and 500 mA charging current
limit. limit.
config REGULATOR_WM8350
tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC"
depends on MFD_WM8350
select REGULATOR
help
This driver provides support for the voltage and current regulators
of the WM8350 AudioPlus PMIC.
config REGULATOR_WM8400 config REGULATOR_WM8400
tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC"
depends on MFD_WM8400 depends on MFD_WM8400
@ -63,4 +71,5 @@ config REGULATOR_WM8400
help help
This driver provides support for the voltage regulators of the This driver provides support for the voltage regulators of the
WM8400 AudioPlus PMIC. WM8400 AudioPlus PMIC.
endmenu endmenu

View file

@ -8,6 +8,7 @@ obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,8 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/mfd/wm8350/pmic.h>
/* /*
* Register values. * Register values.
*/ */
@ -570,6 +572,9 @@ struct wm8350 {
struct mutex irq_mutex; /* IRQ table mutex */ struct mutex irq_mutex; /* IRQ table mutex */
struct wm8350_irq irq[WM8350_NUM_IRQ]; struct wm8350_irq irq[WM8350_NUM_IRQ];
int chip_irq; int chip_irq;
/* Client devices */
struct wm8350_pmic pmic;
}; };
/** /**

View file

@ -696,4 +696,46 @@
#define NUM_WM8350_REGULATORS 12 #define NUM_WM8350_REGULATORS 12
struct wm8350;
struct platform_device;
struct regulator_init_data;
struct wm8350_pmic {
/* ISINK to DCDC mapping */
int isink_A_dcdc;
int isink_B_dcdc;
/* hibernate configs */
u16 dcdc1_hib_mode;
u16 dcdc3_hib_mode;
u16 dcdc4_hib_mode;
u16 dcdc6_hib_mode;
/* regulator devices */
struct platform_device *pdev[NUM_WM8350_REGULATORS];
};
int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
struct regulator_init_data *initdata);
/*
* Additional DCDC control not supported via regulator API
*/
int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start,
u16 stop, u16 fault);
int wm8350_dcdc25_set_mode(struct wm8350 *wm8350, int dcdc, u16 mode,
u16 ilim, u16 ramp, u16 feedback);
/*
* Additional LDO control not supported via regulator API
*/
int wm8350_ldo_set_slot(struct wm8350 *wm8350, int ldo, u16 start, u16 stop);
/*
* Additional ISINK control not supported via regulator API
*/
int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode,
u16 trigger, u16 duration, u16 on_ramp,
u16 off_ramp, u16 drive);
#endif #endif