drivers/media/tuners/r820t.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/r820t.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/r820t.c- Extension
.c- Size
- 56805 bytes
- Lines
- 2407
- 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
linux/videodev2.hlinux/mutex.hlinux/slab.hlinux/bitrev.htuner-i2c.hr820t.h
Detected Declarations
struct r820t_sect_typestruct r820t_privstruct r820t_freq_rangeenum xtal_cap_valuefunction shadow_storefunction r820t_writefunction r820t_write_regfunction r820t_read_cache_regfunction r820t_write_reg_maskfunction r820t_readfunction r820t_set_muxfunction r820t_set_pllfunction r820t_sysfreq_selfunction r820t_set_tv_standardfunction r820t_read_gainfunction r820t_set_gain_modefunction generic_set_freqfunction r820t_standbyfunction r820t_xtal_checkfunction r820t_imr_preparefunction r820t_multi_readfunction r820t_imr_crossfunction r820t_compre_corfunction r820t_compre_stepfunction r820t_iq_treefunction r820t_sectionfunction r820t_vga_adjustfunction r820t_iqfunction r820t_f_imrfunction r820t_imrfunction r820t_imr_callibratefunction r820t_gpiofunction r820t_initfunction r820t_sleepfunction r820t_set_analog_freqfunction r820t_set_paramsfunction r820t_signalfunction r820t_get_if_frequencyfunction r820t_releaseexport r820t_attach
Annotated Snippet
struct r820t_sect_type {
u8 phase_y;
u8 gain_x;
u16 value;
};
struct r820t_priv {
struct list_head hybrid_tuner_instance_list;
const struct r820t_config *cfg;
struct tuner_i2c_props i2c_props;
struct mutex lock;
u8 regs[NUM_REGS];
u8 buf[NUM_REGS + 1];
enum xtal_cap_value xtal_cap_sel;
u16 pll; /* kHz */
u32 int_freq;
u8 fil_cal_code;
bool imr_done;
bool has_lock;
bool init_done;
struct r820t_sect_type imr_data[NUM_IMR];
/* Store current mode */
u32 delsys;
enum v4l2_tuner_type type;
v4l2_std_id std;
u32 bw; /* in MHz */
};
struct r820t_freq_range {
u32 freq;
u8 open_d;
u8 rf_mux_ploy;
u8 tf_c;
u8 xtal_cap20p;
u8 xtal_cap10p;
u8 xtal_cap0p;
u8 imr_mem; /* Not used, currently */
};
#define VCO_POWER_REF 0x02
#define DIP_FREQ 32000000
/*
* Static constants
*/
static LIST_HEAD(hybrid_tuner_instance_list);
static DEFINE_MUTEX(r820t_list_mutex);
/* Those initial values start from REG_SHADOW_START */
static const u8 r820t_init_array[NUM_REGS] = {
0x83, 0x32, 0x75, /* 05 to 07 */
0xc0, 0x40, 0xd6, 0x6c, /* 08 to 0b */
0xf5, 0x63, 0x75, 0x68, /* 0c to 0f */
0x6c, 0x83, 0x80, 0x00, /* 10 to 13 */
0x0f, 0x00, 0xc0, 0x30, /* 14 to 17 */
0x48, 0xcc, 0x60, 0x00, /* 18 to 1b */
0x54, 0xae, 0x4a, 0xc0 /* 1c to 1f */
};
/* Tuner frequency ranges */
static const struct r820t_freq_range freq_ranges[] = {
{
.freq = 0,
.open_d = 0x08, /* low */
.rf_mux_ploy = 0x02, /* R26[7:6]=0 (LPF) R26[1:0]=2 (low) */
.tf_c = 0xdf, /* R27[7:0] band2,band0 */
.xtal_cap20p = 0x02, /* R16[1:0] 20pF (10) */
.xtal_cap10p = 0x01,
.xtal_cap0p = 0x00,
.imr_mem = 0,
}, {
.freq = 50, /* Start freq, in MHz */
.open_d = 0x08, /* low */
.rf_mux_ploy = 0x02, /* R26[7:6]=0 (LPF) R26[1:0]=2 (low) */
.tf_c = 0xbe, /* R27[7:0] band4,band1 */
.xtal_cap20p = 0x02, /* R16[1:0] 20pF (10) */
.xtal_cap10p = 0x01,
.xtal_cap0p = 0x00,
.imr_mem = 0,
}, {
.freq = 55, /* Start freq, in MHz */
.open_d = 0x08, /* low */
.rf_mux_ploy = 0x02, /* R26[7:6]=0 (LPF) R26[1:0]=2 (low) */
.tf_c = 0x8b, /* R27[7:0] band7,band4 */
.xtal_cap20p = 0x02, /* R16[1:0] 20pF (10) */
.xtal_cap10p = 0x01,
.xtal_cap0p = 0x00,
Annotation
- Immediate include surface: `linux/videodev2.h`, `linux/mutex.h`, `linux/slab.h`, `linux/bitrev.h`, `tuner-i2c.h`, `r820t.h`.
- Detected declarations: `struct r820t_sect_type`, `struct r820t_priv`, `struct r820t_freq_range`, `enum xtal_cap_value`, `function shadow_store`, `function r820t_write`, `function r820t_write_reg`, `function r820t_read_cache_reg`, `function r820t_write_reg_mask`, `function r820t_read`.
- 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.