linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* The resume of sgtl5000 causes kernel Oops
@ 2014-05-22 14:56 Shawn Guo
  2014-05-22 17:48 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2014-05-22 14:56 UTC (permalink / raw)
  To: linux-arm-kernel

The suspend/resume test on imx51-babbage board discovers a kernel Oops
caused by sgtl5000_resume().  I believe it happens due to commit
e5d80e82e32e (ASoC: sgtl5000: Convert to use regmap directly).  After
the commit, it seems that the codec->reg_cache in function
sgtl5000_restore_regs() becomes invalid.  It looks that the register
restoring in the function requires some strict sequence, I'm not sure
what the correct fix is.

Shawn

$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
PM: Preparing system for mem sleep
Freezing user space processes ... (elapsed 0.006 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.004 seconds) done.
PM: Entering mem sleep
PM: suspend of devices complete after 41.598 msecs
PM: suspend devices took 0.050 seconds
PM: late suspend of devices complete after 6.434 msecs
PM: noirq suspend of devices complete after 6.735 msecs
Disabling non-boot CPUs ...
PM: noirq resume of devices complete after 10.871 msecs
PM: early resume of devices complete after 5.241 msecs
Unable to handle kernel NULL pointer dereference at virtual address 00000010
pgd = 80004000
[00000010] *pgd=00000000
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 21 Comm: kworker/0:1 Not tainted 3.15.0-rc3-00071-g49a96400a142-dirty #118
Workqueue: events soc_resume_deferred
task: 9e11c440 ti: 9e14e000 task.ti: 9e14e000
PC is at sgtl5000_resume+0x7c/0x124
LR is at mark_held_locks+0x70/0x94
pc : [<804e8fb8>]    lr : [<800661b8>]    psr: 80000013
sp : 9e14fe40  ip : 80a26e60  fp : 9e14fe5c
r10: 9fbd6b00  r9 : 00000001  r8 : 00000000
r7 : 00000010  r6 : 9e369a00  r5 : 00000002  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 9e369a00
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: ac828019  DAC: 00000015
Process kworker/0:1 (pid: 21, stack limit = 0x9e14e240)
Stack: (0x9e14fe40 to 0x9e150000)
fe40: 9e387d84 9e369a00 9e387c64 9e387da4 9e14fe84 9e14fe60 804d90d0 804e8f48
fe60: 9e135300 9e387d84 9fbd36c0 9e14e000 00000000 9fbd6b00 9e14fee4 9e14fe88
fe80: 8003f060 804d8fd0 00000001 00000000 8003efec 9fbd36c0 8003f620 00000000
fea0: 00000000 9e14fea8 80e981a0 80a26e60 00000000 80843dfc 80661fac 9e135300
fec0: 9fbd36f0 9e14e000 9e135318 9e14e000 9fbd36c0 8094e442 9e14ff24 9e14fee8
fee0: 8003f700 8003eec4 80662510 00000000 9e134ac0 9e14e000 8003f5dc 00000000
ff00: 9e134ac0 9e135300 8003f5dc 00000000 00000000 00000000 9e14ffac 9e14ff28
ff20: 800463bc 8003f5e8 800663bc 00000000 9e14ff54 9e135300 00000000 00000000
ff40: dead4ead ffffffff ffffffff 80952424 00000000 00000000 807cc28c 9e14ff5c
ff60: 9e14ff5c 00000000 00000000 dead4ead ffffffff ffffffff 80952424 00000000
ff80: 00000000 807cc28c 9e14ff88 9e14ff88 9e134ac0 800462ec 00000000 00000000
ffa0: 00000000 9e14ffb0 8000eb68 800462f8 00000000 00000000 00000000 00000000
ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00c37f70 76f142d0
Backtrace:
[<804e8f3c>] (sgtl5000_resume) from [<804d90d0>] (soc_resume_deferred+0x10c/0x30c)
 r7:9e387da4 r6:9e387c64 r5:9e369a00 r4:9e387d84
