Lines Matching full: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, in snd_hdac_ext_stream_init() argument
34 stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE + in snd_hdac_ext_stream_init()
37 stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE + in snd_hdac_ext_stream_init()
43 stream->spib_addr = bus->spbcap + AZX_SPB_BASE + in snd_hdac_ext_stream_init()
47 stream->fifo_addr = bus->spbcap + AZX_SPB_BASE + in snd_hdac_ext_stream_init()
53 stream->dpibr_addr = bus->drsmcap + AZX_DRSM_BASE + in snd_hdac_ext_stream_init()
56 stream->decoupled = false; in snd_hdac_ext_stream_init()
57 snd_hdac_stream_init(bus, &stream->hstream, idx, direction, tag); in snd_hdac_ext_stream_init()
62 * snd_hdac_ext_stream_init_all - create and initialize the stream objects
76 struct hdac_ext_stream *stream = in snd_hdac_ext_stream_init_all() local
77 kzalloc(sizeof(*stream), GFP_KERNEL); in snd_hdac_ext_stream_init_all()
78 if (!stream) in snd_hdac_ext_stream_init_all()
81 snd_hdac_ext_stream_init(bus, stream, idx, dir, tag); in snd_hdac_ext_stream_init_all()
91 * snd_hdac_stream_free_all - free hdac extended stream objects
98 struct hdac_ext_stream *stream; in snd_hdac_stream_free_all() local
101 stream = stream_to_hdac_ext_stream(s); in snd_hdac_stream_free_all()
102 snd_hdac_ext_stream_decouple(bus, stream, false); in snd_hdac_stream_free_all()
104 kfree(stream); in snd_hdac_stream_free_all()
110 * snd_hdac_ext_stream_decouple - decouple the hdac stream
112 * @stream: HD-audio ext core stream object to initialize
116 struct hdac_ext_stream *stream, bool decouple) in snd_hdac_ext_stream_decouple() argument
118 struct hdac_stream *hstream = &stream->hstream; in snd_hdac_ext_stream_decouple()
130 stream->decoupled = decouple; in snd_hdac_ext_stream_decouple()
136 * snd_hdac_ext_linkstream_start - start a stream
137 * @stream: HD-audio ext core stream to start
139 void snd_hdac_ext_link_stream_start(struct hdac_ext_stream *stream) in snd_hdac_ext_link_stream_start() argument
141 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, in snd_hdac_ext_link_stream_start()
147 * snd_hdac_ext_link_stream_clear - stop a stream DMA
148 * @stream: HD-audio ext core stream to stop
150 void snd_hdac_ext_link_stream_clear(struct hdac_ext_stream *stream) in snd_hdac_ext_link_stream_clear() argument
152 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, AZX_PPLCCTL_RUN, 0); in snd_hdac_ext_link_stream_clear()
157 * snd_hdac_ext_link_stream_reset - reset a stream
158 * @stream: HD-audio ext core stream to reset
160 void snd_hdac_ext_link_stream_reset(struct hdac_ext_stream *stream) in snd_hdac_ext_link_stream_reset() argument
165 snd_hdac_ext_link_stream_clear(stream); in snd_hdac_ext_link_stream_reset()
167 snd_hdac_updatel(stream->pplc_addr, AZX_REG_PPLCCTL, in snd_hdac_ext_link_stream_reset()
172 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) & in snd_hdac_ext_link_stream_reset()
179 writel(val, stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_link_stream_reset()
183 /* waiting for hardware to report that the stream is out of reset */ in snd_hdac_ext_link_stream_reset()
185 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL) & AZX_PPLCCTL_STRST; in snd_hdac_ext_link_stream_reset()
196 * @stream: HD-audio ext core stream to set up
197 * @fmt: stream format
199 int snd_hdac_ext_link_stream_setup(struct hdac_ext_stream *stream, int fmt) in snd_hdac_ext_link_stream_setup() argument
201 struct hdac_stream *hstream = &stream->hstream; in snd_hdac_ext_link_stream_setup()
205 snd_hdac_ext_link_stream_clear(stream); in snd_hdac_ext_link_stream_setup()
207 val = readl(stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_link_stream_setup()
210 writel(val, stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_link_stream_setup()
212 /* program the stream format */ in snd_hdac_ext_link_stream_setup()
213 writew(fmt, stream->pplc_addr + AZX_REG_PPLCFMT); in snd_hdac_ext_link_stream_setup()
220 * snd_hdac_ext_link_set_stream_id - maps stream id to link output
222 * @stream: stream id
225 int stream) in snd_hdac_ext_link_set_stream_id() argument
227 snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 1 << stream); in snd_hdac_ext_link_set_stream_id()
232 * snd_hdac_ext_link_clear_stream_id - maps stream id to link output
234 * @stream: stream id
237 int stream) in snd_hdac_ext_link_clear_stream_id() argument
239 snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, (1 << stream), 0); in snd_hdac_ext_link_clear_stream_id()
248 struct hdac_stream *stream = NULL; in hdac_ext_link_stream_assign() local
251 dev_err(bus->dev, "stream type not supported\n"); in hdac_ext_link_stream_assign()
255 list_for_each_entry(stream, &bus->stream_list, list) { in hdac_ext_link_stream_assign()
256 struct hdac_ext_stream *hstream = container_of(stream, in hdac_ext_link_stream_assign()
259 if (stream->direction != substream->stream) in hdac_ext_link_stream_assign()
262 /* check if decoupled stream and not in use is available */ in hdac_ext_link_stream_assign()
288 struct hdac_stream *stream = NULL; in hdac_ext_host_stream_assign() local
291 dev_err(bus->dev, "stream type not supported\n"); in hdac_ext_host_stream_assign()
295 list_for_each_entry(stream, &bus->stream_list, list) { in hdac_ext_host_stream_assign()
296 struct hdac_ext_stream *hstream = container_of(stream, in hdac_ext_host_stream_assign()
299 if (stream->direction != substream->stream) in hdac_ext_host_stream_assign()
302 if (!stream->opened) { in hdac_ext_host_stream_assign()
321 * snd_hdac_ext_stream_assign - assign a stream for the PCM
324 * @type: type of stream (coupled, host or link stream)
326 * This assigns the stream based on the type (coupled/host/link), for the
327 * given PCM substream, assigns it and returns the stream object
329 * coupled: Looks for an unused stream
330 * host: Looks for an unused decoupled host stream
331 * link: Looks for an unused decoupled link stream
333 * If no stream is free, returns NULL. The function tries to keep using
334 * the same stream object when it's used beforehand. when a stream is
335 * decoupled, it becomes a host stream and link stream.
342 struct hdac_stream *stream = NULL; in snd_hdac_ext_stream_assign() local
346 stream = snd_hdac_stream_assign(bus, substream); in snd_hdac_ext_stream_assign()
347 if (stream) in snd_hdac_ext_stream_assign()
348 hstream = container_of(stream, in snd_hdac_ext_stream_assign()
365 * snd_hdac_ext_stream_release - release the assigned stream
366 * @stream: HD-audio ext core stream to release
367 * @type: type of stream (coupled, host or link stream)
369 * Release the stream that has been assigned by snd_hdac_ext_stream_assign().
371 void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type) in snd_hdac_ext_stream_release() argument
373 struct hdac_bus *bus = stream->hstream.bus; in snd_hdac_ext_stream_release()
377 snd_hdac_stream_release(&stream->hstream); in snd_hdac_ext_stream_release()
381 if (stream->decoupled && !stream->link_locked) in snd_hdac_ext_stream_release()
382 snd_hdac_ext_stream_decouple(bus, stream, false); in snd_hdac_ext_stream_release()
383 snd_hdac_stream_release(&stream->hstream); in snd_hdac_ext_stream_release()
387 if (stream->decoupled && !stream->hstream.opened) in snd_hdac_ext_stream_release()
388 snd_hdac_ext_stream_decouple(bus, stream, false); in snd_hdac_ext_stream_release()
390 stream->link_locked = 0; in snd_hdac_ext_stream_release()
391 stream->link_substream = NULL; in snd_hdac_ext_stream_release()
403 * snd_hdac_ext_stream_spbcap_enable - enable SPIB for a stream
406 * @index: stream index for which SPIB need to be enabled
428 * snd_hdac_ext_stream_set_spib - sets the spib value of a stream
430 * @stream: hdac_ext_stream
434 struct hdac_ext_stream *stream, u32 value) in snd_hdac_ext_stream_set_spib() argument
442 writel(value, stream->spib_addr); in snd_hdac_ext_stream_set_spib()
449 * snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream
451 * @stream: hdac_ext_stream
453 * Return maxfifo for the stream
456 struct hdac_ext_stream *stream) in snd_hdac_ext_stream_get_spbmaxfifo() argument
464 return readl(stream->fifo_addr); in snd_hdac_ext_stream_get_spbmaxfifo()
470 * snd_hdac_ext_stop_streams - stop all stream if running
475 struct hdac_stream *stream; in snd_hdac_ext_stop_streams() local
478 list_for_each_entry(stream, &bus->stream_list, list) in snd_hdac_ext_stop_streams()
479 snd_hdac_stream_stop(stream); in snd_hdac_ext_stop_streams()
486 * snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
489 * @index: stream index for which DRSM need to be enabled
511 * snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
513 * @stream: hdac_ext_stream
517 struct hdac_ext_stream *stream, u32 value) in snd_hdac_ext_stream_set_dpibr() argument
525 writel(value, stream->dpibr_addr); in snd_hdac_ext_stream_set_dpibr()
532 * snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
533 * @stream: hdac_ext_stream
536 int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value) in snd_hdac_ext_stream_set_lpib() argument
538 snd_hdac_stream_writel(&stream->hstream, SD_LPIB, value); in snd_hdac_ext_stream_set_lpib()