Re: [PATCH 2/6] soundwire: stream: update state machine and add state checks

From: Vinod Koul
Date: Fri Jan 10 2020 - 01:48:58 EST


On 08-01-20, 11:54, Pierre-Louis Bossart wrote:

> Stream State Operations
> -----------------------
> @@ -246,6 +251,9 @@ SDW_STREAM_PREPARED
>
> Prepare state of stream. Operations performed before entering in this state:
>
> + (0) Steps 1 and 2 are omitted in the case of a resume operation,
> + where the bus bandwidth is known.
> +
> (1) Bus parameters such as bandwidth, frame shape, clock frequency,
> are computed based on current stream as well as already active
> stream(s) on Bus. Re-computation is required to accommodate current
> @@ -270,13 +278,15 @@ Prepare state of stream. Operations performed before entering in this state:
> After all above operations are successful, stream state is set to
> ``SDW_STREAM_PREPARED``.
>
> -Bus implements below API for PREPARE state which needs to be called once per
> -stream. From ASoC DPCM framework, this stream state is linked to
> -.prepare() operation.
> +Bus implements below API for PREPARE state which needs to be called
> +once per stream. From ASoC DPCM framework, this stream state is linked
> +to .prepare() operation. Since the .trigger() operations may not
> +follow the .prepare(), a direct transitions from
> +``SDW_STREAM_PREPARED`` to ``SDW_STREAM_DEPREPARED`` is allowed.
>
> .. code-block:: c
>
> - int sdw_prepare_stream(struct sdw_stream_runtime * stream);
> + int sdw_prepare_stream(struct sdw_stream_runtime * stream, bool resume);

so what does the additional argument of resume do..?

> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index 178ae92b8cc1..6aa0b5d370c0 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -1553,8 +1553,18 @@ int sdw_prepare_stream(struct sdw_stream_runtime *stream)

and it is not modified here, so is the doc correct or this..?

--
~Vinod