drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c- Extension
.c- Size
- 42104 bytes
- Lines
- 1769
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/init.hlinux/slab.hlinux/wait.hlinux/fs.hlinux/module.hlinux/usb.hlinux/delay.hlinux/time.hlinux/errno.hlinux/jiffies.hlinux/mutex.hlinux/firmware.hmedia/dvb_frontend.hmedia/dmxdev.hmedia/dvb_demux.hmedia/dvb_net.hves1820.hcx22700.htda1004x.hstv0299.htda8083.hstv0297.hlnbp21.hlinux/dvb/frontend.hlinux/dvb/dmx.hlinux/pci.h
Detected Declarations
struct ttusbfunction ttusb_cmdfunction ttusb_i2c_msgfunction master_xferfunction ttusb_boot_dspfunction ttusb_set_channelfunction ttusb_del_channelfunction ttusb_set_filterfunction ttusb_del_filterfunction ttusb_init_controllerfunction ttusb_send_diseqcfunction ttusb_update_lnbfunction ttusb_set_voltagefunction ttusb_set_tonefunction ttusb_set_led_freqfunction ttusb_process_muxpackfunction ttusb_process_framefunction ttusb_iso_irqfunction ttusb_free_iso_urbsfunction ttusb_alloc_iso_urbsfunction ttusb_stop_iso_xferfunction ttusb_start_iso_xferfunction ttusb_handle_ts_datafunction ttusb_handle_sec_datafunction ttusb_start_feedfunction ttusb_stop_feedfunction ttusb_setup_interfacesfunction stc_openfunction stc_readfunction stc_releasefunction functionalityfunction alps_tdmb7_tuner_set_paramsfunction philips_tdm1316l_tuner_initfunction philips_tdm1316l_tuner_set_paramsfunction philips_tdm1316l_request_firmwarefunction alps_stv0299_set_symbol_ratefunction philips_tsa5059_tuner_set_paramsfunction ttusb_novas_grundig_29504_491_tuner_set_paramsfunction alps_tdbe2_tuner_set_paramsfunction read_pwmfunction dvbc_philips_tdm1316l_tuner_set_paramsfunction frontend_initfunction ttusb_probefunction ttusb_disconnect
Annotated Snippet
static const struct file_operations stc_fops = {
.owner = THIS_MODULE,
.read = stc_read,
.open = stc_open,
.release = stc_release,
};
#endif
static u32 functionality(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C;
}
static int alps_tdmb7_tuner_set_params(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
u8 data[4];
struct i2c_msg msg = {.addr=0x61, .flags=0, .buf=data, .len=sizeof(data) };
u32 div;
div = (p->frequency + 36166667) / 166667;
data[0] = (div >> 8) & 0x7f;
data[1] = div & 0xff;
data[2] = ((div >> 10) & 0x60) | 0x85;
data[3] = p->frequency < 592000000 ? 0x40 : 0x80;
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1) return -EIO;
return 0;
}
static struct cx22700_config alps_tdmb7_config = {
.demod_address = 0x43,
};
static int philips_tdm1316l_tuner_init(struct dvb_frontend* fe)
{
struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
static u8 td1316_init[] = { 0x0b, 0xf5, 0x85, 0xab };
static u8 disable_mc44BC374c[] = { 0x1d, 0x74, 0xa0, 0x68 };
struct i2c_msg tuner_msg = { .addr=0x60, .flags=0, .buf=td1316_init, .len=sizeof(td1316_init) };
// setup PLL configuration
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) return -EIO;
msleep(1);
// disable the mc44BC374c (do not check for errors)
tuner_msg.addr = 0x65;
tuner_msg.buf = disable_mc44BC374c;
tuner_msg.len = sizeof(disable_mc44BC374c);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) {
i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1);
}
return 0;
}
static int philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
u8 tuner_buf[4];
struct i2c_msg tuner_msg = {.addr=0x60, .flags=0, .buf=tuner_buf, .len=sizeof(tuner_buf) };
int tuner_frequency = 0;
u8 band, cp, filter;
// determine charge pump
tuner_frequency = p->frequency + 36130000;
if (tuner_frequency < 87000000) return -EINVAL;
else if (tuner_frequency < 130000000) cp = 3;
else if (tuner_frequency < 160000000) cp = 5;
else if (tuner_frequency < 200000000) cp = 6;
else if (tuner_frequency < 290000000) cp = 3;
else if (tuner_frequency < 420000000) cp = 5;
else if (tuner_frequency < 480000000) cp = 6;
else if (tuner_frequency < 620000000) cp = 3;
else if (tuner_frequency < 830000000) cp = 5;
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/wait.h`, `linux/fs.h`, `linux/module.h`, `linux/usb.h`, `linux/delay.h`, `linux/time.h`.
- Detected declarations: `struct ttusb`, `function ttusb_cmd`, `function ttusb_i2c_msg`, `function master_xfer`, `function ttusb_boot_dsp`, `function ttusb_set_channel`, `function ttusb_del_channel`, `function ttusb_set_filter`, `function ttusb_del_filter`, `function ttusb_init_controller`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.