Skip to content

Commit 645524a

Browse files
broonieSamuel Ortiz
authored andcommitted
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>
1 parent 53a0d99 commit 645524a

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎drivers/mfd/wm8350-core.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,9 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
13011301

13021302
switch (mask_rev) {
13031303
case 0:
1304+
wm8350->pmic.max_dcdc = WM8350_DCDC_6;
1305+
wm8350->pmic.max_isink = WM8350_ISINK_B;
1306+
13041307
switch (chip_rev) {
13051308
case WM8350_REV_E:
13061309
dev_info(wm8350->dev, "WM8350 Rev E\n");
@@ -1325,6 +1328,9 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
13251328
break;
13261329

13271330
case 2:
1331+
wm8350->pmic.max_dcdc = WM8350_DCDC_6;
1332+
wm8350->pmic.max_isink = WM8350_ISINK_B;
1333+
13281334
switch (chip_rev) {
13291335
case 0:
13301336
dev_info(wm8350->dev, "WM8352 Rev A\n");

‎drivers/regulator/wm8350-regulator.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,13 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
13801380
if (wm8350->pmic.pdev[reg])
13811381
return -EBUSY;
13821382

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+
13831390
pdev = platform_device_alloc("wm8350-regulator", reg);
13841391
if (!pdev)
13851392
return -ENOMEM;

‎include/linux/mfd/wm8350/pmic.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,10 @@ struct platform_device;
701701
struct regulator_init_data;
702702

703703
struct wm8350_pmic {
704+
/* Number of regulators of each type on this device */
705+
int max_dcdc;
706+
int max_isink;
707+
704708
/* ISINK to DCDC mapping */
705709
int isink_A_dcdc;
706710
int isink_B_dcdc;

0 commit comments

Comments
 (0)