drivers/media/dvb-frontends/dib7000p.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/dib7000p.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/dib7000p.c- Extension
.c- Size
- 75912 bytes
- Lines
- 2864
- 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/slab.hlinux/i2c.hlinux/mutex.hasm/div64.hlinux/int_log.hmedia/dvb_frontend.hdib7000p.h
Detected Declarations
struct dib7000p_statestruct linear_segmentsenum dib7000p_power_modefunction dib7000p_read_wordfunction dib7000p_write_wordfunction dib7000p_write_tabfunction dib7000p_set_output_modefunction dib7000p_set_diversity_infunction dib7000p_set_power_modefunction dib7000p_set_adc_statefunction dib7000p_set_bandwidthfunction dib7000p_sad_calibfunction dib7000p_set_wbd_reffunction dib7000p_get_agc_valuesfunction dib7000p_set_agc1_minfunction dib7000p_reset_pllfunction dib7000p_get_internal_freqfunction dib7000p_update_pllfunction dib7000p_reset_gpiofunction dib7000p_cfg_gpiofunction dib7000p_set_gpiofunction dib7000p_demod_resetfunction dib7000p_pll_clk_cfgfunction dib7000p_restart_agcfunction dib7000p_update_lnafunction dib7000p_set_agc_configfunction dib7000p_set_ddsfunction dib7000p_agc_startupfunction dib7000p_update_timffunction dib7000p_ctrl_timffunction dib7000p_set_channelfunction dib7000p_autosearch_startfunction dib7000p_autosearch_is_irqfunction dib7000p_spur_protectfunction dib7000p_tunefunction dib7000p_wakeupfunction dib7000p_sleepfunction dib7000p_identifyfunction dib7000p_get_frontendfunction dib7000p_set_frontendfunction dib7000p_read_statusfunction dib7000p_read_berfunction dib7000p_read_unc_blocksfunction dib7000p_read_signal_strengthfunction dib7000p_get_snrfunction dib7000p_read_snrfunction dib7000p_reset_statsfunction interpolate_value
Annotated Snippet
struct dib7000p_state {
struct dvb_frontend demod;
struct dib7000p_config cfg;
u8 i2c_addr;
struct i2c_adapter *i2c_adap;
struct dibx000_i2c_master i2c_master;
u16 wbd_ref;
u8 current_band;
u32 current_bandwidth;
struct dibx000_agc_config *current_agc;
u32 timf;
u8 div_force_off:1;
u8 div_state:1;
u16 div_sync_wait;
u8 agc_state;
u16 gpio_dir;
u16 gpio_val;
u8 sfn_workaround_active:1;
#define SOC7090 0x7090
u16 version;
u16 tuner_enable;
struct i2c_adapter dib7090_tuner_adap;
/* for the I2C transfer */
struct i2c_msg msg[2];
u8 i2c_write_buffer[4];
u8 i2c_read_buffer[2];
struct mutex i2c_buffer_lock;
u8 input_mode_mpeg;
/* for DVBv5 stats */
s64 old_ucb;
unsigned long per_jiffies_stats;
unsigned long ber_jiffies_stats;
unsigned long get_stats_time;
};
enum dib7000p_power_mode {
DIB7000P_POWER_ALL = 0,
DIB7000P_POWER_ANALOG_ADC,
DIB7000P_POWER_INTERFACE_ONLY,
};
/* dib7090 specific functions */
static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode);
static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff);
static void dib7090_setDibTxMux(struct dib7000p_state *state, int mode);
static void dib7090_setHostBusMux(struct dib7000p_state *state, int mode);
static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg)
{
u16 ret;
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
dprintk("could not acquire lock\n");
return 0;
}
state->i2c_write_buffer[0] = reg >> 8;
state->i2c_write_buffer[1] = reg & 0xff;
memset(state->msg, 0, 2 * sizeof(struct i2c_msg));
state->msg[0].addr = state->i2c_addr >> 1;
state->msg[0].flags = 0;
state->msg[0].buf = state->i2c_write_buffer;
state->msg[0].len = 2;
state->msg[1].addr = state->i2c_addr >> 1;
state->msg[1].flags = I2C_M_RD;
state->msg[1].buf = state->i2c_read_buffer;
state->msg[1].len = 2;
if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2)
dprintk("i2c read error on %d\n", reg);
ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1];
mutex_unlock(&state->i2c_buffer_lock);
return ret;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/i2c.h`, `linux/mutex.h`, `asm/div64.h`, `linux/int_log.h`, `media/dvb_frontend.h`, `dib7000p.h`.
- Detected declarations: `struct dib7000p_state`, `struct linear_segments`, `enum dib7000p_power_mode`, `function dib7000p_read_word`, `function dib7000p_write_word`, `function dib7000p_write_tab`, `function dib7000p_set_output_mode`, `function dib7000p_set_diversity_in`, `function dib7000p_set_power_mode`, `function dib7000p_set_adc_state`.
- 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.