drivers/media/i2c/ov772x.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov772x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov772x.c- Extension
.c- Size
- 45888 bytes
- Lines
- 1576
- 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.
- 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/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/kernel.hlinux/module.hlinux/regmap.hlinux/slab.hlinux/v4l2-mediabus.hlinux/videodev2.hmedia/i2c/ov772x.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-image-sizes.hmedia/v4l2-subdev.h
Detected Declarations
struct ov772x_color_formatstruct ov772x_win_sizestruct ov772x_privfunction ov772x_resetfunction ov772x_s_streamfunction ov772x_select_fpsfunction ov772x_set_frame_ratefunction ov772x_get_frame_intervalfunction ov772x_set_frame_intervalfunction ov772x_s_ctrlfunction ov772x_g_registerfunction ov772x_s_registerfunction ov772x_power_onfunction ov772x_power_offfunction ov772x_s_powerfunction ov772x_select_paramsfunction ov772x_edgectrlfunction ov772x_set_paramsfunction ov772x_get_selectionfunction ov772x_get_fmtfunction ov772x_set_fmtfunction ov772x_video_probefunction ov772x_enum_frame_intervalfunction ov772x_enum_mbus_codefunction ov772x_parse_dtfunction ov772x_probefunction ov772x_remove
Annotated Snippet
struct ov772x_color_format {
u32 code;
enum v4l2_colorspace colorspace;
u8 dsp3;
u8 dsp4;
u8 com3;
u8 com7;
};
struct ov772x_win_size {
char *name;
unsigned char com7_bit;
unsigned int sizeimage;
struct v4l2_rect rect;
};
struct ov772x_priv {
struct v4l2_subdev subdev;
struct v4l2_ctrl_handler hdl;
struct clk *clk;
struct regmap *regmap;
struct ov772x_camera_info *info;
struct gpio_desc *pwdn_gpio;
struct gpio_desc *rstb_gpio;
const struct ov772x_color_format *cfmt;
const struct ov772x_win_size *win;
struct v4l2_ctrl *vflip_ctrl;
struct v4l2_ctrl *hflip_ctrl;
unsigned int test_pattern;
/* band_filter = COM8[5] ? 256 - BDBASE : 0 */
struct v4l2_ctrl *band_filter_ctrl;
unsigned int fps;
/* lock to protect power_count and streaming */
struct mutex lock;
int power_count;
int streaming;
struct media_pad pad;
enum v4l2_mbus_type bus_type;
};
/*
* supported color format list
*/
static const struct ov772x_color_format ov772x_cfmts[] = {
{
.code = MEDIA_BUS_FMT_YUYV8_2X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = 0x0,
.dsp4 = DSP_OFMT_YUV,
.com3 = SWAP_YUV,
.com7 = OFMT_YUV,
},
{
.code = MEDIA_BUS_FMT_YVYU8_2X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = UV_ON,
.dsp4 = DSP_OFMT_YUV,
.com3 = SWAP_YUV,
.com7 = OFMT_YUV,
},
{
.code = MEDIA_BUS_FMT_UYVY8_2X8,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = 0x0,
.dsp4 = DSP_OFMT_YUV,
.com3 = 0x0,
.com7 = OFMT_YUV,
},
{
.code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = 0x0,
.dsp4 = DSP_OFMT_YUV,
.com3 = SWAP_RGB,
.com7 = FMT_RGB555 | OFMT_RGB,
},
{
.code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = 0x0,
.dsp4 = DSP_OFMT_YUV,
.com3 = 0x0,
.com7 = FMT_RGB555 | OFMT_RGB,
},
{
.code = MEDIA_BUS_FMT_RGB565_2X8_LE,
.colorspace = V4L2_COLORSPACE_SRGB,
.dsp3 = 0x0,
.dsp4 = DSP_OFMT_YUV,
.com3 = SWAP_RGB,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct ov772x_color_format`, `struct ov772x_win_size`, `struct ov772x_priv`, `function ov772x_reset`, `function ov772x_s_stream`, `function ov772x_select_fps`, `function ov772x_set_frame_rate`, `function ov772x_get_frame_interval`, `function ov772x_set_frame_interval`, `function ov772x_s_ctrl`.
- 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.
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.