rtc: tps80031: register as mfd sub device
Laxman Dewangan [Wed, 1 Aug 2012 10:55:25 +0000 (15:55 +0530)]
register RTC driver of TPS80031 as mfd sub
driver in place of adding it as a sub devices.
This is inline with the mfd driver policy.

Change-Id: I2f9c13478a1e85c9670dd7bc576ec761f2e24733
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/121133
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/board-enterprise-power.c
drivers/mfd/tps80031.c
drivers/rtc/rtc-tps80031.c
include/linux/mfd/tps80031.h

index 9f3f8ae..4bf7f03 100644 (file)
@@ -333,13 +333,6 @@ static struct tps80031_bg_platform_data battery_gauge_data = {
        .battery_present = 1,
 };
 
-#define TPS_RTC()                              \
-       {                                               \
-               .id     = 0,            \
-               .name   = "rtc_tps80031",       \
-               .platform_data = &rtc_data,     \
-       }
-
 #define TPS_BATTERY()                                  \
        {                                               \
                .name   = "tps80031-charger",           \
@@ -356,14 +349,12 @@ static struct tps80031_bg_platform_data battery_gauge_data = {
        }
 
 #define TPS80031_DEVS_COMMON           \
-       TPS_RTC(),                      \
        TPS_BATTERY(),                  \
        TPS_BATTERY_GAUGE(),            \
        TPS_GPADC()
 
 
 static struct tps80031_subdev_info tps80031_devs[] = {
-       TPS_RTC(),
        TPS_BATTERY(),
        TPS_BATTERY_GAUGE(),
        TPS_GPADC()
@@ -451,6 +442,7 @@ static struct tps80031_platform_data tps_platform = {
        .clk32k_init_data       = clk32k_idata,
        .clk32k_init_data_size  = ARRAY_SIZE(clk32k_idata),
        .use_power_off  = true,
+       .rtc_pdata = &rtc_data,
 };
 
 static struct i2c_board_info __initdata enterprise_regulators[] = {
index f524b29..a1b6237 100644 (file)
@@ -302,6 +302,9 @@ static struct mfd_cell tps80031_cell[] = {
        {
                .name = "tps80031-regulators",
        },
+       {
+               .name = "tps80031-rtc",
+       },
 };
 
 
index b2b9d04..44013e1 100644 (file)
@@ -349,12 +349,20 @@ static irqreturn_t tps80031_rtc_irq(int irq, void *data)
 
 static int __devinit tps80031_rtc_probe(struct platform_device *pdev)
 {
-       struct tps80031_rtc_platform_data *pdata = pdev->dev.platform_data;
+       struct tps80031_platform_data *tps80031_pdata;
+       struct tps80031_rtc_platform_data *pdata;
        struct tps80031_rtc *rtc;
        struct rtc_time tm;
        int err;
        u8 reg;
 
+       tps80031_pdata = dev_get_platdata(pdev->dev.parent);
+       if (!tps80031_pdata) {
+               dev_err(&pdev->dev, "no tps80031 platform_data specified\n");
+               return -EINVAL;
+       }
+
+       pdata = tps80031_pdata->rtc_pdata;
        if (!pdata) {
                dev_err(&pdev->dev, "no platform_data specified\n");
                return -EINVAL;
@@ -469,7 +477,7 @@ static int __devexit tps80031_rtc_remove(struct platform_device *pdev)
 
 static struct platform_driver tps80031_rtc_driver = {
        .driver = {
-               .name   = "rtc_tps80031",
+               .name   = "tps80031-rtc",
                .owner  = THIS_MODULE,
        },
        .probe  = tps80031_rtc_probe,
index 974fc0d..d0cef73 100644 (file)
@@ -199,6 +199,7 @@ struct tps80031_platform_data {
        int pupd_init_data_size;
        struct tps80031_regulator_platform_data **regulator_pdata;
        int num_regulator_pdata;
+       struct tps80031_rtc_platform_data *rtc_pdata;
 };
 
 struct tps80031_bg_platform_data {