drivers/hwtracing/coresight/coresight-ctcu-core.c
Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-ctcu-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/coresight/coresight-ctcu-core.c- Extension
.c- Size
- 8214 bytes
- Lines
- 313
- Domain
- Driver Families
- Bucket
- drivers/hwtracing
- 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
linux/clk.hlinux/coresight.hlinux/device.hlinux/err.hlinux/kernel.hlinux/init.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/slab.hcoresight-ctcu.hcoresight-priv.h
Detected Declarations
function ctcu_program_atid_registerfunction __ctcu_set_etr_traceidfunction ctcu_get_active_portfunction ctcu_set_etr_traceidfunction ctcu_enablefunction ctcu_disablefunction ctcu_probefunction ctcu_removefunction ctcu_platform_probefunction ctcu_platform_removefunction ctcu_runtime_suspendfunction ctcu_runtime_resume
Annotated Snippet
if (cfgs->num_etr_config <= ETR_MAX_NUM) {
for (i = 0; i < cfgs->num_etr_config; i++) {
etr_cfg = &cfgs->etr_cfgs[i];
drvdata->atid_offset[i] = etr_cfg->atid_offset;
}
}
}
drvdata->base = base;
drvdata->dev = dev;
platform_set_drvdata(pdev, drvdata);
desc.type = CORESIGHT_DEV_TYPE_HELPER;
desc.subtype.helper_subtype = CORESIGHT_DEV_SUBTYPE_HELPER_CTCU;
desc.pdata = pdata;
desc.dev = dev;
desc.ops = &ctcu_ops;
desc.access = CSDEV_ACCESS_IOMEM(base);
raw_spin_lock_init(&drvdata->spin_lock);
drvdata->csdev = coresight_register(&desc);
if (IS_ERR(drvdata->csdev))
return PTR_ERR(drvdata->csdev);
return 0;
}
static void ctcu_remove(struct platform_device *pdev)
{
struct ctcu_drvdata *drvdata = platform_get_drvdata(pdev);
coresight_unregister(drvdata->csdev);
}
static int ctcu_platform_probe(struct platform_device *pdev)
{
int ret;
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
ret = ctcu_probe(pdev);
pm_runtime_put(&pdev->dev);
if (ret)
pm_runtime_disable(&pdev->dev);
return ret;
}
static void ctcu_platform_remove(struct platform_device *pdev)
{
struct ctcu_drvdata *drvdata = platform_get_drvdata(pdev);
if (WARN_ON(!drvdata))
return;
ctcu_remove(pdev);
pm_runtime_disable(&pdev->dev);
}
#ifdef CONFIG_PM
static int ctcu_runtime_suspend(struct device *dev)
{
struct ctcu_drvdata *drvdata = dev_get_drvdata(dev);
clk_disable_unprepare(drvdata->apb_clk);
return 0;
}
static int ctcu_runtime_resume(struct device *dev)
{
struct ctcu_drvdata *drvdata = dev_get_drvdata(dev);
return clk_prepare_enable(drvdata->apb_clk);
}
#endif
static const struct dev_pm_ops ctcu_dev_pm_ops = {
SET_RUNTIME_PM_OPS(ctcu_runtime_suspend, ctcu_runtime_resume, NULL)
};
static const struct of_device_id ctcu_match[] = {
{.compatible = "qcom,sa8775p-ctcu", .data = &sa8775p_cfgs},
{}
};
static struct platform_driver ctcu_driver = {
.probe = ctcu_platform_probe,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/coresight.h`, `linux/device.h`, `linux/err.h`, `linux/kernel.h`, `linux/init.h`, `linux/io.h`, `linux/module.h`.
- Detected declarations: `function ctcu_program_atid_register`, `function __ctcu_set_etr_traceid`, `function ctcu_get_active_port`, `function ctcu_set_etr_traceid`, `function ctcu_enable`, `function ctcu_disable`, `function ctcu_probe`, `function ctcu_remove`, `function ctcu_platform_probe`, `function ctcu_platform_remove`.
- Atlas domain: Driver Families / drivers/hwtracing.
- 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.