drivers/media/dvb-frontends/stb0899_drv.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stb0899_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stb0899_drv.c- Extension
.c- Size
- 45157 bytes
- Lines
- 1646
- 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/jiffies.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/string.hlinux/dvb/frontend.hmedia/dvb_frontend.hstb0899_drv.hstb0899_priv.hstb0899_reg.h
Detected Declarations
function _stb0899_read_regfunction stb0899_read_regfunction _stb0899_read_s2regfunction stb0899_write_s2regfunction stb0899_read_regsfunction stb0899_write_regsfunction stb0899_write_regfunction stb0899_get_mclkfunction stb0899_set_mclkfunction stb0899_postprocfunction stb0899_detachfunction stb0899_releasefunction stb0899_get_alphafunction stb0899_init_calcfunction stb0899_wait_diseqc_fifo_emptyfunction stb0899_send_diseqc_msgfunction stb0899_wait_diseqc_rxidlefunction stb0899_recv_slave_replyfunction stb0899_wait_diseqc_txidlefunction stb0899_send_diseqc_burstfunction stb0899_diseqc_initfunction stb0899_sleepfunction stb0899_wakeupfunction stb0899_initfunction stb0899_table_lookupfunction stb0899_read_signal_strengthfunction stb0899_read_snrfunction stb0899_read_statusfunction stb0899_read_berfunction stb0899_set_voltagefunction stb0899_set_tonefunction stb0899_i2c_gate_ctrlfunction CONVERT32function stb0899_get_dev_idfunction stb0899_set_deliveryfunction stb0899_set_iterationsfunction stb0899_searchfunction stb0899_get_frontendfunction stb0899_frontend_algoexport stb0899_attach
Annotated Snippet
if (enable) {
if (postproc[ctl].level == STB0899_GPIOPULLUP)
stb0899_write_reg(state, postproc[ctl].gpio, 0x02);
else
stb0899_write_reg(state, postproc[ctl].gpio, 0x82);
} else {
if (postproc[ctl].level == STB0899_GPIOPULLUP)
stb0899_write_reg(state, postproc[ctl].gpio, 0x82);
else
stb0899_write_reg(state, postproc[ctl].gpio, 0x02);
}
}
return 0;
}
static void stb0899_detach(struct dvb_frontend *fe)
{
struct stb0899_state *state = fe->demodulator_priv;
/* post process event */
stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
}
static void stb0899_release(struct dvb_frontend *fe)
{
struct stb0899_state *state = fe->demodulator_priv;
dprintk(state->verbose, FE_DEBUG, 1, "Release Frontend");
kfree(state);
}
/*
* stb0899_get_alpha
* return: rolloff
*/
static int stb0899_get_alpha(struct stb0899_state *state)
{
u8 mode_coeff;
mode_coeff = stb0899_read_reg(state, STB0899_DEMOD);
if (STB0899_GETFIELD(MODECOEFF, mode_coeff) == 1)
return 20;
else
return 35;
}
/*
* stb0899_init_calc
*/
static void stb0899_init_calc(struct stb0899_state *state)
{
struct stb0899_internal *internal = &state->internal;
int master_clk;
u8 agc[2];
u32 reg;
/* Read registers (in burst mode) */
stb0899_read_regs(state, STB0899_AGC1REF, agc, 2); /* AGC1R and AGC2O */
/* Initial calculations */
master_clk = stb0899_get_mclk(state);
internal->t_agc1 = 0;
internal->t_agc2 = 0;
internal->master_clk = master_clk;
internal->mclk = master_clk / 65536L;
internal->rolloff = stb0899_get_alpha(state);
/* DVBS2 Initial calculations */
/* Set AGC value to the middle */
internal->agc_gain = 8154;
reg = STB0899_READ_S2REG(STB0899_S2DEMOD, IF_AGC_CNTRL);
STB0899_SETFIELD_VAL(IF_GAIN_INIT, reg, internal->agc_gain);
stb0899_write_s2reg(state, STB0899_S2DEMOD, STB0899_BASE_IF_AGC_CNTRL, STB0899_OFF0_IF_AGC_CNTRL, reg);
reg = STB0899_READ_S2REG(STB0899_S2DEMOD, RRC_ALPHA);
internal->rrc_alpha = STB0899_GETFIELD(RRC_ALPHA, reg);
internal->center_freq = 0;
internal->av_frame_coarse = 10;
internal->av_frame_fine = 20;
internal->step_size = 2;
/*
if ((pParams->SpectralInv == FE_IQ_NORMAL) || (pParams->SpectralInv == FE_IQ_AUTO))
pParams->IQLocked = 0;
else
pParams->IQLocked = 1;
*/
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/string.h`, `linux/dvb/frontend.h`, `media/dvb_frontend.h`.
- Detected declarations: `function _stb0899_read_reg`, `function stb0899_read_reg`, `function _stb0899_read_s2reg`, `function stb0899_write_s2reg`, `function stb0899_read_regs`, `function stb0899_write_regs`, `function stb0899_write_reg`, `function stb0899_get_mclk`, `function stb0899_set_mclk`, `function stb0899_postproc`.
- 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.