diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-12-11 19:24:30 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-05-07 06:04:56 -0400 |
commit | d87964c46005ccb04754f6309df0fd8f67b08c6d (patch) | |
tree | d35fc1fb3660dca0cdb236ef14ba27dcd69618f2 /arch/arm/plat-s3c/include | |
parent | 966bcc14386000e8b4dc7bbb426910bcb55a8588 (diff) |
[ARM] S3C: GPIO PM core GPIOlib integration
Move the GPIO suspend/resume support inline with the gpiolib support
so that it will work with both the S3C24XX and S3C64XX series.
The s3c_gpio_chip is extended to have a pm callback and a save block
to keep the state of the GPIO over suspend, and the code from the
s3c24xx implementation is added to a new common file.
The suspend process now uses the list of registered chips to go through
saving and restoring each one as appropriate, using the pm callback to
select the appropriate routine depending on the type of control register
present.
This change also means that any additional GPIO added should not require
changes to the PM.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c/include')
-rw-r--r-- | arch/arm/plat-s3c/include/plat/gpio-core.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c/include/plat/gpio-core.h b/arch/arm/plat-s3c/include/plat/gpio-core.h index 2fc60a580ac8..32af612767aa 100644 --- a/arch/arm/plat-s3c/include/plat/gpio-core.h +++ b/arch/arm/plat-s3c/include/plat/gpio-core.h | |||
@@ -20,6 +20,18 @@ | |||
20 | * specific code. | 20 | * specific code. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | struct s3c_gpio_chip; | ||
24 | |||
25 | /** | ||
26 | * struct s3c_gpio_pm - power management (suspend/resume) information | ||
27 | * @save: Routine to save the state of the GPIO block | ||
28 | * @resume: Routine to resume the GPIO block. | ||
29 | */ | ||
30 | struct s3c_gpio_pm { | ||
31 | void (*save)(struct s3c_gpio_chip *chip); | ||
32 | void (*resume)(struct s3c_gpio_chip *chip); | ||
33 | }; | ||
34 | |||
23 | struct s3c_gpio_cfg; | 35 | struct s3c_gpio_cfg; |
24 | 36 | ||
25 | /** | 37 | /** |
@@ -27,6 +39,7 @@ struct s3c_gpio_cfg; | |||
27 | * @chip: The chip structure to be exported via gpiolib. | 39 | * @chip: The chip structure to be exported via gpiolib. |
28 | * @base: The base pointer to the gpio configuration registers. | 40 | * @base: The base pointer to the gpio configuration registers. |
29 | * @config: special function and pull-resistor control information. | 41 | * @config: special function and pull-resistor control information. |
42 | * @pm_save: Save information for suspend/resume support. | ||
30 | * | 43 | * |
31 | * This wrapper provides the necessary information for the Samsung | 44 | * This wrapper provides the necessary information for the Samsung |
32 | * specific gpios being registered with gpiolib. | 45 | * specific gpios being registered with gpiolib. |
@@ -34,7 +47,11 @@ struct s3c_gpio_cfg; | |||
34 | struct s3c_gpio_chip { | 47 | struct s3c_gpio_chip { |
35 | struct gpio_chip chip; | 48 | struct gpio_chip chip; |
36 | struct s3c_gpio_cfg *config; | 49 | struct s3c_gpio_cfg *config; |
50 | struct s3c_gpio_pm *pm; | ||
37 | void __iomem *base; | 51 | void __iomem *base; |
52 | #ifdef CONFIG_PM | ||
53 | u32 pm_save[4]; | ||
54 | #endif | ||
38 | }; | 55 | }; |
39 | 56 | ||
40 | static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc) | 57 | static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc) |
@@ -75,3 +92,16 @@ static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int chip) | |||
75 | 92 | ||
76 | static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { } | 93 | static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { } |
77 | #endif | 94 | #endif |
95 | |||
96 | #ifdef CONFIG_PM | ||
97 | extern struct s3c_gpio_pm s3c_gpio_pm_1bit; | ||
98 | extern struct s3c_gpio_pm s3c_gpio_pm_2bit; | ||
99 | extern struct s3c_gpio_pm s3c_gpio_pm_4bit; | ||
100 | #define __gpio_pm(x) x | ||
101 | #else | ||
102 | #define s3c_gpio_pm_1bit NULL | ||
103 | #define s3c_gpio_pm_2bit NULL | ||
104 | #define s3c_gpio_pm_4bit NULL | ||
105 | #define __gpio_pm(x) NULL | ||
106 | |||
107 | #endif /* CONFIG_PM */ | ||