drivers/media/i2c/mt9v032.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/mt9v032.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/mt9v032.c- Extension
.c- Size
- 36669 bytes
- Lines
- 1296
- 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/log2.hlinux/mod_devicetable.hlinux/module.hlinux/mutex.hlinux/of.hlinux/of_graph.hlinux/regmap.hlinux/slab.hlinux/v4l2-mediabus.hlinux/videodev2.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct mt9v032_model_versionstruct mt9v032_model_datastruct mt9v032_model_infostruct mt9v032_platform_datastruct mt9v032enum mt9v032_modelfunction mt9v032_update_aec_agcfunction mt9v032_update_hblankfunction mt9v032_power_onfunction mt9v032_power_offfunction __mt9v032_set_powerfunction __mt9v032_get_pad_formatfunction __mt9v032_get_pad_cropfunction mt9v032_s_streamfunction mt9v032_enum_mbus_codefunction mt9v032_enum_frame_sizefunction mt9v032_get_formatfunction mt9v032_configure_pixel_ratefunction mt9v032_calc_ratiofunction mt9v032_set_formatfunction mt9v032_get_selectionfunction mt9v032_set_selectionfunction mt9v032_s_ctrlfunction mt9v032_set_powerfunction mt9v032_registeredfunction mt9v032_openfunction mt9v032_closefunction mt9v032_get_pdatafunction mt9v032_probefunction mt9v032_remove
Annotated Snippet
struct mt9v032_model_version {
unsigned int version;
const char *name;
};
struct mt9v032_model_data {
unsigned int min_row_time;
unsigned int min_hblank;
unsigned int min_vblank;
unsigned int max_vblank;
unsigned int min_shutter;
unsigned int max_shutter;
unsigned int pclk_reg;
unsigned int aec_max_shutter_reg;
const struct v4l2_ctrl_config * const aec_max_shutter_v4l2_ctrl;
};
struct mt9v032_model_info {
const struct mt9v032_model_data *data;
bool color;
};
static const struct mt9v032_model_version mt9v032_versions[] = {
{ MT9V032_CHIP_ID_REV1, "MT9V022/MT9V032 rev1/2" },
{ MT9V032_CHIP_ID_REV3, "MT9V022/MT9V032 rev3" },
{ MT9V034_CHIP_ID_REV1, "MT9V024/MT9V034 rev1" },
};
struct mt9v032_platform_data {
unsigned int clk_pol:1;
const s64 *link_freqs;
s64 link_def_freq;
};
struct mt9v032 {
struct device *dev;
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_mbus_framefmt format;
struct v4l2_rect crop;
unsigned int hratio;
unsigned int vratio;
struct v4l2_ctrl_handler ctrls;
struct {
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate;
};
struct mutex power_lock;
int power_count;
struct regmap *regmap;
struct clk *clk;
struct gpio_desc *reset_gpio;
struct gpio_desc *standby_gpio;
struct mt9v032_platform_data pdata;
const struct mt9v032_model_info *model;
const struct mt9v032_model_version *version;
u32 sysclk;
u16 aec_agc;
u16 hblank;
struct {
struct v4l2_ctrl *test_pattern;
struct v4l2_ctrl *test_pattern_color;
};
};
static struct mt9v032 *to_mt9v032(struct v4l2_subdev *sd)
{
return container_of(sd, struct mt9v032, subdev);
}
static int
mt9v032_update_aec_agc(struct mt9v032 *mt9v032, u16 which, int enable)
{
struct regmap *map = mt9v032->regmap;
u16 value = mt9v032->aec_agc;
int ret;
if (enable)
value |= which;
else
value &= ~which;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/log2.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/mutex.h`.
- Detected declarations: `struct mt9v032_model_version`, `struct mt9v032_model_data`, `struct mt9v032_model_info`, `struct mt9v032_platform_data`, `struct mt9v032`, `enum mt9v032_model`, `function mt9v032_update_aec_agc`, `function mt9v032_update_hblank`, `function mt9v032_power_on`, `function mt9v032_power_off`.
- 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.