drivers/media/platform/arm/mali-c55/mali-c55-capture.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/arm/mali-c55/mali-c55-capture.c- Extension
.c- Size
- 26619 bytes
- Lines
- 960
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/minmax.hlinux/lockdep.hlinux/pm_runtime.hlinux/string.hlinux/videodev2.hmedia/v4l2-dev.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-subdev.hmedia/videobuf2-core.hmedia/videobuf2-dma-contig.hmali-c55-common.hmali-c55-registers.h
Detected Declarations
function mali_c55_cap_dev_writefunction mali_c55_cap_dev_readfunction mali_c55_cap_dev_update_bitsfunction mali_c55_mbus_code_can_produce_fmtfunction mali_c55_format_is_rawfunction mali_c55_format_from_pixfunction mali_c55_link_validatefunction mali_c55_vb2_queue_setupfunction mali_c55_buf_queuefunction mali_c55_buf_initfunction mali_c55_set_next_bufferfunction scoped_guardfunction mali_c55_set_plane_donefunction scoped_guardfunction mali_c55_cap_dev_stream_disablefunction mali_c55_cap_dev_stream_enablefunction mali_c55_cap_dev_return_buffersfunction scoped_guardfunction mali_c55_cap_dev_format_configurefunction mali_c55_vb2_start_streamingfunction mali_c55_vb2_stop_streamingfunction mali_c55_try_fmtfunction mali_c55_try_fmt_vid_cap_mplanefunction mali_c55_set_formatfunction mali_c55_s_fmt_vid_cap_mplanefunction mali_c55_g_fmt_vid_cap_mplanefunction mali_c55_enum_fmt_vid_cap_mplanefunction mali_c55_querycapfunction mali_c55_register_cap_devfunction mali_c55_register_capture_devsfunction mali_c55_unregister_cap_devfunction mali_c55_unregister_capture_devs
Annotated Snippet
if (j++ == f->index) {
f->pixelformat = mali_c55_fmts[i].fourcc;
return 0;
}
}
return -EINVAL;
}
static int mali_c55_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{
strscpy(cap->driver, MALI_C55_DRIVER_NAME, sizeof(cap->driver));
strscpy(cap->card, "ARM Mali-C55 ISP", sizeof(cap->card));
return 0;
}
static const struct v4l2_ioctl_ops mali_c55_v4l2_ioctl_ops = {
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_create_bufs = vb2_ioctl_create_bufs,
.vidioc_qbuf = vb2_ioctl_qbuf,
.vidioc_expbuf = vb2_ioctl_expbuf,
.vidioc_dqbuf = vb2_ioctl_dqbuf,
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_try_fmt_vid_cap_mplane = mali_c55_try_fmt_vid_cap_mplane,
.vidioc_s_fmt_vid_cap_mplane = mali_c55_s_fmt_vid_cap_mplane,
.vidioc_g_fmt_vid_cap_mplane = mali_c55_g_fmt_vid_cap_mplane,
.vidioc_enum_fmt_vid_cap = mali_c55_enum_fmt_vid_cap_mplane,
.vidioc_querycap = mali_c55_querycap,
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
};
static int mali_c55_register_cap_dev(struct mali_c55 *mali_c55,
enum mali_c55_cap_devs cap_dev_id)
{
struct mali_c55_cap_dev *cap_dev = &mali_c55->cap_devs[cap_dev_id];
struct v4l2_pix_format_mplane pix_mp;
struct video_device *vdev;
struct vb2_queue *vb2q;
int ret;
vdev = &cap_dev->vdev;
vb2q = &cap_dev->queue;
cap_dev->mali_c55 = mali_c55;
mutex_init(&cap_dev->lock);
INIT_LIST_HEAD(&cap_dev->buffers.input);
INIT_LIST_HEAD(&cap_dev->buffers.processing);
spin_lock_init(&cap_dev->buffers.lock);
spin_lock_init(&cap_dev->buffers.processing_lock);
switch (cap_dev_id) {
case MALI_C55_CAP_DEV_FR:
cap_dev->rsz = &mali_c55->resizers[MALI_C55_RSZ_FR];
cap_dev->reg_offset = MALI_C55_CAP_DEV_FR_REG_OFFSET;
break;
case MALI_C55_CAP_DEV_DS:
cap_dev->rsz = &mali_c55->resizers[MALI_C55_RSZ_DS];
cap_dev->reg_offset = MALI_C55_CAP_DEV_DS_REG_OFFSET;
break;
default:
ret = -EINVAL;
goto err_destroy_mutex;
}
cap_dev->pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&cap_dev->vdev.entity, 1, &cap_dev->pad);
if (ret) {
mutex_destroy(&cap_dev->lock);
goto err_destroy_mutex;
}
vb2q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
vb2q->io_modes = VB2_MMAP | VB2_DMABUF;
vb2q->drv_priv = cap_dev;
vb2q->mem_ops = &vb2_dma_contig_memops;
vb2q->ops = &mali_c55_vb2_ops;
vb2q->buf_struct_size = sizeof(struct mali_c55_buffer);
vb2q->min_queued_buffers = 1;
vb2q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
vb2q->lock = &cap_dev->lock;
vb2q->dev = mali_c55->dev;
ret = vb2_queue_init(vb2q);
if (ret) {
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/minmax.h`, `linux/lockdep.h`, `linux/pm_runtime.h`, `linux/string.h`, `linux/videodev2.h`, `media/v4l2-dev.h`, `media/v4l2-event.h`.
- Detected declarations: `function mali_c55_cap_dev_write`, `function mali_c55_cap_dev_read`, `function mali_c55_cap_dev_update_bits`, `function mali_c55_mbus_code_can_produce_fmt`, `function mali_c55_format_is_raw`, `function mali_c55_format_from_pix`, `function mali_c55_link_validate`, `function mali_c55_vb2_queue_setup`, `function mali_c55_buf_queue`, `function mali_c55_buf_init`.
- 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.
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.