linux-stable/sound/soc
Maxim Kochetkov 7a7a438f91 ASoC: dwc: move DMA init to snd_soc_dai_driver probe()
[ Upstream commit 011a8719d6 ]

When using DMA mode we are facing with Oops:
[  396.458157] Unable to handle kernel access to user memory without uaccess routines at virtual address 000000000000000c
[  396.469374] Oops [#1]
[  396.471839] Modules linked in:
[  396.475144] CPU: 0 PID: 114 Comm: arecord Not tainted 6.0.0-00164-g9a8eccdaf2be-dirty #68
[  396.483619] Hardware name: YMP ELCT FPGA (DT)
[  396.488156] epc : dmaengine_pcm_open+0x1d2/0x342
[  396.493227]  ra : dmaengine_pcm_open+0x1d2/0x342
[  396.498140] epc : ffffffff807fe346 ra : ffffffff807fe346 sp : ffffffc804e138f0
[  396.505602]  gp : ffffffff817bf730 tp : ffffffd8042c8ac0 t0 : 6500000000000000
[  396.513045]  t1 : 0000000000000064 t2 : 656e69676e65616d s0 : ffffffc804e13990
[  396.520477]  s1 : ffffffd801b86a18 a0 : 0000000000000026 a1 : ffffffff816920f8
[  396.527897]  a2 : 0000000000000010 a3 : fffffffffffffffe a4 : 0000000000000000
[  396.535319]  a5 : 0000000000000000 a6 : ffffffd801b87040 a7 : 0000000000000038
[  396.542740]  s2 : ffffffd801b94a00 s3 : 0000000000000000 s4 : ffffffd80427f5e8
[  396.550153]  s5 : ffffffd80427f5e8 s6 : ffffffd801b44410 s7 : fffffffffffffff5
[  396.557569]  s8 : 0000000000000800 s9 : 0000000000000001 s10: ffffffff8066d254
[  396.564978]  s11: ffffffd8059cf768 t3 : ffffffff817d5577 t4 : ffffffff817d5577
[  396.572391]  t5 : ffffffff817d5578 t6 : ffffffc804e136e8
[  396.577876] status: 0000000200000120 badaddr: 000000000000000c cause: 000000000000000d
[  396.586007] [<ffffffff806839f4>] snd_soc_component_open+0x1a/0x68
[  396.592439] [<ffffffff807fdd62>] __soc_pcm_open+0xf0/0x502
[  396.598217] [<ffffffff80685d86>] soc_pcm_open+0x2e/0x4e
[  396.603741] [<ffffffff8066cea4>] snd_pcm_open_substream+0x442/0x68e
[  396.610313] [<ffffffff8066d1ea>] snd_pcm_open+0xfa/0x212
[  396.615868] [<ffffffff8066d39c>] snd_pcm_capture_open+0x3a/0x60
[  396.622048] [<ffffffff8065b35a>] snd_open+0xa8/0x17a
[  396.627421] [<ffffffff801ae036>] chrdev_open+0xa0/0x218
[  396.632893] [<ffffffff801a5a28>] do_dentry_open+0x17c/0x2a6
[  396.638713] [<ffffffff801a6d9a>] vfs_open+0x1e/0x26
[  396.643850] [<ffffffff801b8544>] path_openat+0x96e/0xc96
[  396.649518] [<ffffffff801b9390>] do_filp_open+0x7c/0xf6
[  396.655034] [<ffffffff801a6ff2>] do_sys_openat2+0x8a/0x11e
[  396.660765] [<ffffffff801a735a>] sys_openat+0x50/0x7c
[  396.666068] [<ffffffff80003aca>] ret_from_syscall+0x0/0x2
[  396.674964] ---[ end trace 0000000000000000 ]---

It happens because of play_dma_data/capture_dma_data pointers are NULL.
Current implementation assigns these pointers at snd_soc_dai_driver
startup() callback and reset them back to NULL at shutdown(). But
soc_pcm_open() sequence uses DMA pointers in dmaengine_pcm_open()
before snd_soc_dai_driver startup().
Most generic DMA capable I2S drivers use snd_soc_dai_driver probe()
callback to init DMA pointers only once at probe. So move DMA init
to dw_i2s_dai_probe and drop shutdown() and startup() callbacks.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://lore.kernel.org/r/20230512110343.66664-1-fido_max@inbox.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-21 16:02:07 +02:00
..
adi
amd ASoC: amd: ps: fix for acp_lock access in pdm driver 2023-06-14 11:17:01 +02:00
apple ASoC: apple: mca: Improve handling of unavailable DMA channels 2023-02-24 16:31:20 +00:00
atmel ASoC: mchp-pdmc: fix poc noises when starting 2023-02-28 17:59:15 +00:00
au1x
bcm
cirrus sound updates for 6.3-rc1 2023-02-22 10:29:05 -08:00
codecs ASoC: cs35l41: Fix default regmap values for some registers 2023-06-21 16:02:07 +02:00
dwc ASoC: dwc: move DMA init to snd_soc_dai_driver probe() 2023-06-21 16:02:07 +02:00
fsl ASoC: fsl_micfil: Fix error handler with pm_runtime_enable 2023-05-24 17:30:13 +01:00
generic ASoC: simple-card-utils: fix PCM constraint error check 2023-06-14 11:17:02 +02:00
hisilicon
img
intel ASoC: Intel: avs: Add missing checks on FE startup 2023-06-21 16:02:07 +02:00
jz4740 ASoC: jz4740-i2s: Make I2S divider calculations more robust 2023-06-09 10:48:03 +02:00
kirkwood ASoC: kirkwood: Iterate over array indexes instead of using pointer math 2023-01-28 10:51:05 +00:00
mediatek ASoC: mediatek: mt8195: fix use-after-free in driver remove path 2023-06-14 11:17:02 +02:00
meson ASoC: meson: use helper function 2023-01-31 11:05:03 +00:00
mxs
pxa - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
qcom ASoC: qcom: q6prm: fix incorrect clk_root passed to ADSP 2023-03-05 23:36:37 +00:00
rockchip ASoC: rockchip: use helper function 2023-01-31 11:05:04 +00:00
samsung sound updates for 6.3-rc1 2023-02-22 10:29:05 -08:00
sh ASoC: rsnd: adg: Fix BRG typos 2023-02-16 13:11:35 +00:00
sof ASoC: SOF: pm: save io region state in case of errors in resume 2023-06-09 10:48:06 +02:00
spear ASoC: spear: use helper function 2023-01-31 11:04:59 +00:00
sprd
sti
stm
sunxi ASoC: sunxi: use devm_platform_get_and_ioremap_resource() 2022-11-14 11:30:31 +00:00
tegra ASoC: tegra: use helper function 2023-01-31 11:05:05 +00:00
ti sound updates for 6.3-rc1 2023-02-22 10:29:05 -08:00
uniphier ASoC: uniphier: aio-core: Make some read-only arrays static const 2022-12-05 14:05:40 +00:00
ux500 ASoC: ux500: remove stedma40 references 2023-01-20 12:05:57 +00:00
xilinx
xtensa
Kconfig
Makefile
soc-ac97.c ASoC: soc-ac97: Return correct error codes 2023-02-15 16:09:07 +00:00
soc-acpi.c
soc-card.c
soc-component.c ASoC: soc-component: add get_jack_type 2023-01-27 12:20:55 +00:00
soc-compress.c ASoC: soc-compress: Inherit atomicity from DAI link for Compress FE 2023-05-11 23:17:24 +09:00
soc-core.c ASoC: soc-core.c: use helper function 2023-01-31 11:05:07 +00:00
soc-dai.c ASoC: soc-dai.h: cleanup Playback/Capture data for snd_soc_dai 2023-01-31 11:05:12 +00:00
soc-dapm.c ASoC: soc-dapm.c: use helper function 2023-01-31 11:05:08 +00:00
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-jack.c
soc-link.c
soc-ops.c ASoC: ops: Correct bounds check for second channel on SX controls 2022-11-25 16:29:33 +00:00
soc-pcm.c ASoC: soc-pcm: test if a BE can be prepared 2023-06-21 16:02:06 +02:00
soc-topology-test.c
soc-topology.c ASoC: Updates for v6.3 2023-02-16 14:32:04 +01:00
soc-utils-test.c
soc-utils.c