drivers/media/platform/amd/isp4/isp4_video.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/amd/isp4/isp4_video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/amd/isp4/isp4_video.c- Extension
.c- Size
- 21247 bytes
- Lines
- 798
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
media/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-vmalloc.hisp4_interface.hisp4_subdev.hisp4_video.h
Detected Declarations
function isp4vid_handle_frame_donefunction scoped_guardfunction isp4vid_capture_return_all_buffersfunction scoped_guardfunction isp4vid_vdev_link_validatefunction isp4vid_ioctl_querycapfunction isp4vid_g_fmt_vid_capfunction isp4vid_fill_buffer_sizefunction isp4vid_try_fmt_vid_capfunction isp4vid_set_fmt_2_ispfunction isp4vid_s_fmt_vid_capfunction isp4vid_enum_fmt_vid_capfunction isp4vid_enum_framesizesfunction isp4vid_ioctl_enum_frameintervalsfunction isp4vid_ioctl_g_paramfunction isp4vid_get_image_sizefunction isp4vid_qops_queue_setupfunction isp4vid_qops_buffer_queuefunction isp4vid_qops_start_streamingfunction isp4vid_qops_stop_streamingfunction isp4vid_qops_buf_initfunction isp4vid_qops_buf_cleanupfunction isp4vid_dev_initfunction isp4vid_dev_deinit
Annotated Snippet
if (vbuf != img_buf->planes[0].sys_addr) {
dev_err(isp_vdev->dev, "Invalid vbuf\n");
return;
}
list_del(&isp4vid_buf->list);
}
/* Fill the buffer */
isp4vid_buf->vb2.vb2_buf.timestamp = ktime_get_ns();
isp4vid_buf->vb2.sequence = isp_vdev->sequence++;
isp4vid_buf->vb2.field = V4L2_FIELD_ANY;
vb2_set_plane_payload(&isp4vid_buf->vb2.vb2_buf,
0, isp_vdev->format.sizeimage);
vb2_buffer_done(&isp4vid_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE);
dev_dbg(isp_vdev->dev, "call vb2_buffer_done(size=%u)\n",
isp_vdev->format.sizeimage);
}
static const struct v4l2_pix_format isp4vid_fmt_default = {
.width = 1920,
.height = 1080,
.pixelformat = ISP4VID_DEFAULT_FMT,
.field = V4L2_FIELD_NONE,
.colorspace = V4L2_COLORSPACE_SRGB,
};
static void isp4vid_capture_return_all_buffers(struct isp4vid_dev *isp_vdev,
enum vb2_buffer_state state)
{
struct isp4vid_capture_buffer *vbuf, *node;
scoped_guard(mutex, &isp_vdev->buf_list_lock) {
list_for_each_entry_safe(vbuf, node, &isp_vdev->buf_list, list)
vb2_buffer_done(&vbuf->vb2.vb2_buf, state);
INIT_LIST_HEAD(&isp_vdev->buf_list);
}
dev_dbg(isp_vdev->dev, "call vb2_buffer_done(%d)\n", state);
}
static int isp4vid_vdev_link_validate(struct media_link *link)
{
return 0;
}
static const struct media_entity_operations isp4vid_vdev_ent_ops = {
.link_validate = isp4vid_vdev_link_validate,
};
static const struct v4l2_file_operations isp4vid_vdev_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = vb2_fop_release,
.read = vb2_fop_read,
.poll = vb2_fop_poll,
.unlocked_ioctl = video_ioctl2,
.mmap = vb2_fop_mmap,
};
static int isp4vid_ioctl_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{
struct isp4vid_dev *isp_vdev = video_drvdata(file);
strscpy(cap->driver, ISP4VID_ISP_DRV_NAME, sizeof(cap->driver));
snprintf(cap->card, sizeof(cap->card), "%s", ISP4VID_ISP_DRV_NAME);
cap->capabilities |= V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE;
dev_dbg(isp_vdev->dev, "%s|capabilities=0x%X\n", isp_vdev->vdev.name,
cap->capabilities);
return 0;
}
static int isp4vid_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct isp4vid_dev *isp_vdev = video_drvdata(file);
f->fmt.pix = isp_vdev->format;
return 0;
}
static int isp4vid_fill_buffer_size(struct v4l2_pix_format *fmt)
{
Annotation
- Immediate include surface: `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/videobuf2-vmalloc.h`, `isp4_interface.h`, `isp4_subdev.h`, `isp4_video.h`.
- Detected declarations: `function isp4vid_handle_frame_done`, `function scoped_guard`, `function isp4vid_capture_return_all_buffers`, `function scoped_guard`, `function isp4vid_vdev_link_validate`, `function isp4vid_ioctl_querycap`, `function isp4vid_g_fmt_vid_cap`, `function isp4vid_fill_buffer_size`, `function isp4vid_try_fmt_vid_cap`, `function isp4vid_set_fmt_2_isp`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- 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.