Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Ben Dooks and committed by
Kukjin Kim
1bac282a c17afc0a

+25
+3
arch/arm/mach-s3c2410/include/mach/pm-core.h
··· 62 62 struct pm_uart_save *save) 63 63 { 64 64 } 65 + 66 + static inline void s3c_pm_restored_gpios(void) { } 67 + static inline void s3c_pm_saved_gpios(void) { }
+17
arch/arm/mach-s3c64xx/include/mach/pm-core.h
··· 96 96 save->ucon = new_ucon; 97 97 } 98 98 } 99 + 100 + static inline void s3c_pm_restored_gpios(void) 101 + { 102 + /* ensure sleep mode has been cleared from the system */ 103 + 104 + __raw_writel(0, S3C64XX_SLPEN); 105 + } 106 + 107 + static inline void s3c_pm_saved_gpios(void) 108 + { 109 + /* turn on the sleep mode and keep it there, as it seems that during 110 + * suspend the xCON registers get re-set and thus you can end up with 111 + * problems between going to sleep and resuming. 112 + */ 113 + 114 + __raw_writel(S3C64XX_SLPEN_USE_xSLP, S3C64XX_SLPEN); 115 + }
+3
arch/arm/mach-s5pv210/include/mach/pm-core.h
··· 41 41 { 42 42 /* nothing here yet */ 43 43 } 44 + 45 + static inline void s3c_pm_restored_gpios(void) { } 46 + static inline void s3c_pm_saved_gpios(void) { }
+2
arch/arm/plat-samsung/pm.c
··· 268 268 /* save all necessary core registers not covered by the drivers */ 269 269 270 270 s3c_pm_save_gpios(); 271 + s3c_pm_saved_gpios(); 271 272 s3c_pm_save_uarts(); 272 273 s3c_pm_save_core(); 273 274 ··· 310 309 s3c_pm_restore_core(); 311 310 s3c_pm_restore_uarts(); 312 311 s3c_pm_restore_gpios(); 312 + s3c_pm_restored_gpios(); 313 313 314 314 s3c_pm_debug_init(); 315 315