diff options
-rw-r--r-- | arch/arm/mach-mx5/pm.c | 9 | ||||
-rw-r--r-- | arch/arm/plat-mxc/tzic.c | 4 | ||||
-rw-r--r-- | arch/arm/plat-mxc/usb_common.c | 1 | ||||
-rw-r--r-- | drivers/mxc/pmic/core/pmic_core_i2c.c | 16 | ||||
-rw-r--r-- | drivers/mxc/pmic/core/pmic_core_spi.c | 18 | ||||
-rw-r--r-- | drivers/rtc/rtc-mc13892.c | 11 |
6 files changed, 49 insertions, 10 deletions
diff --git a/arch/arm/mach-mx5/pm.c b/arch/arm/mach-mx5/pm.c index c257e049bd9f..a63d6e725e8f 100644 --- a/arch/arm/mach-mx5/pm.c +++ b/arch/arm/mach-mx5/pm.c @@ -26,6 +26,7 @@ #include <asm/mach/map.h> #include <mach/hardware.h> #include "crm_regs.h" +#include "mach/irqs.h" static struct cpu_wp *cpu_wp_tbl; static struct clk *cpu_clk; @@ -50,6 +51,14 @@ void (*suspend_in_iram)(void *sdclk_iomux_addr) = NULL; static int mx51_suspend_enter(suspend_state_t state) { void __iomem *sdclk_iomux_addr = IO_ADDRESS(IOMUXC_BASE_ADDR + 0x4b8); + u32 * wake_src; + + /* Check that we have a wake up source. We don't want to suspend if not.*/ + mxc_get_wake_irq(&wake_src); + if ( !wake_src[0] && !wake_src[1] && !wake_src[2] && !wake_src[3] ) { + printk(KERN_ERR "No sources enabled for wake-up! Sleep abort.\n"); + return -EINVAL; + } if (gpc_dvfs_clk == NULL) gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs_clk"); diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c index bcca6ac465a2..8707744fd3d1 100644 --- a/arch/arm/plat-mxc/tzic.c +++ b/arch/arm/plat-mxc/tzic.c @@ -105,6 +105,10 @@ static int mxc_set_wake_irq(unsigned int irq, unsigned int enable) return 0; } +void mxc_get_wake_irq(u32 * wake_src[]) +{ + *wake_src = wakeup_intr; +} static struct irq_chip mxc_tzic_chip = { .name = "MXC_TZIC", diff --git a/arch/arm/plat-mxc/usb_common.c b/arch/arm/plat-mxc/usb_common.c index c8b8ba41b559..2f5f597f806e 100644 --- a/arch/arm/plat-mxc/usb_common.c +++ b/arch/arm/plat-mxc/usb_common.c @@ -447,7 +447,6 @@ static int usb_register_remote_wakeup(struct platform_device *pdev) } irq = res->start; pdev->dev.power.can_wakeup = 1; - enable_irq_wake(irq); return 0; } 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)); diff --git a/drivers/rtc/rtc-mc13892.c b/drivers/rtc/rtc-mc13892.c index e579c1853a26..3b7e3af4e54c 100644 --- a/drivers/rtc/rtc-mc13892.c +++ b/drivers/rtc/rtc-mc13892.c @@ -207,7 +207,8 @@ static int mxc_rtc_probe(struct platform_device *pdev) pdata->event.param = pdata; CHECK_ERROR(pmic_event_subscribe(EVENT_TODAI, pdata->event)); - device_init_wakeup(&pdev->dev, 1); + device_init_wakeup(&pdev->dev, 0); + device_set_wakeup_capable(&pdev->dev, 1); pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, THIS_MODULE); @@ -229,12 +230,20 @@ static int __exit mxc_rtc_remove(struct platform_device *pdev) return 0; } +static int mxc_rtc_suspend(struct platform_device *pdev, pm_message_t state) +{ + if (device_may_wakeup(&pdev->dev)) + enable_irq_wake(platform_get_irq(pdev, 0)); + return 0; +} + static struct platform_driver mxc_rtc_driver = { .driver = { .name = "pmic_rtc", }, .probe = mxc_rtc_probe, .remove = __exit_p(mxc_rtc_remove), + .suspend = mxc_rtc_suspend, }; static int __init mxc_rtc_init(void) |