drivers/media/usb/dvb-usb-v2/lmedm04.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/lmedm04.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/lmedm04.c- Extension
.c- Size
- 30054 bytes
- Lines
- 1275
- 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
linux/usb.hlinux/usb/input.hmedia/rc-core.hdvb_usb.hlmedm04.htda826x.htda10086.hstv0288.hix2505v.hstv0299.hdvb-pll.hz0194a.hm88rs2000.hts2020.h
Detected Declarations
struct lme2510_statefunction lme2510_usb_talkfunction lme2510_stream_restartfunction lme2510_enable_pidfunction lme2510_update_statsfunction lme2510_int_responsefunction lme2510_int_readfunction lme2510_pid_filter_ctrlfunction lme2510_pid_filterfunction lme2510_return_statusfunction lme2510_msgfunction lme2510_i2c_xferfunction lme2510_i2c_funcfunction lme2510_streaming_ctrlfunction check_sumfunction lme2510_download_firmwarefunction lme_coldresetfunction dm04_lme2510_set_voltagefunction dm04_read_statusfunction dm04_read_signal_strengthfunction dm04_read_snrfunction dm04_read_berfunction dm04_read_ucblocksfunction lme_namefunction dm04_lme2510_frontend_attachfunction dm04_lme2510_tunerfunction lme2510_powerupfunction lme2510_identify_statefunction lme2510_get_stream_configfunction lme2510_get_rc_configfunction lme2510_exit
Annotated Snippet
struct lme2510_state {
unsigned long int_urb_due;
enum fe_status lock_status;
u8 id;
u8 tuner_config;
u8 signal_level;
u8 signal_sn;
u8 time_key;
u8 i2c_talk_onoff;
u8 i2c_gate;
u8 i2c_tuner_gate_w;
u8 i2c_tuner_gate_r;
u8 i2c_tuner_addr;
u8 stream_on;
u8 pid_size;
u8 pid_off;
u8 int_buffer[128];
struct urb *lme_urb;
u8 usb_buffer[64];
/* Frontend original calls */
int (*fe_read_status)(struct dvb_frontend *, enum fe_status *);
int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *);
int (*fe_read_snr)(struct dvb_frontend *, u16 *);
int (*fe_read_ber)(struct dvb_frontend *, u32 *);
int (*fe_read_ucblocks)(struct dvb_frontend *, u32 *);
int (*fe_set_voltage)(struct dvb_frontend *, enum fe_sec_voltage);
u8 dvb_usb_lme2510_firmware;
};
static int lme2510_usb_talk(struct dvb_usb_device *d,
u8 *wbuf, int wlen, u8 *rbuf, int rlen)
{
struct lme2510_state *st = d->priv;
int ret = 0;
if (max(wlen, rlen) > sizeof(st->usb_buffer))
return -EINVAL;
ret = mutex_lock_interruptible(&d->usb_mutex);
if (ret < 0)
return -EAGAIN;
memcpy(st->usb_buffer, wbuf, wlen);
ret = dvb_usbv2_generic_rw_locked(d, st->usb_buffer, wlen,
st->usb_buffer, rlen);
if (rlen)
memcpy(rbuf, st->usb_buffer, rlen);
mutex_unlock(&d->usb_mutex);
return ret;
}
static int lme2510_stream_restart(struct dvb_usb_device *d)
{
struct lme2510_state *st = d->priv;
u8 all_pids[] = LME_ALL_PIDS;
u8 stream_on[] = LME_ST_ON_W;
u8 rbuff[1];
if (st->pid_off)
lme2510_usb_talk(d, all_pids, sizeof(all_pids),
rbuff, sizeof(rbuff));
/*Restart Stream Command*/
return lme2510_usb_talk(d, stream_on, sizeof(stream_on),
rbuff, sizeof(rbuff));
}
static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out)
{
struct lme2510_state *st = d->priv;
static u8 pid_buff[] = LME_ZERO_PID;
static u8 rbuf[1];
u8 pid_no = index * 2;
u8 pid_len = pid_no + 2;
int ret = 0;
deb_info(1, "PID Setting Pid %04x", pid_out);
if (st->pid_size == 0)
ret |= lme2510_stream_restart(d);
pid_buff[2] = pid_no;
pid_buff[3] = (u8)pid_out & 0xff;
pid_buff[4] = pid_no + 1;
pid_buff[5] = (u8)(pid_out >> 8);
if (pid_len > st->pid_size)
st->pid_size = pid_len;
pid_buff[7] = 0x80 + st->pid_size;
Annotation
- Immediate include surface: `linux/usb.h`, `linux/usb/input.h`, `media/rc-core.h`, `dvb_usb.h`, `lmedm04.h`, `tda826x.h`, `tda10086.h`, `stv0288.h`.
- Detected declarations: `struct lme2510_state`, `function lme2510_usb_talk`, `function lme2510_stream_restart`, `function lme2510_enable_pid`, `function lme2510_update_stats`, `function lme2510_int_response`, `function lme2510_int_read`, `function lme2510_pid_filter_ctrl`, `function lme2510_pid_filter`, `function lme2510_return_status`.
- 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.