drivers/media/rc/streamzap.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/streamzap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/streamzap.c- Extension
.c- Size
- 10836 bytes
- Lines
- 435
- 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.
- 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/device.hlinux/module.hlinux/slab.hlinux/usb.hlinux/usb/input.hmedia/rc-core.h
Detected Declarations
struct streamzap_irenum StreamzapDecoderStatefunction sz_pushfunction sz_push_full_pulsefunction sz_push_half_pulsefunction sz_push_full_spacefunction sz_push_half_spacefunction sz_process_ir_datafunction streamzap_callbackfunction streamzap_probefunction streamzap_disconnectfunction streamzap_suspendfunction streamzap_resume
Annotated Snippet
struct streamzap_ir {
/* ir-core */
struct rc_dev *rdev;
/* core device info */
struct device *dev;
/* usb */
struct urb *urb_in;
/* buffer & dma */
unsigned char *buf_in;
dma_addr_t dma_in;
unsigned int buf_in_len;
/* track what state we're in */
enum StreamzapDecoderState decoder_state;
char phys[64];
};
/* local function prototypes */
static int streamzap_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void streamzap_disconnect(struct usb_interface *interface);
static void streamzap_callback(struct urb *urb);
static int streamzap_suspend(struct usb_interface *intf, pm_message_t message);
static int streamzap_resume(struct usb_interface *intf);
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver streamzap_driver = {
.name = DRIVER_NAME,
.probe = streamzap_probe,
.disconnect = streamzap_disconnect,
.suspend = streamzap_suspend,
.resume = streamzap_resume,
.id_table = streamzap_table,
};
static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir)
{
dev_dbg(sz->dev, "Storing %s with duration %u us\n",
(rawir.pulse ? "pulse" : "space"), rawir.duration);
ir_raw_event_store_with_filter(sz->rdev, &rawir);
}
static void sz_push_full_pulse(struct streamzap_ir *sz,
unsigned char value)
{
struct ir_raw_event rawir = {
.pulse = true,
.duration = value * SZ_RESOLUTION + SZ_RESOLUTION / 2,
};
sz_push(sz, rawir);
}
static void sz_push_half_pulse(struct streamzap_ir *sz,
unsigned char value)
{
sz_push_full_pulse(sz, (value & SZ_PULSE_MASK) >> 4);
}
static void sz_push_full_space(struct streamzap_ir *sz,
unsigned char value)
{
struct ir_raw_event rawir = {
.pulse = false,
.duration = value * SZ_RESOLUTION + SZ_RESOLUTION / 2,
};
sz_push(sz, rawir);
}
static void sz_push_half_space(struct streamzap_ir *sz,
unsigned long value)
{
sz_push_full_space(sz, value & SZ_SPACE_MASK);
}
static void sz_process_ir_data(struct streamzap_ir *sz, int len)
{
unsigned int i;
for (i = 0; i < len; i++) {
dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n",
i, (unsigned char)sz->buf_in[i]);
switch (sz->decoder_state) {
case PulseSpace:
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/slab.h`, `linux/usb.h`, `linux/usb/input.h`, `media/rc-core.h`.
- Detected declarations: `struct streamzap_ir`, `enum StreamzapDecoderState`, `function sz_push`, `function sz_push_full_pulse`, `function sz_push_half_pulse`, `function sz_push_full_space`, `function sz_push_half_space`, `function sz_process_ir_data`, `function streamzap_callback`, `function streamzap_probe`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.