drivers/media/rc/img-ir/img-ir-core.c
Source file repositories/reference/linux-study-clean/drivers/media/rc/img-ir/img-ir-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/rc/img-ir/img-ir-core.c- Extension
.c- Size
- 4927 bytes
- Lines
- 192
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/platform_device.hlinux/slab.hlinux/spinlock.himg-ir.h
Detected Declarations
function img_ir_isrfunction img_ir_setupfunction img_ir_identfunction img_ir_probefunction img_ir_remove
Annotated Snippet
if (error) {
dev_err(&pdev->dev, "cannot enable sys clock\n");
return error;
}
}
/* Set up raw & hw decoder */
error = img_ir_probe_raw(priv);
error2 = img_ir_probe_hw(priv);
if (error && error2) {
if (error == -ENODEV)
error = error2;
goto err_probe;
}
/* Get the IRQ */
priv->irq = irq;
error = request_irq(priv->irq, img_ir_isr, 0, "img-ir", priv);
if (error) {
dev_err(&pdev->dev, "cannot register IRQ %u\n",
priv->irq);
error = -EIO;
goto err_irq;
}
img_ir_ident(priv);
img_ir_setup(priv);
return 0;
err_irq:
img_ir_remove_hw(priv);
img_ir_remove_raw(priv);
err_probe:
if (!IS_ERR(priv->sys_clk))
clk_disable_unprepare(priv->sys_clk);
return error;
}
static void img_ir_remove(struct platform_device *pdev)
{
struct img_ir_priv *priv = platform_get_drvdata(pdev);
free_irq(priv->irq, priv);
img_ir_remove_hw(priv);
img_ir_remove_raw(priv);
if (!IS_ERR(priv->clk))
clk_disable_unprepare(priv->clk);
if (!IS_ERR(priv->sys_clk))
clk_disable_unprepare(priv->sys_clk);
}
static SIMPLE_DEV_PM_OPS(img_ir_pmops, img_ir_suspend, img_ir_resume);
static const struct of_device_id img_ir_match[] = {
{ .compatible = "img,ir-rev1" },
{}
};
MODULE_DEVICE_TABLE(of, img_ir_match);
static struct platform_driver img_ir_driver = {
.driver = {
.name = "img-ir",
.of_match_table = img_ir_match,
.pm = &img_ir_pmops,
},
.probe = img_ir_probe,
.remove = img_ir_remove,
};
module_platform_driver(img_ir_driver);
MODULE_AUTHOR("Imagination Technologies Ltd.");
MODULE_DESCRIPTION("ImgTec IR");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/clk.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/spinlock.h`.
- Detected declarations: `function img_ir_isr`, `function img_ir_setup`, `function img_ir_ident`, `function img_ir_probe`, `function img_ir_remove`.
- 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.
- 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.