ASoC: soc-component: merge soc_pcm_trigger_start/stop()

Now, soc_pcm_trigger_start/stop() are simple enough.
Let's merge these into soc_pcm_trigger().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87ftbbw8wj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2020-06-04 17:08:12 +09:00 committed by Mark Brown
parent 460b42d162
commit 836367be28
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -1072,57 +1072,37 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
{
int ret;
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
return ret;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
return ret;
return snd_soc_pcm_dai_trigger(substream, cmd);
}
static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
{
int ret;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
return ret;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
return ret;
ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
return ret;
return 0;
}
static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
{ {
int ret; int ret = -EINVAL;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = soc_pcm_trigger_start(substream, cmd); ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_dai_trigger(substream, cmd);
break; break;
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = soc_pcm_trigger_stop(substream, cmd); ret = snd_soc_pcm_dai_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_pcm_component_trigger(substream, cmd);
if (ret < 0)
break;
ret = snd_soc_link_trigger(substream, cmd);
break; break;
default:
return -EINVAL;
} }
return ret; return ret;