[Sound-open-firmware] [PATCH] apl-ssp: change and wrap status transition into ssp_stop
This will remove manual status change, wrap them into ssp_stop(), where the status transition is protect by spin_lock.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- Tested with: APL GPMRB with TDF8532 SOF master: 8b664cee3fa34b38079ff37c624fe58b3d63362d SOF-Tool master: 13b56fa6047c566a8ba3edd0882ea786e595ee2a https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/drivers/apl-ssp.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/drivers/apl-ssp.c b/src/drivers/apl-ssp.c index 6e33656..a51f91c 100644 --- a/src/drivers/apl-ssp.c +++ b/src/drivers/apl-ssp.c @@ -596,23 +596,27 @@ static void ssp_start(struct dai *dai, int direction) }
/* stop the SSP for either playback or capture */ -static void ssp_stop(struct dai *dai) +static void ssp_stop(struct dai *dai, int direction) { struct ssp_pdata *ssp = dai_get_drvdata(dai);
spin_lock(&ssp->lock);
- /* stop Rx if we are not capturing */ - if (ssp->state[SOF_IPC_STREAM_CAPTURE] != COMP_STATE_ACTIVE) { + /* stop Rx if neeed */ + if (direction == DAI_DIR_CAPTURE && + ssp->state[SOF_IPC_STREAM_CAPTURE] == COMP_STATE_ACTIVE) { ssp_update_bits(dai, SSCR1, SSCR1_RSRE, 0); ssp_update_bits(dai, SSRSA, 0x1 << 8, 0x0 << 8); + ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PAUSED; trace_ssp("Ss0"); }
- /* stop Tx if we are not playing */ - if (ssp->state[SOF_IPC_STREAM_PLAYBACK] != COMP_STATE_ACTIVE) { + /* stop Tx if needed */ + if (direction == DAI_DIR_PLAYBACK && + ssp->state[SOF_IPC_STREAM_PLAYBACK] == COMP_STATE_ACTIVE) { ssp_update_bits(dai, SSCR1, SSCR1_TSRE, 0); ssp_update_bits(dai, SSTSA, 0x1 << 8, 0x0 << 8); + ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PAUSED; trace_ssp("Ss1"); }
@@ -647,8 +651,7 @@ static int ssp_trigger(struct dai *dai, int cmd, int direction) break; case COMP_TRIGGER_STOP: case COMP_TRIGGER_PAUSE: - ssp->state[direction] = COMP_STATE_PAUSED; - ssp_stop(dai); + ssp_stop(dai, direction); break; case COMP_TRIGGER_RESUME: ssp_context_restore(dai);
On Tue, 2018-05-08 at 18:42 +0800, Keyon Jie wrote:
This will remove manual status change, wrap them into ssp_stop(), where the status transition is protect by spin_lock.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
Both applied.
Thanks
Liam
On 5/8/18 10:04 AM, Liam Girdwood wrote:
On Tue, 2018-05-08 at 18:42 +0800, Keyon Jie wrote:
This will remove manual status change, wrap them into ssp_stop(), where the status transition is protect by spin_lock.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
Both applied.
I believe BYT is broken, missing state change which is present in the APL-ssp case...
On 2018年05月08日 23:56, Pierre-Louis Bossart wrote:
On 5/8/18 10:04 AM, Liam Girdwood wrote:
On Tue, 2018-05-08 at 18:42 +0800, Keyon Jie wrote:
This will remove manual status change, wrap them into ssp_stop(), where the status transition is protect by spin_lock.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
Both applied.
I believe BYT is broken, missing state change which is present in the APL-ssp case...
Thanks for pointing out, sorry about the missing lines during copy/paste, Keqiao also reported this just now, let me send fix after verification.
Thanks, ~Keyon
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
participants (3)
-
Keyon Jie
-
Liam Girdwood
-
Pierre-Louis Bossart