drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c- Extension
.c- Size
- 23163 bytes
- Lines
- 858
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/cleanup.hlinux/bug.hlinux/device.hlinux/list.hlinux/lockdep.hlinux/mutex.hlinux/spinlock.hlinux/types.hmedia/media-entity.hmedia/v4l2-subdev.hmedia/videobuf2-dma-sg.hmedia/videobuf2-v4l2.hipu6-bus.hipu6-dma.hipu6-fw-isys.hipu6-isys.hipu6-isys-video.h
Detected Declarations
function Copyrightfunction ipu6_isys_buf_cleanupfunction ipu6_isys_queue_setupfunction ipu6_isys_buf_preparefunction ipu6_isys_buffer_list_queuefunction list_for_each_entry_safefunction flush_firmware_streamon_failfunction list_for_each_entryfunction list_for_each_entry_safefunction buffer_list_getfunction list_for_each_entryfunction ipu6_isys_buf_to_fw_frame_buf_pinfunction ipu6_isys_buf_to_fw_frame_buffunction list_for_each_entryfunction ipu6_isys_stream_startfunction buf_queuefunction ipu6_isys_link_fmt_validatefunction return_buffersfunction wrongfunction ipu6_isys_stream_cleanupfunction start_streamingfunction stop_streamingfunction get_sof_sequence_by_timestampfunction get_sof_ns_deltafunction ipu6_isys_buf_calc_sequence_timefunction ipu6_isys_queue_buf_donefunction ipu6_stream_buf_readyfunction list_for_each_entry_reversefunction ipu6_isys_queue_buf_readyfunction ipu6_isys_queue_init
Annotated Snippet
if (first) {
dev_dbg(dev,
"queue buf list %p flags %lx, s %d, %d bufs\n",
bl, op_flags, state, bl->nbufs);
first = false;
}
bl->nbufs--;
}
WARN_ON(bl->nbufs);
}
/*
* flush_firmware_streamon_fail() - Flush in cases where requests may
* have been queued to firmware and the *firmware streamon fails for a
* reason or another.
*/
static void flush_firmware_streamon_fail(struct ipu6_isys_stream *stream)
{
struct device *dev = &stream->isys->adev->auxdev.dev;
struct ipu6_isys_queue *aq;
unsigned long flags;
lockdep_assert_held(&stream->mutex);
list_for_each_entry(aq, &stream->queues, node) {
struct ipu6_isys_video *av = ipu6_isys_queue_to_video(aq);
struct ipu6_isys_buffer *ib, *ib_safe;
spin_lock_irqsave(&aq->lock, flags);
list_for_each_entry_safe(ib, ib_safe, &aq->active, head) {
struct vb2_buffer *vb =
ipu6_isys_buffer_to_vb2_buffer(ib);
list_del(&ib->head);
if (av->streaming) {
dev_dbg(dev,
"%s: queue buffer %u back to incoming\n",
av->vdev.name, vb->index);
/* Queue already streaming, return to driver. */
list_add(&ib->head, &aq->incoming);
continue;
}
/* Queue not yet streaming, return to user. */
dev_dbg(dev, "%s: return %u back to videobuf2\n",
av->vdev.name, vb->index);
vb2_buffer_done(ipu6_isys_buffer_to_vb2_buffer(ib),
VB2_BUF_STATE_QUEUED);
}
spin_unlock_irqrestore(&aq->lock, flags);
}
}
/*
* Attempt obtaining a buffer list from the incoming queues, a list of buffers
* that contains one entry from each video buffer queue. If a buffer can't be
* obtained from every queue, the buffers are returned back to the queue.
*/
static int buffer_list_get(struct ipu6_isys_stream *stream,
struct ipu6_isys_buffer_list *bl)
{
struct device *dev = &stream->isys->adev->auxdev.dev;
struct ipu6_isys_queue *aq;
unsigned long flags;
unsigned long buf_flag = IPU6_ISYS_BUFFER_LIST_FL_INCOMING;
lockdep_assert_held(&stream->mutex);
bl->nbufs = 0;
INIT_LIST_HEAD(&bl->head);
list_for_each_entry(aq, &stream->queues, node) {
struct ipu6_isys_buffer *ib;
spin_lock_irqsave(&aq->lock, flags);
if (list_empty(&aq->incoming)) {
spin_unlock_irqrestore(&aq->lock, flags);
if (!list_empty(&bl->head))
ipu6_isys_buffer_list_queue(bl, buf_flag, 0);
return -ENODATA;
}
ib = list_last_entry(&aq->incoming,
struct ipu6_isys_buffer, head);
dev_dbg(dev, "buffer: %s: buffer %u\n",
ipu6_isys_queue_to_video(aq)->vdev.name,
ipu6_isys_buffer_to_vb2_buffer(ib)->index);
list_del(&ib->head);
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/cleanup.h`, `linux/bug.h`, `linux/device.h`, `linux/list.h`, `linux/lockdep.h`, `linux/mutex.h`, `linux/spinlock.h`.
- Detected declarations: `function Copyright`, `function ipu6_isys_buf_cleanup`, `function ipu6_isys_queue_setup`, `function ipu6_isys_buf_prepare`, `function ipu6_isys_buffer_list_queue`, `function list_for_each_entry_safe`, `function flush_firmware_streamon_fail`, `function list_for_each_entry`, `function list_for_each_entry_safe`, `function buffer_list_get`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.