drivers/media/i2c/max96714.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/max96714.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/max96714.c- Extension
.c- Size
- 26495 bytes
- Lines
- 1018
- 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/bitfield.hlinux/bitops.hlinux/gpio/consumer.hlinux/i2c.hlinux/i2c-mux.hlinux/module.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct max96714_rxportstruct max96714_txportstruct max96714_privenum max96714_vpg_modefunction max96714_enable_tx_portfunction max96714_disable_tx_portfunction max96714_tx_port_enabledfunction max96714_apply_patgen_timingfunction max96714_apply_patgenfunction max96714_s_ctrlfunction max96714_enable_streamsfunction max96714_disable_streamsfunction max96714_set_fmtfunction _max96714_set_routingfunction max96714_set_routingfunction max96714_init_statefunction max96714_link_lockedfunction max96714_link_statusfunction max96714_pipe_lockedfunction max96714_pipe_statusfunction max96714_csi_statusfunction max96714_log_statusfunction max96714_notify_boundfunction max96714_v4l2_notifier_registerfunction max96714_create_subdevfunction max96714_destroy_subdevfunction max96714_i2c_mux_selectfunction max96714_i2c_mux_initfunction max96714_init_tx_portfunction max96714_rxport_enable_pocfunction max96714_rxport_disable_pocfunction max96714_parse_dt_txportfunction max96714_parse_dt_rxportfunction max96714_parse_dtfunction max96714_enable_core_hwfunction max96714_disable_core_hwfunction max96714_get_hw_resourcesfunction max96714_probefunction max96714_remove
Annotated Snippet
struct max96714_rxport {
struct {
struct v4l2_subdev *sd;
u16 pad;
struct fwnode_handle *ep_fwnode;
} source;
struct regulator *poc;
};
struct max96714_txport {
struct v4l2_fwnode_endpoint vep;
};
struct max96714_priv {
struct i2c_client *client;
struct regmap *regmap;
struct gpio_desc *pd_gpio;
struct max96714_rxport rxport;
struct i2c_mux_core *mux;
u64 enabled_source_streams;
struct v4l2_subdev sd;
struct media_pad pads[MAX96714_NPORTS];
struct v4l2_mbus_config_mipi_csi2 mipi_csi2;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
s64 tx_link_freq;
enum max96714_vpg_mode pattern;
};
static inline struct max96714_priv *sd_to_max96714(struct v4l2_subdev *sd)
{
return container_of(sd, struct max96714_priv, sd);
}
static int max96714_enable_tx_port(struct max96714_priv *priv)
{
return cci_update_bits(priv->regmap, MAX96714_MIPI_STDBY_N,
MAX96714_MIPI_STDBY_MASK,
MAX96714_MIPI_STDBY_MASK, NULL);
}
static int max96714_disable_tx_port(struct max96714_priv *priv)
{
return cci_update_bits(priv->regmap, MAX96714_MIPI_STDBY_N,
MAX96714_MIPI_STDBY_MASK, 0, NULL);
}
static bool max96714_tx_port_enabled(struct max96714_priv *priv)
{
u64 val;
cci_read(priv->regmap, MAX96714_MIPI_STDBY_N, &val, NULL);
return val & MAX96714_MIPI_STDBY_MASK;
}
static int max96714_apply_patgen_timing(struct max96714_priv *priv,
struct v4l2_subdev_state *state)
{
struct v4l2_mbus_framefmt *fmt =
v4l2_subdev_state_get_format(state, MAX96714_PAD_SOURCE);
const u32 h_active = fmt->width;
const u32 h_fp = 88;
const u32 h_sw = 44;
const u32 h_bp = 148;
u32 h_tot;
const u32 v_active = fmt->height;
const u32 v_fp = 4;
const u32 v_sw = 5;
const u32 v_bp = 36;
u32 v_tot;
int ret = 0;
h_tot = h_active + h_fp + h_sw + h_bp;
v_tot = v_active + v_fp + v_sw + v_bp;
/* 75 Mhz pixel clock */
cci_update_bits(priv->regmap, MAX96714_IO_CHK0,
MAX96714_PATTERN_CLK_FREQ, 1, &ret);
dev_info(&priv->client->dev, "height: %d width: %d\n", fmt->height,
fmt->width);
cci_write(priv->regmap, MAX96714_PATGEN_VS_DLY, 0, &ret);
cci_write(priv->regmap, MAX96714_PATGEN_VS_HIGH, v_sw * h_tot, &ret);
cci_write(priv->regmap, MAX96714_PATGEN_VS_LOW,
(v_active + v_fp + v_bp) * h_tot, &ret);
cci_write(priv->regmap, MAX96714_PATGEN_HS_HIGH, h_sw, &ret);
cci_write(priv->regmap, MAX96714_PATGEN_HS_LOW, h_active + h_fp + h_bp,
&ret);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/i2c-mux.h`, `linux/module.h`, `linux/property.h`, `linux/regmap.h`.
- Detected declarations: `struct max96714_rxport`, `struct max96714_txport`, `struct max96714_priv`, `enum max96714_vpg_mode`, `function max96714_enable_tx_port`, `function max96714_disable_tx_port`, `function max96714_tx_port_enabled`, `function max96714_apply_patgen_timing`, `function max96714_apply_patgen`, `function max96714_s_ctrl`.
- 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.