drivers/media/platform/qcom/camss/camss-video.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/camss/camss-video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/camss/camss-video.c- Extension
.c- Size
- 20045 bytes
- Lines
- 770
- 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/slab.hmedia/media-entity.hmedia/v4l2-dev.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-dma-sg.hcamss-video.hcamss.h
Detected Declarations
function Copyrightfunction video_get_subdev_formatfunction video_queue_setupfunction video_buf_initfunction video_buf_preparefunction video_buf_queuefunction video_check_formatfunction video_prepare_streamingfunction video_start_streamingfunction video_stop_streamingfunction video_unprepare_streamingfunction video_querycapfunction video_enum_fmtfunction video_enum_framesizesfunction video_g_fmtfunction __video_try_fmtfunction video_try_fmtfunction video_s_fmtfunction video_enum_inputfunction video_g_inputfunction video_s_inputfunction msm_video_releasefunction msm_video_init_formatfunction msm_video_registerfunction msm_video_unregister
Annotated Snippet
if (ret) {
dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
return;
}
}
video_device_pipeline_stop(vdev);
video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR);
}
static void video_unprepare_streaming(struct vb2_queue *q)
{
struct camss_video *video = vb2_get_drv_priv(q);
struct video_device *vdev = &video->vdev;
v4l2_pipeline_pm_put(&vdev->entity);
}
static const struct vb2_ops msm_video_vb2_q_ops = {
.queue_setup = video_queue_setup,
.buf_init = video_buf_init,
.buf_prepare = video_buf_prepare,
.buf_queue = video_buf_queue,
.prepare_streaming = video_prepare_streaming,
.start_streaming = video_start_streaming,
.stop_streaming = video_stop_streaming,
.unprepare_streaming = video_unprepare_streaming,
};
/* -----------------------------------------------------------------------------
* V4L2 ioctls
*/
static int video_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{
strscpy(cap->driver, "qcom-camss", sizeof(cap->driver));
strscpy(cap->card, "Qualcomm Camera Subsystem", sizeof(cap->card));
return 0;
}
static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f)
{
struct camss_video *video = video_drvdata(file);
int i, j, k;
u32 mcode = f->mbus_code;
if (f->type != video->type)
return -EINVAL;
if (f->index >= video->nformats)
return -EINVAL;
/*
* Find index "i" of "k"th unique pixelformat in formats array.
*
* If f->mbus_code passed to video_enum_fmt() is not zero, a device
* with V4L2_CAP_IO_MC capability restricts enumeration to only the
* pixel formats that can be produced from that media bus code.
* This is implemented by skipping video->formats[] entries with
* code != f->mbus_code (if f->mbus_code is not zero).
* If the f->mbus_code passed to video_enum_fmt() is not supported,
* -EINVAL is returned.
* If f->mbus_code is zero, all the pixel formats are enumerated.
*/
k = -1;
for (i = 0; i < video->nformats; i++) {
if (mcode != 0 && video->formats[i].code != mcode)
continue;
for (j = 0; j < i; j++) {
if (mcode != 0 && video->formats[j].code != mcode)
continue;
if (video->formats[i].pixelformat ==
video->formats[j].pixelformat)
break;
}
if (j == i)
k++;
if (k == f->index)
break;
}
if (k == -1 || k < f->index)
/*
* All the unique pixel formats matching the arguments
Annotation
- Immediate include surface: `linux/slab.h`, `media/media-entity.h`, `media/v4l2-dev.h`, `media/v4l2-device.h`, `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/videobuf2-dma-sg.h`, `camss-video.h`.
- Detected declarations: `function Copyright`, `function video_get_subdev_format`, `function video_queue_setup`, `function video_buf_init`, `function video_buf_prepare`, `function video_buf_queue`, `function video_check_format`, `function video_prepare_streaming`, `function video_start_streaming`, `function video_stop_streaming`.
- 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.