drivers/media/pci/smipcie/smipcie-ir.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/smipcie/smipcie-ir.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/smipcie/smipcie-ir.c- Extension
.c- Size
- 4257 bytes
- Lines
- 187
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
smipcie.h
Detected Declarations
function Copyrightfunction smi_ir_disableInterruptfunction smi_ir_clearInterruptfunction smi_ir_stopfunction smi_raw_processfunction smi_ir_decodefunction smi_ir_irqfunction smi_ir_startfunction smi_ir_initfunction smi_ir_exit
Annotated Snippet
if (buffer[cnt] & 0x7f) {
rawir.pulse = (buffer[cnt] & 0x80) == 0;
rawir.duration = ((buffer[cnt] & 0x7f) +
(rawir.pulse ? 0 : -1)) *
rc_dev->rx_resolution;
ir_raw_event_store_with_filter(rc_dev, &rawir);
}
}
}
static void smi_ir_decode(struct smi_rc *ir)
{
struct smi_dev *dev = ir->dev;
struct rc_dev *rc_dev = ir->rc_dev;
u32 control, data;
u8 index, ir_count, read_loop;
control = smi_read(IR_Init_Reg);
dev_dbg(&rc_dev->dev, "ircontrol: 0x%08x\n", control);
if (control & rbIRVld) {
ir_count = (u8)smi_read(IR_Data_Cnt);
dev_dbg(&rc_dev->dev, "ircount %d\n", ir_count);
read_loop = ir_count / 4;
if (ir_count % 4)
read_loop += 1;
for (index = 0; index < read_loop; index++) {
data = smi_read(IR_DATA_BUFFER_BASE + (index * 4));
dev_dbg(&rc_dev->dev, "IRData 0x%08x\n", data);
ir->irData[index * 4 + 0] = (u8)(data);
ir->irData[index * 4 + 1] = (u8)(data >> 8);
ir->irData[index * 4 + 2] = (u8)(data >> 16);
ir->irData[index * 4 + 3] = (u8)(data >> 24);
}
smi_raw_process(rc_dev, ir->irData, ir_count);
}
if (control & rbIRhighidle) {
struct ir_raw_event rawir = {};
dev_dbg(&rc_dev->dev, "high idle\n");
rawir.pulse = 0;
rawir.duration = SMI_SAMPLE_PERIOD * SMI_SAMPLE_IDLEMIN;
ir_raw_event_store_with_filter(rc_dev, &rawir);
}
smi_set(IR_Init_Reg, rbIRVld);
ir_raw_event_handle(rc_dev);
}
/* ir functions call by main driver.*/
int smi_ir_irq(struct smi_rc *ir, u32 int_status)
{
int handled = 0;
if (int_status & IR_X_INT) {
smi_ir_disableInterrupt(ir);
smi_ir_clearInterrupt(ir);
smi_ir_decode(ir);
smi_ir_enableInterrupt(ir);
handled = 1;
}
return handled;
}
void smi_ir_start(struct smi_rc *ir)
{
struct smi_dev *dev = ir->dev;
smi_write(IR_Idle_Cnt_Low,
(((SMI_SAMPLE_PERIOD - 1) & 0xFFFF) << 16) |
(SMI_SAMPLE_IDLEMIN & 0xFFFF));
msleep(20);
smi_set(IR_Init_Reg, rbIRen | rbIRhighidle);
smi_ir_enableInterrupt(ir);
}
int smi_ir_init(struct smi_dev *dev)
{
int ret;
struct rc_dev *rc_dev;
struct smi_rc *ir = &dev->ir;
rc_dev = rc_allocate_device(RC_DRIVER_IR_RAW);
Annotation
- Immediate include surface: `smipcie.h`.
- Detected declarations: `function Copyright`, `function smi_ir_disableInterrupt`, `function smi_ir_clearInterrupt`, `function smi_ir_stop`, `function smi_raw_process`, `function smi_ir_decode`, `function smi_ir_irq`, `function smi_ir_start`, `function smi_ir_init`, `function smi_ir_exit`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.