drivers/media/tuners/tuner-types.c

Source file repositories/reference/linux-study-clean/drivers/media/tuners/tuner-types.c

File Facts

System
Linux kernel
Corpus path
drivers/media/tuners/tuner-types.c
Extension
.c
Size
60771 bytes
Lines
1979
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 *
 * i2c tv tuner chip device type database.
 *
 */

#include <linux/i2c.h>
#include <linux/module.h>
#include <media/tuner.h>
#include <media/tuner-types.h>

/* ---------------------------------------------------------------------- */

/*
 *	The floats in the tuner struct are computed at compile time
 *	by gcc and cast back to integers. Thus we don't violate the
 *	"no float in kernel" rule.
 *
 *	A tuner_range may be referenced by multiple tuner_params structs.
 *	There are many duplicates in here. Reusing tuner_range structs,
 *	rather than defining new ones for each tuner, will cut down on
 *	memory usage, and is preferred when possible.
 *
 *	Each tuner_params array may contain one or more elements, one
 *	for each video standard.
 *
 *	FIXME: tuner_params struct contains an element, tda988x. We must
 *	set this for all tuners that contain a tda988x chip, and then we
 *	can remove this setting from the various card structs.
 *
 *	FIXME: Right now, all tuners are using the first tuner_params[]
 *	array element for analog mode. In the future, we will be merging
 *	similar tuner definitions together, such that each tuner definition
 *	will have a tuner_params struct for each available video standard.
 *	At that point, the tuner_params[] array element will be chosen
 *	based on the video standard in use.
 */

/* The following was taken from dvb-pll.c: */

/* Set AGC TOP value to 103 dBuV:
 *	0x80 = Control Byte
 *	0x40 = 250 uA charge pump (irrelevant)
 *	0x18 = Aux Byte to follow
 *	0x06 = 64.5 kHz divider (irrelevant)
 *	0x01 = Disable Vt (aka sleep)
 *
 *	0x00 = AGC Time constant 2s Iagc = 300 nA (vs 0x80 = 9 nA)
 *	0x50 = AGC Take over point = 103 dBuV
 */
static u8 tua603x_agc103[] = { 2, 0x80|0x40|0x18|0x06|0x01, 0x00|0x50 };

/*	0x04 = 166.67 kHz divider
 *
 *	0x80 = AGC Time constant 50ms Iagc = 9 uA
 *	0x20 = AGC Take over point = 112 dBuV
 */
static u8 tua603x_agc112[] = { 2, 0x80|0x40|0x18|0x04|0x01, 0x80|0x20 };

/* 0-9 */
/* ------------ TUNER_TEMIC_PAL - TEMIC PAL ------------ */

static const struct tuner_range tuner_temic_pal_ranges[] = {
	{ 16 * 140.25 /*MHz*/, 0x8e, 0x02, },
	{ 16 * 463.25 /*MHz*/, 0x8e, 0x04, },
	{ 16 * 999.99        , 0x8e, 0x01, },
};

static const struct tuner_params tuner_temic_pal_params[] = {
	{
		.type   = TUNER_PARAM_TYPE_PAL,
		.ranges = tuner_temic_pal_ranges,
		.count  = ARRAY_SIZE(tuner_temic_pal_ranges),
	},
};

/* ------------ TUNER_PHILIPS_PAL_I - Philips PAL_I ------------ */

static const struct tuner_range tuner_philips_pal_i_ranges[] = {
	{ 16 * 140.25 /*MHz*/, 0x8e, 0xa0, },
	{ 16 * 463.25 /*MHz*/, 0x8e, 0x90, },
	{ 16 * 999.99        , 0x8e, 0x30, },
};

static const struct tuner_params tuner_philips_pal_i_params[] = {
	{
		.type   = TUNER_PARAM_TYPE_PAL,
		.ranges = tuner_philips_pal_i_ranges,
		.count  = ARRAY_SIZE(tuner_philips_pal_i_ranges),

Annotation

Implementation Notes