drivers/media/dvb-frontends/dib3000mc.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/dib3000mc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/dib3000mc.c- Extension
.c- Size
- 26764 bytes
- Lines
- 976
- 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/slab.hlinux/i2c.hmedia/dvb_frontend.hdib3000mc.h
Detected Declarations
struct dib3000mc_statefunction dib3000mc_read_wordfunction dib3000mc_write_wordfunction dib3000mc_identifyfunction dib3000mc_set_timingfunction dib3000mc_setup_pwm_statefunction dib3000mc_set_output_modefunction dib3000mc_set_bandwidthfunction dib3000mc_set_impulse_noisefunction dib3000mc_initfunction dib3000mc_sleepfunction dib3000mc_set_adp_cfgfunction dib3000mc_set_channel_cfgfunction dib3000mc_autosearch_startfunction dib3000mc_autosearch_is_irqfunction dib3000mc_tunefunction dib3000mc_get_tuner_i2c_masterfunction dib3000mc_get_frontendfunction dib3000mc_set_frontendfunction dib3000mc_read_statusfunction dib3000mc_read_berfunction dib3000mc_read_unc_blocksfunction dib3000mc_read_signal_strengthfunction dib3000mc_read_snrfunction dib3000mc_fe_get_tune_settingsfunction dib3000mc_releasefunction dib3000mc_pid_controlfunction dib3000mc_pid_parsefunction dib3000mc_set_configfunction dib3000mc_i2c_enumerationfunction dib3000mc_attachexport dib3000mc_get_tuner_i2c_masterexport dib3000mc_pid_controlexport dib3000mc_pid_parseexport dib3000mc_set_configexport dib3000mc_i2c_enumerationexport dib3000mc_attach
Annotated Snippet
struct dib3000mc_state {
struct dvb_frontend demod;
struct dib3000mc_config *cfg;
u8 i2c_addr;
struct i2c_adapter *i2c_adap;
struct dibx000_i2c_master i2c_master;
u32 timf;
u32 current_bandwidth;
u16 dev_id;
u8 sfn_workaround_active :1;
};
static u16 dib3000mc_read_word(struct dib3000mc_state *state, u16 reg)
{
struct i2c_msg msg[2] = {
{ .addr = state->i2c_addr >> 1, .flags = 0, .len = 2 },
{ .addr = state->i2c_addr >> 1, .flags = I2C_M_RD, .len = 2 },
};
u16 word;
u8 *b;
b = kmalloc(4, GFP_KERNEL);
if (!b)
return 0;
b[0] = (reg >> 8) | 0x80;
b[1] = reg;
b[2] = 0;
b[3] = 0;
msg[0].buf = b;
msg[1].buf = b + 2;
if (i2c_transfer(state->i2c_adap, msg, 2) != 2)
dprintk("i2c read error on %d\n",reg);
word = (b[2] << 8) | b[3];
kfree(b);
return word;
}
static int dib3000mc_write_word(struct dib3000mc_state *state, u16 reg, u16 val)
{
struct i2c_msg msg = {
.addr = state->i2c_addr >> 1, .flags = 0, .len = 4
};
int rc;
u8 *b;
b = kmalloc(4, GFP_KERNEL);
if (!b)
return -ENOMEM;
b[0] = reg >> 8;
b[1] = reg;
b[2] = val >> 8;
b[3] = val;
msg.buf = b;
rc = i2c_transfer(state->i2c_adap, &msg, 1) != 1 ? -EREMOTEIO : 0;
kfree(b);
return rc;
}
static int dib3000mc_identify(struct dib3000mc_state *state)
{
u16 value;
if ((value = dib3000mc_read_word(state, 1025)) != 0x01b3) {
dprintk("-E- DiB3000MC/P: wrong Vendor ID (read=0x%x)\n",value);
return -EREMOTEIO;
}
value = dib3000mc_read_word(state, 1026);
if (value != 0x3001 && value != 0x3002) {
dprintk("-E- DiB3000MC/P: wrong Device ID (%x)\n",value);
return -EREMOTEIO;
}
state->dev_id = value;
dprintk("-I- found DiB3000MC/P: %x\n",state->dev_id);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/i2c.h`, `media/dvb_frontend.h`, `dib3000mc.h`.
- Detected declarations: `struct dib3000mc_state`, `function dib3000mc_read_word`, `function dib3000mc_write_word`, `function dib3000mc_identify`, `function dib3000mc_set_timing`, `function dib3000mc_setup_pwm_state`, `function dib3000mc_set_output_mode`, `function dib3000mc_set_bandwidth`, `function dib3000mc_set_impulse_noise`, `function dib3000mc_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.