]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mfd: Support configurable numbers of DCDCs and ISINKs on WM8350
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 18 Dec 2008 22:12:16 +0000 (23:12 +0100)
committerSamuel Ortiz <samuel@sortiz.org>
Sun, 4 Jan 2009 11:17:42 +0000 (12:17 +0100)
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>
drivers/mfd/wm8350-core.c
drivers/regulator/wm8350-regulator.c
include/linux/mfd/wm8350/pmic.h

index 03af3b12c020478ca0fa28983acb612048565c91..56c363c240a92d82f4017f7f8fb70083663fcd8f 100644 (file)
@@ -1301,6 +1301,9 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
        switch (mask_rev) {
        case 0:
+               wm8350->pmic.max_dcdc = WM8350_DCDC_6;
+               wm8350->pmic.max_isink = WM8350_ISINK_B;
+
                switch (chip_rev) {
                case WM8350_REV_E:
                        dev_info(wm8350->dev, "WM8350 Rev E\n");
@@ -1325,6 +1328,9 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
                break;
 
        case 2:
+               wm8350->pmic.max_dcdc = WM8350_DCDC_6;
+               wm8350->pmic.max_isink = WM8350_ISINK_B;
+
                switch (chip_rev) {
                case 0:
                        dev_info(wm8350->dev, "WM8352 Rev A\n");
index 1f44b17e23b197fb3d32322566ced21dfe515864..c68c496b2c499c30316e86bcb3f4237f79c9c4ff 100644 (file)
@@ -1380,6 +1380,13 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
        if (wm8350->pmic.pdev[reg])
                return -EBUSY;
 
+       if (reg >= WM8350_DCDC_1 && reg <= WM8350_DCDC_6 &&
+           reg > wm8350->pmic.max_dcdc)
+               return -ENODEV;
+       if (reg >= WM8350_ISINK_A && reg <= WM8350_ISINK_B &&
+           reg > wm8350->pmic.max_isink)
+               return -ENODEV;
+
        pdev = platform_device_alloc("wm8350-regulator", reg);
        if (!pdev)
                return -ENOMEM;
index 69b69e07f62fa4338303434e904439e45a65aac8..96acbfc8aa12f2c607a97e110af29ce370389297 100644 (file)
@@ -701,6 +701,10 @@ struct platform_device;
 struct regulator_init_data;
 
 struct wm8350_pmic {
+       /* Number of regulators of each type on this device */
+       int max_dcdc;
+       int max_isink;
+
        /* ISINK to DCDC mapping */
        int isink_A_dcdc;
        int isink_B_dcdc;