[<804d8fc4>] (soc_resume_deferred) from [<8003f060>] (process_one_work+0x1a8/0x444)
 r10:9fbd6b00 r8:00000000 r7:9e14e000 r6:9fbd36c0 r5:9e387d84 r4:9e135300
[<8003eeb8>] (process_one_work) from [<8003f700>] (worker_thread+0x124/0x398)
 r10:8094e442 r9:9fbd36c0 r8:9e14e000 r7:9e135318 r6:9e14e000 r5:9fbd36f0
 r4:9e135300
[<8003f5dc>] (worker_thread) from [<800463bc>] (kthread+0xd0/0xec)
 r10:00000000 r9:00000000 r8:00000000 r7:8003f5dc r6:9e135300 r5:9e134ac0
 r4:00000000
[<800462ec>] (kthread) from [<8000eb68>] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:800462ec r4:9e134ac0
Code: e1a03084 e1a01004 e1a00006 0afffff0 (e19720b3)
---[ end trace eeb2712470f0de34 ]---
Unable to handle kernel paging request at virtual address ffffffd0
pgd = 80004000
[ffffffd0] *pgd=afff6821, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#2] SMP ARM
Modules linked in:
CPU: 0 PID: 21 Comm: kworker/0:1 Tainted: G      D       3.15.0-rc3-00071-g49a96400a142-dirty #118
task: 9e11c440 ti: 9e14e000 task.ti: 9e14e000
PC is at kthread_data+0x10/0x18
LR is at wq_worker_sleeping+0x14/0xc8
pc : [<8004673c>]    lr : [<8004047c>]    psr: 00000193
sp : 9e14fb00  ip : 9e14fb10  fp : 9e14fb0c
r10: 808f2d2c  r9 : 9e11c698  r8 : 808e8c40
r7 : 00000000  r6 : 9e14e000  r5 : 9e11c440  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 9e11c440
Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: ac828019  DAC: 00000015
Process kworker/0:1 (pid: 21, stack limit = 0x9e14e240)
Stack: (0x9e14fb00 to 0x9e150000)
fb00: 9e14fb24 9e14fb10 8004047c 80046738 00000020 9fbd3c40 9e14fbc4 9e14fb28
fb20: 8065dd8c 80040474 9e14e000 60000113 9e14fb4c 9e14fb40 800663bc 800661e8
fb40: 9e14fb74 9e14fb50 808e8c40 808e8c40 9e11c440 9e1078c0 8094fe04 9e116100
fb60: 9e116604 9e11c440 9e14fb84 9e14fb78 800786f0 80078498 9e14fbd4 9e14fb88
fb80: 80029c60 800786e4 00000000 00000000 800299ec 9e11c438 808e7390 00000001
fba0: 9e11c438 9e11c440 9e11c438 9e14e000 9e11c614 9e068000 9e14fbd4 9e14fbc8
fbc0: 8065e114 8065da60 9e14fc0c 9e14fbd8 8002b088 8065e0e8 9e14e000 00000001
fbe0: 9e11c614 9e14fbf0 8094e944 9e11c65c 9e14fbf0 9e14fbf0 80028d90 808f760c
fc00: 9e14fc8c 9e14fc10 80011ff4 8002aa90 9e14e240 0000000b 00000008 00000000
fc20: 00000000 60000113 65000001 33306131 20343830 30613165 34303031 61316520
fc40: 30303030 61302036 66666666 28203066 37393165 33623032 80002029 80659664
fc60: 80823f48 00000010 00000017 00000000 9e14fdf8 00000010 00000001 9e11c440
fc80: 9e14fca4 9e14fc90 80658498 80011dfc 9e14fdf8 00000017 9e14fd44 9e14fca8
fca0: 8001bcd8 80658448 00000037 00000000 9e14fccc 9e14fcc0 800613d0 800612f8
fcc0: 9e14fcf4 9e14fcd0 8007911c 800613c8 9fbd3c40 9e14e000 808e7ffc 9e14e000
fce0: 00000004 00000001 00000004 00000006 9e11c440 60000013 60000013 00000000
fd00: 9e14fd2c 9e14fd10 800661b8 80063254 9e14e000 80012928 9e11c440 00000017
fd20: 8001bb20 808f8314 00000010 9e14fdf8 00000001 9fbd6b00 9e14fdf4 9e14fd48
fd40: 8000840c 8001bb2c 800663bc 800661e8 9e14fe0c 9e14fd60 80012928 800663b4
fd60: 00000001 9e11c8a0 00000000 9e11c440 00000001 00000007 80903a24 80e3ea20
fd80: 60000013 60000013 00000000 9e14fe0c 80a26e60 9e14fda8 800661b8 8006d650
fda0: 20000013 ffffffff 00000000 00000000 00000000 00000000 80e3f308 00000007
fdc0: 60000013 80660be4 9e14fde4 00000000 00000000 804e8fb8 80000013 ffffffff
fde0: 9e14fe2c 00000000 9e14fe5c 9e14fdf8 800128a4 800083dc 9e369a00 00000000
fe00: 00000000 00000000 00000000 00000002 9e369a00 00000010 00000000 00000001
fe20: 9fbd6b00 9e14fe5c 80a26e60 9e14fe40 800661b8 804e8fb8 80000013 ffffffff
fe40: 9e387d84 9e369a00 9e387c64 9e387da4 9e14fe84 9e14fe60 804d90d0 804e8f48
fe60: 9e135300 9e387d84 9fbd36c0 9e14e000 00000000 9fbd6b00 9e14fee4 9e14fe88
fe80: 8003f060 804d8fd0 00000001 00000000 8003efec 9fbd36c0 8003f620 00000000
fea0: 00000000 9e14fea8 80e981a0 80a26e60 00000000 80843dfc 80661fac 9e135300
fec0: 9fbd36f0 9e14e000 9e135318 9e14e000 9fbd36c0 8094e442 9e14ff24 9e14fee8
fee0: 8003f700 8003eec4 80662510 00000000 9e134ac0 9e14e000 8003f5dc 00000000
ff00: 9e134ac0 9e135300 8003f5dc 00000000 00000000 00000000 9e14ffac 9e14ff28
ff20: 800463bc 8003f5e8 800663bc 00000000 9e14ff54 9e135300 00000000 00000000
ff40: dead4ead ffffffff ffffffff 80952424 00000000 00000000 807cc28c 9e14ff5c
ff60: 9e14ff5c 00000001 00010001 dead4ead ffffffff ffffffff 80952424 00000000
ff80: 00000000 807cc28c 9e14ff88 9e14ff88 9e134ac0 800462ec 00000000 00000000
ffa0: 00000000 9e14ffb0 8000eb68 800462f8 00000000 00000000 00000000 00000000
ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00c37f70 76f142d0
Backtrace:
[<8004672c>] (kthread_data) from [<8004047c>] (wq_worker_sleeping+0x14/0xc8)
[<80040468>] (wq_worker_sleeping) from [<8065dd8c>] (__schedule+0x338/0x5cc)
 r4:9fbd3c40 r3:00000020
