From f375e19121e39d5b58a763bc0163a57f4e362bb7 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Tue, 22 Jan 2019 13:26:02 +0800 Subject: [PATCH] ASoC: sof: add comments for non-atomic pcm trigger Add the comments to why explain non-atomic is set in topology parsing. So it is safe to call sof_ipc_tx_message() in the trigger callback. Only FE need nonatomic = 1 Signed-off-by: Libin Yang Signed-off-by: Ranjani Sridharan --- sound/soc/sof/pcm.c | 4 ++++ sound/soc/sof/topology.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 2570ad8f987fa9..196bd63ea464cd 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -224,6 +224,10 @@ static int sof_restore_hw_params(struct snd_pcm_substream *substream, return 0; } +/* + * FE dai link trigger actions are always executed in non-atomic context because + * they involve IPC's. + */ static int sof_pcm_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_soc_pcm_runtime *rtd = substream->private_data; diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index d43b3e3107b0fe..d46faf466234b3 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2346,11 +2346,17 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, int ret = 0; link->platform_name = "sof-audio"; - link->nonatomic = true; - /* send BE configurations to DSP */ - if (!link->no_pcm) + /* + * Set nonatomic property for FE dai links as their trigger action + * involves IPC's. + */ + if (!link->no_pcm) { + link->nonatomic = true; + + /* nothing more to do for FE dai links */ return 0; + } /* usually we use 1 config, but for HDA it may be 0 ATM */ if (le32_to_cpu(cfg->num_hw_configs) != 1) @@ -2363,6 +2369,7 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, return -EINVAL; } + /* Send BE DAI link configurations to DSP */ memset(&config, 0, sizeof(config)); /* get any common DAI tokens */