Commit 56c6c587 authored by Anson Huang's avatar Anson Huang Committed by Nitin Garg
Browse files

MLK-11394 ARM: imx: regulator API can NOT be called under idle context



On i.MX6SL, cpuidle need to check if weak 2P5 is enabled to decide
whether put band gap into low power mode, previous implement is to
call regulator API directly which is actually incorrect, as regulator
API will hole a lock which is NOT allowed to be called in idle
context, see below log:

- Build kernel 3.10.53 GA with CONFIG_DEBUG_ATOMIC_SLEEP=y

- Blank the LCD: echo 1 > /sys/class/graphics/fb0/blank

Then the following BUG is reported after a few seconds:

BUG: sleeping function called from invalid context at kernel/mutex.c:95
in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/0

CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.53-02671-g26ccfed-dirty #26

[<80013f98>] (unwind_backtrace+0x0/0xf8) from [<80011a2c>] (show_stack+0x10/0x14)
[<80011a2c>] (show_stack+0x10/0x14) from [<8060e804>] (mutex_lock+0x18/0x64)
[<8060e804>] (mutex_lock+0x18/0x64) from [<802c42b0>] (regulator_is_enabled+0x24/0x44)
[<802c42b0>] (regulator_is_enabled+0x24/0x44) from [<8001e6d8>] (imx6sl_enter_wait+0x4c/0x9c)
[<8001e6d8>] (imx6sl_enter_wait+0x4c/0x9c) from [<80444708>] (cpuidle_enter_state+0x3c/0xe8)
[<80444708>] (cpuidle_enter_state+0x3c/0xe8) from [<80444854>] (cpuidle_idle_call+0xa0/0x144)
[<80444854>] (cpuidle_idle_call+0xa0/0x144) from [<8000ee60>] (arch_cpu_idle+0x10/0x4c)
[<8000ee60>] (arch_cpu_idle+0x10/0x4c) from [<8005e7ec>] (cpu_startup_entry+0x5c/0x148)
[<8005e7ec>] (cpu_startup_entry+0x5c/0x148) from [<80beba3c>] (start_kernel+0x2cc/0x324)

As i.MX6SL is a single core SoC and this regulator is implemented in cpuidle,
there is a static variable to record the LDO status, we can use it instead
of calling regulator API.

Signed-off-by: default avatarAnson Huang <b20788@freescale.com>

Conflicts:
	arch/arm/mach-imx/cpuidle-imx6sl.c
parent fec2a9a8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment