drivers/media/i2c/imx334.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx334.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx334.c- Extension
.c- Size
- 34116 bytes
- Lines
- 1268
- 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/unaligned.hlinux/clk.hlinux/delay.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct imx334_reg_liststruct imx334_modestruct imx334function to_imx334function imx334_update_controlsfunction imx334_update_exp_gainfunction imx334_set_ctrlfunction imx334_get_format_codefunction imx334_enum_mbus_codefunction imx334_enum_frame_sizefunction imx334_fill_pad_formatfunction imx334_get_pad_formatfunction imx334_set_pad_formatfunction imx334_init_statefunction imx334_set_framefmtfunction imx334_enable_streamsfunction imx334_disable_streamsfunction imx334_detectfunction imx334_parse_hw_configfunction imx334_power_onfunction imx334_power_offfunction imx334_init_controlsfunction imx334_probefunction imx334_remove
Annotated Snippet
struct imx334_reg_list {
u32 num_of_regs;
const struct cci_reg_sequence *regs;
};
/**
* struct imx334_mode - imx334 sensor mode structure
* @width: Frame width
* @height: Frame height
* @hblank: Horizontal blanking in lines
* @vblank: Vertical blanking in lines
* @vblank_min: Minimal vertical blanking in lines
* @vblank_max: Maximum vertical blanking in lines
* @pclk: Sensor pixel clock
* @link_freq_idx: Link frequency index
* @reg_list: Register list for sensor mode
*/
struct imx334_mode {
u32 width;
u32 height;
u32 hblank;
u32 vblank;
u32 vblank_min;
u32 vblank_max;
u64 pclk;
u32 link_freq_idx;
struct imx334_reg_list reg_list;
};
/**
* struct imx334 - imx334 sensor device structure
* @dev: Pointer to generic device
* @cci: CCI register map
* @client: Pointer to i2c client
* @sd: V4L2 sub-device
* @pad: Media pad. Only one pad supported
* @reset_gpio: Sensor reset gpio
* @inclk: Sensor input clock
* @ctrl_handler: V4L2 control handler
* @link_freq_ctrl: Pointer to link frequency control
* @pclk_ctrl: Pointer to pixel clock control
* @hblank_ctrl: Pointer to horizontal blanking control
* @vblank_ctrl: Pointer to vertical blanking control
* @exp_ctrl: Pointer to exposure control
* @again_ctrl: Pointer to analog gain control
* @vblank: Vertical blanking in lines
* @cur_mode: Pointer to current selected sensor mode
* @link_freq_bitmap: Menu bitmap for link_freq_ctrl
* @cur_code: current selected format code
*/
struct imx334 {
struct device *dev;
struct regmap *cci;
struct i2c_client *client;
struct v4l2_subdev sd;
struct media_pad pad;
struct gpio_desc *reset_gpio;
struct clk *inclk;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *link_freq_ctrl;
struct v4l2_ctrl *pclk_ctrl;
struct v4l2_ctrl *hblank_ctrl;
struct v4l2_ctrl *vblank_ctrl;
struct {
struct v4l2_ctrl *exp_ctrl;
struct v4l2_ctrl *again_ctrl;
};
u32 vblank;
const struct imx334_mode *cur_mode;
unsigned long link_freq_bitmap;
u32 cur_code;
};
static const s64 link_freq[] = {
IMX334_LINK_FREQ_891M,
IMX334_LINK_FREQ_445M,
};
/* Sensor common mode registers values */
static const struct cci_reg_sequence common_mode_regs[] = {
{ IMX334_REG_MODE_SELECT, IMX334_MODE_STANDBY },
{ IMX334_REG_WINMODE, 0x04 },
{ IMX334_REG_VMAX, 0x0008ca },
{ IMX334_REG_HMAX, 0x044c },
{ IMX334_REG_BLACK_OFSET_ADR, 0x0000 },
{ IMX334_REG_UNRD_LINE_MAX, 0x0000 },
{ IMX334_REG_OPB_SIZE_V, 0x00 },
{ IMX334_REG_HREVERSE, 0x00 },
{ IMX334_REG_VREVERSE, 0x00 },
{ IMX334_REG_UNREAD_PARAM5, 0x0000 },
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/clk.h`, `linux/delay.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `media/v4l2-cci.h`, `media/v4l2-ctrls.h`.
- Detected declarations: `struct imx334_reg_list`, `struct imx334_mode`, `struct imx334`, `function to_imx334`, `function imx334_update_controls`, `function imx334_update_exp_gain`, `function imx334_set_ctrl`, `function imx334_get_format_code`, `function imx334_enum_mbus_code`, `function imx334_enum_frame_size`.
- 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.