drivers/media/platform/ti/am437x/am437x-vpfe.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/am437x/am437x-vpfe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/am437x/am437x-vpfe.c- Extension
.c- Size
- 69802 bytes
- Lines
- 2632
- 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 user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/delay.hlinux/err.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/of_graph.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hlinux/uaccess.hlinux/videodev2.hmedia/v4l2-common.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-rect.ham437x-vpfe.h
Detected Declarations
struct vpfe_standardfunction __get_bytesperpixelfunction vpfe_reg_readfunction vpfe_reg_writefunction vpfe_pcr_enablefunction vpfe_config_enablefunction vpfe_ccdc_setwinfunction vpfe_reg_dumpfunction vpfe_ccdc_validate_paramfunction vpfe_ccdc_update_raw_paramsfunction vpfe_ccdc_restore_defaultsfunction vpfe_ccdc_closefunction vpfe_ccdc_set_paramsfunction vpfe_ccdc_config_ycbcrfunction vpfe_ccdc_config_black_clampfunction vpfe_ccdc_config_black_compensefunction vpfe_ccdc_config_rawfunction vpfe_ccdc_set_buftypefunction vpfe_ccdc_get_buftypefunction vpfe_ccdc_set_pixel_formatfunction vpfe_ccdc_get_pixel_formatfunction vpfe_ccdc_set_image_windowfunction vpfe_ccdc_get_image_windowfunction vpfe_ccdc_get_line_lengthfunction vpfe_ccdc_set_frame_formatfunction vpfe_ccdc_get_frame_formatfunction vpfe_ccdc_getfidfunction vpfe_set_sdr_addrfunction vpfe_ccdc_set_hw_if_paramsfunction vpfe_clear_intrfunction vpfe_ccdc_config_defaultsfunction vpfe_get_ccdc_image_formatfunction vpfe_config_ccdc_image_formatfunction vpfe_config_image_formatfunction vpfe_initialize_devicefunction vpfe_releasefunction vpfe_openfunction vpfe_schedule_next_bufferfunction vpfe_schedule_bottom_fieldfunction vpfe_process_buffer_completefunction vpfe_handle_interlaced_irqfunction vpfe_isrfunction vpfe_detach_irqfunction vpfe_attach_irqfunction vpfe_querycapfunction __subdev_get_formatfunction __subdev_set_formatfunction vpfe_calc_format_size
Annotated Snippet
struct vpfe_standard {
v4l2_std_id std_id;
unsigned int width;
unsigned int height;
struct v4l2_fract pixelaspect;
int frame_format;
};
static const struct vpfe_standard vpfe_standards[] = {
{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
};
static struct vpfe_fmt formats[VPFE_NUM_FORMATS] = {
{
.fourcc = V4L2_PIX_FMT_YUYV,
.code = MEDIA_BUS_FMT_YUYV8_2X8,
.bitsperpixel = 16,
}, {
.fourcc = V4L2_PIX_FMT_UYVY,
.code = MEDIA_BUS_FMT_UYVY8_2X8,
.bitsperpixel = 16,
}, {
.fourcc = V4L2_PIX_FMT_YVYU,
.code = MEDIA_BUS_FMT_YVYU8_2X8,
.bitsperpixel = 16,
}, {
.fourcc = V4L2_PIX_FMT_VYUY,
.code = MEDIA_BUS_FMT_VYUY8_2X8,
.bitsperpixel = 16,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR8,
.code = MEDIA_BUS_FMT_SBGGR8_1X8,
.bitsperpixel = 8,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG8,
.code = MEDIA_BUS_FMT_SGBRG8_1X8,
.bitsperpixel = 8,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG8,
.code = MEDIA_BUS_FMT_SGRBG8_1X8,
.bitsperpixel = 8,
}, {
.fourcc = V4L2_PIX_FMT_SRGGB8,
.code = MEDIA_BUS_FMT_SRGGB8_1X8,
.bitsperpixel = 8,
}, {
.fourcc = V4L2_PIX_FMT_RGB565,
.code = MEDIA_BUS_FMT_RGB565_2X8_LE,
.bitsperpixel = 16,
}, {
.fourcc = V4L2_PIX_FMT_RGB565X,
.code = MEDIA_BUS_FMT_RGB565_2X8_BE,
.bitsperpixel = 16,
},
};
static int __subdev_get_format(struct vpfe_device *vpfe,
struct v4l2_mbus_framefmt *fmt);
static int vpfe_calc_format_size(struct vpfe_device *vpfe,
const struct vpfe_fmt *fmt,
struct v4l2_format *f);
static struct vpfe_fmt *find_format_by_code(struct vpfe_device *vpfe,
unsigned int code)
{
struct vpfe_fmt *fmt;
unsigned int k;
for (k = 0; k < vpfe->num_active_fmt; k++) {
fmt = vpfe->active_fmt[k];
if (fmt->code == code)
return fmt;
}
return NULL;
}
static struct vpfe_fmt *find_format_by_pix(struct vpfe_device *vpfe,
unsigned int pixelformat)
{
struct vpfe_fmt *fmt;
unsigned int k;
for (k = 0; k < vpfe->num_active_fmt; k++) {
fmt = vpfe->active_fmt[k];
if (fmt->fourcc == pixelformat)
return fmt;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/of_graph.h`, `linux/pinctrl/consumer.h`.
- Detected declarations: `struct vpfe_standard`, `function __get_bytesperpixel`, `function vpfe_reg_read`, `function vpfe_reg_write`, `function vpfe_pcr_enable`, `function vpfe_config_enable`, `function vpfe_ccdc_setwin`, `function vpfe_reg_dump`, `function vpfe_ccdc_validate_param`, `function vpfe_ccdc_update_raw_params`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.