From 356caf663deee8dc46ff3168ec0b24bcbeb00b28 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 8 Jun 2023 06:48:36 +0000 Subject: ASoC: add new trigger ordering method Current ASoC is assuming that trigger starting order is Link -> Component -> DAI as default, and its reverse order for stopping. But some Driver / Card want to reorder it for some reasons. We have such flags, but is unbalance like below. struct snd_soc_component_driver :: start_dma_last struct snd_soc_dai_link :: stop_dma_first We want to have more flexible, and more generic method. This patch adds new snd_soc_trigger_order for start/stop at component / DAI-link. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87r0qmfnzx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 9 +++++++++ include/sound/soc.h | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'include/sound') diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 0b47603c9db2..c7733382757b 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -158,6 +158,15 @@ struct snd_soc_component_driver { int probe_order; int remove_order; + /* + * soc_pcm_trigger() start/stop sequence. + * see also + * snd_soc_dai_link + * soc_pcm_trigger() + */ + enum snd_soc_trigger_order trigger_start; + enum snd_soc_trigger_order trigger_stop; + /* * signal if the module handling the component should not be removed * if a pcm is open. Setting this would prevent the module diff --git a/include/sound/soc.h b/include/sound/soc.h index 10e4ea0664af..49442583d46d 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -607,6 +607,14 @@ int snd_soc_get_strobe(struct snd_kcontrol *kcontrol, int snd_soc_put_strobe(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +enum snd_soc_trigger_order { + /* start stop */ + SND_SOC_TRIGGER_ORDER_DEFAULT = 0, /* Link->Component->DAI DAI->Component->Link */ + SND_SOC_TRIGGER_ORDER_LDC, /* Link->DAI->Component Component->DAI->Link */ + + SND_SOC_TRIGGER_ORDER_MAX, +}; + /* SoC PCM stream information */ struct snd_soc_pcm_stream { const char *stream_name; @@ -707,6 +715,15 @@ struct snd_soc_dai_link { const struct snd_soc_ops *ops; const struct snd_soc_compr_ops *compr_ops; + /* + * soc_pcm_trigger() start/stop sequence. + * see also + * snd_soc_component_driver + * soc_pcm_trigger() + */ + enum snd_soc_trigger_order trigger_start; + enum snd_soc_trigger_order trigger_stop; + /* Mark this pcm with non atomic ops */ unsigned int nonatomic:1; -- cgit v1.2.3 From 099770e2dae04579670947aaf8b5c70ef6a4cb6a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 8 Jun 2023 06:49:11 +0000 Subject: ASoC: remove old trigger ordering method All drivers switch to use generic trigger ordering method. Let's remove old method. Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87legufnyy.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 2 -- include/sound/soc.h | 6 ------ sound/soc/soc-pcm.c | 10 ---------- 3 files changed, 18 deletions(-) (limited to 'include/sound') diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index c7733382757b..87f248a06271 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -199,8 +199,6 @@ struct snd_soc_component_driver { bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */ int be_pcm_base; /* base device ID for all BE PCMs */ - unsigned int start_dma_last; - #ifdef CONFIG_DEBUG_FS const char *debugfs_prefix; #endif diff --git a/include/sound/soc.h b/include/sound/soc.h index 49442583d46d..52bb64d427f5 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -762,12 +762,6 @@ struct snd_soc_dai_link { /* Do not create a PCM for this DAI link (Backend link) */ unsigned int ignore:1; - /* This flag will reorder stop sequence. By enabling this flag - * DMA controller stop sequence will be invoked first followed by - * CPU DAI driver stop sequence - */ - unsigned int stop_dma_first:1; - #ifdef CONFIG_SND_SOC_TOPOLOGY struct snd_soc_dobj dobj; /* For topology */ #endif diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index a10c928debe3..fd45a7433c24 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1111,16 +1111,6 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) stop < 0 || stop >= SND_SOC_TRIGGER_ORDER_MAX) return -EINVAL; - /* REMOVE ME */ - for_each_rtd_components(rtd, i, component) { - if (component->driver->start_dma_last) { - start = SND_SOC_TRIGGER_ORDER_LDC; - break; - } - } - if (rtd->dai_link->stop_dma_first) - stop = SND_SOC_TRIGGER_ORDER_LDC; - /* * START */ -- cgit v1.2.3