drivers/media/tuners/xc4000.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/xc4000.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/xc4000.c- Extension
.c- Size
- 45107 bytes
- Lines
- 1752
- 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.
- 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
linux/module.hlinux/moduleparam.hlinux/videodev2.hlinux/delay.hlinux/dvb/frontend.hlinux/i2c.hlinux/mutex.hlinux/unaligned.hmedia/dvb_frontend.hxc4000.htuner-i2c.hxc2028-types.h
Detected Declarations
struct firmware_descriptionstruct firmware_propertiesstruct xc4000_privstruct XC_TV_STANDARDfunction xc_send_i2c_datafunction xc4000_tuner_resetfunction xc_write_regfunction xc_load_i2c_sequencefunction xc_set_tv_standardfunction xc_set_signal_sourcefunction xc_set_rf_frequencyfunction xc_get_adc_envelopefunction xc_get_frequency_errorfunction xc_get_lock_statusfunction xc_get_versionfunction xc_get_hsync_freqfunction xc_get_frame_linesfunction xc_get_qualityfunction xc_get_signal_levelfunction xc_get_noise_levelfunction xc_wait_for_lockfunction xc_tune_channelfunction xc4000_readregfunction dump_firm_type_and_int_freqfunction seek_firmwarefunction load_firmwarefunction xc4000_fwuploadfunction load_scodefunction check_firmwarefunction xc_debug_dumpfunction xc4000_set_paramsfunction xc4000_set_analog_paramsfunction xc4000_get_signalfunction xc4000_get_frequencyfunction xc4000_get_bandwidthfunction xc4000_get_statusfunction xc4000_sleepfunction xc4000_initfunction xc4000_releaseexport xc4000_attach
Annotated Snippet
struct firmware_description {
unsigned int type;
v4l2_std_id id;
__u16 int_freq;
unsigned char *ptr;
unsigned int size;
};
struct firmware_properties {
unsigned int type;
v4l2_std_id id;
v4l2_std_id std_req;
__u16 int_freq;
unsigned int scode_table;
int scode_nr;
};
struct xc4000_priv {
struct tuner_i2c_props i2c_props;
struct list_head hybrid_tuner_instance_list;
struct firmware_description *firm;
int firm_size;
u32 if_khz;
u32 freq_hz, freq_offset;
u32 bandwidth;
u8 video_standard;
u8 rf_mode;
u8 default_pm;
u8 dvb_amplitude;
u8 set_smoothedcvbs;
u8 ignore_i2c_write_errors;
__u16 firm_version;
struct firmware_properties cur_fw;
__u16 hwmodel;
__u16 hwvers;
struct mutex lock;
};
#define XC4000_AUDIO_STD_B 1
#define XC4000_AUDIO_STD_A2 2
#define XC4000_AUDIO_STD_K3 4
#define XC4000_AUDIO_STD_L 8
#define XC4000_AUDIO_STD_INPUT1 16
#define XC4000_AUDIO_STD_MONO 32
#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.fw"
#define XC4000_DEFAULT_FIRMWARE_NEW "dvb-fe-xc4000-1.4.1.fw"
/* Misc Defines */
#define MAX_TV_STANDARD 24
#define XC_MAX_I2C_WRITE_LENGTH 64
#define XC_POWERED_DOWN 0x80000000U
/* Signal Types */
#define XC_RF_MODE_AIR 0
#define XC_RF_MODE_CABLE 1
/* Product id */
#define XC_PRODUCT_ID_FW_NOT_LOADED 0x2000
#define XC_PRODUCT_ID_XC4000 0x0FA0
#define XC_PRODUCT_ID_XC4100 0x1004
/* Registers (Write-only) */
#define XREG_INIT 0x00
#define XREG_VIDEO_MODE 0x01
#define XREG_AUDIO_MODE 0x02
#define XREG_RF_FREQ 0x03
#define XREG_D_CODE 0x04
#define XREG_DIRECTSITTING_MODE 0x05
#define XREG_SEEK_MODE 0x06
#define XREG_POWER_DOWN 0x08
#define XREG_SIGNALSOURCE 0x0A
#define XREG_SMOOTHEDCVBS 0x0E
#define XREG_AMPLITUDE 0x10
/* Registers (Read-only) */
#define XREG_ADC_ENV 0x00
#define XREG_QUALITY 0x01
#define XREG_FRAME_LINES 0x02
#define XREG_HSYNC_FREQ 0x03
#define XREG_LOCK 0x04
#define XREG_FREQ_ERROR 0x05
#define XREG_SNR 0x06
#define XREG_VERSION 0x07
#define XREG_PRODUCT_ID 0x08
#define XREG_SIGNAL_LEVEL 0x0A
#define XREG_NOISE_LEVEL 0x0B
/*
Basic firmware description. This will remain with
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/videodev2.h`, `linux/delay.h`, `linux/dvb/frontend.h`, `linux/i2c.h`, `linux/mutex.h`, `linux/unaligned.h`.
- Detected declarations: `struct firmware_description`, `struct firmware_properties`, `struct xc4000_priv`, `struct XC_TV_STANDARD`, `function xc_send_i2c_data`, `function xc4000_tuner_reset`, `function xc_write_reg`, `function xc_load_i2c_sequence`, `function xc_set_tv_standard`, `function xc_set_signal_source`.
- 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.