diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2009-01-27 14:09:24 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-05-12 12:39:16 -0400 |
commit | 43ffcd9a042858a9e9f9fe014bb073e55db34c67 (patch) | |
tree | e6e2ecc3d9af3c398e97ecd8c3007d5db1228a79 /arch/arm | |
parent | 699117a69f53efbdf8fddbd6d991575c0a22fd74 (diff) |
OMAP2/3: GPIO: generalize prepare for idle
Currently, the GPIO 'prepare' hook is only called when going to
off-mode, while the function is called 'prepare_for_retention.' This
patch renames the function to 'prepare_for_idle' and calls it for any
powersate != PWRDM_POWER_ON passing in the powerstate.
The hook itself is then responsible for doing various preparation
based on the powerstate.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 10 | ||||
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 19 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/gpio.h | 4 |
4 files changed, 21 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 374299ea7ade..7816c4e84a32 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -107,7 +107,7 @@ static void omap2_enter_full_retention(void) | |||
107 | l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL; | 107 | l = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0) | OMAP24XX_USBSTANDBYCTRL; |
108 | omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0); | 108 | omap_ctrl_writel(l, OMAP2_CONTROL_DEVCONF0); |
109 | 109 | ||
110 | omap2_gpio_prepare_for_retention(); | 110 | omap2_gpio_prepare_for_idle(PWRDM_POWER_RET); |
111 | 111 | ||
112 | if (omap2_pm_debug) { | 112 | if (omap2_pm_debug) { |
113 | omap2_pm_dump(0, 0, 0); | 113 | omap2_pm_dump(0, 0, 0); |
@@ -141,7 +141,7 @@ no_sleep: | |||
141 | tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC; | 141 | tmp = timespec_to_ns(&ts_idle) * NSEC_PER_USEC; |
142 | omap2_pm_dump(0, 1, tmp); | 142 | omap2_pm_dump(0, 1, tmp); |
143 | } | 143 | } |
144 | omap2_gpio_resume_after_retention(); | 144 | omap2_gpio_resume_after_idle(); |
145 | 145 | ||
146 | clk_enable(osc_ck); | 146 | clk_enable(osc_ck); |
147 | 147 | ||
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 5de07db636bd..468e1e3321e0 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -376,15 +376,14 @@ void omap_sram_idle(void) | |||
376 | core_next_state = pwrdm_read_next_pwrst(core_pwrdm); | 376 | core_next_state = pwrdm_read_next_pwrst(core_pwrdm); |
377 | if (per_next_state < PWRDM_POWER_ON) { | 377 | if (per_next_state < PWRDM_POWER_ON) { |
378 | omap_uart_prepare_idle(2); | 378 | omap_uart_prepare_idle(2); |
379 | omap2_gpio_prepare_for_idle(per_next_state); | ||
379 | if (per_next_state == PWRDM_POWER_OFF) { | 380 | if (per_next_state == PWRDM_POWER_OFF) { |
380 | if (core_next_state == PWRDM_POWER_ON) { | 381 | if (core_next_state == PWRDM_POWER_ON) { |
381 | per_next_state = PWRDM_POWER_RET; | 382 | per_next_state = PWRDM_POWER_RET; |
382 | pwrdm_set_next_pwrst(per_pwrdm, per_next_state); | 383 | pwrdm_set_next_pwrst(per_pwrdm, per_next_state); |
383 | per_state_modified = 1; | 384 | per_state_modified = 1; |
384 | } else { | 385 | } else |
385 | omap2_gpio_prepare_for_retention(); | ||
386 | omap3_per_save_context(); | 386 | omap3_per_save_context(); |
387 | } | ||
388 | } | 387 | } |
389 | } | 388 | } |
390 | 389 | ||
@@ -455,10 +454,9 @@ void omap_sram_idle(void) | |||
455 | /* PER */ | 454 | /* PER */ |
456 | if (per_next_state < PWRDM_POWER_ON) { | 455 | if (per_next_state < PWRDM_POWER_ON) { |
457 | per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); | 456 | per_prev_state = pwrdm_read_prev_pwrst(per_pwrdm); |
458 | if (per_prev_state == PWRDM_POWER_OFF) { | 457 | omap2_gpio_resume_after_idle(); |
458 | if (per_prev_state == PWRDM_POWER_OFF) | ||
459 | omap3_per_restore_context(); | 459 | omap3_per_restore_context(); |
460 | omap2_gpio_resume_after_retention(); | ||
461 | } | ||
462 | omap_uart_resume_idle(2); | 460 | omap_uart_resume_idle(2); |
463 | if (per_state_modified) | 461 | if (per_state_modified) |
464 | pwrdm_set_next_pwrst(per_pwrdm, PWRDM_POWER_OFF); | 462 | pwrdm_set_next_pwrst(per_pwrdm, PWRDM_POWER_OFF); |
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 2f185ffaca4a..1c81340ce65c 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <mach/irqs.h> | 27 | #include <mach/irqs.h> |
28 | #include <mach/gpio.h> | 28 | #include <mach/gpio.h> |
29 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
30 | #include <plat/powerdomain.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * OMAP1510 GPIO registers | 33 | * OMAP1510 GPIO registers |
@@ -2041,19 +2042,24 @@ static struct sys_device omap_gpio_device = { | |||
2041 | 2042 | ||
2042 | static int workaround_enabled; | 2043 | static int workaround_enabled; |
2043 | 2044 | ||
2044 | void omap2_gpio_prepare_for_retention(void) | 2045 | void omap2_gpio_prepare_for_idle(int power_state) |
2045 | { | 2046 | { |
2046 | int i, c = 0; | 2047 | int i, c = 0; |
2047 | int min = 0; | 2048 | int min = 0; |
2048 | 2049 | ||
2049 | if (cpu_is_omap34xx()) | 2050 | if (cpu_is_omap34xx()) |
2050 | min = 1; | 2051 | min = 1; |
2051 | /* Remove triggering for all non-wakeup GPIOs. Otherwise spurious | 2052 | |
2052 | * IRQs will be generated. See OMAP2420 Errata item 1.101. */ | ||
2053 | for (i = min; i < gpio_bank_count; i++) { | 2053 | for (i = min; i < gpio_bank_count; i++) { |
2054 | struct gpio_bank *bank = &gpio_bank[i]; | 2054 | struct gpio_bank *bank = &gpio_bank[i]; |
2055 | u32 l1, l2; | 2055 | u32 l1, l2; |
2056 | 2056 | ||
2057 | if (power_state > PWRDM_POWER_OFF) | ||
2058 | continue; | ||
2059 | |||
2060 | /* If going to OFF, remove triggering for all | ||
2061 | * non-wakeup GPIOs. Otherwise spurious IRQs will be | ||
2062 | * generated. See OMAP2420 Errata item 1.101. */ | ||
2057 | if (!(bank->enabled_non_wakeup_gpios)) | 2063 | if (!(bank->enabled_non_wakeup_gpios)) |
2058 | continue; | 2064 | continue; |
2059 | 2065 | ||
@@ -2101,19 +2107,20 @@ void omap2_gpio_prepare_for_retention(void) | |||
2101 | workaround_enabled = 1; | 2107 | workaround_enabled = 1; |
2102 | } | 2108 | } |
2103 | 2109 | ||
2104 | void omap2_gpio_resume_after_retention(void) | 2110 | void omap2_gpio_resume_after_idle(void) |
2105 | { | 2111 | { |
2106 | int i; | 2112 | int i; |
2107 | int min = 0; | 2113 | int min = 0; |
2108 | 2114 | ||
2109 | if (!workaround_enabled) | ||
2110 | return; | ||
2111 | if (cpu_is_omap34xx()) | 2115 | if (cpu_is_omap34xx()) |
2112 | min = 1; | 2116 | min = 1; |
2113 | for (i = min; i < gpio_bank_count; i++) { | 2117 | for (i = min; i < gpio_bank_count; i++) { |
2114 | struct gpio_bank *bank = &gpio_bank[i]; | 2118 | struct gpio_bank *bank = &gpio_bank[i]; |
2115 | u32 l, gen, gen0, gen1; | 2119 | u32 l, gen, gen0, gen1; |
2116 | 2120 | ||
2121 | if (!workaround_enabled) | ||
2122 | continue; | ||
2123 | |||
2117 | if (!(bank->enabled_non_wakeup_gpios)) | 2124 | if (!(bank->enabled_non_wakeup_gpios)) |
2118 | continue; | 2125 | continue; |
2119 | 2126 | ||
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index de7c54731cbe..de1c604962eb 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h | |||
@@ -72,8 +72,8 @@ | |||
72 | IH_GPIO_BASE + (nr)) | 72 | IH_GPIO_BASE + (nr)) |
73 | 73 | ||
74 | extern int omap_gpio_init(void); /* Call from board init only */ | 74 | extern int omap_gpio_init(void); /* Call from board init only */ |
75 | extern void omap2_gpio_prepare_for_retention(void); | 75 | extern void omap2_gpio_prepare_for_idle(int power_state); |
76 | extern void omap2_gpio_resume_after_retention(void); | 76 | extern void omap2_gpio_resume_after_idle(void); |
77 | extern void omap_set_gpio_debounce(int gpio, int enable); | 77 | extern void omap_set_gpio_debounce(int gpio, int enable); |
78 | extern void omap_set_gpio_debounce_time(int gpio, int enable); | 78 | extern void omap_set_gpio_debounce_time(int gpio, int enable); |
79 | extern void omap_gpio_save_context(void); | 79 | extern void omap_gpio_save_context(void); |