drivers/media/tuners/tua9001.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/tua9001.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/tua9001.c- Extension
.c- Size
- 5622 bytes
- Lines
- 268
- 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
tua9001_priv.h
Detected Declarations
function Copyrightfunction tua9001_sleepfunction tua9001_set_paramsfunction tua9001_get_if_frequencyfunction tua9001_probefunction tua9001_remove
Annotated Snippet
switch (c->bandwidth_hz) {
case 8000000:
val = 0x0000;
break;
case 7000000:
val = 0x1000;
break;
case 6000000:
val = 0x2000;
break;
case 5000000:
val = 0x3000;
break;
default:
ret = -EINVAL;
goto err;
}
break;
default:
ret = -EINVAL;
goto err;
}
data[0].reg = 0x04;
data[0].val = val;
data[1].reg = 0x1f;
data[1].val = div_u64((u64) (c->frequency - 150000000) * 48, 1000000);
if (fe->callback) {
ret = fe->callback(client->adapter,
DVB_FRONTEND_COMPONENT_TUNER,
TUA9001_CMD_RXEN, 0);
if (ret)
goto err;
}
for (i = 0; i < ARRAY_SIZE(data); i++) {
ret = regmap_write(dev->regmap, data[i].reg, data[i].val);
if (ret)
goto err;
}
if (fe->callback) {
ret = fe->callback(client->adapter,
DVB_FRONTEND_COMPONENT_TUNER,
TUA9001_CMD_RXEN, 1);
if (ret)
goto err;
}
return 0;
err:
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
}
static int tua9001_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tua9001_dev *dev = fe->tuner_priv;
struct i2c_client *client = dev->client;
dev_dbg(&client->dev, "\n");
*frequency = 0; /* Zero-IF */
return 0;
}
static const struct dvb_tuner_ops tua9001_tuner_ops = {
.info = {
.name = "Infineon TUA9001",
.frequency_min_hz = 170 * MHz,
.frequency_max_hz = 862 * MHz,
},
.init = tua9001_init,
.sleep = tua9001_sleep,
.set_params = tua9001_set_params,
.get_if_frequency = tua9001_get_if_frequency,
};
static int tua9001_probe(struct i2c_client *client)
{
struct tua9001_dev *dev;
struct tua9001_platform_data *pdata = client->dev.platform_data;
struct dvb_frontend *fe = pdata->dvb_frontend;
int ret;
static const struct regmap_config regmap_config = {
.reg_bits = 8,
.val_bits = 16,
};
Annotation
- Immediate include surface: `tua9001_priv.h`.
- Detected declarations: `function Copyright`, `function tua9001_sleep`, `function tua9001_set_params`, `function tua9001_get_if_frequency`, `function tua9001_probe`, `function tua9001_remove`.
- 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.