drivers/media/dvb-frontends/cxd2820r_core.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/cxd2820r_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/cxd2820r_core.c- Extension
.c- Size
- 18186 bytes
- Lines
- 746
- 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.
- 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
cxd2820r_priv.h
Detected Declarations
function Copyrightfunction cxd2820r_gpiofunction cxd2820r_set_frontendfunction cxd2820r_read_statusfunction cxd2820r_get_frontendfunction cxd2820r_read_berfunction cxd2820r_read_signal_strengthfunction cxd2820r_read_snrfunction cxd2820r_read_ucblocksfunction cxd2820r_initfunction cxd2820r_sleepfunction cxd2820r_get_tune_settingsfunction cxd2820r_searchfunction cxd2820r_get_frontend_algofunction cxd2820r_releasefunction cxd2820r_i2c_gate_ctrlfunction cxd2820r_gpio_direction_outputfunction cxd2820r_gpio_setfunction cxd2820r_gpio_getfunction cxd2820r_probefunction cxd2820r_removeexport cxd2820r_attach
Annotated Snippet
if (priv->delivery_system == SYS_DVBT) {
ret = cxd2820r_sleep_t(fe);
if (ret)
goto error;
c->delivery_system = SYS_DVBT2;
} else if (priv->delivery_system == SYS_DVBT2) {
ret = cxd2820r_sleep_t2(fe);
if (ret)
goto error;
c->delivery_system = SYS_DVBT;
}
}
/* set frontend */
ret = cxd2820r_set_frontend(fe);
if (ret)
goto error;
/* frontend lock wait loop count */
switch (priv->delivery_system) {
case SYS_DVBT:
case SYS_DVBC_ANNEX_A:
i = 20;
break;
case SYS_DVBT2:
i = 40;
break;
case SYS_UNDEFINED:
default:
i = 0;
break;
}
/* wait frontend lock */
for (; i > 0; i--) {
dev_dbg(&client->dev, "loop=%d\n", i);
msleep(50);
ret = cxd2820r_read_status(fe, &status);
if (ret)
goto error;
if (status & FE_HAS_LOCK)
break;
}
/* check if we have a valid signal */
if (status & FE_HAS_LOCK) {
priv->last_tune_failed = false;
return DVBFE_ALGO_SEARCH_SUCCESS;
} else {
priv->last_tune_failed = true;
return DVBFE_ALGO_SEARCH_AGAIN;
}
error:
dev_dbg(&client->dev, "failed=%d\n", ret);
return DVBFE_ALGO_SEARCH_ERROR;
}
static enum dvbfe_algo cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
{
return DVBFE_ALGO_CUSTOM;
}
static void cxd2820r_release(struct dvb_frontend *fe)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
struct i2c_client *client = priv->client[0];
dev_dbg(&client->dev, "\n");
i2c_unregister_device(client);
return;
}
static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
struct i2c_client *client = priv->client[0];
dev_dbg_ratelimited(&client->dev, "enable=%d\n", enable);
return regmap_update_bits(priv->regmap[0], 0x00db, 0x01, enable ? 1 : 0);
}
#ifdef CONFIG_GPIOLIB
static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr,
Annotation
- Immediate include surface: `cxd2820r_priv.h`.
- Detected declarations: `function Copyright`, `function cxd2820r_gpio`, `function cxd2820r_set_frontend`, `function cxd2820r_read_status`, `function cxd2820r_get_frontend`, `function cxd2820r_read_ber`, `function cxd2820r_read_signal_strength`, `function cxd2820r_read_snr`, `function cxd2820r_read_ucblocks`, `function cxd2820r_init`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.