drivers/media/dvb-frontends/tda8083.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/tda8083.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/tda8083.c- Extension
.c- Size
- 11436 bytes
- Lines
- 485
- 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.hmedia/dvb_frontend.htda8083.h
Detected Declarations
struct tda8083_statefunction tda8083_writeregfunction tda8083_readregsfunction tda8083_readregfunction tda8083_set_inversionfunction tda8083_set_fecfunction tda8083_get_fecfunction tda8083_set_symbolratefunction tda8083_wait_diseqc_fifofunction tda8083_set_tonefunction tda8083_set_voltagefunction tda8083_send_diseqc_burstfunction tda8083_send_diseqc_msgfunction tda8083_read_statusfunction tda8083_read_berfunction tda8083_read_signal_strengthfunction tda8083_read_snrfunction tda8083_read_ucblocksfunction tda8083_set_frontendfunction tda8083_get_frontendfunction tda8083_sleepfunction tda8083_initfunction tda8083_diseqc_send_burstfunction tda8083_diseqc_set_tonefunction tda8083_diseqc_set_voltagefunction tda8083_releasefunction tda8083_attachexport tda8083_attach
Annotated Snippet
struct tda8083_state {
struct i2c_adapter* i2c;
/* configuration settings */
const struct tda8083_config* config;
struct dvb_frontend frontend;
};
static int debug;
#define dprintk(args...) \
do { \
if (debug) printk(KERN_DEBUG "tda8083: " args); \
} while (0)
static u8 tda8083_init_tab [] = {
0x04, 0x00, 0x4a, 0x79, 0x04, 0x00, 0xff, 0xea,
0x48, 0x42, 0x79, 0x60, 0x70, 0x52, 0x9a, 0x10,
0x0e, 0x10, 0xf2, 0xa7, 0x93, 0x0b, 0x05, 0xc8,
0x9d, 0x00, 0x42, 0x80, 0x00, 0x60, 0x40, 0x00,
0x00, 0x75, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
static int tda8083_writereg (struct tda8083_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 %02x, ret == %i)\n",
__func__, reg, ret);
return (ret != 1) ? -1 : 0;
}
static int tda8083_readregs (struct tda8083_state* state, u8 reg1, u8 *b, u8 len)
{
int ret;
struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = ®1, .len = 1 },
{ .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b, .len = len } };
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2)
dprintk ("%s: readreg error (reg %02x, ret == %i)\n",
__func__, reg1, ret);
return ret == 2 ? 0 : -1;
}
static inline u8 tda8083_readreg (struct tda8083_state* state, u8 reg)
{
u8 val;
tda8083_readregs (state, reg, &val, 1);
return val;
}
static int tda8083_set_inversion(struct tda8083_state *state,
enum fe_spectral_inversion inversion)
{
/* XXX FIXME: implement other modes than FEC_AUTO */
if (inversion == INVERSION_AUTO)
return 0;
return -EINVAL;
}
static int tda8083_set_fec(struct tda8083_state *state, enum fe_code_rate fec)
{
if (fec == FEC_AUTO)
return tda8083_writereg (state, 0x07, 0xff);
if (fec >= FEC_1_2 && fec <= FEC_8_9)
return tda8083_writereg (state, 0x07, 1 << (FEC_8_9 - fec));
return -EINVAL;
}
static enum fe_code_rate tda8083_get_fec(struct tda8083_state *state)
{
u8 index;
static enum fe_code_rate fec_tab[] = {
FEC_8_9, FEC_1_2, FEC_2_3, FEC_3_4,
FEC_4_5, FEC_5_6, FEC_6_7, FEC_7_8
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `linux/jiffies.h`, `media/dvb_frontend.h`, `tda8083.h`.
- Detected declarations: `struct tda8083_state`, `function tda8083_writereg`, `function tda8083_readregs`, `function tda8083_readreg`, `function tda8083_set_inversion`, `function tda8083_set_fec`, `function tda8083_get_fec`, `function tda8083_set_symbolrate`, `function tda8083_wait_diseqc_fifo`, `function tda8083_set_tone`.
- 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.