diff options
author | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-06-23 14:13:29 +0200 |
---|---|---|
committer | Alejandro Gonzalez <alex.gonzalez@digi.com> | 2010-06-23 14:31:10 +0200 |
commit | a7ffa03d4fd492441def38a3c770615b342c7e6a (patch) | |
tree | 583ab7e1873a34a2b2a18b6680a24e1f269a4b5f /drivers/mxc | |
parent | 436bc07e9deda38533233e1b1d822f0b360d1f60 (diff) |
ccwmx51: Do not unconditionally set the PMIC as a suspend wake up source
This behaviour was causing that even when the user has not explicitely set
a wakeup source the system was suspending without a way to awake. With
this change the RTC wake up source is set up when its suspend method is
called, making it possible to check for enabled wake up sources on the
platform suspend enter.
Signed-off-by: Alejandro Gonzalez <alex.gonzalez@digi.com>
Diffstat (limited to 'drivers/mxc')
-rw-r--r-- | drivers/mxc/pmic/core/pmic_core_i2c.c | 16 | ||||
-rw-r--r-- | drivers/mxc/pmic/core/pmic_core_spi.c | 18 |
2 files changed, 26 insertions, 8 deletions
diff --git a/drivers/mxc/pmic/core/pmic_core_i2c.c b/drivers/mxc/pmic/core/pmic_core_i2c.c index d2f982efb2a1..12f394d69088 100644 --- a/drivers/mxc/pmic/core/pmic_core_i2c.c +++ b/drivers/mxc/pmic/core/pmic_core_i2c.c @@ -71,6 +71,13 @@ static struct platform_device power_ldm = { .name = "pmic_power", .id = 1, }; + +static struct resource pmic_rtc_resources[] = { + { + .flags = IORESOURCE_IRQ, + }, +}; + static struct platform_device rtc_ldm = { .name = "pmic_rtc", .id = 1, @@ -92,13 +99,17 @@ static struct platform_device bleds_ldm = { .id = 'b', }; -static void pmic_pdev_register(struct device *dev) +static void pmic_pdev_register(struct i2c_client *client) { + struct device *dev = client->dev; + platform_device_register(&adc_ldm); if (!cpu_is_mx53()) platform_device_register(&battery_ldm); + rtc_ldm.resource->start = client->irq; + rtc_ldm.resource->end = client->irq; platform_device_register(&rtc_ldm); platform_device_register(&power_ldm); platform_device_register(&light_ldm); @@ -270,7 +281,6 @@ static int __devinit pmic_probe(struct i2c_client *client, dev_err(&client->dev, "request irq %d error!\n", pmic_irq); return ret; } - enable_irq_wake(pmic_irq); if (plat_data && plat_data->init) { ret = plat_data->init(mc13892); @@ -282,7 +292,7 @@ static int __devinit pmic_probe(struct i2c_client *client, if (ret) dev_err(&client->dev, "create device file failed!\n"); - pmic_pdev_register(&client->dev); + pmic_pdev_register(&client); dev_info(&client->dev, "Loaded\n"); diff --git a/drivers/mxc/pmic/core/pmic_core_spi.c b/drivers/mxc/pmic/core/pmic_core_spi.c index 300ae9aafdaa..b685b5f51261 100644 --- a/drivers/mxc/pmic/core/pmic_core_spi.c +++ b/drivers/mxc/pmic/core/pmic_core_spi.c @@ -41,7 +41,7 @@ /* * Static functions */ -static void pmic_pdev_register(void); +static void pmic_pdev_register(struct spi_device *spi); static void pmic_pdev_unregister(void); /* @@ -59,9 +59,17 @@ static struct platform_device power_ldm = { .name = "pmic_power", .id = 1, }; +static struct resource pmic_rtc_resources[] = { + { + .flags = IORESOURCE_IRQ, + }, +}; + static struct platform_device rtc_ldm = { .name = "pmic_rtc", .id = 1, + .num_resources = ARRAY_SIZE(pmic_rtc_resources), + .resource = pmic_rtc_resources, }; static struct platform_device light_ldm = { .name = "pmic_light", @@ -93,10 +101,12 @@ extern pmic_version_t mxc_pmic_version; * This function registers platform device structures for * PMIC client drivers. */ -static void pmic_pdev_register(void) +static void pmic_pdev_register(struct spi_device *spi) { platform_device_register(&adc_ldm); platform_device_register(&battery_ldm); + rtc_ldm.resource->start = spi->irq; + rtc_ldm.resource->end = spi->irq; platform_device_register(&rtc_ldm); platform_device_register(&power_ldm); platform_device_register(&light_ldm); @@ -210,8 +220,6 @@ static int __devinit pmic_probe(struct spi_device *spi) return ret; } - enable_irq_wake(spi->irq); - if (plat_data && plat_data->init) { ret = plat_data->init(spi_get_drvdata(spi)); if (ret != 0) { @@ -223,7 +231,7 @@ static int __devinit pmic_probe(struct spi_device *spi) power_ldm.dev.platform_data = spi->dev.platform_data; - pmic_pdev_register(); + pmic_pdev_register(spi); printk(KERN_INFO "Device %s probed\n", dev_name(&spi->dev)); |