linux/sound/soc
Kuninori Morimoto a122a116fc
ASoC: rsnd: call rsnd_ssi_master_clk_start() from rsnd_ssi_init()
Current rsnd needs to call .prepare (P) for clock settings,
.trigger for playback start (S) and stop (E).
It should be called as below from SSI point of view.

	P -> S -> E -> P -> S -> E -> ...

But, if you used MIXer, below case might happen

	              (2)
	1: P -> S ---> E -> ...
	2:         P ----> S -> ...
	          (1)     (3)

P(1) setups clock, but E(2) resets it. and starts playback (3).
In such case, it will reports "SSI parent/child should use same rate".

rsnd_ssi_master_clk_start() which is the main function at (P)
was called from rsnd_ssi_init() (= S) before,
but was moved by below patch to rsnd_soc_dai_prepare() (= P) to avoid
using clk_get_rate() which shouldn't be used under atomic context.

	commit 4d230d1271 ("ASoC: rsnd: fixup not to call clk_get/set
				under non-atomic")

Because of above patch, rsnd_ssi_master_clk_start() is now called at (P)
which is for non atomic context. But (P) is assuming that spin lock is
*not* used.
One issue now is rsnd_ssi_master_clk_start() is checking ssi->xxx
which should be protected by spin lock.

After above patch, adg.c had below patch for other reasons.

	commit 06e8f5c842 ("ASoC: rsnd: don't call clk_get_rate()
				under atomic context")

clk_get_rate() is used at probe() timing by this patch.
In other words, rsnd_ssi_master_clk_start() is no longer using
clk_get_rate() any more.

This means we can call it from rsnd_ssi_init() (= S) again which is
protected by spin lock.
This patch re-move it to under spin lock, and solves
1. checking ssi->xxx without spin lock issue.
2. clk setting / device start / device stop race condition.

Reported-by: Linh Phung T. Y. <linh.phung.jy@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875z0x1jt5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-14 15:24:09 +01:00
..
adi ASoC: adi: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:44 +00:00
amd ASoC: amd: Add support for ALC1015P codec in acp3x machine driver 2021-04-09 20:03:10 +01:00
atmel ASoC: atmel: atmel-i2s: remove useless initialization 2021-03-31 18:03:16 +01:00
au1x ASoC: au1x: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:46 +00:00
bcm ASoC: bcm: cygnus_ssp: remove useless initialization 2021-03-31 18:03:17 +01:00
cirrus ASoC: cirrus: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:48 +00:00
codecs ASoC: cs35l36: Fix an error handling path in 'cs35l36_i2c_probe()' 2021-04-13 14:12:55 +01:00
dwc ASoC: dwc: Fix -Wmissing-prototypes warnings 2021-03-29 17:28:13 +01:00
fsl ASoC: fsl: sunxi: remove redundant dev_err call 2021-04-08 15:21:52 +01:00
generic ASoC: simple-card-utils: tidyup asoc_simple_parse_convert() 2021-04-13 12:32:56 +01:00
hisilicon treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
img ASoC: img-parallel-out: Fix a reference count leak 2020-06-15 20:58:35 +01:00
intel ASoC: Intel: KMB: Constify static struct snd_soc_dai_ops 2021-04-09 13:39:47 +01:00
jz4740 ASoC: jz4740: sync parameter naming (rate/sample_bits) 2021-01-21 12:38:08 +00:00
kirkwood ASoC: kirkwood: Use managed DMA buffer allocation 2021-01-13 11:36:16 +00:00
mediatek ALSA: control - add generic LED API 2021-03-31 17:16:14 +01:00
meson ASoC: meson: axg-fifo: add NO_PERIOD_WAKEUP support 2021-04-07 16:58:31 +01:00
mxs ASoC: mxs-saif: drop unneeded snd_soc_dai_set_drvdata 2021-03-10 13:07:06 +00:00
pxa ASoC: pxa: remove useless assignment 2021-03-31 18:03:19 +01:00
qcom ALSA: control - add generic LED API 2021-03-31 17:16:14 +01:00
rockchip ASoC: rockchip: sync parameter naming (rate/sample_bits) 2021-01-21 12:37:50 +00:00
samsung ASoC: samsung: tm2_wm5110: remove shadowed variable 2021-03-12 20:45:41 +00:00
sh ASoC: rsnd: call rsnd_ssi_master_clk_start() from rsnd_ssi_init() 2021-04-14 15:24:09 +01:00
sof Merge series "ASoC: SOF: Intel: descriptor corrections for TGL and ADL" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: 2021-04-12 19:56:23 +01:00
spear ASoC: spear: merge .digital_mute() into .mute_stream() 2020-07-16 23:06:08 +01:00
sprd ASoC: sprd: Switch to use list_entry_is_head() helper 2020-12-28 12:24:45 +00:00
sti ASoC: sti: sti_uniperif: add missing MODULE_DEVICE_TABLE 2021-04-13 12:33:45 +01:00
stm ASoC: stm: stm32_adfsdm: fix snprintf format string 2021-03-31 18:03:22 +01:00
sunxi ASoC: fsl: sunxi: remove redundant dev_err call 2021-04-08 15:21:52 +01:00
tegra ASoC: tegra: tegra20_das: align function prototypes 2021-03-31 18:03:25 +01:00
ti ASoC: ti: omap-mcsp: remove duplicate test 2021-03-31 18:03:26 +01:00
uniphier ASoC: uniphier: Simplify the return expression of uniphier_aio_startup 2021-03-10 13:07:15 +00:00
ux500 ASoC: ux500: mop500: align function prototype 2021-03-31 18:03:28 +01:00
xilinx sound: remove duplicate "the the" phrase in Kconfig text 2020-08-18 14:52:43 +01:00
xtensa ASoC: xtensa: use asoc_substream_to_rtd() 2020-07-23 19:07:42 +01:00
Kconfig ASoC: topology: KUnit: Add KUnit tests passing various arguments to snd_soc_tplg_component_load 2021-01-21 12:36:24 +00:00
Makefile ASoC: topology: KUnit: Add KUnit tests passing various arguments to snd_soc_tplg_component_load 2021-01-21 12:36:24 +00:00
soc-ac97.c ASoC: soc-ac97: fix kernel-doc 2020-07-03 17:33:46 +01:00
soc-acpi.c
soc-card.c
soc-component.c ASoC: soc-component: Add snd_soc_pcm_component_ack 2021-03-25 13:58:06 +00:00
soc-compress.c ASoC: soc-compress: lock pcm_mutex to resolve lockdep error 2021-04-09 13:39:44 +01:00
soc-core.c ASoC: soc-core: use device_unregister() if rtd allocation failed 2021-03-31 18:02:23 +01:00
soc-dai.c ASoC: soc-dai: fix kernel-doc 2021-03-10 13:08:46 +00:00
soc-dapm.c ASoC: don't indicate error message for snd_soc_[pcm_]dai_xxx() 2021-03-19 12:24:04 +00:00
soc-devres.c ASoC: core: Remove only the registered component in devm functions 2020-07-07 11:55:46 +01:00
soc-generic-dmaengine-pcm.c ASoC: dmaengine: Document support for TX only or RX only streams 2020-10-09 15:11:20 +01:00
soc-jack.c
soc-link.c ASoC: soc-pcm: care trigger rollback 2020-12-09 12:13:38 +00:00
soc-ops.c ASoC: soc-ops: remove useless assignment 2021-03-10 13:06:53 +00:00
soc-pcm.c ASoC: soc-component: Add snd_soc_pcm_component_ack 2021-03-25 13:58:06 +00:00
soc-topology-test.c ASoC: topology: KUnit: Convert from cpu to data format 2021-02-02 17:08:21 +00:00
soc-topology.c ASoC: soc-topology: clarify expression 2021-03-10 13:06:57 +00:00
soc-utils.c ASoC: soc-xxx: add asoc_substream_to_rtd() 2020-07-23 19:07:19 +01:00