Lines Matching defs:stream
3 * hdac-ext-stream.c - HD-audio extended stream operations.
19 * snd_hdac_ext_stream_init - initialize each stream (aka device)
21 * @stream: HD-audio ext core stream object to initialize
22 * @idx: stream index number
23 * @direction: stream direction (SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE)
26 * initialize the stream, if ppcap is enabled then init those and then
27 * invoke hdac stream initialization routine
30 struct hdac_ext_stream *stream,
34 stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE +
37 stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE +
43 stream->spib_addr = bus->spbcap + AZX_SPB_BASE +
47 stream->fifo_addr = bus->spbcap + AZX_SPB_BASE +
53 stream->dpibr_addr = bus->drsmcap + AZX_DRSM_BASE +
56 stream->decoupled = false;
57 snd_hdac_stream_init(bus, &stream->hstream, idx, direction, tag);
62 * snd_hdac_ext_stream_init_all - create and initialize the stream objects
76 struct hdac_ext_stream *stream =
77 kzalloc(sizeof(*stream), GFP_KERNEL);
78 if (!stream)
81 snd_hdac_ext_stream_init(bus, stream, idx, dir, tag);
91 * snd_hdac_stream_free_all - free hdac extended stream objects
98 struct hdac_ext_stream *stream;
101 stream = stream_to_hdac_ext_stream(s);
102 snd_hdac_ext_stream_decouple(bus, stream, false);
104 kfree(stream);
110 struct hdac_ext_stream *stream,
113 struct hdac_stream *hstream = &stream->hstream;
124 stream->decoupled = decouple;
129 * snd_hdac_ext_stream_decouple - decouple the hdac stream
131 * @stream: HD-audio ext core stream object to initialize
135 struct hdac_ext_stream *stream, bool decouple)
138 snd_hdac_ext_stream_decouple_locked(bus, stream, decouple);
144 * snd_hdac_ext_linkstream_start - start a stream
145 * @stream: HD-audio ext core stream to start
147 void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream)
149 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
155 * snd_hdac_ext_link_stream_clear - stop a stream DMA
156 * @stream: HD-audio ext core stream to stop
158 void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *stream)
160 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, AZX_PPLCCTL_RUN, 0);
165 * snd_hdac_ext_link_stream_reset - reset a stream
166 * @stream: HD-audio ext core stream to reset
168 void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream)
173 snd_hdac_ext_link_stream_clear(stream);
175 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL,
180 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) &
187 writel(val, stream->pplc_addr + AZX_REG_PPLCCTL);
191 /* waiting for hardware to report that the stream is out of reset */
193 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) & AZX_PPLCCTL_STRST;
204 * @stream: HD-audio ext core stream to set up
205 * @fmt: stream format
207 int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *stream, int fmt)
209 struct hdac_stream *hstream = &stream->hstream;
213 snd_hdac_ext_link_stream_clear(stream);
215 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL);
218 writel(val, stream->pplc_addr + AZX_REG_PPLCCTL);
220 /* program the stream format */
221 writew(fmt, stream->pplc_addr + AZX_REG_PPLCFMT);
228 * snd_hdac_ext_link_set_stream_id - maps stream id to link output
230 * @stream: stream id
233 int stream)
235 snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 1 << stream);
240 * snd_hdac_ext_link_clear_stream_id - maps stream id to link output
242 * @stream: stream id
245 int stream)
247 snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0);
256 struct hdac_stream *stream = NULL;
259 dev_err(bus->dev, "stream type not supported\n");
264 list_for_each_entry(stream, &bus->stream_list, list) {
265 struct hdac_ext_stream *hstream = container_of(stream,
268 if (stream->direction != substream->stream)
271 /* check if decoupled stream and not in use is available */
296 struct hdac_stream *stream = NULL;
299 dev_err(bus->dev, "stream type not supported\n");
304 list_for_each_entry(stream, &bus->stream_list, list) {
305 struct hdac_ext_stream *hstream = container_of(stream,
308 if (stream->direction != substream->stream)
311 if (!stream->opened) {
329 * snd_hdac_ext_stream_assign - assign a stream for the PCM
332 * @type: type of stream (coupled, host or link stream)
334 * This assigns the stream based on the type (coupled/host/link), for the
335 * given PCM substream, assigns it and returns the stream object
337 * coupled: Looks for an unused stream
338 * host: Looks for an unused decoupled host stream
339 * link: Looks for an unused decoupled link stream
341 * If no stream is free, returns NULL. The function tries to keep using
342 * the same stream object when it's used beforehand. when a stream is
343 * decoupled, it becomes a host stream and link stream.
350 struct hdac_stream *stream = NULL;
354 stream = snd_hdac_stream_assign(bus, substream);
355 if (stream)
356 hstream = container_of(stream,
373 * snd_hdac_ext_stream_release - release the assigned stream
374 * @stream: HD-audio ext core stream to release
375 * @type: type of stream (coupled, host or link stream)
377 * Release the stream that has been assigned by snd_hdac_ext_stream_assign().
379 void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type)
381 struct hdac_bus *bus = stream->hstream.bus;
385 snd_hdac_stream_release(&stream->hstream);
390 if (stream->decoupled && !stream->link_locked)
391 snd_hdac_ext_stream_decouple_locked(bus, stream, false);
393 snd_hdac_stream_release(&stream->hstream);
398 if (stream->decoupled && !stream->hstream.opened)
399 snd_hdac_ext_stream_decouple_locked(bus, stream, false);
400 stream->link_locked = 0;
401 stream->link_substream = NULL;
413 * snd_hdac_ext_stream_spbcap_enable - enable SPIB for a stream
416 * @index: stream index for which SPIB need to be enabled
438 * snd_hdac_ext_stream_set_spib - sets the spib value of a stream
440 * @stream: hdac_ext_stream
444 struct hdac_ext_stream *stream, u32 value)
452 writel(value, stream->spib_addr);
459 * snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream
461 * @stream: hdac_ext_stream
463 * Return maxfifo for the stream
466 struct hdac_ext_stream *stream)
474 return readl(stream->fifo_addr);
479 * snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
482 * @index: stream index for which DRSM need to be enabled
504 * snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
506 * @stream: hdac_ext_stream
510 struct hdac_ext_stream *stream, u32 value)
518 writel(value, stream->dpibr_addr);
525 * snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
526 * @stream: hdac_ext_stream
529 int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value)
531 snd_hdac_stream_writel(&stream->hstream, SD_LPIB, value);