drivers/media/pci/ddbridge/ddbridge-core.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/ddbridge/ddbridge-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/ddbridge/ddbridge-core.c- Extension
.c- Size
- 84947 bytes
- Lines
- 3439
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/module.hlinux/init.hlinux/interrupt.hlinux/delay.hlinux/slab.hlinux/poll.hlinux/io.hlinux/pci.hlinux/pci_ids.hlinux/timer.hlinux/i2c.hlinux/swab.hlinux/vmalloc.hddbridge.hddbridge-i2c.hddbridge-regs.hddbridge-max.hddbridge-ci.hddbridge-io.htda18271c2dd.hstv6110x.hstv090x.hlnbh24.hdrxk.hstv0367.hstv0367_priv.hcxd2841er.htda18212.hstv0910.hstv6111.hlnbh25.hcxd2099.h
Detected Declarations
function voidfunction ddb_set_dma_tablefunction ddb_set_dma_tablesfunction ddb_redirect_dmafunction ddb_unredirectfunction ddb_redirectfunction dma_freefunction dma_allocfunction ddb_buffers_allocfunction ddb_buffers_freefunction calc_confunction ddb_output_startfunction ddb_output_stopfunction ddb_input_stopfunction ddb_input_startfunction ddb_input_start_allfunction ddb_input_stop_allfunction ddb_output_freefunction ddb_output_writefunction ddb_input_availfunction ddb_input_readfunction ts_writefunction ts_readfunction ts_pollfunction ts_releasefunction ts_openfunction locked_gate_ctrlfunction demod_attach_drxkfunction tuner_attach_tda18271function demod_attach_stv0367function tuner_tda18212_pingfunction demod_attach_cxd28xxfunction tuner_attach_tda18212function demod_attach_stv0900function tuner_attach_stv6110function has_lnbh25function demod_attach_stv0910function tuner_attach_stv6111function demod_attach_dummyfunction start_feedfunction stop_feedfunction dvb_input_detachfunction dvb_register_adaptersfunction dvb_unregister_adaptersfunction dvb_input_attachfunction V7function port_has_enctifunction port_has_cxd
Annotated Snippet
static const struct file_operations ci_fops = {
.owner = THIS_MODULE,
.read = ts_read,
.write = ts_write,
.open = ts_open,
.release = ts_release,
.poll = ts_poll,
.mmap = NULL,
};
static struct dvb_device dvbdev_ci = {
.priv = NULL,
.readers = 1,
.writers = 1,
.users = 2,
.fops = &ci_fops,
};
/****************************************************************************/
/****************************************************************************/
static int locked_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct ddb_input *input = fe->sec_priv;
struct ddb_port *port = input->port;
struct ddb_dvb *dvb = &port->dvb[input->nr & 1];
int status;
if (enable) {
mutex_lock(&port->i2c_gate_lock);
status = dvb->i2c_gate_ctrl(fe, 1);
} else {
status = dvb->i2c_gate_ctrl(fe, 0);
mutex_unlock(&port->i2c_gate_lock);
}
return status;
}
static int demod_attach_drxk(struct ddb_input *input)
{
struct i2c_adapter *i2c = &input->port->i2c->adap;
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
struct device *dev = input->port->dev->dev;
struct drxk_config config;
memset(&config, 0, sizeof(config));
config.adr = 0x29 + (input->nr & 1);
config.microcode_name = "drxk_a3.mc";
dvb->fe = dvb_attach(drxk_attach, &config, i2c);
if (!dvb->fe) {
dev_err(dev, "No DRXK found!\n");
return -ENODEV;
}
dvb->fe->sec_priv = input;
dvb->i2c_gate_ctrl = dvb->fe->ops.i2c_gate_ctrl;
dvb->fe->ops.i2c_gate_ctrl = locked_gate_ctrl;
return 0;
}
static int tuner_attach_tda18271(struct ddb_input *input)
{
struct i2c_adapter *i2c = &input->port->i2c->adap;
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
struct device *dev = input->port->dev->dev;
struct dvb_frontend *fe;
if (dvb->fe->ops.i2c_gate_ctrl)
dvb->fe->ops.i2c_gate_ctrl(dvb->fe, 1);
fe = dvb_attach(tda18271c2dd_attach, dvb->fe, i2c, 0x60);
if (dvb->fe->ops.i2c_gate_ctrl)
dvb->fe->ops.i2c_gate_ctrl(dvb->fe, 0);
if (!fe) {
dev_err(dev, "No TDA18271 found!\n");
return -ENODEV;
}
return 0;
}
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
static struct stv0367_config ddb_stv0367_config[] = {
{
.demod_address = 0x1f,
.xtal = 27000000,
.if_khz = 0,
.if_iq_mode = FE_TER_NORMAL_IF_TUNER,
.ts_mode = STV0367_SERIAL_PUNCT_CLOCK,
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/slab.h`, `linux/poll.h`, `linux/io.h`, `linux/pci.h`.
- Detected declarations: `function void`, `function ddb_set_dma_table`, `function ddb_set_dma_tables`, `function ddb_redirect_dma`, `function ddb_unredirect`, `function ddb_redirect`, `function dma_free`, `function dma_alloc`, `function ddb_buffers_alloc`, `function ddb_buffers_free`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.