diff options
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r-- | drivers/regulator/wm831x-ldo.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 2220cf8defb1..6709710a059e 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -310,11 +310,17 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) | |||
310 | { | 310 | { |
311 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 311 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
312 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; | 312 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; |
313 | int id = pdev->id % ARRAY_SIZE(pdata->ldo); | 313 | int id; |
314 | struct wm831x_ldo *ldo; | 314 | struct wm831x_ldo *ldo; |
315 | struct resource *res; | 315 | struct resource *res; |
316 | int ret, irq; | 316 | int ret, irq; |
317 | 317 | ||
318 | if (pdata && pdata->wm831x_num) | ||
319 | id = (pdata->wm831x_num * 10) + 1; | ||
320 | else | ||
321 | id = 0; | ||
322 | id = pdev->id - id; | ||
323 | |||
318 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); | 324 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); |
319 | 325 | ||
320 | if (pdata == NULL || pdata->ldo[id] == NULL) | 326 | if (pdata == NULL || pdata->ldo[id] == NULL) |
@@ -574,11 +580,17 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) | |||
574 | { | 580 | { |
575 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 581 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
576 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; | 582 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; |
577 | int id = pdev->id % ARRAY_SIZE(pdata->ldo); | 583 | int id; |
578 | struct wm831x_ldo *ldo; | 584 | struct wm831x_ldo *ldo; |
579 | struct resource *res; | 585 | struct resource *res; |
580 | int ret, irq; | 586 | int ret, irq; |
581 | 587 | ||
588 | if (pdata && pdata->wm831x_num) | ||
589 | id = (pdata->wm831x_num * 10) + 1; | ||
590 | else | ||
591 | id = 0; | ||
592 | id = pdev->id - id; | ||
593 | |||
582 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); | 594 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); |
583 | 595 | ||
584 | if (pdata == NULL || pdata->ldo[id] == NULL) | 596 | if (pdata == NULL || pdata->ldo[id] == NULL) |
@@ -764,11 +776,18 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev) | |||
764 | { | 776 | { |
765 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 777 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
766 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; | 778 | struct wm831x_pdata *pdata = wm831x->dev->platform_data; |
767 | int id = pdev->id % ARRAY_SIZE(pdata->ldo); | 779 | int id; |
768 | struct wm831x_ldo *ldo; | 780 | struct wm831x_ldo *ldo; |
769 | struct resource *res; | 781 | struct resource *res; |
770 | int ret; | 782 | int ret; |
771 | 783 | ||
784 | if (pdata && pdata->wm831x_num) | ||
785 | id = (pdata->wm831x_num * 10) + 1; | ||
786 | else | ||
787 | id = 0; | ||
788 | id = pdev->id - id; | ||
789 | |||
790 | |||
772 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); | 791 | dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); |
773 | 792 | ||
774 | if (pdata == NULL || pdata->ldo[id] == NULL) | 793 | if (pdata == NULL || pdata->ldo[id] == NULL) |