drivers/media/usb/dvb-usb/gp8psk.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/gp8psk.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/gp8psk.c- Extension
.c- Size
- 10089 bytes
- Lines
- 401
- 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
gp8psk.hgp8psk-fe.h
Detected Declarations
struct gp8psk_statefunction gp8psk_usb_in_opfunction gp8psk_usb_out_opfunction usb_sndctrlpipefunction gp8psk_get_fw_versionfunction gp8psk_get_fpga_versionfunction gp8psk_infofunction gp8psk_load_bcm4500fwfunction gp8psk_power_ctrlfunction gp8psk_bcm4500_reloadfunction gp8psk_streaming_ctrlfunction gp8psk_fe_infunction gp8psk_fe_outfunction gp8psk_fe_reloadfunction gp8psk_frontend_attachfunction gp8psk_usb_probe
Annotated Snippet
struct gp8psk_state {
unsigned char data[80];
};
static int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
u16 index, u8 *b, int blen)
{
struct gp8psk_state *st = d->priv;
int ret = 0,try = 0;
if (blen > sizeof(st->data))
return -EIO;
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
while (ret >= 0 && ret != blen && try < 3) {
ret = usb_control_msg(d->udev,
usb_rcvctrlpipe(d->udev,0),
req,
USB_TYPE_VENDOR | USB_DIR_IN,
value, index, st->data, blen,
2000);
deb_info("reading number %d (ret: %d)\n",try,ret);
try++;
}
if (ret < 0 || ret != blen) {
warn("usb in %d operation failed.", req);
ret = -EIO;
} else {
ret = 0;
memcpy(b, st->data, blen);
}
deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
debug_dump(b,blen,deb_xfer);
mutex_unlock(&d->usb_mutex);
return ret;
}
static int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
u16 index, u8 *b, int blen)
{
struct gp8psk_state *st = d->priv;
int ret;
deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index);
debug_dump(b,blen,deb_xfer);
if (blen > sizeof(st->data))
return -EIO;
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
memcpy(st->data, b, blen);
if (usb_control_msg(d->udev,
usb_sndctrlpipe(d->udev,0),
req,
USB_TYPE_VENDOR | USB_DIR_OUT,
value, index, st->data, blen,
2000) != blen) {
warn("usb out operation failed.");
ret = -EIO;
} else
ret = 0;
mutex_unlock(&d->usb_mutex);
return ret;
}
static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers)
{
return gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6);
}
static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers)
{
return gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1);
}
static void gp8psk_info(struct dvb_usb_device *d)
{
u8 fpga_vers, fw_vers[6];
if (!gp8psk_get_fw_version(d, fw_vers))
Annotation
- Immediate include surface: `gp8psk.h`, `gp8psk-fe.h`.
- Detected declarations: `struct gp8psk_state`, `function gp8psk_usb_in_op`, `function gp8psk_usb_out_op`, `function usb_sndctrlpipe`, `function gp8psk_get_fw_version`, `function gp8psk_get_fpga_version`, `function gp8psk_info`, `function gp8psk_load_bcm4500fw`, `function gp8psk_power_ctrl`, `function gp8psk_bcm4500_reload`.
- 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.