[<8065da54>] (__schedule) from [<8065e114>] (schedule+0x38/0x88)
 r10:9e068000 r9:9e11c614 r8:9e14e000 r7:9e11c438 r6:9e11c440 r5:9e11c438
 r4:00000001
[<8065e0dc>] (schedule) from [<8002b088>] (do_exit+0x604/0x8d8)
[<8002aa84>] (do_exit) from [<80011ff4>] (die+0x204/0x3c0)
 r7:808f760c
[<80011df0>] (die) from [<80658498>] (__do_kernel_fault.part.9+0x5c/0x7c)
 r10:9e11c440 r9:00000001 r8:00000010 r7:9e14fdf8 r6:00000000 r5:00000017
 r4:00000010
[<8065843c>] (__do_kernel_fault.part.9) from [<8001bcd8>] (do_page_fault+0x1b8/0x3e4)
 r7:00000017 r3:9e14fdf8
[<8001bb20>] (do_page_fault) from [<8000840c>] (do_DataAbort+0x3c/0xa0)
 r10:9fbd6b00 r9:00000001 r8:9e14fdf8 r7:00000010 r6:808f8314 r5:8001bb20
 r4:00000017
[<800083d0>] (do_DataAbort) from [<800128a4>] (__dabt_svc+0x44/0x80)
Exception stack(0x9e14fdf8 to 0x9e14fe40)
fde0:                                                       9e369a00 00000000
fe00: 00000000 00000000 00000000 00000002 9e369a00 00000010 00000000 00000001
fe20: 9fbd6b00 9e14fe5c 80a26e60 9e14fe40 800661b8 804e8fb8 80000013 ffffffff
 r8:00000000 r7:9e14fe2c r6:ffffffff r5:80000013 r4:804e8fb8
