25 Nov, 2019

1 commit


11 Nov, 2019

1 commit


01 Nov, 2019

1 commit


14 Apr, 2019

1 commit

  • With small buffer size, the resume will be triggered after suspend
    immediately, if we reserve the period done message to be sent with
    the next command, one period time later, it will cause underrun in
    m4 side, for ALSA thought the appl_ptr is updated, but the command
    won't be sent to M4 immediately, M4 don't have enough data to play.

    In this patch, we check that if the left size in the buffer is less
    that one period, the work queue will be triggered to send the period
    done message immediately.

    Fixes: 348d47695622 ("MLK-21307: ASoC: fsl_rpmsg_i2s: optimize
    the message sent to m4")
    Signed-off-by: Shengjiu Wang

    (cherry picked from commit 3dfecae40765329c0b7de1157f97ade24ecfce6d)

    Shengjiu Wang
     

12 Apr, 2019

5 commits

  • M4 complain that there are two much period done message sent to m4, that
    M4 don't have enough time to handle these messages.

    The solution for this issue is to reduce the number of period done message.
    We allocate a specific memory for period done message, every time there is
    period done coming, it will be writed to this memory, not write it directly
    to the work queue, that queue will not be overflow, and the old period done
    message will be overwrited.

    In the rpmsg_i2s_work, we first check if there is period done message, then
    send it first, after that, send the command in queue.

    Signed-off-by: Shengjiu Wang
    Reviewed-by: Daniel Baluta
    (cherry picked from commit caabdfa176453cc7c8d6521f7865a670a7265a18)

    Shengjiu Wang
     
  • Previously we add snd_soc_find_dai to check if the codec is probed or
    not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

    [ 2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
    [ 2.831827] Modules linked in:
    [ 2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
    [ 2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
    [ 2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
    [ 2.853745] PC is at snd_soc_find_dai+0x144/0x150
    [ 2.858462] LR is at snd_soc_find_dai+0x140/0x150

    ...

    [ 3.469675] Call trace:
    [ 3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
    [ 3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
    [ 3.4864333.596564] [] bus_add_driver+0x110/0x230
    [ 3.602149] [] driver_register+0x68/0x100
    [ 3.607735] [] __platform_driver_register+0x54/0x60
    [ 3.614191] [] imx_rpmsg_driver_init+0x20/0x28
    [ 3.620213] [] do_one_initcall+0x44/0x130
    [ 3.625801] [] kernel_init_freeable+0x1e0/0x280
    [ 3.631909] [] kernel_init+0x18/0x110
    [ 3.637148] [] ret_from_fork+0x10/0x1c

    So we could't resolve the warning "snd_soc_register_card failed (-517)".

    Fixes: 2bf5f9704785 ("MLK-19854-1: ASoC: imx-cs42888: fix error when m4
    image is not loaded")
    Signed-off-by: Shengjiu Wang

    (cherry picked from commit 58ffdf239288cfa6904640fc8432c182cf56589b)

    Shengjiu Wang
     
  • Previously we add snd_soc_find_dai to check if the codec is probed or
    not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

    [ 2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
    [ 2.831827] Modules linked in:
    [ 2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
    [ 2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
    [ 2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
    [ 2.853745] PC is at snd_soc_find_dai+0x144/0x150
    [ 2.858462] LR is at snd_soc_find_dai+0x140/0x150

    ...

    [ 3.469675] Call trace:
    [ 3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
    [ 3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
    [ 3.4864333.596564] [] bus_add_driver+0x110/0x230
    [ 3.602149] [] driver_register+0x68/0x100
    [ 3.607735] [] __platform_driver_register+0x54/0x60
    [ 3.614191] [] imx_rpmsg_driver_init+0x20/0x28
    [ 3.620213] [] do_one_initcall+0x44/0x130
    [ 3.625801] [] kernel_init_freeable+0x1e0/0x280
    [ 3.631909] [] kernel_init+0x18/0x110
    [ 3.637148] [] ret_from_fork+0x10/0x1c

    So we could't resolve the warning "snd_soc_register_card failed (-517)".

    Fixes: a52c88bc3932 ("MLK-19854-1: ASoC: imx-wm8960: fix error when m4
    image is not loaded")
    Signed-off-by: Shengjiu Wang

    (cherry picked from commit f5d9013702e172a243da74a42941a62283bbe4a8)

    Shengjiu Wang
     
  • Previously we add snd_soc_find_dai to check if the codec is probed or
    not, but this bring kernel dump issue when CONFIG_LOCKDEP=y.

    [ 2.823379] WARNING: CPU: 2 PID: 1 at sound/soc/soc-core.c:1016 snd_soc_find_dai+0x144/0x150
    [ 2.831827] Modules linked in:
    [ 2.834907] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.14.78-00007-g524e1b1f0b3f #18
    [ 2.842748] Hardware name: FSL i.MX8MM EVK board (DT)
    [ 2.847811] task: ffff8000624f0000 task.stack: ffff000008078000
    [ 2.853745] PC is at snd_soc_find_dai+0x144/0x150
    [ 2.858462] LR is at snd_soc_find_dai+0x140/0x150

    ...

    [ 3.469675] Call trace:
    [ 3.472135] Exception stack(0xffff00000807ba40 to 0xffff00000807bb80)
    [ 3.478590] ba40: 0000000000000000 00000000ffffffff 0000000000000000 0000000000000002
    [ 3.4864333.596564] [] bus_add_driver+0x110/0x230
    [ 3.602149] [] driver_register+0x68/0x100
    [ 3.607735] [] __platform_driver_register+0x54/0x60
    [ 3.614191] [] imx_rpmsg_driver_init+0x20/0x28
    [ 3.620213] [] do_one_initcall+0x44/0x130
    [ 3.625801] [] kernel_init_freeable+0x1e0/0x280
    [ 3.631909] [] kernel_init+0x18/0x110
    [ 3.637148] [] ret_from_fork+0x10/0x1c

    So we could't resolve the warning "snd_soc_register_card failed (-517)".

    Fixes: 75632b22a332 ("MLK-20247: ASoC: imx-rpmsg: fix error when
    m4 image is not loaded")
    Signed-off-by: Shengjiu Wang

    (cherry picked from commit bbc1868d1c3ec448301d76606e7199f74aa35581)

    Shengjiu Wang
     
  • With CONFIG_LOCKDEP=y, there will kernel dump

    [ 55.305563] INFO: trying to register non-static key.
    [ 55.310540] the code is fine but needs lockdep annotation.
    [ 55.316027] turning off the locking correctness validator.
    [ 55.321520] CPU: 0 PID: 32 Comm: kworker/0:1 Tainted: G W 4.14.78-00007-g524e1b1f0b3f #18
    [ 55.330827] Hardware name: FSL i.MX8MM EVK board (DT)
    [ 55.335892] Workqueue: events rpmsg_work_handler
    [ 55.340515] Call trace:
    [ 55.342971] [] dump_backtrace+0x0/0x270
    [ 55.348375] [] show_stack+0x24/0x30
    [ 55.353433] [] dump_stack+0xb8/0xf0
    [ 55.358490] [] register_lock_class+0x364/0x548
    [ 55.364501] [] __lock_acquire+0x7c/0x18a8
    [ 55.370077] [] lock_acquire+0xc8/0x290
    [ 55.375394] [] _raw_spin_lock_irqsave+0x54/0x70
    [ 55.381493] [] i2s_rpmsg_cb+0xe8/0x1b0
    [ 55.386810] [] rpmsg_recv_done+0x144/0x210
    [ 55.392476] [] vring_interrupt+0x44/0x78
    [ 55.397966] [] imx_mu_rpmsg_callback+0x6c/0x80
    [ 55.403977] [] notifier_call_chain+0x5c/0x98
    [ 55.409813] [] __blocking_notifier_call_chain+0x58/0xa0
    [ 55.416605] [] blocking_notifier_call_chain+0x3c/0x50
    [ 55.423223] [] rpmsg_work_handler+0x88/0xe8
    [ 55.428974] [] process_one_work+0x290/0x738
    [ 55.434723] [] worker_thread+0x58/0x460
    [ 55.440127] [] kthread+0x104/0x130
    [ 55.445096] [] ret_from_fork+0x10/0x1c

    The reason is that the spin lock is not initilized.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 0e98ac55f17f6505f92c515c3c04581039e21865)

    Shengjiu Wang
     

27 Mar, 2019

1 commit

  • Because we are re-initializing the proxy at close it might
    happen that work is still pending which causes the following crash:

    [ 94.699835] Unable to handle kernel NULL pointer dereference at virtual address 00000008
    [ 94.707923] Mem abort info:
    [ 94.710722] Exception class = DABT (current EL), IL = 32 bits
    [ 94.716637] SET = 0, FnV = 0
    [ 94.719686] EA = 0, S1PTW = 0
    [ 94.722822] Data abort info:
    [ 94.725698] ISV = 0, ISS = 0x00000005
    [ 94.729530] CM = 0, WnR = 0
    [ 94.732504] user pgtable: 4k pages, 48-bit VAs, pgd = ffff8008d9ba3000
    [ 94.739035] [0000000000000008] *pgd=0000000938419003, *pud=0000000000000000
    [ 94.746015] Internal error: Oops: 96000005 [#1] PREEMPT SMP
    [ 94.751589] Modules linked in:
    [ 94.754652] CPU: 0 PID: 2068 Comm: kworker/0:2 Not tainted 4.14.98-dirty #75
    [ 94.761700] Hardware name: Freescale i.MX8QM MEK (DT)
    [ 94.766768] task: ffff8008f23ae200 task.stack: ffff000014378000
    [ 94.772705] PC is at process_one_work+0x34/0x414
    [ 94.777325] LR is at process_one_work+0x1e0/0x414

    In order to fix this, we make sure that no work is pending before starting
    the re-initialization.

    Signed-off-by: Daniel Baluta
    Reviewed-by: Shengjiu Wang
    (cherry picked from commit 2c00c24be5f8b63636e3f9005e15a3de42058438)

    Daniel Baluta
     

13 Mar, 2019

3 commits

  • The channel num (9 - 15) should not be supported in tdm & daisy chain
    mode for there is two dataline, this channel number can't be
    symmetrically distributed on two dataline (the first one is fixed to
    be 8 channel)

    Fixes commit 8d29874365c3 ("MLK-17817-2: ASoC: imx-ak4458: enable 16
    channels in TDM mode")

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 0bc47b31660efd3dbbeee7e51fca6f75e7ecb69f)

    Shengjiu Wang
     
  • We designed length of msg queue to be 0x18, which is too
    small if the period size = 512bytes, sometimes the queue
    will be full, which cause the msg is replaced by new one.
    which is not acceptable.

    So we need to enlarge the length of msg queue and add
    protection when msg queue is full, if the msg queue is full
    with the cmd (START, STOP, PAUSE...), driver will return
    error, with the cmd (I2S_TX_POINTER, I2S_TX_PERIOD_DONE)
    driver will drop the cmd.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 31def064871336af7780d01a6ed8c5ed075b7e48)

    Shengjiu Wang
     
  • Fixes commit 4028bd0f76fd ("MLK-21002-2: ASoC: imx-pcm-rpmsg: don't
    remove timer at suspend")

    if the timer isn't removed at suspend, there will be interrupt
    from M4 side when the period size is small to wake up system quickly
    So we need to revert the previous fix and add timer in resume state

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit a23d1df081f1ed33bc8dc7fffc42d1dfa3db2366)

    Shengjiu Wang
     

01 Mar, 2019

2 commits

  • If timer is deleted in suspend, when the suspend is resumed
    by pressing the power key, there will be no timer until the buffer
    empty, and the hw_ptr will not be updated.

    So the timer should not be removed at suspend.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 9a17ce36ecef46ea5ec88d4b89b117abe8eebf8f)

    Shengjiu Wang
     
  • In LPA, we use the timer to simulate the interrupt, if the period time
    is 1s, the timer is 500ms, which means the interrupt is more frequent
    than actual.

    With pause ALSA will update the hw_ptr_jiffies, because the interrupt
    is more frequent, so sometimes in snd_pcm_update_hw_ptr0, the condition
    delta > new_hw_ptr will be true, then the new_hw_ptr will be added whole
    buffer_size, which cause the whole buffer be flushed.

    if (in_interrupt) {
    /* we know that one period was processed */
    /* delta = "expected next hw_ptr" for in_interrupt != 0 */
    delta = runtime->hw_ptr_interrupt + runtime->period_size;
    if (delta > new_hw_ptr) {
    /* check for double acknowledged interrupts */
    hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
    if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
    hw_base += runtime->buffer_size;
    if (hw_base >= runtime->boundary) {
    hw_base = 0;
    crossed_boundary++;
    }
    new_hw_ptr = hw_base + pos;
    goto __delta;
    }
    }
    }

    So even we use the timer to simulate the interrupt, the timer should
    be same as the period time, otherwise will cause issue.

    Signed-off-by: Shengjiu Wang
    (cherry picked from commit 9a9af932118774083119dba72c5c6133852ba926)

    Shengjiu Wang
     

22 Feb, 2019

1 commit


12 Feb, 2019

24 commits