drivers/media/dvb-frontends/zd1301_demod.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/zd1301_demod.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/zd1301_demod.c- Extension
.c- Size
- 12732 bytes
- Lines
- 541
- 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
zd1301_demod.h
Detected Declarations
struct zd1301_demod_devfunction zd1301_demod_wregfunction zd1301_demod_rregfunction zd1301_demod_set_frontendfunction zd1301_demod_sleepfunction zd1301_demod_initfunction zd1301_demod_get_tune_settingsfunction zd1301_demod_read_statusfunction zd1301_demod_i2c_master_xferfunction zd1301_demod_i2c_functionalityfunction zd1301_demod_probefunction zd1301_demod_removeexport zd1301_demod_get_dvb_frontendexport zd1301_demod_get_i2c_adapter
Annotated Snippet
struct zd1301_demod_dev {
struct platform_device *pdev;
struct dvb_frontend frontend;
struct i2c_adapter adapter;
u8 gain;
};
static int zd1301_demod_wreg(struct zd1301_demod_dev *dev, u16 reg, u8 val)
{
struct platform_device *pdev = dev->pdev;
struct zd1301_demod_platform_data *pdata = pdev->dev.platform_data;
return pdata->reg_write(pdata->reg_priv, reg, val);
}
static int zd1301_demod_rreg(struct zd1301_demod_dev *dev, u16 reg, u8 *val)
{
struct platform_device *pdev = dev->pdev;
struct zd1301_demod_platform_data *pdata = pdev->dev.platform_data;
return pdata->reg_read(pdata->reg_priv, reg, val);
}
static int zd1301_demod_set_frontend(struct dvb_frontend *fe)
{
struct zd1301_demod_dev *dev = fe->demodulator_priv;
struct platform_device *pdev = dev->pdev;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret;
u32 if_frequency;
u8 r6a50_val;
dev_dbg(&pdev->dev, "frequency=%u bandwidth_hz=%u\n",
c->frequency, c->bandwidth_hz);
/* Program tuner */
if (fe->ops.tuner_ops.set_params &&
fe->ops.tuner_ops.get_if_frequency) {
ret = fe->ops.tuner_ops.set_params(fe);
if (ret)
goto err;
ret = fe->ops.tuner_ops.get_if_frequency(fe, &if_frequency);
if (ret)
goto err;
} else {
ret = -EINVAL;
goto err;
}
dev_dbg(&pdev->dev, "if_frequency=%u\n", if_frequency);
if (if_frequency != 36150000) {
ret = -EINVAL;
goto err;
}
switch (c->bandwidth_hz) {
case 6000000:
r6a50_val = 0x78;
break;
case 7000000:
r6a50_val = 0x68;
break;
case 8000000:
r6a50_val = 0x58;
break;
default:
ret = -EINVAL;
goto err;
}
ret = zd1301_demod_wreg(dev, 0x6a60, 0x11);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a47, 0x46);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a48, 0x46);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a4a, 0x15);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a4b, 0x63);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a5b, 0x99);
if (ret)
goto err;
ret = zd1301_demod_wreg(dev, 0x6a3b, 0x10);
if (ret)
Annotation
- Immediate include surface: `zd1301_demod.h`.
- Detected declarations: `struct zd1301_demod_dev`, `function zd1301_demod_wreg`, `function zd1301_demod_rreg`, `function zd1301_demod_set_frontend`, `function zd1301_demod_sleep`, `function zd1301_demod_init`, `function zd1301_demod_get_tune_settings`, `function zd1301_demod_read_status`, `function zd1301_demod_i2c_master_xfer`, `function zd1301_demod_i2c_functionality`.
- 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.