ARM: pm: convert cpu_suspend() to a normal function

cpu_suspend() has a weird calling method which makes it only possible to
call from assembly code: it returns with a modified stack pointer to
finish the suspend, but on resume, it 'returns' via a provided pointer.

We can make cpu_suspend() appear to be a normal function merely by
swapping the resume pointer argument and the link register.

Do so, and update all callers to take account of this more traditional
behaviour.

Acked-by: Frank Hofmann <frank.hofmann@tomtom.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Acked-by: Jean Pihet <j-pihet@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King
2011-06-13 15:58:34 +01:00
parent dbc125168f
commit e8856a8797
8 changed files with 31 additions and 40 deletions

View File

@@ -35,9 +35,11 @@ ENTRY(pxa3xx_cpu_suspend)
#endif
stmfd sp!, {r2 - r12, lr} @ save registers on stack
mov r1, r0
ldr r3, =pxa_cpu_resume @ resume function
adr r3, BSYM(pxa3xx_finish_suspend)
bl cpu_suspend
b pxa_cpu_resume
pxa3xx_finish_suspend:
mov r0, #0x06 @ S2D3C4 mode
mcr p14, 0, r0, c7, c0, 0 @ enter sleep
@@ -60,9 +62,11 @@ ENTRY(pxa27x_cpu_suspend)
#endif
stmfd sp!, {r2 - r12, lr} @ save registers on stack
mov r2, r0 @ save sleep mode
ldr r3, =pxa_cpu_resume @ resume function
adr r3, BSYM(pxa27x_finish_suspend)
bl cpu_suspend
b pxa_cpu_resume
pxa27x_finish_suspend:
@ Put the processor to sleep
@ (also workaround for sighting 28071)
@@ -110,8 +114,11 @@ ENTRY(pxa27x_cpu_suspend)
ENTRY(pxa25x_cpu_suspend)
stmfd sp!, {r2 - r12, lr} @ save registers on stack
mov r2, r0 @ save sleep mode
ldr r3, =pxa_cpu_resume @ resume function
adr r3, BSYM(pxa25x_finish_suspend)
bl cpu_suspend
b pxa_cpu_resume
pxa25x_finish_suspend:
@ prepare value for sleep mode
mov r1, r0 @ sleep mode