drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c- Extension
.c- Size
- 11491 bytes
- Lines
- 504
- 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-tuner.hmxl111sf-phy.hmxl111sf-reg.h
Detected Declarations
struct mxl111sf_tuner_statefunction mxl111sf_tuner_read_regfunction mxl111sf_tuner_write_regfunction mxl111sf_tuner_program_regsfunction mxl1x1sf_tuner_top_master_ctrlfunction mxl1x1sf_tuner_set_if_output_freqfunction mxl1x1sf_tune_rffunction mxl1x1sf_tuner_get_lock_statusfunction mxl1x1sf_tuner_loop_thru_ctrlfunction mxl111sf_tuner_set_paramsfunction mxl111sf_tuner_initfunction mxl111sf_tuner_sleepfunction mxl111sf_tuner_get_statusfunction mxl111sf_get_rf_strengthfunction mxl111sf_tuner_get_frequencyfunction mxl111sf_tuner_get_bandwidthfunction mxl111sf_tuner_get_if_frequencyfunction mxl111sf_tuner_releaseexport mxl111sf_tuner_attach
Annotated Snippet
struct mxl111sf_tuner_state {
struct mxl111sf_state *mxl_state;
const struct mxl111sf_tuner_config *cfg;
enum mxl_if_freq if_freq;
u32 frequency;
u32 bandwidth;
};
static int mxl111sf_tuner_read_reg(struct mxl111sf_tuner_state *state,
u8 addr, u8 *data)
{
return (state->cfg->read_reg) ?
state->cfg->read_reg(state->mxl_state, addr, data) :
-EINVAL;
}
static int mxl111sf_tuner_write_reg(struct mxl111sf_tuner_state *state,
u8 addr, u8 data)
{
return (state->cfg->write_reg) ?
state->cfg->write_reg(state->mxl_state, addr, data) :
-EINVAL;
}
static int mxl111sf_tuner_program_regs(struct mxl111sf_tuner_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;
}
static int mxl1x1sf_tuner_top_master_ctrl(struct mxl111sf_tuner_state *state,
int onoff)
{
return (state->cfg->top_master_ctrl) ?
state->cfg->top_master_ctrl(state->mxl_state, onoff) :
-EINVAL;
}
/* ------------------------------------------------------------------------ */
static struct mxl111sf_reg_ctrl_info mxl_phy_tune_rf[] = {
{0x1d, 0x7f, 0x00}, /* channel bandwidth section 1/2/3,
DIG_MODEINDEX, _A, _CSF, */
{0x1e, 0xff, 0x00}, /* channel frequency (lo and fractional) */
{0x1f, 0xff, 0x00}, /* channel frequency (hi for integer portion) */
{0, 0, 0}
};
/* ------------------------------------------------------------------------ */
static struct mxl111sf_reg_ctrl_info *mxl111sf_calc_phy_tune_regs(u32 freq,
u8 bw)
{
u8 filt_bw;
/* set channel bandwidth */
switch (bw) {
case 0: /* ATSC */
filt_bw = 25;
break;
case 1: /* QAM */
filt_bw = 69;
break;
case 6:
filt_bw = 21;
break;
case 7:
filt_bw = 42;
break;
case 8:
filt_bw = 63;
break;
default:
pr_err("%s: invalid bandwidth setting!", __func__);
return NULL;
}
/* calculate RF channel */
freq /= 1000000;
freq *= 64;
#if 0
/* do round */
freq += 0.5;
#endif
Annotation
- Immediate include surface: `mxl111sf-tuner.h`, `mxl111sf-phy.h`, `mxl111sf-reg.h`.
- Detected declarations: `struct mxl111sf_tuner_state`, `function mxl111sf_tuner_read_reg`, `function mxl111sf_tuner_write_reg`, `function mxl111sf_tuner_program_regs`, `function mxl1x1sf_tuner_top_master_ctrl`, `function mxl1x1sf_tuner_set_if_output_freq`, `function mxl1x1sf_tune_rf`, `function mxl1x1sf_tuner_get_lock_status`, `function mxl1x1sf_tuner_loop_thru_ctrl`, `function mxl111sf_tuner_set_params`.
- 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.