drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c- Extension
.c- Size
- 14399 bytes
- Lines
- 599
- 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
mxl111sf-demod.hmxl111sf-reg.h
Detected Declarations
struct mxl111sf_demod_statefunction mxl111sf_demod_read_regfunction mxl111sf_demod_write_regfunction mxl111sf_demod_program_regsfunction mxl1x1sf_demod_get_tps_code_ratefunction mxl1x1sf_demod_get_tps_modulationfunction mxl1x1sf_demod_get_tps_guard_fft_modefunction mxl1x1sf_demod_get_tps_guard_intervalfunction mxl1x1sf_demod_get_tps_hierarchyfunction mxl1x1sf_demod_get_sync_lock_statusfunction mxl1x1sf_demod_get_rs_lock_statusfunction mxl1x1sf_demod_get_tps_lock_statusfunction mxl1x1sf_demod_get_fec_lock_statusfunction mxl1x1sf_demod_get_cp_lock_statusfunction mxl1x1sf_demod_reset_irq_statusfunction mxl111sf_demod_set_frontendfunction mxl1x1sf_demod_reset_packet_error_countfunction mxl111sf_demod_read_ucblocksfunction mxl111sf_demod_read_berfunction mxl111sf_demod_calc_snrfunction mxl111sf_demod_read_snrfunction mxl111sf_demod_read_statusfunction mxl111sf_demod_read_signal_strengthfunction mxl111sf_demod_get_frontendfunction mxl111sf_demod_get_tune_settingsfunction mxl111sf_demod_releaseexport mxl111sf_demod_attach
Annotated Snippet
struct mxl111sf_demod_state {
struct mxl111sf_state *mxl_state;
const struct mxl111sf_demod_config *cfg;
struct dvb_frontend fe;
};
/* ------------------------------------------------------------------------ */
static int mxl111sf_demod_read_reg(struct mxl111sf_demod_state *state,
u8 addr, u8 *data)
{
return (state->cfg->read_reg) ?
state->cfg->read_reg(state->mxl_state, addr, data) :
-EINVAL;
}
static int mxl111sf_demod_write_reg(struct mxl111sf_demod_state *state,
u8 addr, u8 data)
{
return (state->cfg->write_reg) ?
state->cfg->write_reg(state->mxl_state, addr, data) :
-EINVAL;
}
static
int mxl111sf_demod_program_regs(struct mxl111sf_demod_state *state,
struct mxl111sf_reg_ctrl_info *ctrl_reg_info)
{
return (state->cfg->program_regs) ?
state->cfg->program_regs(state->mxl_state, ctrl_reg_info) :
-EINVAL;
}
/* ------------------------------------------------------------------------ */
/* TPS */
static
int mxl1x1sf_demod_get_tps_code_rate(struct mxl111sf_demod_state *state,
enum fe_code_rate *code_rate)
{
u8 val;
int ret = mxl111sf_demod_read_reg(state, V6_CODE_RATE_TPS_REG, &val);
/* bit<2:0> - 000:1/2, 001:2/3, 010:3/4, 011:5/6, 100:7/8 */
if (mxl_fail(ret))
goto fail;
switch (val & V6_CODE_RATE_TPS_MASK) {
case 0:
*code_rate = FEC_1_2;
break;
case 1:
*code_rate = FEC_2_3;
break;
case 2:
*code_rate = FEC_3_4;
break;
case 3:
*code_rate = FEC_5_6;
break;
case 4:
*code_rate = FEC_7_8;
break;
}
fail:
return ret;
}
static
int mxl1x1sf_demod_get_tps_modulation(struct mxl111sf_demod_state *state,
enum fe_modulation *modulation)
{
u8 val;
int ret = mxl111sf_demod_read_reg(state, V6_MODORDER_TPS_REG, &val);
/* Constellation, 00 : QPSK, 01 : 16QAM, 10:64QAM */
if (mxl_fail(ret))
goto fail;
switch ((val & V6_PARAM_CONSTELLATION_MASK) >> 4) {
case 0:
*modulation = QPSK;
break;
case 1:
*modulation = QAM_16;
break;
case 2:
*modulation = QAM_64;
break;
}
Annotation
- Immediate include surface: `mxl111sf-demod.h`, `mxl111sf-reg.h`.
- Detected declarations: `struct mxl111sf_demod_state`, `function mxl111sf_demod_read_reg`, `function mxl111sf_demod_write_reg`, `function mxl111sf_demod_program_regs`, `function mxl1x1sf_demod_get_tps_code_rate`, `function mxl1x1sf_demod_get_tps_modulation`, `function mxl1x1sf_demod_get_tps_guard_fft_mode`, `function mxl1x1sf_demod_get_tps_guard_interval`, `function mxl1x1sf_demod_get_tps_hierarchy`, `function mxl1x1sf_demod_get_sync_lock_status`.
- 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.