mirror of https://github.com/thesofproject/sof.git
SSP: refine ssp stop function
merge commit 72e63a467f
("apl-ssp: change and wrap status
transition into ssp_stop")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
This commit is contained in:
parent
1ea2941cda
commit
54d265e7ec
|
@ -437,23 +437,27 @@ static void ssp_start(struct dai *dai, int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop the SSP for either playback or capture */
|
/* 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);
|
struct ssp_pdata *ssp = dai_get_drvdata(dai);
|
||||||
|
|
||||||
spin_lock(&ssp->lock);
|
spin_lock(&ssp->lock);
|
||||||
|
|
||||||
/* stop Rx if we are not capturing */
|
/* stop Rx if neeed */
|
||||||
if (ssp->state[SOF_IPC_STREAM_CAPTURE] != COMP_STATE_ACTIVE) {
|
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, SSCR1, SSCR1_RSRE, 0);
|
||||||
ssp_update_bits(dai, SSCR0, SSCR0_RIM, SSCR0_RIM);
|
ssp_update_bits(dai, SSCR0, SSCR0_RIM, SSCR0_RIM);
|
||||||
|
ssp->state[SOF_IPC_STREAM_CAPTURE] = COMP_STATE_PAUSED;
|
||||||
trace_ssp("Ss0");
|
trace_ssp("Ss0");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop Tx if we are not playing */
|
/* stop Tx if needed */
|
||||||
if (ssp->state[SOF_IPC_STREAM_PLAYBACK] != COMP_STATE_ACTIVE) {
|
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, SSCR1, SSCR1_TSRE, 0);
|
||||||
ssp_update_bits(dai, SSCR0, SSCR0_TIM, SSCR0_TIM);
|
ssp_update_bits(dai, SSCR0, SSCR0_TIM, SSCR0_TIM);
|
||||||
|
ssp->state[SOF_IPC_STREAM_PLAYBACK] = COMP_STATE_PAUSED;
|
||||||
trace_ssp("Ss1");
|
trace_ssp("Ss1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,8 +492,7 @@ static int ssp_trigger(struct dai *dai, int cmd, int direction)
|
||||||
break;
|
break;
|
||||||
case COMP_TRIGGER_STOP:
|
case COMP_TRIGGER_STOP:
|
||||||
case COMP_TRIGGER_PAUSE:
|
case COMP_TRIGGER_PAUSE:
|
||||||
ssp->state[direction] = COMP_STATE_PAUSED;
|
ssp_stop(dai, direction);
|
||||||
ssp_stop(dai);
|
|
||||||
break;
|
break;
|
||||||
case COMP_TRIGGER_RESUME:
|
case COMP_TRIGGER_RESUME:
|
||||||
ssp_context_restore(dai);
|
ssp_context_restore(dai);
|
||||||
|
|
Loading…
Reference in New Issue