[<804e8f3c>] (sgtl5000_resume) from [<804d90d0>] (soc_resume_deferred+0x10c/0x30c)
 r7:9e387da4 r6:9e387c64 r5:9e369a00 r4:9e387d84
[<804d8fc4>] (soc_resume_deferred) from [<8003f060>] (process_one_work+0x1a8/0x444)
 r10:9fbd6b00 r8:00000000 r7:9e14e000 r6:9fbd36c0 r5:9e387d84 r4:9e135300
[<8003eeb8>] (process_one_work) from [<8003f700>] (worker_thread+0x124/0x398)
 r10:8094e442 r9:9fbd36c0 r8:9e14e000 r7:9e135318 r6:9e14e000 r5:9fbd36f0
 r4:9e135300
[<8003f5dc>] (worker_thread) from [<800463bc>] (kthread+0xd0/0xec)
 r10:00000000 r9:00000000 r8:00000000 r7:8003f5dc r6:9e135300 r5:9e134ac0
 r4:00000000
[<800462ec>] (kthread) from [<8000eb68>] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:800462ec r4:9e134ac0
Code: e1a0c00d e92dd800 e24cb004 e590322c (e5130030)
---[ end trace eeb2712470f0de35 ]---
Fixing recursive fault but reboot is needed!
BUG: spinlock lockup suspected on CPU#0, kworker/0:1/21
 lock: 0x9fbd3c40, .magic: dead4ead, .owner: kworker/0:1/21, .owner_cpu: 0
CPU: 0 PID: 21 Comm: kworker/0:1 Tainted: G      D       3.15.0-rc3-00071-g49a96400a142-dirty #118
Backtrace:
[<80011c50>] (dump_backtrace) from [<80011dec>] (show_stack+0x18/0x1c)
 r6:016e3600 r5:00000000 r4:00000000 r3:00000000
[<80011dd4>] (show_stack) from [<8065b720>] (dump_stack+0x88/0xa4)
[<8065b698>] (dump_stack) from [<806595ac>] (spin_dump+0x7c/0x90)
 r5:9fbd3c40 r4:9e11c440
[<80659530>] (spin_dump) from [<80068a74>] (do_raw_spin_lock+0x110/0x198)
 r5:00000000 r4:016e3600
[<80068964>] (do_raw_spin_lock) from [<80661fac>] (_raw_spin_lock_irq+0x44/0x4c)
 r10:808f2d2c r9:8094e944 r8:808e8c40 r7:00000000 r6:9e14e000 r5:8065dab4
 r4:9fbd3c40 r3:9e11c440
[<80661f68>] (_raw_spin_lock_irq) from [<8065dab4>] (__schedule+0x60/0x5cc)
 r5:9e11c440 r4:9fbd3c40
[<8065da54>] (__schedule) from [<8065e114>] (schedule+0x38/0x88)
 r10:00000001 r9:8094e944 r8:9e14e000 r7:808f760c r6:9e11c440 r5:0000000b
 r4:0000000b
