mfd: Support configurable numbers of DCDCs and ISINKs on WM8350

Some WM8350 variants have fewer DCDCs and ISINKs. Identify these at
probe and refuse to use the absent DCDCs when running on these chips.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>

authored by

Mark Brown and committed by
Samuel Ortiz
645524a9 53a0d99b

+17
+6
drivers/mfd/wm8350-core.c
··· 1301 1301 1302 1302 switch (mask_rev) { 1303 1303 case 0: 1304 + wm8350->pmic.max_dcdc = WM8350_DCDC_6; 1305 + wm8350->pmic.max_isink = WM8350_ISINK_B; 1306 + 1304 1307 switch (chip_rev) { 1305 1308 case WM8350_REV_E: 1306 1309 dev_info(wm8350->dev, "WM8350 Rev E\n"); ··· 1328 1325 break; 1329 1326 1330 1327 case 2: 1328 + wm8350->pmic.max_dcdc = WM8350_DCDC_6; 1329 + wm8350->pmic.max_isink = WM8350_ISINK_B; 1330 + 1331 1331 switch (chip_rev) { 1332 1332 case 0: 1333 1333 dev_info(wm8350->dev, "WM8352 Rev A\n");
+7
drivers/regulator/wm8350-regulator.c
··· 1380 1380 if (wm8350->pmic.pdev[reg]) 1381 1381 return -EBUSY; 1382 1382 1383 + if (reg >= WM8350_DCDC_1 && reg <= WM8350_DCDC_6 && 1384 + reg > wm8350->pmic.max_dcdc) 1385 + return -ENODEV; 1386 + if (reg >= WM8350_ISINK_A && reg <= WM8350_ISINK_B && 1387 + reg > wm8350->pmic.max_isink) 1388 + return -ENODEV; 1389 + 1383 1390 pdev = platform_device_alloc("wm8350-regulator", reg); 1384 1391 if (!pdev) 1385 1392 return -ENOMEM;
+4
include/linux/mfd/wm8350/pmic.h
··· 701 701 struct regulator_init_data; 702 702 703 703 struct wm8350_pmic { 704 + /* Number of regulators of each type on this device */ 705 + int max_dcdc; 706 + int max_isink; 707 + 704 708 /* ISINK to DCDC mapping */ 705 709 int isink_A_dcdc; 706 710 int isink_B_dcdc;