drivers/media/dvb-frontends/af9013.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/af9013.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/af9013.c- Extension
.c- Size
- 35344 bytes
- Lines
- 1577
- 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
af9013_priv.h
Detected Declarations
struct af9013_statefunction af9013_set_gpiofunction af9013_get_tune_settingsfunction af9013_set_frontendfunction af9013_get_frontendfunction af9013_read_statusfunction time_is_before_jiffiesfunction af9013_read_snrfunction af9013_read_signal_strengthfunction af9013_read_berfunction af9013_read_ucblocksfunction af9013_initfunction af9013_sleepfunction af9013_download_firmwarefunction af9013_pid_filter_ctrlfunction af9013_pid_filterfunction af9013_selectfunction af9013_deselectfunction af9013_wregsfunction af9013_rregsfunction af9013_regmap_writefunction af9013_regmap_readfunction af9013_probefunction af9013_remove
Annotated Snippet
struct af9013_state {
struct i2c_client *client;
struct regmap *regmap;
struct i2c_mux_core *muxc;
struct dvb_frontend fe;
u32 clk;
u8 tuner;
u32 if_frequency;
u8 ts_mode;
u8 ts_output_pin;
bool spec_inv;
u8 api_version[4];
u8 gpio[4];
u32 bandwidth_hz;
enum fe_status fe_status;
/* RF and IF AGC limits used for signal strength calc */
u8 strength_en, rf_agc_50, rf_agc_80, if_agc_50, if_agc_80;
unsigned long set_frontend_jiffies;
unsigned long read_status_jiffies;
unsigned long strength_jiffies;
unsigned long cnr_jiffies;
unsigned long ber_ucb_jiffies;
u16 dvbv3_snr;
u16 dvbv3_strength;
u32 dvbv3_ber;
u32 dvbv3_ucblocks;
bool first_tune;
};
static int af9013_set_gpio(struct af9013_state *state, u8 gpio, u8 gpioval)
{
struct i2c_client *client = state->client;
int ret;
u8 pos;
u16 addr;
dev_dbg(&client->dev, "gpio %u, gpioval %02x\n", gpio, gpioval);
/*
* GPIO0 & GPIO1 0xd735
* GPIO2 & GPIO3 0xd736
*/
switch (gpio) {
case 0:
case 1:
addr = 0xd735;
break;
case 2:
case 3:
addr = 0xd736;
break;
default:
ret = -EINVAL;
goto err;
}
switch (gpio) {
case 0:
case 2:
pos = 0;
break;
case 1:
case 3:
default:
pos = 4;
break;
}
ret = regmap_update_bits(state->regmap, addr, 0x0f << pos,
gpioval << pos);
if (ret)
goto err;
return 0;
err:
dev_dbg(&client->dev, "failed %d\n", ret);
return ret;
}
static int af9013_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *fesettings)
{
fesettings->min_delay_ms = 800;
fesettings->step_size = 0;
fesettings->max_drift = 0;
return 0;
Annotation
- Immediate include surface: `af9013_priv.h`.
- Detected declarations: `struct af9013_state`, `function af9013_set_gpio`, `function af9013_get_tune_settings`, `function af9013_set_frontend`, `function af9013_get_frontend`, `function af9013_read_status`, `function time_is_before_jiffies`, `function af9013_read_snr`, `function af9013_read_signal_strength`, `function af9013_read_ber`.
- 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.