ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control
authorBen Dooks <ben-linux@fluff.org>
Wed, 1 Jun 2011 09:44:50 +0000 (10:44 +0100)
committerKukjin Kim <kgene.kim@samsung.com>
Wed, 20 Jul 2011 14:13:20 +0000 (23:13 +0900)
Add a callback so that per-arch can do pre-sleep and post-resume
gpio configuration so that for the S3C64XX, the GPIO configuration
is restored before the sleep mode is cleared.

For the S3C64XX case, it means that the GPIOs get set back to normal
operation after the restore code puts the original configurations
back in after the

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-s3c2410/include/mach/pm-core.h
arch/arm/mach-s3c64xx/include/mach/pm-core.h
arch/arm/mach-s5pv210/include/mach/pm-core.h
arch/arm/plat-samsung/pm.c

index 70a83b209e254429b408d31af87a8362ca5ac028..45eea5210c87d55a76c34b752fdf20954c8e7df0 100644 (file)
@@ -62,3 +62,6 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
                                           struct pm_uart_save *save)
 {
 }
+
+static inline void s3c_pm_restored_gpios(void) { }
+static inline void s3c_pm_saved_gpios(void) { }
index 4ed0f582d2222c303078f7bad11c283ebe493521..38659bebe4b17de87387dfd4f8d60f23615bfe9b 100644 (file)
@@ -96,3 +96,20 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
                save->ucon = new_ucon;
        }
 }
+
+static inline void s3c_pm_restored_gpios(void)
+{
+       /* ensure sleep mode has been cleared from the system */
+
+       __raw_writel(0, S3C64XX_SLPEN);
+}
+
+static inline void s3c_pm_saved_gpios(void)
+{
+       /* turn on the sleep mode and keep it there, as it seems that during
+        * suspend the xCON registers get re-set and thus you can end up with
+        * problems between going to sleep and resuming.
+        */
+
+       __raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
+}
index e8d394f8b0573b4a8a10bd31d39011a949aa00a2..3e22109e1b7b4e851f890cb19cffd4d49c89314e 100644 (file)
@@ -41,3 +41,6 @@ static inline void s3c_pm_arch_update_uart(void __iomem *regs,
 {
        /* nothing here yet */
 }
+
+static inline void s3c_pm_restored_gpios(void) { }
+static inline void s3c_pm_saved_gpios(void) { }
index 5c0a440d6e16741f34f547b7aa6583a16997b5c4..4f9a9515beae3af9e37e95706e33ff585cf898c9 100644 (file)
@@ -268,6 +268,7 @@ static int s3c_pm_enter(suspend_state_t state)
        /* save all necessary core registers not covered by the drivers */
 
        s3c_pm_save_gpios();
+       s3c_pm_saved_gpios();
        s3c_pm_save_uarts();
        s3c_pm_save_core();
 
@@ -309,6 +310,7 @@ static int s3c_pm_enter(suspend_state_t state)
        s3c_pm_restore_core();
        s3c_pm_restore_uarts();
        s3c_pm_restore_gpios();
+       s3c_pm_restored_gpios();
 
        s3c_pm_debug_init();