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 <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2021-07-07 15:56:20 -07:00 committed by Pierre-Louis Bossart
parent 690481ae69
commit fc73578be7
1 changed files with 4 additions and 4 deletions

View File

@ -268,10 +268,10 @@ static int ssp_set_config(struct dai *dai, struct ipc_config_dai *common_config,
spin_lock(&dai->lock); spin_lock(&dai->lock);
/* is playback/capture already running */ /* ignore config if SSP is already configured */
if (ssp->state[DAI_DIR_PLAYBACK] == COMP_STATE_ACTIVE || if (ssp->state[DAI_DIR_PLAYBACK] > COMP_STATE_READY ||
ssp->state[DAI_DIR_CAPTURE] == COMP_STATE_ACTIVE) { ssp->state[DAI_DIR_CAPTURE] > COMP_STATE_READY) {
dai_info(dai, "ssp_set_config(): playback/capture active. Ignore config"); dai_info(dai, "ssp_set_config(): Already configured. Ignore config");
goto out; goto out;
} }