[Sound-open-firmware] [PATCH] byt-ssp: change and wrap status transition into ssp_stop
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Tue May 8 17:53:58 CEST 2018
On 5/8/18 5:48 AM, 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 at linux.intel.com>
> ---
> src/drivers/byt-ssp.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/drivers/byt-ssp.c b/src/drivers/byt-ssp.c
> index 758f211..fcde98f 100644
> --- a/src/drivers/byt-ssp.c
> +++ b/src/drivers/byt-ssp.c
> @@ -504,20 +504,22 @@ 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);
> 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);
> trace_ssp("Ss1");
> }
> @@ -553,8 +555,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;
so where is the state changed now?
> - ssp_stop(dai);
> + ssp_stop(dai, direction);
after all this, ssp->state[direction] is still COMP_STATE_ACTIVE
-> something's weird or missing.
> break;
> case COMP_TRIGGER_RESUME:
> ssp_context_restore(dai);
>
More information about the Sound-open-firmware
mailing list