Commit 158e06653bf8de65087d7bbf56d0ebac303379d4
1 parent
3bd1e28683
Exists in
v3.2_SMARCT335xPSP_04.06.00.11
and in
3 other branches
ARM: OMAP: AM33XX: PM: Enable GPIO0 wakeup for standby
Keep GPIO0 module enabled during standby to support GPIO0 io-pads to wakeup the system from standby mode. Signed-off-by: Satyanarayana Sandhya <sandhya.satyanarayana@ti.com>
Showing 3 changed files with 57 additions and 3 deletions Side-by-side Diff
arch/arm/mach-omap2/pm33xx.c
... | ... | @@ -130,8 +130,21 @@ |
130 | 130 | * might have issues. Refer to commit 672639b for the |
131 | 131 | * details |
132 | 132 | */ |
133 | - if (suspend_cfg_param_list[EVM_ID] != EVM_SK) | |
133 | + /* | |
134 | + * Keep GPIO0 module enabled during standby to | |
135 | + * support wakeup via GPIO0 keys. | |
136 | + */ | |
137 | + if ((suspend_cfg_param_list[EVM_ID] != EVM_SK) && | |
138 | + (suspend_state != PM_SUSPEND_STANDBY)) | |
134 | 139 | omap_hwmod_idle(gpio1_oh); |
140 | + /* | |
141 | + * Update Suspend_State value to be used in sleep33xx.S to keep | |
142 | + * GPIO0 module enabled during standby for EVM-SK | |
143 | + */ | |
144 | + if (suspend_state == PM_SUSPEND_STANDBY) | |
145 | + suspend_cfg_param_list[SUSPEND_STATE] = PM_STANDBY; | |
146 | + else | |
147 | + suspend_cfg_param_list[SUSPEND_STATE] = PM_DS0; | |
135 | 148 | |
136 | 149 | /* |
137 | 150 | * Keep Touchscreen module enabled during standby |
... | ... | @@ -192,7 +205,12 @@ |
192 | 205 | * Enable the GPIO module. Once the driver is |
193 | 206 | * fully adapted to runtime PM this will go away |
194 | 207 | */ |
195 | - if (suspend_cfg_param_list[EVM_ID] != EVM_SK) | |
208 | + /* | |
209 | + * During standby, GPIO was not disabled. Hence no | |
210 | + * need to enable it here. | |
211 | + */ | |
212 | + if ((suspend_cfg_param_list[EVM_ID] != EVM_SK) && | |
213 | + (suspend_state != PM_SUSPEND_STANDBY)) | |
196 | 214 | omap_hwmod_enable(gpio1_oh); |
197 | 215 | |
198 | 216 | return ret; |
arch/arm/mach-omap2/pm33xx.h
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | SUSP_VTP_CTRL_VAL, |
32 | 32 | EVM_ID, |
33 | 33 | CPU_REV, |
34 | + SUSPEND_STATE, | |
34 | 35 | SUSPEND_CFG_PARAMS_END /* Must be the last entry */ |
35 | 36 | }; |
36 | 37 | |
... | ... | @@ -80,6 +81,9 @@ |
80 | 81 | #define CPU_REV_2 2 |
81 | 82 | |
82 | 83 | #define M3_VERSION_UNKNOWN 0x0000ffff |
84 | + | |
85 | +#define PM_DS0 0 | |
86 | +#define PM_STANDBY 1 | |
83 | 87 | |
84 | 88 | #endif |
arch/arm/mach-omap2/sleep33xx.S
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | * 2) susp_vtp_ctrl_val [r1] |
43 | 43 | * 3) evm_id [r2] |
44 | 44 | * 4) cpu_rev [r3] |
45 | + * 5) suspend_state[r4] | |
45 | 46 | * |
46 | 47 | * The code loads these values taking r0 value as reference to the array in |
47 | 48 | * registers starting from r0, i,e memory_type goes to r0 and susp_vtp_ctrl_val |
48 | 49 | |
... | ... | @@ -139,13 +140,14 @@ |
139 | 140 | mov r0, #0 |
140 | 141 | mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate |
141 | 142 | |
142 | - ldm r8, {r0-r3} @ gather values passed | |
143 | + ldm r8, {r0-r4} @ gather values passed | |
143 | 144 | |
144 | 145 | /* Save the values passed */ |
145 | 146 | str r0, mem_type |
146 | 147 | str r1, susp_vtp_ctrl_val |
147 | 148 | str r2, evm_id |
148 | 149 | str r3, cpu_rev |
150 | + str r4, suspend_state | |
149 | 151 | |
150 | 152 | ldr r0, emif_addr_virt |
151 | 153 | |
... | ... | @@ -245,6 +247,16 @@ |
245 | 247 | mov r2, #(1 << 7) |
246 | 248 | str r2, [r0, #OMAP4_GPIO_CLEARDATAOUT] |
247 | 249 | |
250 | + /* | |
251 | + * Keep GPIO0 enabled during standby to support | |
252 | + * wakeup from Standby via GPIO0 keys. | |
253 | + * | |
254 | + * GPIO0 is disabled here for EVM_SK only in DS0. | |
255 | + */ | |
256 | + ldr r6, suspend_state | |
257 | + cmp r6, #PM_STANDBY | |
258 | + beq no_gpio_toggle | |
259 | + | |
248 | 260 | /* Disable GPIO0 for EVM_SK here */ |
249 | 261 | ldr r1, virt_gpio0_clkctrl |
250 | 262 | ldr r2, [r1] |
... | ... | @@ -462,6 +474,14 @@ |
462 | 474 | cmp r6, #EVM_SK |
463 | 475 | bne no_gpio_toggle2 |
464 | 476 | |
477 | + /* | |
478 | + * GPIO0 was not disabled during standby for EVM_SK | |
479 | + * Hence no need to enable it back here. | |
480 | + */ | |
481 | + ldr r6, suspend_state | |
482 | + cmp r6, #PM_STANDBY | |
483 | + beq skip_gpio_enable1 | |
484 | + | |
465 | 485 | /* Enable GPIO0 for EVM-SK here */ |
466 | 486 | ldr r1, virt_gpio0_clkctrl |
467 | 487 | mov r2, #0x2 |
... | ... | @@ -471,6 +491,7 @@ |
471 | 491 | cmp r2, r3 |
472 | 492 | bne wait_gpio0_enable |
473 | 493 | |
494 | +skip_gpio_enable1: | |
474 | 495 | /* Drive GPIO0_7 HIGH */ |
475 | 496 | ldr r0, gpio0_addr_virt |
476 | 497 | ldr r1, [r0, #OMAP4_GPIO_SETDATAOUT] |
... | ... | @@ -669,6 +690,14 @@ |
669 | 690 | cmp r6, #EVM_SK |
670 | 691 | bne no_gpio_toggle3 |
671 | 692 | |
693 | + /* | |
694 | + * GPIO0 was not disabled during standby for EVM_SK | |
695 | + * Hence no need to enable it back here. | |
696 | + */ | |
697 | + ldr r6, suspend_state | |
698 | + cmp r6, #PM_STANDBY | |
699 | + beq skip_gpio_enable2 | |
700 | + | |
672 | 701 | /* Enable GPIO0 for EVM-SK here */ |
673 | 702 | ldr r1, phys_gpio0_clkctrl |
674 | 703 | mov r2, #0x2 |
... | ... | @@ -678,6 +707,7 @@ |
678 | 707 | cmp r2, r3 |
679 | 708 | bne wait_gpio0_phys_enable |
680 | 709 | |
710 | +skip_gpio_enable2: | |
681 | 711 | /* Drive GPIO0_7 HIGH */ |
682 | 712 | ldr r0, gpio0_phys_addr |
683 | 713 | ldr r1, [r0, #OMAP4_GPIO_SETDATAOUT] |
... | ... | @@ -958,6 +988,8 @@ |
958 | 988 | evm_id: |
959 | 989 | .word 0xDEADBEEF |
960 | 990 | cpu_rev: |
991 | + .word 0xDEADBEEF | |
992 | +suspend_state: | |
961 | 993 | .word 0xDEADBEEF |
962 | 994 | emif_addr_virt: |
963 | 995 | .word 0xDEADBEEF |