[<8065e0dc>] (schedule) from [<8002b2dc>] (do_exit+0x858/0x8d8)
[<8002aa84>] (do_exit) from [<80011ff4>] (die+0x204/0x3c0)
 r7:808f760c
[<80011df0>] (die) from [<80658498>] (__do_kernel_fault.part.9+0x5c/0x7c)
 r10:9e11c440 r9:9e11c698 r8:ffffffd0 r7:9e14fab8 r6:00000000 r5:00000017
 r4:ffffffd0
[<8065843c>] (__do_kernel_fault.part.9) from [<8001bcd8>] (do_page_fault+0x1b8/0x3e4)
 r7:00000017 r3:9e14fab8
[<8001bb20>] (do_page_fault) from [<8000840c>] (do_DataAbort+0x3c/0xa0)
 r10:808f2d2c r9:9e11c698 r8:9e14fab8 r7:ffffffd0 r6:808f8314 r5:8001bb20
 r4:00000017
[<800083d0>] (do_DataAbort) from [<800128a4>] (__dabt_svc+0x44/0x80)
Exception stack(0x9e14fab8 to 0x9e14fb00)
faa0:                                                       9e11c440 00000000
fac0: 00000000 00000000 00000000 9e11c440 9e14e000 00000000 808e8c40 9e11c698
fae0: 808f2d2c 9e14fb0c 9e14fb10 9e14fb00 8004047c 8004673c 00000193 ffffffff
 r8:808e8c40 r7:9e14faec r6:ffffffff r5:00000193 r4:8004673c
[<8004672c>] (kthread_data) from [<8004047c>] (wq_worker_sleeping+0x14/0xc8)
[<80040468>] (wq_worker_sleeping) from [<8065dd8c>] (__schedule+0x338/0x5cc)
 r4:9fbd3c40 r3:00000020
[<8065da54>] (__schedule) from [<8065e114>] (schedule+0x38/0x88)
 r10:9e068000 r9:9e11c614 r8:9e14e000 r7:9e11c438 r6:9e11c440 r5:9e11c438
 r4:00000001
[<8065e0dc>] (schedule) from [<8002b088>] (do_exit+0x604/0x8d8)
[<8002aa84>] (do_exit) from [<80011ff4>] (die+0x204/0x3c0)
 r7:808f760c
[<80011df0>] (die) from [<80658498>] (__do_kernel_fault.part.9+0x5c/0x7c)
 r10:9e11c440 r9:00000001 r8:00000010 r7:9e14fdf8 r6:00000000 r5:00000017
 r4:00000010
[<8065843c>] (__do_kernel_fault.part.9) from [<8001bcd8>] (do_page_fault+0x1b8/0x3e4)
 r7:00000017 r3:9e14fdf8
[<8001bb20>] (do_page_fault) from [<8000840c>] (do_DataAbort+0x3c/0xa0)
 r10:9fbd6b00 r9:00000001 r8:9e14fdf8 r7:00000010 r6:808f8314 r5:8001bb20
 r4:00000017
[<800083d0>] (do_DataAbort) from [<800128a4>] (__dabt_svc+0x44/0x80)
Exception stack(0x9e14fdf8 to 0x9e14fe40)
fde0:                                                       9e369a00 00000000
fe00: 00000000 00000000 00000000 00000002 9e369a00 00000010 00000000 00000001
fe20: 9fbd6b00 9e14fe5c 80a26e60 9e14fe40 800661b8 804e8fb8 80000013 ffffffff
 r8:00000000 r7:9e14fe2c r6:ffffffff r5:80000013 r4:804e8fb8
[<804e8f3c>] (sgtl5000_resume) from [<804d90d0>] (soc_resume_deferred+0x10c/0x30c)
 r7:9e387da4 r6:9e387c64 r5:9e369a00 r4:9e387d84
[<804d8fc4>] (soc_resume_deferred) from [<8003f060>] (process_one_work+0x1a8/0x444)
 r10:9fbd6b00 r8:00000000 r7:9e14e000 r6:9fbd36c0 r5:9e387d84 r4:9e135300
