drivers/video/fbdev/mb862xx/mb862xx-i2c.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/mb862xx/mb862xx-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/mb862xx/mb862xx-i2c.c- Extension
.c- Size
- 3524 bytes
- Lines
- 168
- Domain
- Driver Families
- Bucket
- drivers/video
- 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/fb.hlinux/i2c.hlinux/io.hlinux/delay.hmb862xxfb.hmb862xx_reg.h
Detected Declarations
function mb862xx_i2c_wait_eventfunction mb862xx_i2c_do_addressfunction mb862xx_i2c_write_bytefunction mb862xx_i2c_read_bytefunction mb862xx_i2c_stopfunction mb862xx_i2c_readfunction mb862xx_i2c_writefunction mb862xx_xferfunction mb862xx_funcfunction mb862xx_i2c_initfunction mb862xx_i2c_exit
Annotated Snippet
if (!mb862xx_i2c_read_byte(adap, &m->buf[i], i == last)) {
ret = -EIO;
break;
}
}
return ret;
}
static int mb862xx_i2c_write(struct i2c_adapter *adap, struct i2c_msg *m)
{
int i, ret = 0;
for (i = 0; i < m->len; i++) {
if (!mb862xx_i2c_write_byte(adap, m->buf[i])) {
ret = -EIO;
break;
}
}
return ret;
}
static int mb862xx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
int num)
{
struct mb862xxfb_par *par = adap->algo_data;
struct i2c_msg *m;
int addr;
int i = 0, err = 0;
dev_dbg(par->dev, "%s: %d msgs\n", __func__, num);
for (i = 0; i < num; i++) {
m = &msgs[i];
if (!m->len) {
dev_dbg(par->dev, "%s: null msgs\n", __func__);
continue;
}
addr = m->addr;
if (m->flags & I2C_M_RD)
addr |= 1;
err = mb862xx_i2c_do_address(adap, addr);
if (err < 0)
break;
if (m->flags & I2C_M_RD)
err = mb862xx_i2c_read(adap, m);
else
err = mb862xx_i2c_write(adap, m);
}
if (i)
mb862xx_i2c_stop(adap);
return (err < 0) ? err : i;
}
static u32 mb862xx_func(struct i2c_adapter *adap)
{
return I2C_FUNC_SMBUS_BYTE_DATA;
}
static const struct i2c_algorithm mb862xx_algo = {
.master_xfer = mb862xx_xfer,
.functionality = mb862xx_func,
};
static struct i2c_adapter mb862xx_i2c_adapter = {
.name = "MB862xx I2C adapter",
.algo = &mb862xx_algo,
.owner = THIS_MODULE,
};
int mb862xx_i2c_init(struct mb862xxfb_par *par)
{
mb862xx_i2c_adapter.algo_data = par;
par->adap = &mb862xx_i2c_adapter;
return i2c_add_adapter(par->adap);
}
void mb862xx_i2c_exit(struct mb862xxfb_par *par)
{
if (par->adap) {
i2c_del_adapter(par->adap);
par->adap = NULL;
}
}
Annotation
- Immediate include surface: `linux/fb.h`, `linux/i2c.h`, `linux/io.h`, `linux/delay.h`, `mb862xxfb.h`, `mb862xx_reg.h`.
- Detected declarations: `function mb862xx_i2c_wait_event`, `function mb862xx_i2c_do_address`, `function mb862xx_i2c_write_byte`, `function mb862xx_i2c_read_byte`, `function mb862xx_i2c_stop`, `function mb862xx_i2c_read`, `function mb862xx_i2c_write`, `function mb862xx_xfer`, `function mb862xx_func`, `function mb862xx_i2c_init`.
- Atlas domain: Driver Families / drivers/video.
- 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.