Skip to contentSkip to conversation

ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

PATCH New Mark Brown 3 participants 5 messages Apr 27, 2011 – Jun 10, 2011

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

From: Ben Dooks <[email protected]>

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

---
 arch/arm/mach-s3c2410/include/mach/pm-core.h |    3 +++
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |   17 +++++++++++++++++
 arch/arm/mach-s5pv210/include/mach/pm-core.h |    3 +++
 arch/arm/plat-samsung/pm.c                   |    2 ++
 4 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/pm-core.h +3 -0
index 70a83b2..45eea52 100644
@@ -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) { }
arch/arm/mach-s3c64xx/include/mach/pm-core.h +17 -0
index 4ed0f58..38659be 100644
@@ -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);
+}
arch/arm/mach-s5pv210/include/mach/pm-core.h +3 -0
index e8d394f..3e22109 100644
@@ -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) { }
arch/arm/plat-samsung/pm.c +2 -0
index 5c0a440..4f9a951 100644
@@ -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();
 
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/1 ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

Quoted 45 lines · Mark Brown

From: Ben Dooks <[email protected]>

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

---
 arch/arm/mach-s3c2410/include/mach/pm-core.h |    3 +++
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |   17 +++++++++++++++++
 arch/arm/mach-s5pv210/include/mach/pm-core.h |    3 +++
 arch/arm/plat-samsung/pm.c                   |    2 ++
 4 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s3c2410/include/mach/pm-core.h +0 -0

s3c2410/include/mach/pm-core.h
index 70a83b2..45eea52 100644

arch/arm/mach-s3c2410/include/mach/pm-core.h +3 -0
@@ -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) { }
arch/arm/mach- renamed from arch/arm/mach-s3c64xx/include/mach/pm-core.h +0 -0

s3c64xx/include/mach/pm-core.h
index 4ed0f58..38659be 100644

arch/arm/mach-s3c64xx/include/mach/pm-core.h +2 -0
@@ -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)

arch/arm/mach-s3c64xx/include/mach/pm-core.h static inline void s3c_pm_arch_update_uart(void __iomem

Quoted 10 lines
arch/arm/mach-s3c64xx/include/mach/pm-core.h +10 -0
+{
+	/* 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

Quoted 39 lines
arch/arm/mach-s3c64xx/include/mach/pm-core.h +5 -0
+	 * problems between going to sleep and resuming.
+	 */
+
+	__raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
+}
arch/arm/mach- renamed from arch/arm/mach-s5pv210/include/mach/pm-core.h +0 -0

s5pv210/include/mach/pm-core.h
index e8d394f..3e22109 100644

arch/arm/mach-s5pv210/include/mach/pm-core.h +3 -0
@@ -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) { }
arch/arm/plat-samsung/pm.c +2 -1
index 5c0a440..4f9a951 100644
@@ -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();
 
--
Quoted 1 line

1.7.4.1

Ok, will apply.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#2 lore raw

PATCH 1/1 ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

Hello,

Quoted 97 lines · Kukjin Kim
Quoted 13 lines · Mark Brown

From: Ben Dooks <[email protected]>

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

Review

Quoted 8 lines
---
 arch/arm/mach-s3c2410/include/mach/pm-core.h |    3 +++
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |   17 +++++++++++++++++
 arch/arm/mach-s5pv210/include/mach/pm-core.h |    3 +++
 arch/arm/plat-samsung/pm.c                   |    2 ++
 4 files changed, 25 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-

Review

Quoted 13 lines

s3c2410/include/mach/pm-core.h
index 70a83b2..45eea52 100644

arch/arm/mach-s3c2410/include/mach/pm-core.h +3 -0
@@ -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) { }
(quoted diff) +0 -0

b/arch/arm/mach-

arch/arm/mach-s3c64xx/include/mach/pm-core.h static inline void s3c_pm_arch_update_uart(void

Quoted 5 lines

s3c64xx/include/mach/pm-core.h
index 4ed0f58..38659be 100644

arch/arm/mach-s3c64xx/include/mach/pm-core.h +0 -0
@@ -96,3 +96,20 @@ static inline void s3c_pm_arch_update_uart(void

__iomem

Quoted 6 lines
arch/arm/mach-s3c64xx/include/mach/pm-core.h +2 -0
 *regs,
 		save->ucon = new_ucon;
 	}
 }
+
+static inline void s3c_pm_restored_gpios(void)

arch/arm/mach-s3c64xx/include/mach/pm-core.h static inline void s3c_pm_arch_update_uart(void __iomem *regs,

Quoted 10 lines
arch/arm/mach-s3c64xx/include/mach/pm-core.h +10 -0
+{
+	/* 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

Review

Quoted 6 lines
arch/arm/mach-s3c64xx/include/mach/pm-core.h +5 -0
+	 * problems between going to sleep and resuming.
+	 */
+
+	__raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN);
+}
(quoted diff) +0 -0

b/arch/arm/mach-

Quoted 30 lines

s5pv210/include/mach/pm-core.h
index e8d394f..3e22109 100644

arch/arm/mach-s5pv210/include/mach/pm-core.h +3 -0
@@ -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) { }
arch/arm/plat-samsung/pm.c +2 -0
index 5c0a440..4f9a951 100644
@@ -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();
 
Quoted 6 lines
Quoted 4 lines
arch/arm/plat-samsung/pm.c +0 -1
 	s3c_pm_debug_init();
 
--

1.7.4.1

Ok, will apply.

This patch lacks stubs for s5p64x0, s5pc100 and exynos4. I will send a quick fix soon.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center
#3 lore raw

PATCH 1/1 ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

Quoted 2 lines · Marek Szyprowski

Hello,

Hi :)

(snip)

Quoted 3 lines

This patch lacks stubs for s5p64x0, s5pc100 and exynos4. I will send a quick fix soon.

Oops, I couldn't test it all on my laptop which is so slow :(

OK, thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#4 lore raw

PATCH 1/1 ARM: SAMSUNG: Add support for pre-sleep/post-restore gpio control

Hello,

Quoted 5 lines · Kukjin Kim
Quoted 2 lines · Marek Szyprowski

Hello,

Hi :)

Quoted 8 lines

(snip)

Quoted 2 lines

This patch lacks stubs for s5p64x0, s5pc100 and exynos4. I will send a

quick fix

Quoted 1 line

soon.

Oops, I couldn't test it all on my laptop which is so slow :(

In fact the problem was only on exynos4 platform, because both s5p64x0 and s5pc100 don't support pm at all. I've posted build fix patch for exynos4.

Best regards

Signature · 2 lines
Marek Szyprowski
Samsung Poland R&D Center