mfd: Register ab8500 devices using the newly DT:ed MFD API
authorLee Jones <lee.jones@linaro.org>
Mon, 2 Jul 2012 15:10:56 +0000 (17:10 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 8 Jul 2012 22:16:13 +0000 (00:16 +0200)
Now the MFD API is Device Tree aware we can use it for platform
registration again, even when booting with DT enabled. To aid in
Device Node pointer allocation we provide each cell with the
associative compatible string.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
arch/arm/mach-ux500/board-mop500.c
drivers/mfd/ab8500-core.c
drivers/mfd/ab8500-debugfs.c
drivers/mfd/ab8500-gpadc.c
drivers/mfd/ab8500-sysctrl.c
drivers/misc/ab8500-pwm.c
drivers/regulator/ab8500.c

index 44d816ffaeb63e1fbf1327d899cb0a41965bf88a..6224400a9d47c658a5e062169bcf49a6380ed36b 100644 (file)
@@ -793,7 +793,6 @@ static const struct of_device_id u8500_local_bus_nodes[] = {
        /* only create devices below soc node */
        { .compatible = "stericsson,db8500", },
        { .compatible = "stericsson,db8500-prcmu", },
-       { .compatible = "stericsson,ab8500-regulator", },
        { .compatible = "simple-bus"},
        { },
 };
index e580c5d535fb9a5cfa0de9ed51d9947e638814c2..626b4ecaf64761fdd3cd43ac3f02986d6830e467 100644 (file)
@@ -970,54 +970,69 @@ static struct mfd_cell __devinitdata abx500_common_devs[] = {
 #ifdef CONFIG_DEBUG_FS
        {
                .name = "ab8500-debug",
+               .of_compatible = "stericsson,ab8500-debug",
                .num_resources = ARRAY_SIZE(ab8500_debug_resources),
                .resources = ab8500_debug_resources,
        },
 #endif
        {
                .name = "ab8500-sysctrl",
+               .of_compatible = "stericsson,ab8500-sysctrl",
        },
        {
                .name = "ab8500-regulator",
+               .of_compatible = "stericsson,ab8500-regulator",
        },
        {
                .name = "ab8500-gpadc",
+               .of_compatible = "stericsson,ab8500-gpadc",
                .num_resources = ARRAY_SIZE(ab8500_gpadc_resources),
                .resources = ab8500_gpadc_resources,
        },
        {
                .name = "ab8500-rtc",
+               .of_compatible = "stericsson,ab8500-rtc",
                .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
                .resources = ab8500_rtc_resources,
        },
        {
                .name = "ab8500-acc-det",
+               .of_compatible = "stericsson,ab8500-acc-det",
                .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
                .resources = ab8500_av_acc_detect_resources,
        },
        {
                .name = "ab8500-poweron-key",
+               .of_compatible = "stericsson,ab8500-poweron-key",
                .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources),
                .resources = ab8500_poweronkey_db_resources,
        },
        {
                .name = "ab8500-pwm",
+               .of_compatible = "stericsson,ab8500-pwm",
                .id = 1,
        },
        {
                .name = "ab8500-pwm",
+               .of_compatible = "stericsson,ab8500-pwm",
                .id = 2,
        },
        {
                .name = "ab8500-pwm",
+               .of_compatible = "stericsson,ab8500-pwm",
                .id = 3,
        },
-       { .name = "ab8500-leds", },
+       {
+               .name = "ab8500-leds",
+               .of_compatible = "stericsson,ab8500-leds",
+       },
        {
                .name = "ab8500-denc",
+               .of_compatible = "stericsson,ab8500-denc",
        },
        {
                .name = "ab8500-temp",
+               .of_compatible = "stericsson,ab8500-temp",
                .num_resources = ARRAY_SIZE(ab8500_temp_resources),
                .resources = ab8500_temp_resources,
        },
@@ -1049,11 +1064,13 @@ static struct mfd_cell __devinitdata ab8500_bm_devs[] = {
 static struct mfd_cell __devinitdata ab8500_devs[] = {
        {
                .name = "ab8500-gpio",
+               .of_compatible = "stericsson,ab8500-gpio",
                .num_resources = ARRAY_SIZE(ab8500_gpio_resources),
                .resources = ab8500_gpio_resources,
        },
        {
                .name = "ab8500-usb",
+               .of_compatible = "stericsson,ab8500-usb",
                .num_resources = ARRAY_SIZE(ab8500_usb_resources),
                .resources = ab8500_usb_resources,
        },
@@ -1399,32 +1416,29 @@ static int __devinit ab8500_probe(struct platform_device *pdev)
                        goto out_freeoldmask;
        }
 
-       if (!np) {
-               ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs,
-                               ARRAY_SIZE(abx500_common_devs), NULL,
-                               ab8500->irq_base);
+       ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs,
+                       ARRAY_SIZE(abx500_common_devs), NULL,
+                       ab8500->irq_base);
+       if (ret)
+               goto out_freeirq;
 
-               if (ret)
-                       goto out_freeirq;
-
-               if (is_ab9540(ab8500))
-                       ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
-                                       ARRAY_SIZE(ab9540_devs), NULL,
-                                       ab8500->irq_base);
-               else
-                       ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs,
-                                       ARRAY_SIZE(ab8500_devs), NULL,
-                                       ab8500->irq_base);
-               if (ret)
-                       goto out_freeirq;
+       if (is_ab9540(ab8500))
+               ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
+                               ARRAY_SIZE(ab9540_devs), NULL,
+                               ab8500->irq_base);
+       else
+               ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs,
+                               ARRAY_SIZE(ab8500_devs), NULL,
+                               ab8500->irq_base);
+       if (ret)
+               goto out_freeirq;
 
