Commit d4e0a89e authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

mfd: Add support for WM8320 PMICs

The WM8320 is an integrated power management subsystem providing
voltage regulators, RTC, watchdog and other functionality. The
WM8320 is derived from the WM831x and therefore shares most of
the driver code with the WM831x.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 6f2ecaae
...@@ -185,12 +185,12 @@ config MFD_WM8400 ...@@ -185,12 +185,12 @@ config MFD_WM8400
the functionality of the device. the functionality of the device.
config MFD_WM831X config MFD_WM831X
tristate "Support Wolfson Microelectronics WM831x PMICs" tristate "Support Wolfson Microelectronics WM831x/2x PMICs"
select MFD_CORE select MFD_CORE
depends on I2C depends on I2C
help help
Support for the Wolfson Microelecronics WM831x PMICs. This Support for the Wolfson Microelecronics WM831x and WM832x PMICs.
driver provides common support for accessing the device, This driver provides common support for accessing the device,
additional drivers must be enabled in order to use the additional drivers must be enabled in order to use the
functionality of the device. functionality of the device.
......
...@@ -93,6 +93,7 @@ enum wm831x_parent { ...@@ -93,6 +93,7 @@ enum wm831x_parent {
WM8310 = 0x8310, WM8310 = 0x8310,
WM8311 = 0x8311, WM8311 = 0x8311,
WM8312 = 0x8312, WM8312 = 0x8312,
WM8320 = 0x8320,
}; };
static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg) static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
...@@ -478,6 +479,20 @@ static struct resource wm831x_dcdc4_resources[] = { ...@@ -478,6 +479,20 @@ static struct resource wm831x_dcdc4_resources[] = {
}, },
}; };
static struct resource wm8320_dcdc4_buck_resources[] = {
{
.start = WM831X_DC4_CONTROL,
.end = WM832X_DC4_SLEEP_CONTROL,
.flags = IORESOURCE_IO,
},
{
.name = "UV",
.start = WM831X_IRQ_UV_DC4,
.end = WM831X_IRQ_UV_DC4,
.flags = IORESOURCE_IRQ,
},
};
static struct resource wm831x_gpio_resources[] = { static struct resource wm831x_gpio_resources[] = {
{ {
.start = WM831X_IRQ_GPIO_1, .start = WM831X_IRQ_GPIO_1,
...@@ -1237,6 +1252,137 @@ static struct mfd_cell wm8312_devs[] = { ...@@ -1237,6 +1252,137 @@ static struct mfd_cell wm8312_devs[] = {
}, },
}; };
static struct mfd_cell wm8320_devs[] = {
{
.name = "wm831x-backup",
},
{
.name = "wm831x-buckv",
.id = 1,
.num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
.resources = wm831x_dcdc1_resources,
},
{
.name = "wm831x-buckv",
.id = 2,
.num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
.resources = wm831x_dcdc2_resources,
},
{
.name = "wm831x-buckp",
.id = 3,
.num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
.resources = wm831x_dcdc3_resources,
},
{
.name = "wm831x-buckp",
.id = 4,
.num_resources = ARRAY_SIZE(wm8320_dcdc4_buck_resources),
.resources = wm8320_dcdc4_buck_resources,
},
{
.name = "wm831x-gpio",
.num_resources = ARRAY_SIZE(wm831x_gpio_resources),
.resources = wm831x_gpio_resources,
},
{
.name = "wm831x-hwmon",
},
{
.name = "wm831x-ldo",
.id = 1,
.num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
.resources = wm831x_ldo1_resources,
},
{
.name = "wm831x-ldo",
.id = 2,
.num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
.resources = wm831x_ldo2_resources,
},
{
.name = "wm831x-ldo",
.id = 3,
.num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
.resources = wm831x_ldo3_resources,
},
{
.name = "wm831x-ldo",
.id = 4,
.num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
.resources = wm831x_ldo4_resources,
},
{
.name = "wm831x-ldo",
.id = 5,
.num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
.resources = wm831x_ldo5_resources,
},
{
.name = "wm831x-ldo",
.id = 6,
.num_resources = ARRAY_SIZE(wm831x_ldo6_resources),
.resources = wm831x_ldo6_resources,
},
{
.name = "wm831x-aldo",
.id = 7,
.num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
.resources = wm831x_ldo7_resources,
},
{
.name = "wm831x-aldo",
.id = 8,
.num_resources = ARRAY_SIZE(wm831x_ldo8_resources),
.resources = wm831x_ldo8_resources,
},
{
.name = "wm831x-aldo",
.id = 9,
.num_resources = ARRAY_SIZE(wm831x_ldo9_resources),
.resources = wm831x_ldo9_resources,
},
{
.name = "wm831x-aldo",
.id = 10,
.num_resources = ARRAY_SIZE(wm831x_ldo10_resources),
.resources = wm831x_ldo10_resources,
},
{
.name = "wm831x-alive-ldo",
.id = 11,
.num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
.resources = wm831x_ldo11_resources,
},
{
.name = "wm831x-on",
.num_resources = ARRAY_SIZE(wm831x_on_resources),
.resources = wm831x_on_resources,
},
{
.name = "wm831x-rtc",
.num_resources = ARRAY_SIZE(wm831x_rtc_resources),
.resources = wm831x_rtc_resources,
},
{
.name = "wm831x-status",
.id = 1,
.num_resources = ARRAY_SIZE(wm831x_status1_resources),
.resources = wm831x_status1_resources,
},
{
.name = "wm831x-status",
.id = 2,
.num_resources = ARRAY_SIZE(wm831x_status2_resources),
.resources = wm831x_status2_resources,
},
{
.name = "wm831x-watchdog",
.num_resources = ARRAY_SIZE(wm831x_wdt_resources),
.resources = wm831x_wdt_resources,
},
};
static struct mfd_cell backlight_devs[] = { static struct mfd_cell backlight_devs[] = {
{ {
.name = "wm831x-backlight", .name = "wm831x-backlight",
...@@ -1309,6 +1455,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) ...@@ -1309,6 +1455,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev); dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev);
break; break;
case WM8320:
parent = WM8320;
wm831x->num_gpio = 12;
dev_info(wm831x->dev, "WM8320 revision %c\n", 'A' + rev);
break;
default: default:
dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret); dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret);
ret = -EINVAL; ret = -EINVAL;
...@@ -1367,6 +1519,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) ...@@ -1367,6 +1519,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
NULL, 0); NULL, 0);
break; break;
case WM8320:
ret = mfd_add_devices(wm831x->dev, -1,
wm8320_devs, ARRAY_SIZE(wm8320_devs),
NULL, 0);
break;
default: default:
/* If this happens the bus probe function is buggy */ /* If this happens the bus probe function is buggy */
BUG(); BUG();
...@@ -1492,6 +1650,7 @@ static const struct i2c_device_id wm831x_i2c_id[] = { ...@@ -1492,6 +1650,7 @@ static const struct i2c_device_id wm831x_i2c_id[] = {
{ "wm8310", WM8310 }, { "wm8310", WM8310 },
{ "wm8311", WM8311 }, { "wm8311", WM8311 },
{ "wm8312", WM8312 }, { "wm8312", WM8312 },
{ "wm8320", WM8320 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id); MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
......
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
#define WM831X_DC3_SLEEP_CONTROL 0x4063 #define WM831X_DC3_SLEEP_CONTROL 0x4063
#define WM831X_DC4_CONTROL 0x4064 #define WM831X_DC4_CONTROL 0x4064
#define WM831X_DC4_SLEEP_CONTROL 0x4065 #define WM831X_DC4_SLEEP_CONTROL 0x4065
#define WM832X_DC4_SLEEP_CONTROL 0x4067
#define WM831X_EPE1_CONTROL 0x4066 #define WM831X_EPE1_CONTROL 0x4066
#define WM831X_EPE2_CONTROL 0x4067 #define WM831X_EPE2_CONTROL 0x4067
#define WM831X_LDO1_CONTROL 0x4068 #define WM831X_LDO1_CONTROL 0x4068
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment