drivers/media/test-drivers/vimc/vimc-debayer.c
Source file repositories/reference/linux-study-clean/drivers/media/test-drivers/vimc/vimc-debayer.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/test-drivers/vimc/vimc-debayer.c- Extension
.c- Size
- 16552 bytes
- Lines
- 613
- 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.
- 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/moduleparam.hlinux/platform_device.hlinux/vmalloc.hlinux/v4l2-mediabus.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-subdev.hvimc-common.h
Detected Declarations
struct vimc_debayer_pix_mapstruct vimc_debayer_deviceenum vimc_debayer_rgb_colorsfunction vimc_debayer_src_code_is_validfunction vimc_debayer_init_statefunction vimc_debayer_enum_mbus_codefunction vimc_debayer_enum_frame_sizefunction vimc_debayer_adjust_sink_fmtfunction vimc_debayer_set_fmtfunction vimc_debayer_process_rgb_framefunction vimc_debayer_s_streamfunction vimc_debayer_get_valfunction vimc_debayer_calc_rgb_sinkfunction vimc_debayer_s_ctrlfunction vimc_debayer_release
Annotated Snippet
struct vimc_debayer_pix_map {
u32 code;
enum vimc_debayer_rgb_colors order[2][2];
};
struct vimc_debayer_device {
struct vimc_ent_device ved;
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
struct media_pad pads[2];
u8 *src_frame;
void (*set_rgb_src)(struct vimc_debayer_device *vdebayer,
unsigned int lin, unsigned int col,
unsigned int rgb[3]);
/*
* Virtual "hardware" configuration, filled when the stream starts or
* when controls are set.
*/
struct {
const struct vimc_debayer_pix_map *sink_pix_map;
unsigned int sink_bpp;
struct v4l2_area size;
unsigned int mean_win_size;
u32 src_code;
} hw;
};
static const struct v4l2_mbus_framefmt sink_fmt_default = {
.width = 640,
.height = 480,
.code = MEDIA_BUS_FMT_SRGGB8_1X8,
.field = V4L2_FIELD_NONE,
.colorspace = V4L2_COLORSPACE_SRGB,
};
static const u32 vimc_debayer_src_mbus_codes[] = {
MEDIA_BUS_FMT_GBR888_1X24,
MEDIA_BUS_FMT_BGR888_1X24,
MEDIA_BUS_FMT_BGR888_3X8,
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_RGB888_2X12_BE,
MEDIA_BUS_FMT_RGB888_2X12_LE,
MEDIA_BUS_FMT_RGB888_3X8,
MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
MEDIA_BUS_FMT_RGB888_1X32_PADHI,
};
static const struct vimc_debayer_pix_map vimc_debayer_pix_map_list[] = {
{
.code = MEDIA_BUS_FMT_SBGGR8_1X8,
.order = { { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN },
{ VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED } }
},
{
.code = MEDIA_BUS_FMT_SGBRG8_1X8,
.order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE },
{ VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN } }
},
{
.code = MEDIA_BUS_FMT_SGRBG8_1X8,
.order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED },
{ VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN } }
},
{
.code = MEDIA_BUS_FMT_SRGGB8_1X8,
.order = { { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN },
{ VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE } }
},
{
.code = MEDIA_BUS_FMT_SBGGR10_1X10,
.order = { { VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN },
{ VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED } }
},
{
.code = MEDIA_BUS_FMT_SGBRG10_1X10,
.order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_BLUE },
{ VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN } }
},
{
.code = MEDIA_BUS_FMT_SGRBG10_1X10,
.order = { { VIMC_DEBAYER_GREEN, VIMC_DEBAYER_RED },
{ VIMC_DEBAYER_BLUE, VIMC_DEBAYER_GREEN } }
},
{
.code = MEDIA_BUS_FMT_SRGGB10_1X10,
.order = { { VIMC_DEBAYER_RED, VIMC_DEBAYER_GREEN },
Annotation
- Immediate include surface: `linux/moduleparam.h`, `linux/platform_device.h`, `linux/vmalloc.h`, `linux/v4l2-mediabus.h`, `media/v4l2-ctrls.h`, `media/v4l2-event.h`, `media/v4l2-subdev.h`, `vimc-common.h`.
- Detected declarations: `struct vimc_debayer_pix_map`, `struct vimc_debayer_device`, `enum vimc_debayer_rgb_colors`, `function vimc_debayer_src_code_is_valid`, `function vimc_debayer_init_state`, `function vimc_debayer_enum_mbus_code`, `function vimc_debayer_enum_frame_size`, `function vimc_debayer_adjust_sink_fmt`, `function vimc_debayer_set_fmt`, `function vimc_debayer_process_rgb_frame`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.