RE: [PATCH V3 05/15] clk: imx: imx8mp-audiomix: remove sdma root clock

From: Peng Fan
Date: Mon Jul 15 2024 - 21:25:07 EST


> Subject: Re: [PATCH V3 05/15] clk: imx: imx8mp-audiomix: remove
> sdma root clock
>
> On Sun, Jul 14, 2024 at 8:11 PM Peng Fan <peng.fan@xxxxxxx> wrote:
> >
> > > Subject: Re: [PATCH V3 05/15] clk: imx: imx8mp-audiomix: remove
> sdma
> > > root clock
> > >
> > > On Fri, Jun 7, 2024 at 8:28 AM Peng Fan (OSS)
> <peng.fan@xxxxxxxxxxx>
> > > wrote:
> > > >
> > > > From: Peng Fan <peng.fan@xxxxxxx>
> > > >
> > > > There is an issue:
> > > > SDMA3 can't work without setting AUDIOMIX_CLKEN0[SDMA2]
> (bit-
> > > 26) to 1
> > > >
> > > > The workaround is:
> > > > As the reset state of AUDIOMIX_CLKEN0[SDMA2] is enabled, we
> just
> > > need
> > > > to keep it on as reset state, don't touch it in kernel, then every
> > > > thing is same as before, if we register the clock in clk-audiomix,
> > > > then kernel will try to disable it in idle.
> > > >
> > > > Fixes: 6cd95f7b151c ("clk: imx: imx8mp: Add audiomix block
> > > control")
> > > > Reviewed-by: Shengjiu Wang <shengjiu.wang@xxxxxxx>
> > > > Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> > > > ---
> > >
> > > With this patch,I found it broke the imx8mp-beacon board when
> > > running audio through a codec connected to sai3. Reverting this
> > > patch made the crash go away. Is there a way to mark the clock as
> > > critical so it doesn't get idled?
> >
> > Mark it as critical means the blk ctrl needs to be powered on always.
> >
> > You driver touched the SDMA2_ROOT clock?
>
> I have a WM8962 CODEC connected through sai3. Without this patch,
> the sound plays just fine. With this patch, I get the following:

Try use this for SDMA2.
clocks = <&clk IMX8MP_CLK_AUDIO_AHB_ROOT>,
<&clk IMX8MP_CLK_AUDIO_AHB_ROOT>;

I will give a look and see how to address the issue.

Thanks for the report.

Thanks,
Peng.

>
> [ 73.245199] imx-sdma 30e10000.dma-controller: Timeout waiting
> for CH0 ready
> [ 73.252197] ------------[ cut here ]------------
> [ 73.256816] WARNING: CPU: 1 PID: 1080 at
> kernel/dma/mapping.c:586
> dma_free_attrs+0x94/0xc0
> [ 73.256832] Modules linked in: overlay af_alg dw_hdmi_gp_audio
> dw_hdmi_cec tpm_tis_spi snd_soc_hdmi_codec caam_jr tpm_tis_core
> caamhash_desc caamalg_desc crypto_engine authenc libdes
> hantro_vpu v4l2_jpeg v4l2_vp9 v4l2_h264 v4l2_mem2mem
> videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videodev
> imx8mp_hdmi_tx btnxpuart nvme videobuf2_common dw_hdmi mc
> nvme_core etnaviv imx_lcdif bluetooth fsl_imx8_ddr_perf
> drm_display_helper dwmac_imx gpu_sched phy_fsl_samsung_hdmi
> imx8mp_hdmi_pvi drm_dma_helper samsung_dsim snd_soc_fsl_sai
> stmmac_platform snd_soc_fsl_xcvr snd_soc_fsl_micfil
> snd_soc_fsl_aud2htx stmmac adv7511 ecdh_generic imx_pcm_dma
> snd_soc_fsl_utils ecc pcs_xpcs cec tcpci flexcan tcpm hd3ss3220
> snd_soc_wm8962 spi_imx can_dev typec at24 caam rtc_pcf85363
> rtc_snvs error snvs_pwrkey imx8mm_thermal crct10dif_ce
> snd_soc_imx_hdmi coresight_tmc snd_soc_imx_card
> snd_soc_simple_card coresight_funnel snd_soc_simple_card_utils
> display_connector snd_soc_dmic coresight drm_kms_helper
> imx_cpufreq_dt imx_sdma mwifiex_sdio
> [ 73.256997] mwifiex cfg80211 rfkill fuse drm backlight ipv6
> [ 73.257015] CPU: 1 UID: 0 PID: 1080 Comm: speaker-test Not
> tainted
> 6.10.0-rc7-next-20240709-ga90ee5931efe-dirty #9
> [ 73.257022] Hardware name: Beacon EmbeddedWorks i.MX8MPlus
> Development kit (DT)
> [ 73.257025] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS
> BTYPE=--)
> [ 73.257031] pc : dma_free_attrs+0x94/0xc0
> [ 73.257037] lr : dma_free_attrs+0x50/0xc0
> [ 73.257041] sp : ffff800084f6b980
> [ 73.257043] x29: ffff800084f6b980 x28: 0000000000000010 x27:
> 00000000000003c2
> [ 73.257051] x26: 0000000000000005 x25: 0000000000000010 x24:
> 0000000000000000
> [ 73.257057] x23: 00000000c5504000 x22: 0000000000000000 x21:
> ffff800083183000
> [ 73.257064] x20: 00000000000000c0 x19: ffff0000c0e54410 x18:
> 0000000000000006
> [ 73.257071] x17: 0000000000000000 x16: 0000000000000000 x15:
> ffff800084f6b330
> [ 73.257078] x14: 0000000000000000 x13: ffff8000826845d8 x12:
> 0000000000000639
> [ 73.257085] x11: 0000000000000213 x10: ffff8000826dc5d8 x9 :
> ffff8000826845d8
> [ 73.257092] x8 : 00000000ffffefff x7 : ffff8000826dc5d8 x6 :
> 0000000000000040
> [ 73.257098] x5 : 0000000000000000 x4 : 0000000000000000 x3 :
> 00000000c5504000
> [ 73.257105] x2 : ffff800083183000 x1 : 0000000000000000 x0 :
> 00000000000000c0
> [ 73.257112] Call trace:
> [ 73.257115] dma_free_attrs+0x94/0xc0
> [ 73.257121] sdma_free_bd+0x60/0x6c [imx_sdma]
> [ 73.257130] sdma_transfer_init+0x1e8/0x270 [imx_sdma]
> [ 73.257137] sdma_prep_dma_cyclic+0x74/0x200 [imx_sdma]
> [ 73.257143] snd_dmaengine_pcm_trigger+0xd8/0x18c
> [ 73.257152] dmaengine_pcm_trigger+0x18/0x24
> [ 73.257159] snd_soc_pcm_component_trigger+0x170/0x21c
> [ 73.257168] soc_pcm_trigger+0xdc/0x1c8
> [ 73.257175] snd_pcm_do_start+0x44/0x70
> [ 73.257183] snd_pcm_action_single+0x48/0xa4
> [ 73.257189] snd_pcm_action+0x80/0x9c
> [ 73.257195] snd_pcm_start+0x24/0x30
> [ 73.257203] __snd_pcm_lib_xfer+0x6a4/0x7d8
> [ 73.257208] snd_pcm_common_ioctl+0x1140/0x1780
> [ 73.257215] snd_pcm_ioctl+0x34/0x4c
> [ 73.257222] __arm64_sys_ioctl+0xac/0xf0
> [ 73.257231] invoke_syscall+0x48/0x114
> [ 73.257239] el0_svc_common.constprop.0+0x40/0xe0
> [ 73.257246] do_el0_svc+0x1c/0x28
> [ 73.257252] el0_svc+0x34/0xd8
> [ 73.257260] el0t_64_sync_handler+0x120/0x12c
> [ 73.257267] el0t_64_sync+0x190/0x194
> [ 73.257273] ---[ end trace 0000000000000000 ]---
> [ 73.565659] fsl-sai 30c30000.sai: ASoC: error at
> soc_component_trigger on 30c30000.sai: -12
>
> Write error: -5,Input/output erro[ 76.767120] imx-sdma
> 30e10000.dma-controller: Timeout waiting for CH0 ready
>
> No sound is heard.
>
> I haven't looked far into the driver to see what was touched, but I was
> able to reproduce this by enabling and disabling the patch several
> times, so it's repeatable. imx-sdma 30e10000.dma-controller seems to
> correspond to sdma2.
>
> adam
> >
> > Regards,
> > Peng.
> >
> > >
> > > adam
> > > > drivers/clk/imx/clk-imx8mp-audiomix.c | 1 -
> > > > 1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c
> > > > b/drivers/clk/imx/clk-imx8mp-audiomix.c
> > > > index b381d6f784c8..88d8ba975b5a 100644
> > > > --- a/drivers/clk/imx/clk-imx8mp-audiomix.c
> > > > +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c
> > > > @@ -172,7 +172,6 @@ static struct clk_imx8mp_audiomix_sel
> sels[]
> > > = {
> > > > CLK_GATE("ocrama", OCRAMA_IPG),
> > > > CLK_GATE("aud2htx", AUD2HTX_IPG),
> > > > CLK_GATE("earc_phy", EARC_PHY),
> > > > - CLK_GATE("sdma2", SDMA2_ROOT),
> > > > CLK_GATE("sdma3", SDMA3_ROOT),
> > > > CLK_GATE("spba2", SPBA2_ROOT),
> > > > CLK_GATE("dsp", DSP_ROOT),
> > > > --
> > > > 2.37.1
> > > >
> > > >