From fc73578be774001ef0e9aafdfbc1b4f054cd93d4 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 7 Jul 2021 15:56:20 -0700 Subject: [PATCH] drivers: Intel: SSP: ignore config when SSP is already configured When two streams are started one after the other, 2 DAI_CONFIG IPC's will be sent before the START trigger. This ends up configuring the SSP when the first one has already just configured it and ends up with xruns. The root cause is that the ssp_set_config() function configures a set of variables, writes those variables into SSP registers, and later on does a read-modify-write operation on the TSRE, RSRE and SSE bits. If the ssp_set_config is executed more than once, this will temporarily clear all three bitfields, and temporarily disable DMA transfers and SSP clocks. Avoid this by checking if the current state is > COMP_STATE_READY before configuring the SSP, so that the ssp_set_config() function only modifies SSP registers once. Signed-off-by: Ranjani Sridharan --- src/drivers/intel/ssp/ssp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/intel/ssp/ssp.c b/src/drivers/intel/ssp/ssp.c index acb992e8b..31ec2de49 100644 --- a/src/drivers/intel/ssp/ssp.c +++ b/src/drivers/intel/ssp/ssp.c @@ -268,10 +268,10 @@ static int ssp_set_config(struct dai *dai, struct ipc_config_dai *common_config, spin_lock(&dai->lock); - /* is playback/capture already running */ - if (ssp->state[DAI_DIR_PLAYBACK] == COMP_STATE_ACTIVE || - ssp->state[DAI_DIR_CAPTURE] == COMP_STATE_ACTIVE) { - dai_info(dai, "ssp_set_config(): playback/capture active. Ignore config"); + /* ignore config if SSP is already configured */ + if (ssp->state[DAI_DIR_PLAYBACK] > COMP_STATE_READY || + ssp->state[DAI_DIR_CAPTURE] > COMP_STATE_READY) { + dai_info(dai, "ssp_set_config(): Already configured. Ignore config"); goto out; }