drivers/media/pci/ddbridge/ddbridge-i2c.h
Source file repositories/reference/linux-study-clean/drivers/media/pci/ddbridge/ddbridge-i2c.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/ddbridge/ddbridge-i2c.h- Extension
.h- Size
- 2895 bytes
- Lines
- 104
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hddbridge.h
Detected Declarations
function i2c_iofunction i2c_writefunction i2c_readfunction i2c_read_regsfunction i2c_read_regs16function i2c_write_reg16function i2c_write_regfunction i2c_read_reg16function i2c_read_reg
Annotated Snippet
#ifndef __DDBRIDGE_I2C_H__
#define __DDBRIDGE_I2C_H__
#include <linux/i2c.h>
#include "ddbridge.h"
/******************************************************************************/
void ddb_i2c_release(struct ddb *dev);
int ddb_i2c_init(struct ddb *dev);
/******************************************************************************/
static int __maybe_unused i2c_io(struct i2c_adapter *adapter, u8 adr,
u8 *wbuf, u32 wlen, u8 *rbuf, u32 rlen)
{
struct i2c_msg msgs[2] = { { .addr = adr, .flags = 0,
.buf = wbuf, .len = wlen },
{ .addr = adr, .flags = I2C_M_RD,
.buf = rbuf, .len = rlen } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int __maybe_unused i2c_write(struct i2c_adapter *adap, u8 adr,
u8 *data, int len)
{
struct i2c_msg msg = { .addr = adr, .flags = 0,
.buf = data, .len = len };
return (i2c_transfer(adap, &msg, 1) == 1) ? 0 : -1;
}
static int __maybe_unused i2c_read(struct i2c_adapter *adapter, u8 adr, u8 *val)
{
struct i2c_msg msgs[1] = { { .addr = adr, .flags = I2C_M_RD,
.buf = val, .len = 1 } };
return (i2c_transfer(adapter, msgs, 1) == 1) ? 0 : -1;
}
static int __maybe_unused i2c_read_regs(struct i2c_adapter *adapter,
u8 adr, u8 reg, u8 *val, u8 len)
{
struct i2c_msg msgs[2] = { { .addr = adr, .flags = 0,
.buf = ®, .len = 1 },
{ .addr = adr, .flags = I2C_M_RD,
.buf = val, .len = len } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int __maybe_unused i2c_read_regs16(struct i2c_adapter *adapter,
u8 adr, u16 reg, u8 *val, u8 len)
{
u8 msg[2] = { reg >> 8, reg & 0xff };
struct i2c_msg msgs[2] = { { .addr = adr, .flags = 0,
.buf = msg, .len = 2 },
{ .addr = adr, .flags = I2C_M_RD,
.buf = val, .len = len } };
return (i2c_transfer(adapter, msgs, 2) == 2) ? 0 : -1;
}
static int __maybe_unused i2c_write_reg16(struct i2c_adapter *adap,
u8 adr, u16 reg, u8 val)
{
u8 msg[3] = { reg >> 8, reg & 0xff, val };
return i2c_write(adap, adr, msg, 3);
}
static int __maybe_unused i2c_write_reg(struct i2c_adapter *adap,
u8 adr, u8 reg, u8 val)
{
u8 msg[2] = { reg, val };
return i2c_write(adap, adr, msg, 2);
}
static int __maybe_unused i2c_read_reg16(struct i2c_adapter *adapter,
u8 adr, u16 reg, u8 *val)
{
return i2c_read_regs16(adapter, adr, reg, val, 1);
}
static int __maybe_unused i2c_read_reg(struct i2c_adapter *adapter,
u8 adr, u8 reg, u8 *val)
{
Annotation
- Immediate include surface: `linux/i2c.h`, `ddbridge.h`.
- Detected declarations: `function i2c_io`, `function i2c_write`, `function i2c_read`, `function i2c_read_regs`, `function i2c_read_regs16`, `function i2c_write_reg16`, `function i2c_write_reg`, `function i2c_read_reg16`, `function i2c_read_reg`.
- 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.