drivers/hwtracing/coresight/coresight-tpda.c
Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-tpda.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/coresight/coresight-tpda.c- Extension
.c- Size
- 15644 bytes
- Lines
- 640
- 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/amba/bus.hlinux/bitfield.hlinux/coresight.hlinux/device.hlinux/err.hlinux/fs.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hcoresight-priv.hcoresight-tpda.hcoresight-trace-id.hcoresight-tpdm.h
Detected Declarations
function Copyrightfunction tpda_set_element_sizefunction tpdm_read_element_sizefunction tpda_get_element_sizefunction tpda_enable_pre_portfunction tpda_enable_portfunction __tpda_enablefunction tpda_enablefunction __tpda_disablefunction tpda_disablefunction tpda_trace_idfunction tpda_trig_sysfs_showfunction tpda_trig_sysfs_storefunction global_flush_req_showfunction global_flush_req_storefunction syncr_mode_showfunction syncr_mode_storefunction syncr_count_showfunction syncr_count_storefunction port_flush_req_showfunction port_flush_req_storefunction tpda_init_default_datafunction tpda_probefunction tpda_remove
Annotated Snippet
if (csdev->pdata->in_conns[i]->filter_src_fwnode) {
in = csdev->pdata->in_conns[i]->filter_src_dev;
if (!in)
continue;
}
if (coresight_device_is_tpdm(in)) {
if (drvdata->dsb_esize || drvdata->cmb_esize)
return -EEXIST;
rc = tpdm_read_element_size(drvdata, in);
if (rc)
return rc;
} else {
/* Recurse down the path */
rc = tpda_get_element_size(drvdata, in, -1);
if (rc)
return rc;
}
}
return rc;
}
/* Settings pre enabling port control register */
static void tpda_enable_pre_port(struct tpda_drvdata *drvdata)
{
u32 val = 0;
val |= FIELD_PREP(TPDA_CR_ATID, drvdata->atid);
if (drvdata->trig_async)
val |= TPDA_CR_SRIE;
if (drvdata->trig_flag_ts)
val |= TPDA_CR_FLRIE;
if (drvdata->trig_freq)
val |= TPDA_CR_FRIE;
if (drvdata->freq_ts)
val |= TPDA_CR_FREQTS;
if (drvdata->cmbchan_mode)
val |= TPDA_CR_CMBCHANMODE;
writel_relaxed(val, drvdata->base + TPDA_CR);
/*
* If FLRIE bit is set, set the master and channel
* id as zero
*/
if (drvdata->trig_flag_ts)
writel_relaxed(0x0, drvdata->base + TPDA_FPID_CR);
/* Initialize with a value of 0 */
val = 0;
if (drvdata->syncr_mode)
val |= TPDA_SYNCR_MODE_CTRL_MASK;
if (drvdata->syncr_count > 0 &&
drvdata->syncr_count < TPDA_SYNCR_COUNT_MASK)
val |= drvdata->syncr_count;
else
/* Program the count to its MAX value by default */
val |= TPDA_SYNCR_COUNT_MASK;
writel_relaxed(val, drvdata->base + TPDA_SYNCR);
}
static int tpda_enable_port(struct tpda_drvdata *drvdata, int port)
{
u32 val;
int rc;
val = readl_relaxed(drvdata->base + TPDA_Pn_CR(port));
tpda_clear_element_size(drvdata->csdev);
rc = tpda_get_element_size(drvdata, drvdata->csdev, port);
if (!rc && (drvdata->dsb_esize || drvdata->cmb_esize)) {
tpda_set_element_size(drvdata, &val);
/* Enable the port */
val |= TPDA_Pn_CR_ENA;
writel_relaxed(val, drvdata->base + TPDA_Pn_CR(port));
} else if (rc == -EEXIST)
dev_warn_once(&drvdata->csdev->dev,
"Detected multiple TPDMs on port %d", port);
else
dev_warn_once(&drvdata->csdev->dev,
"Didn't find TPDM element size");
return rc;
}
Annotation
- Immediate include surface: `linux/amba/bus.h`, `linux/bitfield.h`, `linux/coresight.h`, `linux/device.h`, `linux/err.h`, `linux/fs.h`, `linux/io.h`, `linux/kernel.h`.
- Detected declarations: `function Copyright`, `function tpda_set_element_size`, `function tpdm_read_element_size`, `function tpda_get_element_size`, `function tpda_enable_pre_port`, `function tpda_enable_port`, `function __tpda_enable`, `function tpda_enable`, `function __tpda_disable`, `function tpda_disable`.
- 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.