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.

Dependency Surface

Detected Declarations

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

Implementation Notes