[<8003eeb8>] (process_one_work) from [<8003f700>] (worker_thread+0x124/0x398)
 r10:8094e442 r9:9fbd36c0 r8:9e14e000 r7:9e135318 r6:9e14e000 r5:9fbd36f0
 r4:9e135300
[<8003f5dc>] (worker_thread) from [<800463bc>] (kthread+0xd0/0xec)
 r10:00000000 r9:00000000 r8:00000000 r7:8003f5dc r6:9e135300 r5:9e134ac0
 r4:00000000
[<800462ec>] (kthread) from [<8000eb68>] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:800462ec r4:9e134ac0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* The resume of sgtl5000 causes kernel Oops
  2014-05-22 14:56 The resume of sgtl5000 causes kernel Oops Shawn Guo
@ 2014-05-22 17:48 ` Mark Brown
  2014-05-22 21:33   ` [alsa-devel] " Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2014-05-22 17:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 22, 2014 at 10:56:51PM +0800, Shawn Guo wrote:
> The suspend/resume test on imx51-babbage board discovers a kernel Oops
> caused by sgtl5000_resume().  I believe it happens due to commit
> e5d80e82e32e (ASoC: sgtl5000: Convert to use regmap directly).  After
> the commit, it seems that the codec->reg_cache in function
> sgtl5000_restore_regs() becomes invalid.  It looks that the register
> restoring in the function requires some strict sequence, I'm not sure
> what the correct fix is.

Yes, reg_cache isn't there if we're not using ASoC level caching.  The
fix should just be to replace the direct cache references with
snd_soc_read()s which will end up in a cache lookup if the register is
cached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140522/6d4e05d8/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [alsa-devel] The resume of sgtl5000 causes kernel Oops
  2014-05-22 17:48 ` Mark Brown
@ 2014-05-22 21:33   ` Fabio Estevam
  2014-05-23  2:05     ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2014-05-22 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Mark,

On Thu, May 22, 2014 at 2:48 PM, Mark Brown <broonie@kernel.org> wrote:
> On Thu, May 22, 2014 at 10:56:51PM +0800, Shawn Guo wrote:
>> The suspend/resume test on imx51-babbage board discovers a kernel Oops
>> caused by sgtl5000_resume().  I believe it happens due to commit
>> e5d80e82e32e (ASoC: sgtl5000: Convert to use regmap directly).  After
>> the commit, it seems that the codec->reg_cache in function
>> sgtl5000_restore_regs() becomes invalid.  It looks that the register
>> restoring in the function requires some strict sequence, I'm not sure
>> what the correct fix is.
>
> Yes, reg_cache isn't there if we're not using ASoC level caching.  The
> fix should just be to replace the direct cache references with
> snd_soc_read()s which will end up in a cache lookup if the register is
> cached.

Do you mean like this?

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 9626ee0..437751a 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1075,7 +1075,6 @@ static int sgtl5000_suspend(struct snd_soc_codec *codec)
  */
 static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
 {
-    u16 *cache = codec->reg_cache;
     u16 reg;

     /* restore regular registers */
@@ -1089,12 +1088,12 @@ static int sgtl5000_restore_regs(struct
snd_soc_codec *codec)
             reg == SGTL5000_CHIP_REF_CTRL)
             continue;

-        snd_soc_write(codec, reg, cache[reg]);
+        snd_soc_write(codec, reg, snd_soc_read(codec, reg));
     }

     /* restore dap registers */
     for (reg = SGTL5000_DAP_REG_OFFSET; reg <
SGTL5000_MAX_REG_OFFSET; reg += 2)
-        snd_soc_write(codec, reg, cache[reg]);
+        snd_soc_write(codec, reg, snd_soc_read(codec, reg));

     /*
      * restore these regs according to the power setting sequence in
@@ -1110,19 +1109,19 @@ static int sgtl5000_restore_regs(struct
snd_soc_codec *codec)
      *    prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
      */
     snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
