drivers/media/i2c/max9286.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/max9286.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/max9286.c- Extension
.c- Size
- 43214 bytes
- Lines
- 1685
- 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/delay.hlinux/device.hlinux/fwnode.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/gpio/machine.hlinux/i2c.hlinux/i2c-mux.hlinux/module.hlinux/of_graph.hlinux/regulator/consumer.hlinux/slab.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct max9286_format_infostruct max9286_i2c_speedstruct max9286_sourcestruct max9286_asdstruct max9286_privfunction to_max9286_asdfunction max9286_readfunction max9286_writefunction max9286_i2c_mux_configurefunction max9286_i2c_mux_openfunction max9286_i2c_mux_closefunction max9286_i2c_mux_selectfunction max9286_i2c_mux_initfunction for_each_sourcefunction max9286_configure_i2cfunction max9286_reverse_channel_setupfunction max9286_check_video_linksfunction max9286_check_config_linkfunction max9286_set_video_formatfunction max9286_set_fsync_periodfunction max9286_set_pixelratefunction for_each_sourcefunction max9286_notify_boundfunction max9286_notify_unbindfunction max9286_v4l2_notifier_registerfunction for_each_sourcefunction max9286_v4l2_notifier_unregisterfunction max9286_s_streamfunction for_each_sourcefunction max9286_get_frame_intervalfunction max9286_set_frame_intervalfunction max9286_enum_mbus_codefunction max9286_set_fmtfunction max9286_init_statefunction max9286_s_ctrlfunction max9286_v4l2_registerfunction max9286_v4l2_unregisterfunction max9286_setupfunction max9286_gpio_setfunction max9286_gpiochip_setfunction max9286_gpiochip_getfunction max9286_register_gpiofunction max9286_parse_gpiosfunction max9286_poc_power_onfunction max9286_poc_power_offfunction for_each_sourcefunction max9286_poc_enablefunction max9286_init
Annotated Snippet
struct max9286_format_info {
u32 code;
u8 datatype;
};
struct max9286_i2c_speed {
u32 rate;
u8 mstbt;
};
struct max9286_source {
struct v4l2_subdev *sd;
struct fwnode_handle *fwnode;
struct regulator *regulator;
};
struct max9286_asd {
struct v4l2_async_connection base;
struct max9286_source *source;
};
static inline struct max9286_asd *
to_max9286_asd(struct v4l2_async_connection *asd)
{
return container_of(asd, struct max9286_asd, base);
}
struct max9286_priv {
struct i2c_client *client;
struct gpio_desc *gpiod_pwdn;
struct v4l2_subdev sd;
struct media_pad pads[MAX9286_N_PADS];
struct regulator *regulator;
struct gpio_chip gpio;
u8 gpio_state;
struct i2c_mux_core *mux;
unsigned int mux_channel;
bool mux_open;
/* The initial reverse control channel amplitude. */
u32 init_rev_chan_mv;
u32 rev_chan_mv;
u8 i2c_mstbt;
u32 bus_width;
bool use_gpio_poc;
u32 gpio_poc[2];
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *pixelrate_ctrl;
unsigned int pixelrate;
unsigned int nsources;
unsigned int source_mask;
unsigned int route_mask;
unsigned int bound_sources;
unsigned int csi2_data_lanes;
struct max9286_source sources[MAX9286_NUM_GMSL];
struct v4l2_async_notifier notifier;
};
static struct max9286_source *next_source(struct max9286_priv *priv,
struct max9286_source *source)
{
if (!source)
source = &priv->sources[0];
else
source++;
for (; source < &priv->sources[MAX9286_NUM_GMSL]; source++) {
if (source->fwnode)
return source;
}
return NULL;
}
#define for_each_source(priv, source) \
for ((source) = NULL; ((source) = next_source((priv), (source))); )
#define to_index(priv, source) ((source) - &(priv)->sources[0])
static inline struct max9286_priv *sd_to_max9286(struct v4l2_subdev *sd)
{
return container_of(sd, struct max9286_priv, sd);
}
static const struct max9286_format_info max9286_formats[] = {
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/fwnode.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`, `linux/gpio/machine.h`, `linux/i2c.h`, `linux/i2c-mux.h`.
- Detected declarations: `struct max9286_format_info`, `struct max9286_i2c_speed`, `struct max9286_source`, `struct max9286_asd`, `struct max9286_priv`, `function to_max9286_asd`, `function max9286_read`, `function max9286_write`, `function max9286_i2c_mux_configure`, `function max9286_i2c_mux_open`.
- 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.