drivers/media/tuners/xc5000.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/xc5000.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/xc5000.c- Extension
.c- Size
- 36799 bytes
- Lines
- 1475
- 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/module.hlinux/moduleparam.hlinux/videodev2.hlinux/delay.hlinux/workqueue.hlinux/dvb/frontend.hlinux/i2c.hmedia/dvb_frontend.hxc5000.htuner-i2c.h
Detected Declarations
struct xc5000_privstruct XC_TV_STANDARDstruct xc5000_fw_cfgfunction xc_send_i2c_datafunction xc_read_i2c_datafunction xc5000_readregfunction xc5000_tuner_resetfunction xc_write_regfunction xc_load_i2c_sequencefunction xc_initializefunction xc_set_tv_standardfunction xc_set_signal_sourcefunction xc_set_rf_frequencyfunction xc_set_IF_frequencyfunction xc_get_adc_envelopefunction xc_get_frequency_errorfunction xc_get_lock_statusfunction xc_get_versionfunction xc_get_buildversionfunction xc_get_hsync_freqfunction xc_get_frame_linesfunction xc_get_qualityfunction xc_get_analogsnrfunction xc_get_totalgainfunction xc_tune_channelfunction xc_set_xtalfunction xc5000_fwuploadfunction xc_debug_dumpfunction xc5000_tune_digitalfunction xc5000_set_digital_paramsfunction xc5000_is_firmware_loadedfunction xc5000_config_tvfunction xc5000_set_tv_freqfunction xc5000_config_radiofunction xc5000_set_radio_freqfunction xc5000_set_paramsfunction xc5000_set_analog_paramsfunction xc5000_get_frequencyfunction xc5000_get_if_frequencyfunction xc5000_get_bandwidthfunction xc5000_get_statusfunction xc_load_fw_and_init_tunerfunction xc5000_do_timer_sleepfunction xc5000_sleepfunction xc5000_suspendfunction xc5000_resumefunction xc5000_initfunction xc5000_release
Annotated Snippet
struct xc5000_priv {
struct tuner_i2c_props i2c_props;
struct list_head hybrid_tuner_instance_list;
u32 if_khz;
u16 xtal_khz;
u32 freq_hz, freq_offset;
u32 bandwidth;
u8 video_standard;
unsigned int mode;
u8 rf_mode;
u8 radio_input;
u16 output_amp;
int chip_id;
u16 pll_register_no;
u8 init_status_supported;
u8 fw_checksum_supported;
struct dvb_frontend *fe;
struct delayed_work timer_sleep;
bool inited;
};
/* Misc Defines */
#define MAX_TV_STANDARD 24
#define XC_MAX_I2C_WRITE_LENGTH 64
/* Time to suspend after the .sleep callback is called */
#define XC5000_SLEEP_TIME 5000 /* ms */
/* 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_FW_LOADED 0x1388
/* Registers */
#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_IF_OUT 0x05
#define XREG_SEEK_MODE 0x07
#define XREG_POWER_DOWN 0x0A /* Obsolete */
/* Set the output amplitude - SIF for analog, DTVP/DTVN for digital */
#define XREG_OUTPUT_AMP 0x0B
#define XREG_SIGNALSOURCE 0x0D /* 0=Air, 1=Cable */
#define XREG_SMOOTHEDCVBS 0x0E
#define XREG_XTALFREQ 0x0F
#define XREG_FINERFREQ 0x10
#define XREG_DDIMODE 0x11
#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_BUSY 0x09
#define XREG_BUILD 0x0D
#define XREG_TOTALGAIN 0x0F
#define XREG_FW_CHECKSUM 0x12
#define XREG_INIT_STATUS 0x13
/*
Basic firmware description. This will remain with
the driver for documentation purposes.
This represents an I2C firmware file encoded as a
string of unsigned char. Format is as follows:
char[0 ]=len0_MSB -> len = len_MSB * 256 + len_LSB
char[1 ]=len0_LSB -> length of first write transaction
char[2 ]=data0 -> first byte to be sent
char[3 ]=data1
char[4 ]=data2
char[ ]=...
char[M ]=dataN -> last byte to be sent
char[M+1]=len1_MSB -> len = len_MSB * 256 + len_LSB
char[M+2]=len1_LSB -> length of second write transaction
char[M+3]=data0
char[M+4]=data1
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/videodev2.h`, `linux/delay.h`, `linux/workqueue.h`, `linux/dvb/frontend.h`, `linux/i2c.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct xc5000_priv`, `struct XC_TV_STANDARD`, `struct xc5000_fw_cfg`, `function xc_send_i2c_data`, `function xc_read_i2c_data`, `function xc5000_readreg`, `function xc5000_tuner_reset`, `function xc_write_reg`, `function xc_load_i2c_sequence`, `function xc_initialize`.
- 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.