aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-01 10:41:07 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2009-12-13 13:20:44 -0500
commitd4e0a89e3d170affa896efcdb4320e38a2f3a546 (patch)
tree496c6514976b379597f96c1412a628dcb71d8a14 /drivers/mfd
parent6f2ecaae72910211034c4f1955da97b2ff994265 (diff)
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: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/Kconfig6
-rw-r--r--drivers/mfd/wm831x-core.c159
2 files changed, 162 insertions, 3 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 2aea25ba7ba0..b0b3e42e7ee6 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -185,12 +185,12 @@ config MFD_WM8400
185 the functionality of the device. 185 the functionality of the device.
186 186
187config MFD_WM831X 187config MFD_WM831X
188 tristate "Support Wolfson Microelectronics WM831x PMICs" 188 tristate "Support Wolfson Microelectronics WM831x/2x PMICs"
189 select MFD_CORE 189 select MFD_CORE
190 depends on I2C 190 depends on I2C
191 help 191 help
192 Support for the Wolfson Microelecronics WM831x PMICs. This 192 Support for the Wolfson Microelecronics WM831x and WM832x PMICs.
193 driver provides common support for accessing the device, 193 This driver provides common support for accessing the device,
194 additional drivers must be enabled in order to use the 194 additional drivers must be enabled in order to use the
195 functionality of the device. 195 functionality of the device.
196 196
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 8d386c0c8027..163029f06185 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -93,6 +93,7 @@ enum wm831x_parent {
93 WM8310 = 0x8310, 93 WM8310 = 0x8310,
94 WM8311 = 0x8311, 94 WM8311 = 0x8311,
95 WM8312 = 0x8312, 95 WM8312 = 0x8312,
96 WM8320 = 0x8320,
96}; 97};
97 98
98static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg) 99static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
@@ -478,6 +479,20 @@ static struct resource wm831x_dcdc4_resources[] = {
478 }, 479 },
479}; 480};
480 481
482static struct resource wm8320_dcdc4_buck_resources[] = {
483 {
484 .start = WM831X_DC4_CONTROL,
485 .end = WM832X_DC4_SLEEP_CONTROL,
486 .flags = IORESOURCE_IO,
487 },
488 {
489 .name = "UV",
490 .start = WM831X_IRQ_UV_DC4,
491 .end = WM831X_IRQ_UV_DC4,
492 .flags = IORESOURCE_IRQ,
493 },
494};
495
481static struct resource wm831x_gpio_resources[] = { 496static struct resource wm831x_gpio_resources[] = {
482 { 497 {
483 .start = WM831X_IRQ_GPIO_1, 498 .start = WM831X_IRQ_GPIO_1,
@@ -1237,6 +1252,137 @@ static struct mfd_cell wm8312_devs[] = {
1237 }, 1252 },
1238}; 1253};
1239 1254
1255static struct mfd_cell wm8320_devs[] = {
1256 {
1257 .name = "wm831x-backup",
1258 },
1259 {
1260 .name = "wm831x-buckv",
1261 .id = 1,
1262 .num_resources = ARRAY_SIZE(wm831x_dcdc1_resources),
1263 .resources = wm831x_dcdc1_resources,
1264 },
1265 {
1266 .name = "wm831x-buckv",
1267 .id = 2,
1268 .num_resources = ARRAY_SIZE(wm831x_dcdc2_resources),
1269 .resources = wm831x_dcdc2_resources,
1270 },
1271 {
1272 .name = "wm831x-buckp",
1273 .id = 3,
1274 .num_resources = ARRAY_SIZE(wm831x_dcdc3_resources),
1275 .resources = wm831x_dcdc3_resources,
1276 },
1277 {
1278 .name = "wm831x-buckp",
1279 .id = 4,
1280 .num_resources = ARRAY_SIZE(wm8320_dcdc4_buck_resources),
1281 .resources = wm8320_dcdc4_buck_resources,
1282 },
1283 {
1284 .name = "wm831x-gpio",
1285 .num_resources = ARRAY_SIZE(wm831x_gpio_resources),
1286 .resources = wm831x_gpio_resources,
1287 },
1288 {
1289 .name = "wm831x-hwmon",
1290 },
1291 {
1292 .name = "wm831x-ldo",
1293 .id = 1,
1294 .num_resources = ARRAY_SIZE(wm831x_ldo1_resources),
1295 .resources = wm831x_ldo1_resources,
1296 },
1297 {
1298 .name = "wm831x-ldo",
1299 .id = 2,
1300 .num_resources = ARRAY_SIZE(wm831x_ldo2_resources),
1301 .resources = wm831x_ldo2_resources,
1302 },
1303 {
1304 .name = "wm831x-ldo",
1305 .id = 3,
1306 .num_resources = ARRAY_SIZE(wm831x_ldo3_resources),
1307 .resources = wm831x_ldo3_resources,
1308 },
1309 {
1310 .name = "wm831x-ldo",
1311 .id = 4,
1312 .num_resources = ARRAY_SIZE(wm831x_ldo4_resources),
1313 .resources = wm831x_ldo4_resources,
1314 },
1315 {
1316 .name = "wm831x-ldo",
1317 .id = 5,
1318 .num_resources = ARRAY_SIZE(wm831x_ldo5_resources),
1319 .resources = wm831x_ldo5_resources,
1320 },
1321 {
1322 .name = "wm831x-ldo",
1323 .id = 6,
1324 .num_resources = ARRAY_SIZE(wm831x_ldo6_resources),
1325 .resources = wm831x_ldo6_resources,
1326 },
1327 {
1328 .name = "wm831x-aldo",
1329 .id = 7,
1330 .num_resources = ARRAY_SIZE(wm831x_ldo7_resources),
1331 .resources = wm831x_ldo7_resources,
1332 },
1333 {
1334 .name = "wm831x-aldo",
1335 .id = 8,
1336 .num_resources = ARRAY_SIZE(wm831x_ldo8_resources),
1337 .resources = wm831x_ldo8_resources,
1338 },
1339 {
1340 .name = "wm831x-aldo",
1341 .id = 9,
1342 .num_resources = ARRAY_SIZE(wm831x_ldo9_resources),
1343 .resources = wm831x_ldo9_resources,
1344 },
1345 {
1346 .name = "wm831x-aldo",
1347 .id = 10,
1348 .num_resources = ARRAY_SIZE(wm831x_ldo10_resources),
1349 .resources = wm831x_ldo10_resources,
1350 },
1351 {
1352 .name = "wm831x-alive-ldo",
1353 .id = 11,
1354 .num_resources = ARRAY_SIZE(wm831x_ldo11_resources),
1355 .resources = wm831x_ldo11_resources,
1356 },
1357 {
1358 .name = "wm831x-on",
1359 .num_resources = ARRAY_SIZE(wm831x_on_resources),
1360 .resources = wm831x_on_resources,
1361 },
1362 {
1363 .name = "wm831x-rtc",
1364 .num_resources = ARRAY_SIZE(wm831x_rtc_resources),
1365 .resources = wm831x_rtc_resources,
1366 },
1367 {
1368 .name = "wm831x-status",
1369 .id = 1,
1370 .num_resources = ARRAY_SIZE(wm831x_status1_resources),
1371 .resources = wm831x_status1_resources,
1372 },
1373 {
1374 .name = "wm831x-status",
1375 .id = 2,
1376 .num_resources = ARRAY_SIZE(wm831x_status2_resources),
1377 .resources = wm831x_status2_resources,
1378 },
1379 {
1380 .name = "wm831x-watchdog",
1381 .num_resources = ARRAY_SIZE(wm831x_wdt_resources),
1382 .resources = wm831x_wdt_resources,
1383 },
1384};
1385
1240static struct mfd_cell backlight_devs[] = { 1386static struct mfd_cell backlight_devs[] = {
1241 { 1387 {
1242 .name = "wm831x-backlight", 1388 .name = "wm831x-backlight",
@@ -1309,6 +1455,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1309 dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev); 1455 dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev);
1310 break; 1456 break;
1311 1457
1458 case WM8320:
1459 parent = WM8320;
1460 wm831x->num_gpio = 12;
1461 dev_info(wm831x->dev, "WM8320 revision %c\n", 'A' + rev);
1462 break;
1463
1312 default: 1464 default:
1313 dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret); 1465 dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret);
1314 ret = -EINVAL; 1466 ret = -EINVAL;
@@ -1367,6 +1519,12 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1367 NULL, 0); 1519 NULL, 0);
1368 break; 1520 break;
1369 1521
1522 case WM8320:
1523 ret = mfd_add_devices(wm831x->dev, -1,
1524 wm8320_devs, ARRAY_SIZE(wm8320_devs),
1525 NULL, 0);
1526 break;
1527
1370 default: 1528 default:
1371 /* If this happens the bus probe function is buggy */ 1529 /* If this happens the bus probe function is buggy */
1372 BUG(); 1530 BUG();
@@ -1492,6 +1650,7 @@ static const struct i2c_device_id wm831x_i2c_id[] = {
1492 { "wm8310", WM8310 }, 1650 { "wm8310", WM8310 },
1493 { "wm8311", WM8311 }, 1651 { "wm8311", WM8311 },
1494 { "wm8312", WM8312 }, 1652 { "wm8312", WM8312 },
1653 { "wm8320", WM8320 },
1495 { } 1654 { }
1496}; 1655};
1497MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id); 1656MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);