-               if (is_ab9540(ab8500) || is_ab8505(ab8500))
-                       ret = mfd_add_devices(ab8500->dev, 0, ab9540_ab8505_devs,
-                                       ARRAY_SIZE(ab9540_ab8505_devs), NULL,
-                                       ab8500->irq_base);
-               if (ret)
-                       goto out_freeirq;
-       }
+       if (is_ab9540(ab8500) || is_ab8505(ab8500))
+               ret = mfd_add_devices(ab8500->dev, 0, ab9540_ab8505_devs,
+                               ARRAY_SIZE(ab9540_ab8505_devs), NULL,
+                               ab8500->irq_base);
+       if (ret)
+               goto out_freeirq;
 
        if (!no_bm) {
                /* Add battery management devices */
index 361de52aefe50cce2bf9304996006a1fce8caa4d..c4cb806978acd62603bc76a6780a2cad633fe4e9 100644 (file)
@@ -608,16 +608,10 @@ static int __devexit ab8500_debug_remove(struct platform_device *plf)
        return 0;
 }
 
-static const struct of_device_id ab8500_debug_match[] = {
-        { .compatible = "stericsson,ab8500-debug", },
-        {}
-};
-
 static struct platform_driver ab8500_debug_driver = {
        .driver = {
                .name = "ab8500-debug",
                .owner = THIS_MODULE,
-               .of_match_table = ab8500_debug_match,
        },
        .probe  = ab8500_debug_probe,
        .remove = __devexit_p(ab8500_debug_remove)
index b6cbc3ba2695cb198eef4359aba4969aba7d12a3..866f95960b4b69b34f2fd2e6347842f9b9b096b8 100644 (file)
@@ -649,18 +649,12 @@ static int __devexit ab8500_gpadc_remove(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id ab8500_gpadc_match[] = {
-       { .compatible = "stericsson,ab8500-gpadc", },
-       {}
-};
-
 static struct platform_driver ab8500_gpadc_driver = {
        .probe = ab8500_gpadc_probe,
        .remove = __devexit_p(ab8500_gpadc_remove),
        .driver = {
                .name = "ab8500-gpadc",
                .owner = THIS_MODULE,
-               .of_match_table = ab8500_gpadc_match,
        },
 };
 
index 5a3e51ccf25863b94dccd26b25f4e7002b90ac97..c28d4eb1eff019517d166476c590652f2ac1b8b1 100644 (file)
@@ -61,16 +61,10 @@ static int __devexit ab8500_sysctrl_remove(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id ab8500_sysctrl_match[] = {
-       { .compatible = "stericsson,ab8500-sysctrl", },
-       {}
-};
-
 static struct platform_driver ab8500_sysctrl_driver = {
        .driver = {
                .name = "ab8500-sysctrl",
                .owner = THIS_MODULE,
-               .of_match_table = ab8500_sysctrl_match,
        },
        .probe = ab8500_sysctrl_probe,
        .remove = __devexit_p(ab8500_sysctrl_remove),
index 042a8fe4efaabd2ab57db4299275c19750cad23d..d7a9aa14e5d5aafd8c0efc907b127147a202d197 100644 (file)
@@ -142,16 +142,10 @@ static int __devexit ab8500_pwm_remove(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id ab8500_pwm_match[] = {
-       { .compatible = "stericsson,ab8500-pwm", },
-       {}
-};
-
 static struct platform_driver ab8500_pwm_driver = {
        .driver = {
                .name = "ab8500-pwm",
                .owner = THIS_MODULE,
-               .of_match_table = ab8500_pwm_match,
        },
        .probe = ab8500_pwm_probe,
        .remove = __devexit_p(ab8500_pwm_remove),
index a739f5ca936a878481f408d67e0a7edf8688a42e..6745bd248da497d5cff1305f429b663c4a212c7c 100644 (file)
@@ -906,18 +906,12 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id ab8500_regulator_match[] = {
-        { .compatible = "stericsson,ab8500-regulator", },
-        {}
-};
-
 static struct platform_driver ab8500_regulator_driver = {
        .probe = ab8500_regulator_probe,
        .remove = __devexit_p(ab8500_regulator_remove),
        .driver         = {
                .name   = "ab8500-regulator",
                .owner  = THIS_MODULE,
-               .of_match_table = ab8500_regulator_match,
        },
 };