Lines Matching +full:audio +full:- +full:core
1 // SPDX-License-Identifier: GPL-2.0-only
3 * hdac-ext-stream.c - HD-audio extended stream operations.
22 * snd_hdac_ext_host_stream_setup - Setup a HOST stream.
24 * @code_loading: Whether the stream is for PCM or code-loading.
30 return hext_stream->host_setup(hdac_stream(hext_stream), code_loading); in snd_hdac_ext_host_stream_setup()
35 * snd_hdac_apl_host_stream_setup - Setup a HOST stream following procedure
38 * @code_loading: Whether the stream is for PCM or code-loading.
47 snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, false); in snd_hdac_apl_host_stream_setup()
49 snd_hdac_ext_stream_decouple(hstream->bus, hext_stream, true); in snd_hdac_apl_host_stream_setup()
55 * snd_hdac_ext_stream_init - initialize each stream (aka device)
56 * @bus: HD-audio core bus
57 * @hext_stream: HD-audio ext core stream object to initialize
69 if (bus->ppcap) { in snd_hdac_ext_stream_init()
70 hext_stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE + in snd_hdac_ext_stream_init()
73 hext_stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE + in snd_hdac_ext_stream_init()
74 AZX_PPLC_MULTI * bus->num_streams + in snd_hdac_ext_stream_init()
78 hext_stream->decoupled = false; in snd_hdac_ext_stream_init()
79 snd_hdac_stream_init(bus, &hext_stream->hstream, idx, direction, tag); in snd_hdac_ext_stream_init()
83 * snd_hdac_ext_stream_init_all - create and initialize the stream objects
85 * @bus: HD-audio core bus
93 struct pci_dev *pci = to_pci_dev(bus->dev); in snd_hdac_ext_stream_init_all()
98 if (pci->device == PCI_DEVICE_ID_INTEL_HDA_APL) in snd_hdac_ext_stream_init_all()
107 return -ENOMEM; in snd_hdac_ext_stream_init_all()
111 hext_stream->host_setup = setup_op; in snd_hdac_ext_stream_init_all()
120 * snd_hdac_ext_stream_free_all - free hdac extended stream objects
122 * @bus: HD-audio core bus
129 list_for_each_entry_safe(s, _s, &bus->stream_list, list) { in snd_hdac_ext_stream_free_all()
132 list_del(&s->list); in snd_hdac_ext_stream_free_all()
142 struct hdac_stream *hstream = &hext_stream->hstream; in snd_hdac_ext_stream_decouple_locked()
144 int mask = AZX_PPCTL_PROCEN(hstream->index); in snd_hdac_ext_stream_decouple_locked()
146 val = readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask; in snd_hdac_ext_stream_decouple_locked()
149 snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, mask); in snd_hdac_ext_stream_decouple_locked()
151 snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, mask, 0); in snd_hdac_ext_stream_decouple_locked()
153 hext_stream->decoupled = decouple; in snd_hdac_ext_stream_decouple_locked()
158 * snd_hdac_ext_stream_decouple - decouple the hdac stream
159 * @bus: HD-audio core bus
160 * @hext_stream: HD-audio ext core stream object to initialize
166 spin_lock_irq(&bus->reg_lock); in snd_hdac_ext_stream_decouple()
168 spin_unlock_irq(&bus->reg_lock); in snd_hdac_ext_stream_decouple()
173 * snd_hdac_ext_stream_start - start a stream
174 * @hext_stream: HD-audio ext core stream to start
178 snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL, in snd_hdac_ext_stream_start()
184 * snd_hdac_ext_stream_clear - stop a stream DMA
185 * @hext_stream: HD-audio ext core stream to stop
189 snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL, AZX_PPLCCTL_RUN, 0); in snd_hdac_ext_stream_clear()
194 * snd_hdac_ext_stream_reset - reset a stream
195 * @hext_stream: HD-audio ext core stream to reset
204 snd_hdac_updatel(hext_stream->pplc_addr, AZX_REG_PPLCCTL, in snd_hdac_ext_stream_reset()
209 val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL) & in snd_hdac_ext_stream_reset()
214 } while (--timeout); in snd_hdac_ext_stream_reset()
216 writel(val, hext_stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_stream_reset()
222 val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL) & AZX_PPLCCTL_STRST; in snd_hdac_ext_stream_reset()
226 } while (--timeout); in snd_hdac_ext_stream_reset()
232 * snd_hdac_ext_stream_setup - set up the SD for streaming
233 * @hext_stream: HD-audio ext core stream to set up
238 struct hdac_stream *hstream = &hext_stream->hstream; in snd_hdac_ext_stream_setup()
244 val = readl(hext_stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_stream_setup()
246 (hstream->stream_tag << AZX_PPLCCTL_STRM_SHIFT); in snd_hdac_ext_stream_setup()
247 writel(val, hext_stream->pplc_addr + AZX_REG_PPLCCTL); in snd_hdac_ext_stream_setup()
250 writew(fmt, hext_stream->pplc_addr + AZX_REG_PPLCFMT); in snd_hdac_ext_stream_setup()
263 if (!bus->ppcap) { in hdac_ext_link_dma_stream_assign()
264 dev_err(bus->dev, "stream type not supported\n"); in hdac_ext_link_dma_stream_assign()
268 spin_lock_irq(&bus->reg_lock); in hdac_ext_link_dma_stream_assign()
269 list_for_each_entry(hstream, &bus->stream_list, list) { in hdac_ext_link_dma_stream_assign()
273 if (hstream->direction != substream->stream) in hdac_ext_link_dma_stream_assign()
277 if (!hext_stream->link_locked) { in hdac_ext_link_dma_stream_assign()
285 res->link_locked = 1; in hdac_ext_link_dma_stream_assign()
286 res->link_substream = substream; in hdac_ext_link_dma_stream_assign()
288 spin_unlock_irq(&bus->reg_lock); in hdac_ext_link_dma_stream_assign()
299 if (!bus->ppcap) { in hdac_ext_host_dma_stream_assign()
300 dev_err(bus->dev, "stream type not supported\n"); in hdac_ext_host_dma_stream_assign()
304 spin_lock_irq(&bus->reg_lock); in hdac_ext_host_dma_stream_assign()
305 list_for_each_entry(hstream, &bus->stream_list, list) { in hdac_ext_host_dma_stream_assign()
309 if (hstream->direction != substream->stream) in hdac_ext_host_dma_stream_assign()
312 if (!hstream->opened) { in hdac_ext_host_dma_stream_assign()
319 res->hstream.opened = 1; in hdac_ext_host_dma_stream_assign()
320 res->hstream.running = 0; in hdac_ext_host_dma_stream_assign()
321 res->hstream.substream = substream; in hdac_ext_host_dma_stream_assign()
323 spin_unlock_irq(&bus->reg_lock); in hdac_ext_host_dma_stream_assign()
329 * snd_hdac_ext_stream_assign - assign a stream for the PCM
330 * @bus: HD-audio core bus
374 * snd_hdac_ext_stream_release - release the assigned stream
375 * @hext_stream: HD-audio ext core stream to release
382 struct hdac_bus *bus = hext_stream->hstream.bus; in snd_hdac_ext_stream_release()
386 snd_hdac_stream_release(&hext_stream->hstream); in snd_hdac_ext_stream_release()
390 spin_lock_irq(&bus->reg_lock); in snd_hdac_ext_stream_release()
392 if (!hext_stream->link_locked) in snd_hdac_ext_stream_release()
394 snd_hdac_stream_release_locked(&hext_stream->hstream); in snd_hdac_ext_stream_release()
395 spin_unlock_irq(&bus->reg_lock); in snd_hdac_ext_stream_release()
399 spin_lock_irq(&bus->reg_lock); in snd_hdac_ext_stream_release()
401 if (!hext_stream->hstream.opened) in snd_hdac_ext_stream_release()
403 hext_stream->link_locked = 0; in snd_hdac_ext_stream_release()
404 hext_stream->link_substream = NULL; in snd_hdac_ext_stream_release()
405 spin_unlock_irq(&bus->reg_lock); in snd_hdac_ext_stream_release()
409 dev_dbg(bus->dev, "Invalid type %d\n", type); in snd_hdac_ext_stream_release()
416 * snd_hdac_ext_cstream_assign - assign a host stream for compress
417 * @bus: HD-audio core bus
430 spin_lock_irq(&bus->reg_lock); in snd_hdac_ext_cstream_assign()
431 list_for_each_entry(hstream, &bus->stream_list, list) { in snd_hdac_ext_cstream_assign()
434 if (hstream->direction != cstream->direction) in snd_hdac_ext_cstream_assign()
437 if (!hstream->opened) { in snd_hdac_ext_cstream_assign()
445 res->hstream.opened = 1; in snd_hdac_ext_cstream_assign()
446 res->hstream.running = 0; in snd_hdac_ext_cstream_assign()
447 res->hstream.cstream = cstream; in snd_hdac_ext_cstream_assign()
449 spin_unlock_irq(&bus->reg_lock); in snd_hdac_ext_cstream_assign()