• Kuninori Morimoto's avatar
    ASoC: soc-pcm: care trigger rollback · 6374f493
    Kuninori Morimoto authored
    soc_pcm_trigger() calls DAI/Component/Link trigger,
    but some of them might be failed.
    
    	static int soc_pcm_trigger(...)
    	{
    		...
    		switch (cmd) {
    		case SNDRV_PCM_TRIGGER_START:
    		case SNDRV_PCM_TRIGGER_RESUME:
    		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
    			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;
    		case SNDRV_PCM_TRIGGER_STOP:
    		case SNDRV_PCM_TRIGGER_SUSPEND:
    		case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
    			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;
    		}
    		...
    	}
    
    For example, if soc_pcm_trigger() failed at (*) point,
    we need to rollback previous succeeded trigger.
    
    This patch adds trigger mark for DAI/Component/Link,
    and do STOP if START/RESUME/PAUSE_RELEASE were failed.
    
    Because it need to use new rollback parameter,
    we need to modify DAI/Component/Link trigger functions in the same time.
    Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
    Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    6374f493
soc.h 45 KB