drivers/media/i2c/tw2804.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/tw2804.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/tw2804.c- Extension
.c- Size
- 10515 bytes
- Lines
- 436
- 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/module.hlinux/init.hlinux/i2c.hlinux/videodev2.hlinux/ioctl.hlinux/slab.hmedia/v4l2-subdev.hmedia/v4l2-device.hmedia/v4l2-ctrls.h
Detected Declarations
struct tw2804function write_regfunction write_regsfunction read_regfunction tw2804_log_statusfunction adaptersfunction tw2804_s_ctrlfunction tw2804_s_stdfunction tw2804_s_video_routingfunction tw2804_probefunction tw2804_remove
Annotated Snippet
struct tw2804 {
struct v4l2_subdev sd;
struct v4l2_ctrl_handler hdl;
u8 channel:2;
u8 input:1;
int norm;
};
static const u8 global_registers[] = {
0x39, 0x00,
0x3a, 0xff,
0x3b, 0x84,
0x3c, 0x80,
0x3d, 0x80,
0x3e, 0x82,
0x3f, 0x82,
0x78, 0x00,
0xff, 0xff, /* Terminator (reg 0xff does not exist) */
};
static const u8 channel_registers[] = {
0x01, 0xc4,
0x02, 0xa5,
0x03, 0x20,
0x04, 0xd0,
0x05, 0x20,
0x06, 0xd0,
0x07, 0x88,
0x08, 0x20,
0x09, 0x07,
0x0a, 0xf0,
0x0b, 0x07,
0x0c, 0xf0,
0x0d, 0x40,
0x0e, 0xd2,
0x0f, 0x80,
0x10, 0x80,
0x11, 0x80,
0x12, 0x80,
0x13, 0x1f,
0x14, 0x00,
0x15, 0x00,
0x16, 0x00,
0x17, 0x00,
0x18, 0xff,
0x19, 0xff,
0x1a, 0xff,
0x1b, 0xff,
0x1c, 0xff,
0x1d, 0xff,
0x1e, 0xff,
0x1f, 0xff,
0x20, 0x07,
0x21, 0x07,
0x22, 0x00,
0x23, 0x91,
0x24, 0x51,
0x25, 0x03,
0x26, 0x00,
0x27, 0x00,
0x28, 0x00,
0x29, 0x00,
0x2a, 0x00,
0x2b, 0x00,
0x2c, 0x00,
0x2d, 0x00,
0x2e, 0x00,
0x2f, 0x00,
0x30, 0x00,
0x31, 0x00,
0x32, 0x00,
0x33, 0x00,
0x34, 0x00,
0x35, 0x00,
0x36, 0x00,
0x37, 0x00,
0xff, 0xff, /* Terminator (reg 0xff does not exist) */
};
static int write_reg(struct i2c_client *client, u8 reg, u8 value, u8 channel)
{
return i2c_smbus_write_byte_data(client, reg | (channel << 6), value);
}
static int write_regs(struct i2c_client *client, const u8 *regs, u8 channel)
{
int ret;
int i;
for (i = 0; regs[i] != 0xff; i += 2) {
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/i2c.h`, `linux/videodev2.h`, `linux/ioctl.h`, `linux/slab.h`, `media/v4l2-subdev.h`, `media/v4l2-device.h`.
- Detected declarations: `struct tw2804`, `function write_reg`, `function write_regs`, `function read_reg`, `function tw2804_log_status`, `function adapters`, `function tw2804_s_ctrl`, `function tw2804_s_std`, `function tw2804_s_video_routing`, `function tw2804_probe`.
- 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.