drivers/media/dvb-frontends/lgs8gl5.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/lgs8gl5.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/lgs8gl5.c- Extension
.c- Size
- 9390 bytes
- Lines
- 442
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/init.hlinux/module.hlinux/string.hlinux/slab.hmedia/dvb_frontend.hlgs8gl5.h
Detected Declarations
struct lgs8gl5_statefunction lgs8gl5_write_regfunction lgs8gl5_read_regfunction lgs8gl5_update_regfunction lgs8gl5_update_alt_regfunction lgs8gl5_soft_resetfunction lgs8gl5_start_demodfunction lgs8gl5_initfunction lgs8gl5_read_statusfunction lgs8gl5_read_berfunction lgs8gl5_read_signal_strengthfunction lgs8gl5_read_snrfunction lgs8gl5_read_ucblocksfunction lgs8gl5_set_frontendfunction lgs8gl5_get_frontendfunction lgs8gl5_get_tune_settingsfunction lgs8gl5_releasefunction lgs8gl5_attachexport lgs8gl5_attach
Annotated Snippet
struct lgs8gl5_state {
struct i2c_adapter *i2c;
const struct lgs8gl5_config *config;
struct dvb_frontend frontend;
};
static int debug;
#define dprintk(args...) \
do { \
if (debug) \
printk(KERN_DEBUG "lgs8gl5: " args); \
} while (0)
/* Writes into demod's register */
static int
lgs8gl5_write_reg(struct lgs8gl5_state *state, u8 reg, u8 data)
{
int ret;
u8 buf[] = {reg, data};
struct i2c_msg msg = {
.addr = state->config->demod_address,
.flags = 0,
.buf = buf,
.len = 2
};
ret = i2c_transfer(state->i2c, &msg, 1);
if (ret != 1)
dprintk("%s: error (reg=0x%02x, val=0x%02x, ret=%i)\n",
__func__, reg, data, ret);
return (ret != 1) ? -1 : 0;
}
/* Reads from demod's register */
static int
lgs8gl5_read_reg(struct lgs8gl5_state *state, u8 reg)
{
int ret;
u8 b0[] = {reg};
u8 b1[] = {0};
struct i2c_msg msg[2] = {
{
.addr = state->config->demod_address,
.flags = 0,
.buf = b0,
.len = 1
},
{
.addr = state->config->demod_address,
.flags = I2C_M_RD,
.buf = b1,
.len = 1
}
};
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2)
return -EIO;
return b1[0];
}
static int
lgs8gl5_update_reg(struct lgs8gl5_state *state, u8 reg, u8 data)
{
lgs8gl5_read_reg(state, reg);
lgs8gl5_write_reg(state, reg, data);
return 0;
}
/* Writes into alternate device's register */
/* TODO: Find out what that device is for! */
static int
lgs8gl5_update_alt_reg(struct lgs8gl5_state *state, u8 reg, u8 data)
{
int ret;
u8 b0[] = {reg};
u8 b1[] = {0};
u8 b2[] = {reg, data};
struct i2c_msg msg[3] = {
{
.addr = state->config->demod_address + 2,
.flags = 0,
.buf = b0,
.len = 1
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `media/dvb_frontend.h`, `lgs8gl5.h`.
- Detected declarations: `struct lgs8gl5_state`, `function lgs8gl5_write_reg`, `function lgs8gl5_read_reg`, `function lgs8gl5_update_reg`, `function lgs8gl5_update_alt_reg`, `function lgs8gl5_soft_reset`, `function lgs8gl5_start_demod`, `function lgs8gl5_init`, `function lgs8gl5_read_status`, `function lgs8gl5_read_ber`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.