Lines Matching +full:per +full:- +full:stream
2 Audio Stream in SoundWire
5 An audio stream is a logical or virtual connection created between
16 audio stream contains one or more channels of data. All channels within
17 stream must have same sample rate and same sample size.
19 Assume a stream with two channels (Left & Right) is opened using SoundWire
20 interface. Below are some ways a stream can be represented in SoundWire.
22 Stream Sample in memory (System memory, DSP memory or FIFOs) ::
24 -------------------------
26 -------------------------
28 Example 1: Stereo Stream with L and R channels is rendered from Master to
31 +---------------+ Clock Signal +---------------+
32 | Master +----------------------------------+ Slave |
36 | L + R +----------------------------------+ L + R |
38 +---------------+ +-----------------------> +---------------+
41 Example 2: Stereo Stream with L and R channels is captured from Slave to
45 +---------------+ Clock Signal +---------------+
46 | Master +----------------------------------+ Slave |
50 | L + R +----------------------------------+ L + R |
52 +---------------+ <-----------------------+ +---------------+
55 Example 3: Stereo Stream with L and R channels is rendered by Master. Each
59 +---------------+ Clock Signal +---------------+
60 | Master +---------+------------------------+ Slave |
64 | L + R +---+------------------------------+ L |
66 +---------------+ | | +-------------> +---------------+
69 | | +---------------+
70 | +----------------------> | Slave |
74 +----------------------------> | R |
76 +---------------+
78 Example 4: Stereo Stream with L and R channels is rendered by
85 +---------------+ Clock Signal +---------------+
86 | Master +---------+------------------------+ Slave |
90 | L + R +---+------------------------------+ L + R |
92 +---------------+ | | +-------------> +---------------+
95 | | +---------------+
96 | +----------------------> | Slave |
100 +----------------------------> | L + R |
102 +---------------+
104 Example 5: Stereo Stream with L and R channel is rendered by two different
108 +--------------------+
110 | +--------------+ +----------------+
113 | | 1 |------------+ | |
114 | | L Channel || | +-----+----+ |
116 | Master +----------+ | +---+---------> || Port | |
118 | +--------------+ | || | |
119 | | || | +----------+ |
120 | | Data Port |------------+ | |
124 | +--------------+ Clock Signal | L + R |
125 | +---------------------------> | (Data) |
126 +--------------------+ | |
127 +----------------+
129 Example 6: Stereo Stream with L and R channel is rendered by 2 Masters, each
133 +---------------+ Clock Signal +---------------+
134 | Master +----------------------------------+ Slave |
138 | L +----------------------------------+ L |
140 +---------------+ +-----------------------> +---------------+
142 +---------------+ Clock Signal +---------------+
143 | Master +----------------------------------+ Slave |
147 | R +----------------------------------+ R |
149 +---------------+ +-----------------------> +---------------+
151 Example 7: Stereo Stream with L and R channel is rendered by 2
156 +---------------+ Clock Signal +---------------+
157 | Master +----------------------------------+ Slave |
161 | L + R +----------------------------------+ L + R |
163 +---------------+ +-----------------------> +---------------+
165 +---------------+ Clock Signal +---------------+
166 | Master +----------------------------------+ Slave |
170 | L + R +----------------------------------+ L + R |
172 +---------------+ +-----------------------> +---------------+
174 Example 8: 4-channel Stream is rendered by 2 Masters, each rendering a
177 +---------------+ Clock Signal +---------------+
178 | Master +----------------------------------+ Slave |
182 | L1 + R1 +----------------------------------+ L1 + R1 |
184 +---------------+ +-----------------------> +---------------+
186 +---------------+ Clock Signal +---------------+
187 | Master +----------------------------------+ Slave |
191 | L2 + R2 +----------------------------------+ L2 + R2 |
193 +---------------+ +-----------------------> +---------------+
195 Note1: In multi-link cases like above, to lock, one would acquire a global
197 framework(ASoC DPCM) guarantees that stream operations on a card are
202 transmitted on a link for a given Stream (Example 4) or just a subset
215 SoundWire Stream Management flow
218 Stream definitions
219 ------------------
221 (1) Current stream: This is classified as the stream on which operation has
222 to be performed like prepare, enable, disable, de-prepare etc.
224 (2) Active stream: This is classified as the stream which is already active
225 on Bus other than current stream. There can be multiple active streams
228 SoundWire Bus manages stream operations for each stream getting
230 done for each of the stream allocated/released on Bus. Following are the
231 stream states maintained by the Bus for each of the audio stream.
234 SoundWire stream states
235 -----------------------
237 Below shows the SoundWire stream states and state transition diagram. ::
239 +-----------+ +------------+ +----------+ +----------+
240 | ALLOCATED +---->| CONFIGURED +---->| PREPARED +---->| ENABLED |
242 +-----------+ +------------+ +---+--+---+ +----+-----+
248 +----------+ +-----+------+ +-+--+-----+
249 | RELEASED |<----------+ DEPREPARED |<-------+ DISABLED |
251 +----------+ +------------+ +----------+
264 Stream State Operations
265 -----------------------
268 Slave(s) as part of stream state transitions.
273 Allocation state for stream. This is the entry state
274 of the stream. Operations performed before entering in this state:
276 (1) A stream runtime is allocated for the stream. This stream
278 on the stream.
280 (2) The resources required for holding stream runtime information are
281 allocated and initialized. This holds all stream related information
282 such as stream type (PCM/PDM) and parameters, Master and Slave
283 interface associated with the stream, stream state etc.
285 After all above operations are successful, stream state is set to
288 Bus implements below API for allocate a stream which needs to be called once
289 per stream. From ASoC DPCM framework, this stream state maybe linked to
292 .. code-block:: c
298 stream allocation and sets the stream pointer for all DAIs
299 connected to a stream.
304 Configuration state of stream. Operations performed before entering in
307 (1) The resources allocated for stream information in SDW_STREAM_ALLOCATED
308 state are updated here. This includes stream parameters, Master(s)
309 and Slave(s) runtime information associated with current stream.
311 (2) All the Master(s) and Slave(s) associated with current stream provide
313 Master(s) and Slave(s) for current stream and their channel mask.
315 After all above operations are successful, stream state is set to
319 the respective Master(s) and Slave(s) associated with stream. These APIs can
321 framework, this stream state is linked to .hw_params() operation.
323 .. code-block:: c
328 struct sdw_stream_runtime * stream);
333 struct sdw_stream_runtime * stream);
339 Prepare state of stream. Operations performed before entering in this state:
345 are computed based on current stream as well as already active
346 stream(s) on Bus. Re-computation is required to accommodate current
347 stream on the Bus.
350 computed for the current as well as already active stream based on frame
356 already active stream(s) on the alternate bank (bank currently unused).
357 This is done in order to not disrupt already active stream(s).
362 (5) Ports of Master(s) and Slave(s) for current stream are prepared by
365 After all above operations are successful, stream state is set to
369 once per stream. From ASoC DPCM framework, this stream state is linked
374 .. code-block:: c
376 int sdw_prepare_stream(struct sdw_stream_runtime * stream);
382 Enable state of stream. The data port(s) are enabled upon entering this state.
387 already active stream(s) as well.
389 (2) All the Master(s) and Slave(s) port(s) for the current stream are
395 associated with current stream are enabled.
397 After all above operations are successful, stream state is set to
400 Bus implements below API for ENABLE state which needs to be called once per
401 stream. From ASoC DPCM framework, this stream state is linked to
404 .. code-block:: c
406 int sdw_enable_stream(struct sdw_stream_runtime * stream);
411 Disable state of stream. The data port(s) are disabled upon exiting this state.
414 (1) All the Master(s) and Slave(s) port(s) for the current stream are
418 (2) All the current configuration of Bus and active stream(s) are programmed
423 with current stream are disabled.
425 After all above operations are successful, stream state is set to
429 per stream. From ASoC DPCM framework, this stream state is linked to
436 stream can transition from ``SDW_STREAM_DISABLED`` to
440 .. code-block:: c
442 int sdw_disable_stream(struct sdw_stream_runtime * stream);
448 De-prepare state of stream. Operations performed before entering in this
451 (1) All the port(s) of Master(s) and Slave(s) for current stream are
452 de-prepared by programming PrepareCtrl register.
454 (2) The payload bandwidth of current stream is reduced from the total
458 After all above operations are successful, stream state is set to
462 once per stream. ALSA/ASoC do not have a concept of 'deprepare', and
463 the mapping from this stream state to ALSA/ASoC operation may be
466 When the INFO_PAUSE flag is supported, the stream state is linked to
467 the .hw_free() operation - the stream is not deprepared on a
474 .. code-block:: c
476 int sdw_deprepare_stream(struct sdw_stream_runtime * stream);
482 Release state of stream. Operations performed before entering in this state:
485 associated with current stream.
488 current stream.
490 (3) Release stream runtime resources associated with current stream.
492 After all above operations are successful, stream state is set to
496 all the Master(s) and Slave(s) associated with stream. From ASoC DPCM
497 framework, this stream state is linked to .hw_free() operation.
499 .. code-block:: c
502 struct sdw_stream_runtime * stream);
504 struct sdw_stream_runtime * stream);
508 stream assigned as part of ALLOCATED state.
510 In .shutdown() the data structure maintaining stream state are freed up.
512 .. code-block:: c
514 void sdw_release_stream(struct sdw_stream_runtime * stream);
518 the stream pointer for all DAIS connected to a stream and releases the
519 memory allocated for the stream.
525 streams or across stream. For example a port with 4 channels cannot be used