drivers/media/usb/dvb-usb/cxusb.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/cxusb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/cxusb.c- Extension
.c- Size
- 58641 bytes
- Lines
- 2401
- 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.
- 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
media/tuner.hlinux/delay.hlinux/device.hlinux/kernel.hlinux/slab.hlinux/string.hlinux/vmalloc.hcxusb.hcx22702.hlgdt330x.hmt352.hmt352_priv.hzl10353.hxc2028.htuner-simple.hmxl5005s.hmax2165.hdib7000p.hdib0070.hlgs8gxx.hatbm8830.hsi2168.hsi2157.h
Detected Declarations
struct dib0700_adapter_stateenum cxusb_table_indexfunction cxusb_ctrl_msgfunction cxusb_gpio_tunerfunction cxusb_bluebird_gpio_rwfunction cxusb_bluebird_gpio_pulsefunction cxusb_nano2_ledfunction cxusb_d680_dmb_gpio_tunerfunction cxusb_i2c_xferfunction cxusb_i2c_funcfunction _cxusb_power_ctrlfunction cxusb_power_ctrlfunction cxusb_aver_power_ctrlfunction cxusb_bluebird_power_ctrlfunction cxusb_nano2_power_ctrlfunction cxusb_d680_dmb_power_ctrlfunction cxusb_streaming_ctrlfunction cxusb_aver_streaming_ctrlfunction cxusb_d680_dmb_drain_messagefunction cxusb_d680_dmb_drain_videofunction cxusb_d680_dmb_streaming_ctrlfunction cxusb_rc_queryfunction cxusb_bluebird2_rc_queryfunction cxusb_d680_dmb_rc_queryfunction cxusb_dee1601_demod_initfunction cxusb_mt352_demod_initfunction cxusb_fmd1216me_tuner_attachfunction cxusb_dee1601_tuner_attachfunction cxusb_lgz201_tuner_attachfunction cxusb_dtt7579_tuner_attachfunction cxusb_lgh064f_tuner_attachfunction dvico_bluebird_xc2028_callbackfunction cxusb_dvico_xc3028_tuner_attachfunction cxusb_mxl5003s_tuner_attachfunction cxusb_d680_dmb_tuner_attachfunction cxusb_mygica_d689_tuner_attachfunction cxusb_medion_fe_ts_bus_ctrlfunction cxusb_medion_set_modefunction cxusb_cx22702_frontend_attachfunction cxusb_lgdt3303_frontend_attachfunction cxusb_aver_lgdt3303_frontend_attachfunction cxusb_mt352_frontend_attachfunction cxusb_dee1601_frontend_attachfunction cxusb_dualdig4_frontend_attachfunction cxusb_dualdig4_rev2_frontend_attachfunction dib7070_tuner_resetfunction dib7070_tuner_sleepfunction dib7070_set_param_override
Annotated Snippet
struct dib0700_adapter_state {
int (*set_param_save)(struct dvb_frontend *fe);
struct dib7000p_ops dib7000p_ops;
};
static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_adapter_state *state = adap->priv;
if (usb_set_interface(adap->dev->udev, 0, 1) < 0)
err("set interface failed");
cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1);
if (!dvb_attach(dib7000p_attach, &state->dib7000p_ops))
return -ENODEV;
if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
&cxusb_dualdig4_rev2_config) < 0) {
pr_warn("Unable to enumerate dib7000p\n");
return -ENODEV;
}
adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap,
0x80,
&cxusb_dualdig4_rev2_config);
if (!adap->fe_adap[0].fe)
return -EIO;
return 0;
}
static int dib7070_tuner_reset(struct dvb_frontend *fe, int onoff)
{
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct dib0700_adapter_state *state = adap->priv;
return state->dib7000p_ops.set_gpio(fe, 8, 0, !onoff);
}
static int dib7070_tuner_sleep(struct dvb_frontend *fe, int onoff)
{
return 0;
}
static struct dib0070_config dib7070p_dib0070_config = {
.i2c_address = DEFAULT_DIB0070_I2C_ADDRESS,
.reset = dib7070_tuner_reset,
.sleep = dib7070_tuner_sleep,
.clock_khz = 12000,
};
static int dib7070_set_param_override(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct dvb_usb_adapter *adap = fe->dvb->priv;
struct dib0700_adapter_state *state = adap->priv;
u16 offset;
u8 band = BAND_OF_FREQUENCY(p->frequency / 1000);
switch (band) {
case BAND_VHF:
offset = 950;
break;
default:
case BAND_UHF:
offset = 550;
break;
}
state->dib7000p_ops.set_wbd_ref(fe, offset + dib0070_wbd_offset(fe));
return state->set_param_save(fe);
}
static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_adapter_state *st = adap->priv;
struct i2c_adapter *tun_i2c;
/*
* No need to call dvb7000p_attach here, as it was called
* already, as frontend_attach method is called first, and
* tuner_attach is only called on success.
*/
tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe,
DIBX000_I2C_INTERFACE_TUNER, 1);
Annotation
- Immediate include surface: `media/tuner.h`, `linux/delay.h`, `linux/device.h`, `linux/kernel.h`, `linux/slab.h`, `linux/string.h`, `linux/vmalloc.h`, `cxusb.h`.
- Detected declarations: `struct dib0700_adapter_state`, `enum cxusb_table_index`, `function cxusb_ctrl_msg`, `function cxusb_gpio_tuner`, `function cxusb_bluebird_gpio_rw`, `function cxusb_bluebird_gpio_pulse`, `function cxusb_nano2_led`, `function cxusb_d680_dmb_gpio_tuner`, `function cxusb_i2c_xfer`, `function cxusb_i2c_func`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.