mfd: Added rtc resources & fixed interrupt init
Sumit Sharma [Tue, 16 Oct 2012 05:37:39 +0000 (10:37 +0530)]
Added rtc resources for tps65910-rtc
Fixed interrupt initialiazation for tps65910

Bug 1055083

Change-Id: Idbb5098830075fe459020d5bdf264d9414b7cb8d
Signed-off-by: Sumit Sharma <sumsharma@nvidia.com>
Reviewed-on: http://git-master/r/144779
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/mfd/tps65910-irq.c
drivers/mfd/tps65910.c

index 0f1ff7f..29c0d49 100644 (file)
@@ -201,7 +201,7 @@ int tps65910_irq_init(struct tps65910 *tps65910, int irq,
             cur_irq++) {
                irq_set_chip_data(cur_irq, tps65910);
                irq_set_chip_and_handler(cur_irq, &tps65910_irq_chip,
-                                        handle_edge_irq);
+                                       handle_simple_irq);
                irq_set_nested_thread(cur_irq, 1);
 
                /* ARM needs us to explicitly flag the IRQ as valid
@@ -212,15 +212,14 @@ int tps65910_irq_init(struct tps65910 *tps65910, int irq,
                irq_set_noprobe(cur_irq);
 #endif
        }
-
        ret = request_threaded_irq(irq, NULL, tps65910_irq, flags,
                                   "tps65910", tps65910);
-
-       irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
-
-       if (ret != 0)
+       if (ret != 0) {
                dev_err(tps65910->dev, "Failed to request IRQ: %d\n", ret);
-
+       } else {
+               device_init_wakeup(tps65910->dev, 1);
+               enable_irq_wake(irq);
+       }
        return ret;
 }
 
index 18b30cf..3117156 100644 (file)
 #include <linux/mfd/tps65910.h>
 #include <linux/of_device.h>
 
+static struct resource rtc_resources[] = {
+       {
+               .start = TPS65910_IRQ_RTC_ALARM,
+               .end = TPS65910_IRQ_RTC_ALARM,
+               .flags = IORESOURCE_IRQ,
+       }
+};
+
+
 static struct mfd_cell tps65910s[] = {
        {
                .name = "tps65910-gpio",
@@ -33,6 +42,8 @@ static struct mfd_cell tps65910s[] = {
        },
        {
                .name = "tps65910-rtc",
+               .num_resources = ARRAY_SIZE(rtc_resources),
+               .resources = &rtc_resources[0],
        },
        {
                .name = "tps65910-power",
@@ -242,6 +253,13 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
                return ret;
        }
 
+       init_data->irq = pmic_plat_data->irq;
+       init_data->irq_base = pmic_plat_data->irq_base;
+
+       tps65910_irq_init(tps65910, init_data->irq, init_data);
+
+       tps65910_sleepinit(tps65910, pmic_plat_data);
+
        ret = mfd_add_devices(tps65910->dev, -1,
                              tps65910s, ARRAY_SIZE(tps65910s),
                              NULL, 0);
@@ -250,13 +268,6 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
                return ret;
        }
 
-       init_data->irq = pmic_plat_data->irq;
-       init_data->irq_base = pmic_plat_data->irq_base;
-
-       tps65910_irq_init(tps65910, init_data->irq, init_data);
-
-       tps65910_sleepinit(tps65910, pmic_plat_data);
-
        return ret;
 }