-            cache[SGTL5000_CHIP_LINREG_CTRL]);
+            snd_soc_read(codec, SGTL5000_CHIP_LINREG_CTRL));

     snd_soc_write(codec, SGTL5000_CHIP_ANA_POWER,
-            cache[SGTL5000_CHIP_ANA_POWER]);
+            snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER));

     snd_soc_write(codec, SGTL5000_CHIP_CLK_CTRL,
-            cache[SGTL5000_CHIP_CLK_CTRL]);
+            snd_soc_read(codec, SGTL5000_CHIP_CLK_CTRL));

     snd_soc_write(codec, SGTL5000_CHIP_REF_CTRL,
-            cache[SGTL5000_CHIP_REF_CTRL]);
+            snd_soc_read(codec, SGTL5000_CHIP_REF_CTRL));

     snd_soc_write(codec, SGTL5000_CHIP_LINE_OUT_CTRL,
-            cache[SGTL5000_CHIP_LINE_OUT_CTRL]);
+            snd_soc_read(codec, SGTL5000_CHIP_LINE_OUT_CTRL));
     return 0;
 }

This avoids the crash in suspend, but I get different errors now:

root@freescale /$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.001 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
random: nonblocking pool is initialized
PM: suspend of devices complete after 15.210 msecs
PM: suspend devices took 0.010 seconds
PM: late suspend of devices complete after 4.435 msecs
PM: noirq suspend of devices complete after 4.691 msecs
Disabling non-boot CPUs ...
PM: noirq resume of devices complete after 3.931 msecs
PM: early resume of devices complete after 5.724 msecs
sgtl5000 1-000a: Failed to restore cache: -5
sgtl5000 1-000a: Failed to restore cache: -5
sgtl5000 1-000a: ASoC: Failed to turn on bias: -5
sgtl5000 1-000a: Failed to restore cache: -5
sgtl5000 1-000a: ASoC: Failed to turn on bias: -5
sgtl5000 1-000a: Failed to restore cache: -5
sgtl5000 1-000a: ASoC: Failed to turn on bias: -5
PM: resume of devices complete after 62.349 msecs
PM: resume devices took 0.060 seconds
Restarting tasks ... done.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [alsa-devel] The resume of sgtl5000 causes kernel Oops
  2014-05-22 21:33   ` [alsa-devel] " Fabio Estevam
@ 2014-05-23  2:05     ` Fabio Estevam
  2014-05-23  2:28       ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2014-05-23  2:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 22, 2014 at 6:33 PM, Fabio Estevam <festevam@gmail.com> wrote:
> sgtl5000 1-000a: Failed to restore cache: -5
> sgtl5000 1-000a: Failed to restore cache: -5
> sgtl5000 1-000a: ASoC: Failed to turn on bias: -5
> sgtl5000 1-000a: Failed to restore cache: -5
> sgtl5000 1-000a: ASoC: Failed to turn on bias: -5
> sgtl5000 1-000a: Failed to restore cache: -5
> sgtl5000 1-000a: ASoC: Failed to turn on bias: -5

These errors are gone if on top of the previous change I add:

