drivers/media/dvb-frontends/stv0288.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stv0288.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stv0288.c- Extension
.c- Size
- 13043 bytes
- Lines
- 606
- 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/init.hlinux/kernel.hlinux/module.hlinux/string.hlinux/slab.hlinux/jiffies.hasm/div64.hmedia/dvb_frontend.hstv0288.h
Detected Declarations
struct stv0288_statefunction stv0288_writeregIfunction stv0288_writefunction stv0288_readregfunction stv0288_set_symbolratefunction stv0288_send_diseqc_msgfunction stv0288_send_diseqc_burstfunction stv0288_set_tonefunction stv0288_set_voltagefunction stv0288_initfunction stv0288_read_statusfunction stv0288_read_berfunction stv0288_read_signal_strengthfunction stv0288_sleepfunction stv0288_read_snrfunction stv0288_read_ucblocksfunction stv0288_set_frontendfunction stv0288_i2c_gate_ctrlfunction stv0288_releaseexport stv0288_attach
Annotated Snippet
struct stv0288_state {
struct i2c_adapter *i2c;
const struct stv0288_config *config;
struct dvb_frontend frontend;
u8 initialised:1;
u32 tuner_frequency;
u32 symbol_rate;
enum fe_code_rate fec_inner;
int errmode;
};
#define STATUS_BER 0
#define STATUS_UCBLOCKS 1
static int debug;
static int debug_legacy_dish_switch;
#define dprintk(args...) \
do { \
if (debug) \
printk(KERN_DEBUG "stv0288: " args); \
} while (0)
static int stv0288_writeregI(struct stv0288_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: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n",
__func__, reg, data, ret);
return (ret != 1) ? -EREMOTEIO : 0;
}
static int stv0288_write(struct dvb_frontend *fe, const u8 buf[], int len)
{
struct stv0288_state *state = fe->demodulator_priv;
if (len != 2)
return -EINVAL;
return stv0288_writeregI(state, buf[0], buf[1]);
}
static u8 stv0288_readreg(struct stv0288_state *state, u8 reg)
{
int ret;
u8 b0[] = { reg };
u8 b1[] = { 0 };
struct i2c_msg msg[] = {
{
.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)
dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n",
__func__, reg, ret);
return b1[0];
}
static int stv0288_set_symbolrate(struct dvb_frontend *fe, u32 srate)
{
struct stv0288_state *state = fe->demodulator_priv;
unsigned int temp;
unsigned char b[3];
if ((srate < 1000000) || (srate > 45000000))
return -EINVAL;
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `linux/jiffies.h`, `asm/div64.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct stv0288_state`, `function stv0288_writeregI`, `function stv0288_write`, `function stv0288_readreg`, `function stv0288_set_symbolrate`, `function stv0288_send_diseqc_msg`, `function stv0288_send_diseqc_burst`, `function stv0288_set_tone`, `function stv0288_set_voltage`, `function stv0288_init`.
- 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.