drivers/platform/x86/intel/bxtwc_tmu.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/bxtwc_tmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/bxtwc_tmu.c- Extension
.c- Size
- 3518 bytes
- Lines
- 137
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- 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/module.hlinux/mod_devicetable.hlinux/interrupt.hlinux/platform_device.hlinux/mfd/intel_soc_pmic.h
Detected Declarations
struct wcove_tmufunction bxt_wcove_tmu_irq_handlerfunction bxt_wcove_tmu_probefunction bxt_wcove_tmu_removefunction bxtwc_tmu_suspendfunction bxtwc_tmu_resume
Annotated Snippet
struct wcove_tmu {
int irq;
struct device *dev;
struct regmap *regmap;
};
static irqreturn_t bxt_wcove_tmu_irq_handler(int irq, void *data)
{
struct wcove_tmu *wctmu = data;
unsigned int tmu_irq;
/* Read TMU interrupt reg */
regmap_read(wctmu->regmap, BXTWC_TMUIRQ, &tmu_irq);
if (tmu_irq & BXTWC_TMU_ALRM_IRQ) {
/* clear TMU irq */
regmap_write(wctmu->regmap, BXTWC_TMUIRQ, tmu_irq);
return IRQ_HANDLED;
}
return IRQ_NONE;
}
static int bxt_wcove_tmu_probe(struct platform_device *pdev)
{
struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
struct wcove_tmu *wctmu;
int ret;
wctmu = devm_kzalloc(&pdev->dev, sizeof(*wctmu), GFP_KERNEL);
if (!wctmu)
return -ENOMEM;
wctmu->dev = &pdev->dev;
wctmu->regmap = pmic->regmap;
wctmu->irq = platform_get_irq(pdev, 0);
if (wctmu->irq < 0)
return wctmu->irq;
ret = devm_request_threaded_irq(&pdev->dev, wctmu->irq,
NULL, bxt_wcove_tmu_irq_handler,
IRQF_ONESHOT, "bxt_wcove_tmu", wctmu);
if (ret) {
dev_err(&pdev->dev, "request irq failed: %d,virq: %d\n",
ret, wctmu->irq);
return ret;
}
/* Unmask TMU second level Wake & System alarm */
regmap_update_bits(wctmu->regmap, BXTWC_MTMUIRQ_REG,
BXTWC_TMU_ALRM_MASK, 0);
platform_set_drvdata(pdev, wctmu);
return 0;
}
static void bxt_wcove_tmu_remove(struct platform_device *pdev)
{
struct wcove_tmu *wctmu = platform_get_drvdata(pdev);
unsigned int val;
/* Mask TMU interrupts */
regmap_read(wctmu->regmap, BXTWC_MIRQLVL1, &val);
regmap_write(wctmu->regmap, BXTWC_MIRQLVL1,
val | BXTWC_MIRQLVL1_MTMU);
regmap_read(wctmu->regmap, BXTWC_MTMUIRQ_REG, &val);
regmap_write(wctmu->regmap, BXTWC_MTMUIRQ_REG,
val | BXTWC_TMU_ALRM_MASK);
}
#ifdef CONFIG_PM_SLEEP
static int bxtwc_tmu_suspend(struct device *dev)
{
struct wcove_tmu *wctmu = dev_get_drvdata(dev);
enable_irq_wake(wctmu->irq);
return 0;
}
static int bxtwc_tmu_resume(struct device *dev)
{
struct wcove_tmu *wctmu = dev_get_drvdata(dev);
disable_irq_wake(wctmu->irq);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(bxtwc_tmu_pm_ops, bxtwc_tmu_suspend, bxtwc_tmu_resume);
static const struct platform_device_id bxt_wcove_tmu_id_table[] = {
Annotation
- Immediate include surface: `linux/module.h`, `linux/mod_devicetable.h`, `linux/interrupt.h`, `linux/platform_device.h`, `linux/mfd/intel_soc_pmic.h`.
- Detected declarations: `struct wcove_tmu`, `function bxt_wcove_tmu_irq_handler`, `function bxt_wcove_tmu_probe`, `function bxt_wcove_tmu_remove`, `function bxtwc_tmu_suspend`, `function bxtwc_tmu_resume`.
- Atlas domain: Driver Families / drivers/platform.
- 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.