--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -36,29 +36,55 @@

 /* default value of sgtl5000 registers */
 static const struct reg_default sgtl5000_reg_defaults[] = {
-    { SGTL5000_CHIP_CLK_CTRL,        0x0008 },
-    { SGTL5000_CHIP_I2S_CTRL,        0x0010 },
-    { SGTL5000_CHIP_SSS_CTRL,        0x0010 },
+    { SGTL5000_CHIP_DIG_POWER,         0x0000 },
+    { SGTL5000_CHIP_CLK_CTRL,         0x0008 },
+    { SGTL5000_CHIP_I2S_CTRL,         0x0010 },
+    { SGTL5000_CHIP_SSS_CTRL,         0x0010 },
+    { SGTL5000_CHIP_ADCDAC_CTRL,         0x020c },
     { SGTL5000_CHIP_DAC_VOL,        0x3c3c },
     { SGTL5000_CHIP_PAD_STRENGTH,        0x015f },
-    { SGTL5000_CHIP_ANA_HP_CTRL,        0x1818 },
+    { SGTL5000_CHIP_ANA_ADC_CTRL,        0x0000 },
+    { SGTL5000_CHIP_ANA_HP_CTRL,         0x1818 },
     { SGTL5000_CHIP_ANA_CTRL,        0x0111 },
+    { SGTL5000_CHIP_LINREG_CTRL,        0x0000 },
+    { SGTL5000_CHIP_REF_CTRL,        0x0000 },
+    { SGTL5000_CHIP_MIC_CTRL,        0x0000 },
+    { SGTL5000_CHIP_LINE_OUT_CTRL,        0x0000 },
     { SGTL5000_CHIP_LINE_OUT_VOL,        0x0404 },
     { SGTL5000_CHIP_ANA_POWER,        0x7060 },
     { SGTL5000_CHIP_PLL_CTRL,        0x5000 },
+    { SGTL5000_CHIP_CLK_TOP_CTRL,        0x0000 },
+    { SGTL5000_CHIP_ANA_STATUS,        0x0000 },
+    { SGTL5000_CHIP_SHORT_CTRL,        0x0000 },
+    { SGTL5000_CHIP_ANA_TEST2,        0x0000 },
+    { SGTL5000_DAP_CTRL,            0x0000 },
+    { SGTL5000_DAP_PEQ,            0x0000 },
     { SGTL5000_DAP_BASS_ENHANCE,        0x0040 },
     { SGTL5000_DAP_BASS_ENHANCE_CTRL,    0x051f },
+    { SGTL5000_DAP_AUDIO_EQ,        0x0000 },
     { SGTL5000_DAP_SURROUND,        0x0040 },
+    { SGTL5000_DAP_FLT_COEF_ACCESS,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_B0_MSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_B0_LSB,        0x0000 },
     { SGTL5000_DAP_EQ_BASS_BAND0,        0x002f },
     { SGTL5000_DAP_EQ_BASS_BAND1,        0x002f },
     { SGTL5000_DAP_EQ_BASS_BAND2,        0x002f },
     { SGTL5000_DAP_EQ_BASS_BAND3,        0x002f },
-    { SGTL5000_DAP_EQ_BASS_BAND4,        0x002f },
+    { SGTL5000_DAP_EQ_BASS_BAND4,        0x002f },
     { SGTL5000_DAP_MAIN_CHAN,        0x8000 },
+    { SGTL5000_DAP_MIX_CHAN,        0x0000 },
     { SGTL5000_DAP_AVC_CTRL,        0x0510 },
     { SGTL5000_DAP_AVC_THRESHOLD,        0x1473 },
     { SGTL5000_DAP_AVC_ATTACK,        0x0028 },
     { SGTL5000_DAP_AVC_DECAY,        0x0050 },
+    { SGTL5000_DAP_COEF_WR_B1_MSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_B1_LSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_B2_MSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_B2_LSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_A1_MSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_A1_LSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_A2_MSB,        0x0000 },
+    { SGTL5000_DAP_COEF_WR_A2_LSB,        0x0000 },
 };

,but now I am not able to play audio again after suspend/resume.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [alsa-devel] The resume of sgtl5000 causes kernel Oops
  2014-05-23  2:05     ` Fabio Estevam
@ 2014-05-23  2:28       ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2014-05-23  2:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, May 22, 2014 at 11:05 PM, Fabio Estevam <festevam@gmail.com> wrote:

> ,but now I am not able to play audio again after suspend/resume.

Ok, got it working now. Will submit a patch soon.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-23  2:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-22 14:56 The resume of sgtl5000 causes kernel Oops Shawn Guo
2014-05-22 17:48 ` Mark Brown
2014-05-22 21:33   ` [alsa-devel] " Fabio Estevam
2014-05-23  2:05     ` Fabio Estevam
2014-05-23  2:28       ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).