drivers/media/dvb-frontends/stv0910.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stv0910.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stv0910.c- Extension
.c- Size
- 50813 bytes
- Lines
- 1830
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/firmware.hlinux/i2c.hasm/div64.hmedia/dvb_frontend.hstv0910.hstv0910_regs.h
Detected Declarations
struct stv_basestruct stvstruct slookupenum receive_modeenum dvbs2_fectypeenum dvbs2_mod_codenum fe_stv0910_mod_codenum fe_stv0910_roll_offfunction muldiv32function write_regfunction i2c_read_regs16function read_regfunction read_regsfunction write_shared_regfunction write_fieldfunction get_optim_cloopfunction get_cur_symbol_ratefunction get_signal_parametersfunction tracking_optimizationfunction table_lookupfunction get_signal_to_noisefunction get_bit_error_rate_sfunction dvbs2_nbchfunction get_bit_error_rate_s2function get_bit_error_ratefunction set_mclockfunction stopfunction set_plsfunction set_isifunction set_stream_modesfunction init_search_paramfunction enable_puncture_ratefunction set_vth_defaultfunction set_vthfunction startfunction init_diseqcfunction probefunction gate_ctrlfunction preventedfunction releasefunction set_parametersfunction manage_matype_infofunction read_snrfunction read_berfunction read_signal_strengthfunction read_statusfunction get_frontendfunction tune
Annotated Snippet
struct stv_base {
struct list_head stvlist;
u8 adr;
struct i2c_adapter *i2c;
struct mutex i2c_lock; /* shared I2C access protect */
struct mutex reg_lock; /* shared register write protect */
int count;
u32 extclk;
u32 mclk;
};
struct stv {
struct stv_base *base;
struct dvb_frontend fe;
int nr;
u16 regoff;
u8 i2crpt;
u8 tscfgh;
u8 tsgeneral;
u8 tsspeed;
u8 single;
unsigned long tune_time;
s32 search_range;
u32 started;
u32 demod_lock_time;
enum receive_mode receive_mode;
u32 demod_timeout;
u32 fec_timeout;
u32 first_time_lock;
u8 demod_bits;
u32 symbol_rate;
u8 last_viterbi_rate;
enum fe_code_rate puncture_rate;
enum fe_stv0910_mod_cod mod_cod;
enum dvbs2_fectype fectype;
u32 pilots;
enum fe_stv0910_roll_off feroll_off;
int is_standard_broadcast;
int is_vcm;
u32 cur_scrambling_code;
u32 last_bernumerator;
u32 last_berdenominator;
u8 berscale;
u8 vth[6];
};
struct slookup {
s16 value;
u32 reg_value;
};
static int write_reg(struct stv *state, u16 reg, u8 val)
{
struct i2c_adapter *adap = state->base->i2c;
u8 data[3] = {reg >> 8, reg & 0xff, val};
struct i2c_msg msg = {.addr = state->base->adr, .flags = 0,
.buf = data, .len = 3};
if (i2c_transfer(adap, &msg, 1) != 1) {
dev_warn(&adap->dev, "i2c write error ([%02x] %04x: %02x)\n",
state->base->adr, reg, val);
return -EIO;
}
return 0;
}
static inline int i2c_read_regs16(struct i2c_adapter *adapter, u8 adr,
u16 reg, u8 *val, int count)
{
u8 msg[2] = {reg >> 8, reg & 0xff};
struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
.buf = msg, .len = 2},
{.addr = adr, .flags = I2C_M_RD,
.buf = val, .len = count } };
if (i2c_transfer(adapter, msgs, 2) != 2) {
dev_warn(&adapter->dev, "i2c read error ([%02x] %04x)\n",
adr, reg);
return -EIO;
}
return 0;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `asm/div64.h`.
- Detected declarations: `struct stv_base`, `struct stv`, `struct slookup`, `enum receive_mode`, `enum dvbs2_fectype`, `enum dvbs2_mod_cod`, `enum fe_stv0910_mod_cod`, `enum fe_stv0910_roll_off`, `function muldiv32`, `function write_reg`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.