Patch "ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-soc-pcm-fix-be-handling-of-pause_release.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e41e7485d3d6c95a71a1d0fb6c525b32b82ab61a
Author: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
Date:   Tue Dec 7 11:37:45 2021 -0600

    ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE
    
    [ Upstream commit 3aa1e96a2b95e2ece198f8dd01e96818971b84df ]
    
    A BE connected to more than one FE, e.g. in a mixer case, can go
    through the following transitions.
    
    play FE1    -> BE state is START
    pause FE1   -> BE state is PAUSED
    play FE2    -> BE state is START
    stop FE2    -> BE state is STOP (see note [1] below)
    release FE1 -> BE state is START
    stop FE1    -> BE state is STOP
    
    play FE1    -> BE state is START
    pause FE1   -> BE state is PAUSED
    play FE2    -> BE state is START
    release FE1 -> BE state is START
    stop FE2    -> BE state is START
    stop FE1    -> BE state is STOP
    
    play FE1    -> BE state is START
    play FE2    -> BE state is START (no change)
    pause FE1   -> BE state is START (no change)
    pause FE2   -> BE state is PAUSED
    release FE1 -> BE state is START
    release FE2 -> BE state is START (no change)
    stop FE1    -> BE state is START (no change)
    stop FE2    -> BE state is STOP
    
    The existing code for PAUSE_RELEASE only allows for the case where the
    BE is paused, which clearly would not work in the sequences above.
    
    Extend the allowed states to restart the BE when PAUSE_RELEASE is
    received, and increase the refcount if the BE is already in START.
    
    [1] the existing logic does not move the BE state back to PAUSED when
    the FE2 is stopped. This patch does not change the logic; it would be
    painful to keep a history of changes on the FE side, the state machine
    is already rather complicated with transitions based on the last BE
    state and the trigger type.
    
    Reported-by: Bard Liao <bard.liao@xxxxxxxxx>
    Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
    Reviewed-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>
    Reviewed-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211207173745.15850-7-pierre-louis.bossart@xxxxxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 83977a715a61d..7f96b7d4b3dac 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2155,7 +2155,10 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
 			be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
 			break;
 		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-			if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
+			if (!be->dpcm[stream].be_start &&
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) &&
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
 				goto next;
 
 			be->dpcm[stream].be_start++;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux