drivers/media/tuners/tda18271-fe.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/tda18271-fe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/tda18271-fe.c- Extension
.c- Size
- 32410 bytes
- Lines
- 1345
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
tda18271-priv.htda8290.hlinux/delay.hlinux/videodev2.h
Detected Declarations
function tda18271_toggle_outputfunction charge_pump_sourcefunction tda18271_set_if_notchfunction tda18271_channel_configurationfunction tda18271_read_thermometerfunction tda18271c2_rf_tracking_filters_correctionfunction tda18271_porfunction tda18271_calibrate_rffunction tda18271_powerscanfunction tda18271_powerscan_initfunction tda18271_rf_tracking_filters_initfunction tda18271_calc_rf_filter_curvefunction tda18271c2_rf_cal_initfunction tda18271c1_rf_tracking_filter_calibrationfunction tda18271_ir_cal_initfunction tda18271_initfunction tda18271_sleepfunction tda18271_agcfunction tda18271_tunefunction tda18271_set_paramsfunction tda18271_set_analog_paramsfunction tda18271_releasefunction tda18271_get_frequencyfunction tda18271_get_bandwidthfunction tda18271_get_if_frequencyfunction tda18271_dump_std_mapfunction tda18271_update_std_mapfunction tda18271_get_idfunction tda18271_setup_configurationfunction tda18271_need_cal_on_startupfunction tda18271_set_configexport tda18271_attach
Annotated Snippet
if (wait) {
msleep(5); /* pll locking */
wait = false;
} else
udelay(100); /* pll locking */
/* launch power detection measurement */
tda18271_write_regs(fe, R_EP2, 1);
/* read power detection info, stored in EB10 */
ret = tda18271_read_extended(fe);
if (tda_fail(ret))
return ret;
count += 200;
if (count <= count_limit)
continue;
if (sgn <= 0)
break;
sgn = -1 * sgn;
count = 200;
wait = true;
}
if ((regs[R_EB10] & 0x3f) >= cid_target) {
bcal = 1;
*freq_out = freq - 1000000;
} else
bcal = 0;
tda_cal("bcal = %d, freq_in = %d, freq_out = %d (freq = %d)\n",
bcal, *freq_in, *freq_out, freq);
return bcal;
}
static int tda18271_powerscan_init(struct dvb_frontend *fe)
{
struct tda18271_priv *priv = fe->tuner_priv;
unsigned char *regs = priv->tda18271_regs;
int ret;
/* set standard to digital */
regs[R_EP3] &= ~0x1f; /* clear std bits */
regs[R_EP3] |= 0x12;
/* set cal mode to normal */
regs[R_EP4] &= ~0x03;
/* update IF output level */
regs[R_EP4] &= ~0x1c; /* clear if level bits */
ret = tda18271_write_regs(fe, R_EP3, 2);
if (tda_fail(ret))
goto fail;
regs[R_EB18] &= ~0x03; /* set agc1_gain to 6 dB */
ret = tda18271_write_regs(fe, R_EB18, 1);
if (tda_fail(ret))
goto fail;
regs[R_EB21] &= ~0x03; /* set agc2_gain to -15 dB */
/* 1.5 MHz low pass filter */
regs[R_EB23] |= 0x04; /* forcelp_fc2_en = 1 */
regs[R_EB23] |= 0x02; /* lp_fc[2] = 1 */
ret = tda18271_write_regs(fe, R_EB21, 3);
fail:
return ret;
}
static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq)
{
struct tda18271_priv *priv = fe->tuner_priv;
struct tda18271_rf_tracking_filter_cal *map = priv->rf_cal_state;
unsigned char *regs = priv->tda18271_regs;
int bcal, rf, i;
s32 divisor, dividend;
#define RF1 0
#define RF2 1
#define RF3 2
u32 rf_default[3];
u32 rf_freq[3];
s32 prog_cal[3];
s32 prog_tab[3];
Annotation
- Immediate include surface: `tda18271-priv.h`, `tda8290.h`, `linux/delay.h`, `linux/videodev2.h`.
- Detected declarations: `function tda18271_toggle_output`, `function charge_pump_source`, `function tda18271_set_if_notch`, `function tda18271_channel_configuration`, `function tda18271_read_thermometer`, `function tda18271c2_rf_tracking_filters_correction`, `function tda18271_por`, `function tda18271_calibrate_rf`, `function tda18271_powerscan`, `function tda18271_powerscan_init`.
- 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.