drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/raspberrypi/rp1-cfe/cfe.c- Extension
.c- Size
- 64097 bytes
- Lines
- 2507
- 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/clk.hlinux/debugfs.hlinux/delay.hlinux/device.hlinux/dma-mapping.hlinux/err.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/lcm.hlinux/math.hlinux/module.hlinux/platform_device.hlinux/pm_runtime.hlinux/property.hlinux/seq_file.hlinux/slab.hlinux/uaccess.hlinux/videodev2.hmedia/v4l2-async.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-dev.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-ioctl.hmedia/v4l2-mc.hmedia/videobuf2-dma-contig.hlinux/media/raspberrypi/pisp_fe_config.hlinux/media/raspberrypi/pisp_fe_statistics.hcfe-fmts.h
Detected Declarations
struct node_descriptionstruct cfe_bufferstruct cfe_config_bufferstruct cfe_nodestruct cfe_deviceenum node_idsfunction is_fe_enabledfunction cfg_reg_readfunction cfg_reg_writefunction check_statefunction for_each_set_bitfunction set_statefunction clear_statefunction test_any_nodefunction test_all_nodesfunction mipi_cfg_regs_showfunction cfe_find_16bit_codefunction cfe_find_compressed_codefunction cfe_calc_vid_format_size_bplfunction cfe_calc_meta_format_size_bplfunction cfe_schedule_next_csi2_jobfunction cfe_schedule_next_pisp_jobfunction cfe_check_job_readyfunction cfe_prepare_next_jobfunction cfe_process_buffer_completefunction cfe_queue_event_soffunction cfe_sof_isrfunction cfe_eof_isrfunction cfe_isrfunction cfe_get_vc_dt_fallbackfunction cfe_get_vc_dtfunction cfe_start_channelfunction cfe_stop_channelfunction cfe_return_buffersfunction cfe_queue_setupfunction cfe_buffer_preparefunction cfe_buffer_queuefunction cfe_get_source_link_freqfunction v4l2_get_link_freqfunction cfe_start_streamingfunction cfe_stop_streamingfunction cfe_querycapfunction cfe_enum_fmt_vid_capfunction cfe_g_fmtfunction cfe_validate_fmt_vid_capfunction cfe_s_fmt_vid_capfunction cfe_try_fmt_vid_capfunction cfe_enum_fmt_meta
Annotated Snippet
struct node_description {
enum node_ids id;
const char *name;
unsigned int caps;
unsigned int pad_flags;
unsigned int link_pad;
};
/* Must match the ordering of enum ids */
static const struct node_description node_desc[NUM_NODES] = {
[CSI2_CH0] = {
.name = "csi2-ch0",
.caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_META_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = CSI2_PAD_FIRST_SOURCE + 0
},
/*
* At the moment the main userspace component (libcamera) doesn't
* support metadata with video nodes that support both video and
* metadata. So for the time being this node is set to only support
* V4L2_CAP_META_CAPTURE.
*/
[CSI2_CH1] = {
.name = "csi2-ch1",
.caps = V4L2_CAP_META_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = CSI2_PAD_FIRST_SOURCE + 1
},
[CSI2_CH2] = {
.name = "csi2-ch2",
.caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_META_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = CSI2_PAD_FIRST_SOURCE + 2
},
[CSI2_CH3] = {
.name = "csi2-ch3",
.caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_META_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = CSI2_PAD_FIRST_SOURCE + 3
},
[FE_OUT0] = {
.name = "fe-image0",
.caps = V4L2_CAP_VIDEO_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = FE_OUTPUT0_PAD
},
[FE_OUT1] = {
.name = "fe-image1",
.caps = V4L2_CAP_VIDEO_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = FE_OUTPUT1_PAD
},
[FE_STATS] = {
.name = "fe-stats",
.caps = V4L2_CAP_META_CAPTURE,
.pad_flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = FE_STATS_PAD
},
[FE_CONFIG] = {
.name = "fe-config",
.caps = V4L2_CAP_META_OUTPUT,
.pad_flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT,
.link_pad = FE_CONFIG_PAD
},
};
#define is_fe_node(node) (((node)->id) >= FE_OUT0)
#define is_csi2_node(node) (!is_fe_node(node))
#define node_supports_image_output(node) \
(node_desc[(node)->id].caps & V4L2_CAP_VIDEO_CAPTURE)
#define node_supports_meta_output(node) \
(node_desc[(node)->id].caps & V4L2_CAP_META_CAPTURE)
#define node_supports_image_input(node) \
(node_desc[(node)->id].caps & V4L2_CAP_VIDEO_OUTPUT)
#define node_supports_meta_input(node) \
(node_desc[(node)->id].caps & V4L2_CAP_META_OUTPUT)
#define node_supports_image(node) \
(node_supports_image_output(node) || node_supports_image_input(node))
#define node_supports_meta(node) \
(node_supports_meta_output(node) || node_supports_meta_input(node))
#define is_image_output_node(node) \
((node)->buffer_queue.type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
#define is_image_input_node(node) \
((node)->buffer_queue.type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
#define is_image_node(node) \
(is_image_output_node(node) || is_image_input_node(node))
#define is_meta_output_node(node) \
((node)->buffer_queue.type == V4L2_BUF_TYPE_META_CAPTURE)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/init.h`, `linux/interrupt.h`.
- Detected declarations: `struct node_description`, `struct cfe_buffer`, `struct cfe_config_buffer`, `struct cfe_node`, `struct cfe_device`, `enum node_ids`, `function is_fe_enabled`, `function cfg_reg_read`, `function cfg_reg_write`, `function check_state`.
- 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.