drivers/media/i2c/adv748x/adv748x-core.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/adv748x/adv748x-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/adv748x/adv748x-core.c- Extension
.c- Size
- 23053 bytes
- Lines
- 859
- 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/errno.hlinux/i2c.hlinux/module.hlinux/mutex.hlinux/of_graph.hlinux/regmap.hlinux/slab.hlinux/v4l2-dv-timings.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-dv-timings.hmedia/v4l2-fwnode.hmedia/v4l2-ioctl.hadv748x.h
Detected Declarations
struct adv748x_register_mapstruct adv748x_reg_valuefunction adv748x_configure_regmapfunction adv748x_read_checkfunction adv748x_readfunction adv748x_writefunction adv748x_write_checkfunction adv748x_write_blockfunction adv748x_set_slave_addressesfunction adv748x_unregister_clientsfunction adv748x_initialise_clientsfunction adv748x_write_regsfunction adv748x_power_up_txfunction adv748x_power_down_txfunction adv748x_tx_powerfunction adv748x_link_setupfunction adv748x_sw_resetfunction adv748x_resetfunction adv748x_identify_chipfunction adv748x_resume_earlyfunction adv748x_subdev_initfunction adv748x_parse_csi2_lanesfunction adv748x_parse_dtfunction for_each_endpoint_of_nodefunction adv748x_dt_cleanupfunction adv748x_probefunction adv748x_remove
Annotated Snippet
struct adv748x_register_map {
const char *name;
u8 default_addr;
};
static const struct adv748x_register_map adv748x_default_addresses[] = {
[ADV748X_PAGE_IO] = { "main", 0x70 },
[ADV748X_PAGE_DPLL] = { "dpll", 0x26 },
[ADV748X_PAGE_CP] = { "cp", 0x22 },
[ADV748X_PAGE_HDMI] = { "hdmi", 0x34 },
[ADV748X_PAGE_EDID] = { "edid", 0x36 },
[ADV748X_PAGE_REPEATER] = { "repeater", 0x32 },
[ADV748X_PAGE_INFOFRAME] = { "infoframe", 0x31 },
[ADV748X_PAGE_CBUS] = { "cbus", 0x30 },
[ADV748X_PAGE_CEC] = { "cec", 0x41 },
[ADV748X_PAGE_SDP] = { "sdp", 0x79 },
[ADV748X_PAGE_TXB] = { "txb", 0x48 },
[ADV748X_PAGE_TXA] = { "txa", 0x4a },
};
static int adv748x_read_check(struct adv748x_state *state,
int client_page, u8 reg)
{
struct i2c_client *client = state->i2c_clients[client_page];
int err;
unsigned int val;
err = regmap_read(state->regmap[client_page], reg, &val);
if (err) {
adv_err(state, "error reading %02x, %02x\n",
client->addr, reg);
return err;
}
return val;
}
int adv748x_read(struct adv748x_state *state, u8 page, u8 reg)
{
return adv748x_read_check(state, page, reg);
}
int adv748x_write(struct adv748x_state *state, u8 page, u8 reg, u8 value)
{
return regmap_write(state->regmap[page], reg, value);
}
static int adv748x_write_check(struct adv748x_state *state, u8 page, u8 reg,
u8 value, int *error)
{
if (*error)
return *error;
*error = adv748x_write(state, page, reg, value);
return *error;
}
/* adv748x_write_block(): Write raw data with a maximum of I2C_SMBUS_BLOCK_MAX
* size to one or more registers.
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int adv748x_write_block(struct adv748x_state *state, int client_page,
unsigned int init_reg, const void *val,
size_t val_len)
{
struct regmap *regmap = state->regmap[client_page];
if (val_len > I2C_SMBUS_BLOCK_MAX)
val_len = I2C_SMBUS_BLOCK_MAX;
return regmap_raw_write(regmap, init_reg, val, val_len);
}
static int adv748x_set_slave_addresses(struct adv748x_state *state)
{
struct i2c_client *client;
unsigned int i;
u8 io_reg;
for (i = ADV748X_PAGE_DPLL; i < ADV748X_PAGE_MAX; ++i) {
io_reg = ADV748X_IO_SLAVE_ADDR_BASE + i;
client = state->i2c_clients[i];
io_write(state, io_reg, client->addr << 1);
}
return 0;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/errno.h`, `linux/i2c.h`, `linux/module.h`, `linux/mutex.h`, `linux/of_graph.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `struct adv748x_register_map`, `struct adv748x_reg_value`, `function adv748x_configure_regmap`, `function adv748x_read_check`, `function adv748x_read`, `function adv748x_write`, `function adv748x_write_check`, `function adv748x_write_block`, `function adv748x_set_slave_addresses`, `function adv748x_unregister_clients`.
- 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.