drivers/media/dvb-frontends/ts2020.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/ts2020.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/ts2020.c- Extension
.c- Size
- 17480 bytes
- Lines
- 739
- 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
media/dvb_frontend.hts2020.hlinux/regmap.hlinux/math64.h
Detected Declarations
struct ts2020_privstruct ts2020_reg_valfunction ts2020_releasefunction ts2020_sleepfunction ts2020_initfunction ts2020_tuner_gate_ctrlfunction ts2020_set_tuner_rffunction ts2020_set_paramsfunction ts2020_get_frequencyfunction ts2020_get_if_frequencyfunction ts2020_read_tuner_gainfunction ts2020_get_tuner_gainfunction ts2020_stat_workfunction ts2020_read_signal_strengthfunction ts2020_regmap_lockfunction ts2020_regmap_unlockfunction ts2020_probefunction ts2020_removeexport ts2020_attach
Annotated Snippet
struct ts2020_priv {
struct i2c_client *client;
struct mutex regmap_mutex;
struct regmap_config regmap_config;
struct regmap *regmap;
struct dvb_frontend *fe;
struct delayed_work stat_work;
int (*get_agc_pwm)(struct dvb_frontend *fe, u8 *_agc_pwm);
/* i2c details */
struct i2c_adapter *i2c;
int i2c_address;
bool loop_through:1;
u8 clk_out:2;
u8 clk_out_div:5;
bool dont_poll:1;
u32 frequency_div; /* LO output divider switch frequency */
u32 frequency_khz; /* actual used LO frequency */
#define TS2020_M88TS2020 0
#define TS2020_M88TS2022 1
u8 tuner;
};
struct ts2020_reg_val {
u8 reg;
u8 val;
};
static void ts2020_stat_work(struct work_struct *work);
static void ts2020_release(struct dvb_frontend *fe)
{
struct ts2020_priv *priv = fe->tuner_priv;
struct i2c_client *client = priv->client;
dev_dbg(&client->dev, "\n");
i2c_unregister_device(client);
}
static int ts2020_sleep(struct dvb_frontend *fe)
{
struct ts2020_priv *priv = fe->tuner_priv;
int ret;
u8 u8tmp;
if (priv->tuner == TS2020_M88TS2020)
u8tmp = 0x0a; /* XXX: probably wrong */
else
u8tmp = 0x00;
ret = regmap_write(priv->regmap, u8tmp, 0x00);
if (ret < 0)
return ret;
/* stop statistics polling */
if (!priv->dont_poll)
cancel_delayed_work_sync(&priv->stat_work);
return 0;
}
static int ts2020_init(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct ts2020_priv *priv = fe->tuner_priv;
int i;
u8 u8tmp;
if (priv->tuner == TS2020_M88TS2020) {
regmap_write(priv->regmap, 0x42, 0x73);
regmap_write(priv->regmap, 0x05, priv->clk_out_div);
regmap_write(priv->regmap, 0x20, 0x27);
regmap_write(priv->regmap, 0x07, 0x02);
regmap_write(priv->regmap, 0x11, 0xff);
regmap_write(priv->regmap, 0x60, 0xf9);
regmap_write(priv->regmap, 0x08, 0x01);
regmap_write(priv->regmap, 0x00, 0x41);
} else {
static const struct ts2020_reg_val reg_vals[] = {
{0x7d, 0x9d},
{0x7c, 0x9a},
{0x7a, 0x76},
{0x3b, 0x01},
{0x63, 0x88},
{0x61, 0x85},
{0x22, 0x30},
{0x30, 0x40},
{0x20, 0x23},
{0x24, 0x02},
{0x12, 0xa0},
};
Annotation
- Immediate include surface: `media/dvb_frontend.h`, `ts2020.h`, `linux/regmap.h`, `linux/math64.h`.
- Detected declarations: `struct ts2020_priv`, `struct ts2020_reg_val`, `function ts2020_release`, `function ts2020_sleep`, `function ts2020_init`, `function ts2020_tuner_gate_ctrl`, `function ts2020_set_tuner_rf`, `function ts2020_set_params`, `function ts2020_get_frequency`, `function ts2020_get_if_frequency`.
- 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.