drivers/media/test-drivers/vidtv/vidtv_tuner.c
Source file repositories/reference/linux-study-clean/drivers/media/test-drivers/vidtv/vidtv_tuner.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/test-drivers/vidtv/vidtv_tuner.c- Extension
.c- Size
- 11621 bytes
- Lines
- 437
- 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
linux/errno.hlinux/i2c.hlinux/module.hlinux/printk.hlinux/ratelimit.hlinux/slab.hlinux/types.hmedia/dvb_frontend.hvidtv_tuner.h
Detected Declarations
struct vidtv_tuner_cnr_to_qual_sstruct vidtv_tuner_hardware_statestruct vidtv_tuner_devfunction vidtv_tuner_get_devfunction vidtv_tuner_check_frequency_shiftfunction vidtv_tuner_get_signal_strengthfunction vidtv_tuner_initfunction vidtv_tuner_sleepfunction vidtv_tuner_suspendfunction vidtv_tuner_resumefunction vidtv_tuner_set_paramsfunction vidtv_tuner_set_configfunction vidtv_tuner_get_frequencyfunction vidtv_tuner_get_bandwidthfunction vidtv_tuner_get_if_frequencyfunction vidtv_tuner_get_statusfunction vidtv_tuner_i2c_probefunction vidtv_tuner_i2c_remove
Annotated Snippet
struct vidtv_tuner_cnr_to_qual_s {
/* attempt to use the same values as libdvbv5 */
u32 modulation;
u32 fec;
u32 cnr_ok;
u32 cnr_good;
};
static const struct vidtv_tuner_cnr_to_qual_s vidtv_tuner_c_cnr_2_qual[] = {
/* from libdvbv5 source code, in milli db */
{ QAM_256, FEC_NONE, 34000, 38000},
{ QAM_64, FEC_NONE, 30000, 34000},
};
static const struct vidtv_tuner_cnr_to_qual_s vidtv_tuner_s_cnr_2_qual[] = {
/* from libdvbv5 source code, in milli db */
{ QPSK, FEC_1_2, 7000, 10000},
{ QPSK, FEC_2_3, 9000, 12000},
{ QPSK, FEC_3_4, 10000, 13000},
{ QPSK, FEC_5_6, 11000, 14000},
{ QPSK, FEC_7_8, 12000, 15000},
};
static const struct vidtv_tuner_cnr_to_qual_s vidtv_tuner_s2_cnr_2_qual[] = {
/* from libdvbv5 source code, in milli db */
{ QPSK, FEC_1_2, 9000, 12000},
{ QPSK, FEC_2_3, 11000, 14000},
{ QPSK, FEC_3_4, 12000, 15000},
{ QPSK, FEC_5_6, 12000, 15000},
{ QPSK, FEC_8_9, 13000, 16000},
{ QPSK, FEC_9_10, 13500, 16500},
{ PSK_8, FEC_2_3, 14500, 17500},
{ PSK_8, FEC_3_4, 16000, 19000},
{ PSK_8, FEC_5_6, 17500, 20500},
{ PSK_8, FEC_8_9, 19000, 22000},
};
static const struct vidtv_tuner_cnr_to_qual_s vidtv_tuner_t_cnr_2_qual[] = {
/* from libdvbv5 source code, in milli db*/
{ QPSK, FEC_1_2, 4100, 5900},
{ QPSK, FEC_2_3, 6100, 9600},
{ QPSK, FEC_3_4, 7200, 12400},
{ QPSK, FEC_5_6, 8500, 15600},
{ QPSK, FEC_7_8, 9200, 17500},
{ QAM_16, FEC_1_2, 9800, 11800},
{ QAM_16, FEC_2_3, 12100, 15300},
{ QAM_16, FEC_3_4, 13400, 18100},
{ QAM_16, FEC_5_6, 14800, 21300},
{ QAM_16, FEC_7_8, 15700, 23600},
{ QAM_64, FEC_1_2, 14000, 16000},
{ QAM_64, FEC_2_3, 19900, 25400},
{ QAM_64, FEC_3_4, 24900, 27900},
{ QAM_64, FEC_5_6, 21300, 23300},
{ QAM_64, FEC_7_8, 22000, 24000},
};
/**
* struct vidtv_tuner_hardware_state - Simulate the tuner hardware status
* @asleep: whether the tuner is asleep, i.e whether _sleep() or _suspend() was
* called.
* @lock_status: Whether the tuner has managed to lock on the requested
* frequency.
* @if_frequency: The tuner's intermediate frequency. Hardcoded for the purposes
* of simulation.
* @tuned_frequency: The actual tuned frequency.
* @bandwidth: The actual bandwidth.
*
* This structure is meant to simulate the status of the tuner hardware, as if
* we had a physical tuner hardware.
*/
struct vidtv_tuner_hardware_state {
bool asleep;
u32 lock_status;
u32 if_frequency;
u32 tuned_frequency;
u32 bandwidth;
};
/**
* struct vidtv_tuner_dev - The tuner struct
* @fe: A pointer to the dvb_frontend structure allocated by vidtv_demod
* @hw_state: A struct to simulate the tuner's hardware state as if we had a
* physical tuner hardware.
* @config: The configuration used to start the tuner module, usually filled
* by a bridge driver. For vidtv, this is filled by vidtv_bridge before the
* tuner module is probed.
*/
struct vidtv_tuner_dev {
struct dvb_frontend *fe;
struct vidtv_tuner_hardware_state hw_state;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/i2c.h`, `linux/module.h`, `linux/printk.h`, `linux/ratelimit.h`, `linux/slab.h`, `linux/types.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct vidtv_tuner_cnr_to_qual_s`, `struct vidtv_tuner_hardware_state`, `struct vidtv_tuner_dev`, `function vidtv_tuner_get_dev`, `function vidtv_tuner_check_frequency_shift`, `function vidtv_tuner_get_signal_strength`, `function vidtv_tuner_init`, `function vidtv_tuner_sleep`, `function vidtv_tuner_suspend`, `function vidtv_tuner_resume`.
- 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.