drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c- Extension
.c- Size
- 27123 bytes
- Lines
- 969
- 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.
- 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
linux/iopoll.hlinux/pm_runtime.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-core.hmedia/videobuf2-dma-contig.hdcmipp-common.h
Detected Declarations
struct dcmipp_bytecap_pix_mapstruct dcmipp_bufstruct dcmipp_bytecap_deviceenum dcmipp_statefunction dcmipp_bytecap_pix_map_by_pixelformatfunction dcmipp_bytecap_querycapfunction dcmipp_bytecap_g_fmt_vid_capfunction dcmipp_bytecap_try_fmt_vid_capfunction dcmipp_bytecap_s_fmt_vid_capfunction dcmipp_bytecap_enum_fmt_vid_capfunction dcmipp_bytecap_enum_framesizesfunction dcmipp_start_capturefunction dcmipp_bytecap_all_buffers_donefunction list_for_each_entry_safefunction dcmipp_bytecap_start_streamingfunction dcmipp_dump_statusfunction dcmipp_bytecap_stop_streamingfunction dcmipp_bytecap_buf_preparefunction dcmipp_bytecap_buf_queuefunction dcmipp_bytecap_queue_setupfunction dcmipp_bytecap_buf_initfunction dcmipp_bytecap_releasefunction dcmipp_bytecap_ent_releasefunction dcmipp_buffer_donefunction dcmipp_bytecap_set_next_frame_or_stopfunction dcmipp_bytecap_process_framefunction dcmipp_bytecap_irq_threadfunction dcmipp_bytecap_irq_callbackfunction dcmipp_bytecap_link_validate
Annotated Snippet
struct dcmipp_bytecap_pix_map {
unsigned int code;
u32 pixelformat;
};
#define PIXMAP_MBUS_PFMT(mbus, fmt) \
{ \
.code = MEDIA_BUS_FMT_##mbus, \
.pixelformat = V4L2_PIX_FMT_##fmt \
}
static const struct dcmipp_bytecap_pix_map dcmipp_bytecap_pix_map_list[] = {
PIXMAP_MBUS_PFMT(RGB565_2X8_LE, RGB565),
PIXMAP_MBUS_PFMT(RGB565_1X16, RGB565),
PIXMAP_MBUS_PFMT(RGB888_1X24, RGB24),
PIXMAP_MBUS_PFMT(YUYV8_2X8, YUYV),
PIXMAP_MBUS_PFMT(YUYV8_1X16, YUYV),
PIXMAP_MBUS_PFMT(YVYU8_2X8, YVYU),
PIXMAP_MBUS_PFMT(YVYU8_1X16, YVYU),
PIXMAP_MBUS_PFMT(UYVY8_2X8, UYVY),
PIXMAP_MBUS_PFMT(UYVY8_1X16, UYVY),
PIXMAP_MBUS_PFMT(VYUY8_2X8, VYUY),
PIXMAP_MBUS_PFMT(VYUY8_1X16, VYUY),
PIXMAP_MBUS_PFMT(Y8_1X8, GREY),
PIXMAP_MBUS_PFMT(Y10_1X10, Y10),
PIXMAP_MBUS_PFMT(Y12_1X12, Y12),
PIXMAP_MBUS_PFMT(Y14_1X14, Y14),
PIXMAP_MBUS_PFMT(SBGGR8_1X8, SBGGR8),
PIXMAP_MBUS_PFMT(SGBRG8_1X8, SGBRG8),
PIXMAP_MBUS_PFMT(SGRBG8_1X8, SGRBG8),
PIXMAP_MBUS_PFMT(SRGGB8_1X8, SRGGB8),
PIXMAP_MBUS_PFMT(SBGGR10_1X10, SBGGR10),
PIXMAP_MBUS_PFMT(SGBRG10_1X10, SGBRG10),
PIXMAP_MBUS_PFMT(SGRBG10_1X10, SGRBG10),
PIXMAP_MBUS_PFMT(SRGGB10_1X10, SRGGB10),
PIXMAP_MBUS_PFMT(SBGGR12_1X12, SBGGR12),
PIXMAP_MBUS_PFMT(SGBRG12_1X12, SGBRG12),
PIXMAP_MBUS_PFMT(SGRBG12_1X12, SGRBG12),
PIXMAP_MBUS_PFMT(SRGGB12_1X12, SRGGB12),
PIXMAP_MBUS_PFMT(SBGGR14_1X14, SBGGR14),
PIXMAP_MBUS_PFMT(SGBRG14_1X14, SGBRG14),
PIXMAP_MBUS_PFMT(SGRBG14_1X14, SGRBG14),
PIXMAP_MBUS_PFMT(SRGGB14_1X14, SRGGB14),
PIXMAP_MBUS_PFMT(JPEG_1X8, JPEG),
};
static const struct dcmipp_bytecap_pix_map *
dcmipp_bytecap_pix_map_by_pixelformat(u32 pixelformat)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(dcmipp_bytecap_pix_map_list); i++) {
if (dcmipp_bytecap_pix_map_list[i].pixelformat == pixelformat)
return &dcmipp_bytecap_pix_map_list[i];
}
return NULL;
}
struct dcmipp_buf {
struct vb2_v4l2_buffer vb;
bool prepared;
dma_addr_t addr;
size_t size;
struct list_head list;
};
enum dcmipp_state {
DCMIPP_STOPPED = 0,
DCMIPP_WAIT_FOR_BUFFER,
DCMIPP_RUNNING,
};
struct dcmipp_bytecap_device {
struct dcmipp_ent_device ved;
struct video_device vdev;
struct device *dev;
struct v4l2_pix_format format;
struct vb2_queue queue;
struct list_head buffers;
/*
* Protects concurrent calls of buf queue / irq handler
* and buffer handling related variables / lists
*/
spinlock_t irqlock;
/* mutex used as vdev and queue lock */
struct mutex lock;
u32 sequence;
struct media_pipeline pipe;
struct v4l2_subdev *s_subdev;
Annotation
- Immediate include surface: `linux/iopoll.h`, `linux/pm_runtime.h`, `media/v4l2-ioctl.h`, `media/v4l2-mc.h`, `media/videobuf2-core.h`, `media/videobuf2-dma-contig.h`, `dcmipp-common.h`.
- Detected declarations: `struct dcmipp_bytecap_pix_map`, `struct dcmipp_buf`, `struct dcmipp_bytecap_device`, `enum dcmipp_state`, `function dcmipp_bytecap_pix_map_by_pixelformat`, `function dcmipp_bytecap_querycap`, `function dcmipp_bytecap_g_fmt_vid_cap`, `function dcmipp_bytecap_try_fmt_vid_cap`, `function dcmipp_bytecap_s_fmt_vid_cap`, `function dcmipp_bytecap_enum_fmt_vid_cap`.
- 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.