drivers/media/usb/dvb-usb/af9005-fe.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/af9005-fe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/af9005-fe.c- Extension
.c- Size
- 35498 bytes
- Lines
- 1475
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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
af9005.haf9005-script.hmt2060.hqt1010.hasm/div64.h
Detected Declarations
struct af9005_fe_statefunction af9005_write_word_agcfunction af9005_read_word_agcfunction af9005_is_fecmon_availablefunction af9005_get_post_vit_err_cw_countfunction af9005_get_post_vit_berfunction af9005_get_pre_vit_err_bit_countfunction af9005_reset_pre_viterbifunction af9005_reset_post_viterbifunction af9005_get_statisticfunction af9005_fe_refresh_statefunction af9005_fe_read_statusfunction af9005_fe_read_berfunction af9005_fe_read_unc_blocksfunction af9005_fe_read_signal_strengthfunction af9005_fe_read_snrfunction af9005_fe_program_cfoefunction af9005_fe_select_bwfunction af9005_fe_powerfunction af9005_fe_initfunction af9005_fe_sleepfunction af9005_ts_bus_ctrlfunction af9005_fe_set_frontendfunction af9005_fe_get_frontendfunction af9005_fe_release
Annotated Snippet
struct af9005_fe_state {
struct dvb_usb_device *d;
enum fe_status stat;
/* retraining parameters */
u32 original_fcw;
u16 original_rf_top;
u16 original_if_top;
u16 original_if_min;
u16 original_aci0_if_top;
u16 original_aci1_if_top;
u16 original_aci0_if_min;
u8 original_if_unplug_th;
u8 original_rf_unplug_th;
u8 original_dtop_if_unplug_th;
u8 original_dtop_rf_unplug_th;
/* statistics */
u32 pre_vit_error_count;
u32 pre_vit_bit_count;
u32 ber;
u32 post_vit_error_count;
u32 post_vit_bit_count;
u32 unc;
u16 abort_count;
int opened;
int strong;
unsigned long next_status_check;
struct dvb_frontend frontend;
};
static int af9005_write_word_agc(struct dvb_usb_device *d, u16 reghi,
u16 reglo, u8 pos, u8 len, u16 value)
{
int ret;
if ((ret = af9005_write_ofdm_register(d, reglo, (u8) (value & 0xff))))
return ret;
return af9005_write_register_bits(d, reghi, pos, len,
(u8) ((value & 0x300) >> 8));
}
static int af9005_read_word_agc(struct dvb_usb_device *d, u16 reghi,
u16 reglo, u8 pos, u8 len, u16 * value)
{
int ret;
u8 temp0, temp1;
if ((ret = af9005_read_ofdm_register(d, reglo, &temp0)))
return ret;
if ((ret = af9005_read_ofdm_register(d, reghi, &temp1)))
return ret;
switch (pos) {
case 0:
*value = ((u16) (temp1 & 0x03) << 8) + (u16) temp0;
break;
case 2:
*value = ((u16) (temp1 & 0x0C) << 6) + (u16) temp0;
break;
case 4:
*value = ((u16) (temp1 & 0x30) << 4) + (u16) temp0;
break;
case 6:
*value = ((u16) (temp1 & 0xC0) << 2) + (u16) temp0;
break;
default:
err("invalid pos in read word agc");
return -EINVAL;
}
return 0;
}
static int af9005_is_fecmon_available(struct dvb_frontend *fe, int *available)
{
struct af9005_fe_state *state = fe->demodulator_priv;
int ret;
u8 temp;
*available = false;
ret = af9005_read_register_bits(state->d, xd_p_fec_vtb_rsd_mon_en,
fec_vtb_rsd_mon_en_pos,
fec_vtb_rsd_mon_en_len, &temp);
if (ret)
return ret;
if (temp & 1) {
ret =
af9005_read_register_bits(state->d,
Annotation
- Immediate include surface: `af9005.h`, `af9005-script.h`, `mt2060.h`, `qt1010.h`, `asm/div64.h`.
- Detected declarations: `struct af9005_fe_state`, `function af9005_write_word_agc`, `function af9005_read_word_agc`, `function af9005_is_fecmon_available`, `function af9005_get_post_vit_err_cw_count`, `function af9005_get_post_vit_ber`, `function af9005_get_pre_vit_err_bit_count`, `function af9005_reset_pre_viterbi`, `function af9005_reset_post_viterbi`, `function af9005_get_statistic`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.