arm: lpc32xx: Fix several system suspend related issues linux-2.6.34-lpc32x0_v1.08
authorBangaragiri Govindaraju <bangaragiri.g@nxp.com>
Thu, 7 Apr 2011 21:27:52 +0000 (14:27 -0700)
committerKevin Wells <wellsk40@gmail.com>
Thu, 7 Apr 2011 21:27:52 +0000 (14:27 -0700)
Fixes the suspend to RAM issues in EA3250 & FDI3250 boards and
possibly other boards. Also adds support for ADS7846 wakeup.

arch/arm/configs/ea3250_defconfig
arch/arm/configs/fdi3250_defconfig
arch/arm/mach-lpc32xx/ea3250.c
arch/arm/mach-lpc32xx/suspend.S
drivers/input/touchscreen/ads7846.c

index 6dbee3f..3c37e03 100644 (file)
@@ -170,7 +170,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
 # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
 # CONFIG_MUTEX_SPIN_ON_OWNER is not set
-# CONFIG_FREEZER is not set
+CONFIG_FREEZER=y
 
 #
 # System Type
@@ -369,9 +369,12 @@ CONFIG_BINFMT_AOUT=y
 #
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
-# CONFIG_SUSPEND is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
 # CONFIG_APM_EMULATION is not set
 # CONFIG_PM_RUNTIME is not set
+CONFIG_PM_OPS=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_NET=y
 
index dc2dfae..a895abc 100644 (file)
@@ -169,7 +169,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
 # CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
 # CONFIG_MUTEX_SPIN_ON_OWNER is not set
-# CONFIG_FREEZER is not set
+CONFIG_FREEZER=y
 
 #
 # System Type
@@ -365,9 +365,12 @@ CONFIG_BINFMT_AOUT=y
 #
 CONFIG_PM=y
 # CONFIG_PM_DEBUG is not set
-# CONFIG_SUSPEND is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
 # CONFIG_APM_EMULATION is not set
 # CONFIG_PM_RUNTIME is not set
+CONFIG_PM_OPS=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_NET=y
 
index 41849d8..1ae1609 100644 (file)
@@ -206,6 +206,7 @@ static struct ads7846_platform_data ea_ads7846_platform_data __initdata = {
        .debounce_tol   = 3,
        .pressure_max   = 1024,
        .get_pendown_state = ea3250_ads7846_pendown_state,
+       .wakeup = true,
 };
 
 /*
index e3e1b1f..757fd00 100644 (file)
@@ -117,8 +117,8 @@ ENTRY(lpc32xx_sys_suspend)
                #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
 4:
        ldr     WORK2_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
-       and     WORK2_REG, WORK2_REG, #LPC32XX_CLKPWR_HCLKPLL_PLL_STS
-       bne     4b
+       ands WORK2_REG, WORK2_REG, #LPC32XX_CLKPWR_HCLKPLL_PLL_STS
+       beq 4b
 
        @ Re-enter run mode with self-refresh flag cleared, but no DRAM
        @ update yet. DRAM is still in self-refresh
@@ -139,8 +139,8 @@ ENTRY(lpc32xx_sys_suspend)
        @ Wait for EMC to clear self-refresh mode
 5:
        ldr     WORK2_REG, [EMCBASE_REG, #LPC32XX_EMC_STATUS_OFFS]
-       and     WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_SELF_RFSH
-       bne     5b @ Branch until self-refresh has exited
+       ands WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_SELF_RFSH
+       bne 5b @ Branch until self-refresh has exited
 
        @ restore regs and return
        adr     r0, tmp_stack
index 532279c..8a98a0a 100644 (file)
@@ -815,18 +815,18 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
 {
        struct ads7846 *ts = dev_get_drvdata(&spi->dev);
 
-       spin_lock_irq(&ts->lock);
-
-       ts->is_suspended = 1;
-       ads7846_disable(ts);
-
-       spin_unlock_irq(&ts->lock);
-
        if (device_may_wakeup(&ts->spi->dev))
                enable_irq_wake(ts->spi->irq);
+       else {
+               spin_lock_irq(&ts->lock);
 
-       return 0;
+               ts->is_suspended = 1;
+               ads7846_disable(ts);
 
+               spin_unlock_irq(&ts->lock);
+       }
+
+       return 0;
 }
 
 static int ads7846_resume(struct spi_device *spi)
@@ -835,13 +835,14 @@ static int ads7846_resume(struct spi_device *spi)
 
        if (device_may_wakeup(&ts->spi->dev))
                disable_irq_wake(ts->spi->irq);
+       else {
+               spin_lock_irq(&ts->lock);
 
-       spin_lock_irq(&ts->lock);
-
-       ts->is_suspended = 0;
-       ads7846_enable(ts);
+               ts->is_suspended = 0;
+               ads7846_enable(ts);
 
-       spin_unlock_irq(&ts->lock);
+               spin_unlock_irq(&ts->lock);
+       }
 
        return 0;
 }