* [PATCH v3 0/3] coresight: add static TPDM support
@ 2025-10-13 6:11 Jie Gan
2025-10-13 6:11 ` [PATCH v3 1/3] dt-bindings: arm: document the static TPDM compatible Jie Gan
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Jie Gan @ 2025-10-13 6:11 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel, Jie Gan, Konrad Dybcio
The static TPDM function as a dummy source, however, it is essential
to enable the port connected to the TPDA and configure the element size.
Without this, the TPDA cannot correctly receive trace data from the
static TPDM. Since the static TPDM does not require MMIO mapping to
access its registers, a clock controller is not mandatory for its
operation.
Meanwhile, a function has been introduced to determine whether the
current csdev is a static TPDM. This check enables the TPDA device
to correctly read the element size and activate its port accordingly.
Otherwise the TPDA cannot receive the trace data from the TPDM device.
Changes in V3:
1. rebased on next-20251010
Link to V2 - https://lore.kernel.org/all/20250911-add_static_tpdm_support-v2-0-608559d36f74@oss.qualcomm.com/
Changes in V2:
1. Remove the dependency.
2. Collect tags from Rob and Konard for patchset 1 and patchset 3.
Link to V1 - https://lore.kernel.org/all/20250822103008.1029-1-jie.gan@oss.qualcomm.com/
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
Jie Gan (3):
dt-bindings: arm: document the static TPDM compatible
coresight: tpdm: add static tpdm support
arm64: dts: qcom: lemans: enable static TPDM
.../bindings/arm/qcom,coresight-tpdm.yaml | 23 +++-
arch/arm64/boot/dts/qcom/lemans.dtsi | 105 +++++++++++++++
drivers/hwtracing/coresight/coresight-tpda.c | 9 ++
drivers/hwtracing/coresight/coresight-tpdm.c | 148 ++++++++++++++++-----
drivers/hwtracing/coresight/coresight-tpdm.h | 8 ++
5 files changed, 256 insertions(+), 37 deletions(-)
---
base-commit: 2b763d4652393c90eaa771a5164502ec9dd965ae
change-id: 20251013-add-static-tpdm-support-330b71d6d0f8
Best regards,
--
Jie Gan <jie.gan@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] dt-bindings: arm: document the static TPDM compatible
2025-10-13 6:11 [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
@ 2025-10-13 6:11 ` Jie Gan
2025-10-13 6:11 ` [PATCH v3 2/3] coresight: tpdm: add static tpdm support Jie Gan
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Jie Gan @ 2025-10-13 6:11 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel, Jie Gan
The static TPDM device is intended for sources that do not require MMIO
mapping. Its compatible string should be documented clearly, along with
an example illustrating how to define a static TPDM node in the DT.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
.../bindings/arm/qcom,coresight-tpdm.yaml | 23 +++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
index 4edc47483851..c349306f0d52 100644
--- a/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
+++ b/Documentation/devicetree/bindings/arm/qcom,coresight-tpdm.yaml
@@ -36,9 +36,12 @@ properties:
$nodename:
pattern: "^tpdm(@[0-9a-f]+)$"
compatible:
- items:
- - const: qcom,coresight-tpdm
- - const: arm,primecell
+ oneOf:
+ - items:
+ - const: qcom,coresight-static-tpdm
+ - items:
+ - const: qcom,coresight-tpdm
+ - const: arm,primecell
reg:
maxItems: 1
@@ -147,4 +150,18 @@ examples:
};
};
};
+
+ turing-llm-tpdm {
+ compatible = "qcom,coresight-static-tpdm";
+
+ qcom,cmb-element-bits = <32>;
+
+ out-ports {
+ port {
+ turing_llm_tpdm_out: endpoint {
+ remote-endpoint = <&turing0_funnel_in1>;
+ };
+ };
+ };
+ };
...
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] coresight: tpdm: add static tpdm support
2025-10-13 6:11 [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
2025-10-13 6:11 ` [PATCH v3 1/3] dt-bindings: arm: document the static TPDM compatible Jie Gan
@ 2025-10-13 6:11 ` Jie Gan
2025-10-27 9:17 ` Suzuki K Poulose
2025-10-13 6:11 ` [PATCH v3 3/3] arm64: dts: qcom: lemans: enable static TPDM Jie Gan
2025-10-27 1:12 ` [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
3 siblings, 1 reply; 7+ messages in thread
From: Jie Gan @ 2025-10-13 6:11 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel, Jie Gan
The static TPDM function as a dummy source, however, it is essential
to enable the port connected to the TPDA and configure the element size.
Without this, the TPDA cannot correctly receive trace data from the
static TPDM. Since the static TPDM does not require MMIO mapping to
access its registers, a clock controller is not mandatory for its
operation.
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
drivers/hwtracing/coresight/coresight-tpda.c | 9 ++
drivers/hwtracing/coresight/coresight-tpdm.c | 148 +++++++++++++++++++++------
drivers/hwtracing/coresight/coresight-tpdm.h | 8 ++
3 files changed, 131 insertions(+), 34 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
index 333b3cb23685..4e93fa5bace4 100644
--- a/drivers/hwtracing/coresight/coresight-tpda.c
+++ b/drivers/hwtracing/coresight/coresight-tpda.c
@@ -68,6 +68,15 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
int rc = -EINVAL;
struct tpdm_drvdata *tpdm_data = dev_get_drvdata(csdev->dev.parent);
+ if (coresight_is_static_tpdm(csdev)) {
+ rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
+ "qcom,dsb-element-bits", &drvdata->dsb_esize);
+ rc &= fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
+ "qcom,cmb-element-bits", &drvdata->cmb_esize);
+
+ goto out;
+ }
+
if (tpdm_data->dsb) {
rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
"qcom,dsb-element-bits", &drvdata->dsb_esize);
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
index 7214e65097ec..1766b0182819 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.c
+++ b/drivers/hwtracing/coresight/coresight-tpdm.c
@@ -495,7 +495,9 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
return -EBUSY;
}
- __tpdm_enable(drvdata);
+ if (!coresight_is_static_tpdm(csdev))
+ __tpdm_enable(drvdata);
+
drvdata->enable = true;
spin_unlock(&drvdata->spinlock);
@@ -551,7 +553,9 @@ static void tpdm_disable(struct coresight_device *csdev,
return;
}
- __tpdm_disable(drvdata);
+ if (!coresight_is_static_tpdm(csdev))
+ __tpdm_disable(drvdata);
+
coresight_set_mode(csdev, CS_MODE_DISABLED);
drvdata->enable = false;
spin_unlock(&drvdata->spinlock);
@@ -1342,10 +1346,9 @@ static const struct attribute_group *tpdm_attr_grps[] = {
NULL,
};
-static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
+static int tpdm_probe(struct device *dev, struct resource *res)
{
void __iomem *base;
- struct device *dev = &adev->dev;
struct coresight_platform_data *pdata;
struct tpdm_drvdata *drvdata;
struct coresight_desc desc = { 0 };
@@ -1354,32 +1357,33 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
pdata = coresight_get_platform_data(dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
- adev->dev.platform_data = pdata;
+ dev->platform_data = pdata;
/* driver data*/
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
- drvdata->dev = &adev->dev;
+ drvdata->dev = dev;
dev_set_drvdata(dev, drvdata);
- base = devm_ioremap_resource(dev, &adev->res);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ if (res) {
+ base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
- drvdata->base = base;
+ drvdata->base = base;
+ ret = tpdm_datasets_setup(drvdata);
+ if (ret)
+ return ret;
- ret = tpdm_datasets_setup(drvdata);
- if (ret)
- return ret;
+ if (drvdata && tpdm_has_dsb_dataset(drvdata))
+ of_property_read_u32(drvdata->dev->of_node,
+ "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
- if (drvdata && tpdm_has_dsb_dataset(drvdata))
- of_property_read_u32(drvdata->dev->of_node,
- "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
-
- if (drvdata && tpdm_has_cmb_dataset(drvdata))
- of_property_read_u32(drvdata->dev->of_node,
- "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
+ if (drvdata && tpdm_has_cmb_dataset(drvdata))
+ of_property_read_u32(drvdata->dev->of_node,
+ "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
+ }
/* Set up coresight component description */
desc.name = coresight_alloc_device_name(&tpdm_devs, dev);
@@ -1388,34 +1392,51 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
desc.type = CORESIGHT_DEV_TYPE_SOURCE;
desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM;
desc.ops = &tpdm_cs_ops;
- desc.pdata = adev->dev.platform_data;
- desc.dev = &adev->dev;
+ desc.pdata = dev->platform_data;
+ desc.dev = dev;
desc.access = CSDEV_ACCESS_IOMEM(base);
- desc.groups = tpdm_attr_grps;
+ if (res)
+ desc.groups = tpdm_attr_grps;
drvdata->csdev = coresight_register(&desc);
if (IS_ERR(drvdata->csdev))
return PTR_ERR(drvdata->csdev);
spin_lock_init(&drvdata->spinlock);
- /* Decrease pm refcount when probe is done.*/
- pm_runtime_put(&adev->dev);
-
return 0;
}
-static void tpdm_remove(struct amba_device *adev)
+static int tpdm_remove(struct device *dev)
{
- struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev);
+ struct tpdm_drvdata *drvdata = dev_get_drvdata(dev);
coresight_unregister(drvdata->csdev);
+
+ return 0;
+}
+
+static int dynamic_tpdm_probe(struct amba_device *adev,
+ const struct amba_id *id)
+{
+ int ret;
+
+ ret = tpdm_probe(&adev->dev, &adev->res);
+ if (!ret)
+ pm_runtime_put(&adev->dev);
+
+ return ret;
+}
+
+static void dynamic_tpdm_remove(struct amba_device *adev)
+{
+ tpdm_remove(&adev->dev);
}
/*
* Different TPDM has different periph id.
* The difference is 0-7 bits' value. So ignore 0-7 bits.
*/
-static const struct amba_id tpdm_ids[] = {
+static const struct amba_id dynamic_tpdm_ids[] = {
{
.id = 0x001f0e00,
.mask = 0x00ffff00,
@@ -1423,17 +1444,76 @@ static const struct amba_id tpdm_ids[] = {
{ 0, 0, NULL },
};
-static struct amba_driver tpdm_driver = {
+MODULE_DEVICE_TABLE(amba, dynamic_tpdm_ids);
+
+static struct amba_driver dynamic_tpdm_driver = {
.drv = {
.name = "coresight-tpdm",
.suppress_bind_attrs = true,
},
- .probe = tpdm_probe,
- .id_table = tpdm_ids,
- .remove = tpdm_remove,
+ .probe = dynamic_tpdm_probe,
+ .id_table = dynamic_tpdm_ids,
+ .remove = dynamic_tpdm_remove,
};
-module_amba_driver(tpdm_driver);
+static int tpdm_platform_probe(struct platform_device *pdev)
+{
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ int ret;
+
+ pm_runtime_get_noresume(&pdev->dev);
+ pm_runtime_set_active(&pdev->dev);
+ pm_runtime_enable(&pdev->dev);
+
+ ret = tpdm_probe(&pdev->dev, res);
+ pm_runtime_put(&pdev->dev);
+ if (ret)
+ pm_runtime_disable(&pdev->dev);
+
+ return ret;
+}
+
+static void tpdm_platform_remove(struct platform_device *pdev)
+{
+ struct tpdm_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
+
+ if (WARN_ON(!drvdata))
+ return;
+
+ tpdm_remove(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+}
+
+static const struct of_device_id static_tpdm_match[] = {
+ {.compatible = "qcom,coresight-static-tpdm"},
+ {}
+};
+
+MODULE_DEVICE_TABLE(of, static_tpdm_match);
+
+static struct platform_driver static_tpdm_driver = {
+ .probe = tpdm_platform_probe,
+ .remove = tpdm_platform_remove,
+ .driver = {
+ .name = "coresight-static-tpdm",
+ .of_match_table = static_tpdm_match,
+ .suppress_bind_attrs = true,
+ },
+};
+
+static int __init tpdm_init(void)
+{
+ return coresight_init_driver("tpdm", &dynamic_tpdm_driver, &static_tpdm_driver,
+ THIS_MODULE);
+}
+
+static void __exit tpdm_exit(void)
+{
+ coresight_remove_driver(&dynamic_tpdm_driver, &static_tpdm_driver);
+}
+
+module_init(tpdm_init);
+module_exit(tpdm_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Monitor driver");
diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h
index b11754389734..9f52c88ce5c1 100644
--- a/drivers/hwtracing/coresight/coresight-tpdm.h
+++ b/drivers/hwtracing/coresight/coresight-tpdm.h
@@ -343,4 +343,12 @@ struct tpdm_dataset_attribute {
enum dataset_mem mem;
u32 idx;
};
+
+static inline bool coresight_is_static_tpdm(struct coresight_device *csdev)
+{
+ struct device_node *node = csdev->dev.parent->of_node;
+
+ return (csdev &&
+ of_device_is_compatible(node, "qcom,coresight-static-tpdm"));
+}
#endif /* _CORESIGHT_CORESIGHT_TPDM_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] arm64: dts: qcom: lemans: enable static TPDM
2025-10-13 6:11 [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
2025-10-13 6:11 ` [PATCH v3 1/3] dt-bindings: arm: document the static TPDM compatible Jie Gan
2025-10-13 6:11 ` [PATCH v3 2/3] coresight: tpdm: add static tpdm support Jie Gan
@ 2025-10-13 6:11 ` Jie Gan
2025-10-27 1:12 ` [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
3 siblings, 0 replies; 7+ messages in thread
From: Jie Gan @ 2025-10-13 6:11 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel, Jie Gan, Konrad Dybcio
Enable static TPDM device for lemans.
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/lemans.dtsi | 105 +++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/lemans.dtsi b/arch/arm64/boot/dts/qcom/lemans.dtsi
index cf685cb186ed..3646e2347068 100644
--- a/arch/arm64/boot/dts/qcom/lemans.dtsi
+++ b/arch/arm64/boot/dts/qcom/lemans.dtsi
@@ -2961,6 +2961,14 @@ funnel1_in4: endpoint {
<&apss_funnel1_out>;
};
};
+
+ port@5 {
+ reg = <5>;
+
+ funnel1_in5: endpoint {
+ remote-endpoint = <&dlct0_funnel_out>;
+ };
+ };
};
};
@@ -3118,6 +3126,60 @@ etr1_out: endpoint {
};
};
+ tpda@4ad3000 {
+ compatible = "qcom,coresight-tpda", "arm,primecell";
+ reg = <0x0 0x4ad3000 0x0 0x1000>;
+
+ clocks = <&aoss_qmp>;
+ clock-names = "apb_pclk";
+
+ in-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@10 {
+ reg = <16>;
+ dlct0_tpda_in16: endpoint {
+ remote-endpoint = <&turing0_funnel_out>;
+ };
+ };
+ };
+
+ out-ports {
+ port {
+ dlct0_tpda_out: endpoint {
+ remote-endpoint =
+ <&dlct0_funnel_in0>;
+ };
+ };
+ };
+
+ };
+
+ funnel@4ad4000 {
+ compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
+ reg = <0x0 0x4ad4000 0x0 0x1000>;
+
+ clocks = <&aoss_qmp>;
+ clock-names = "apb_pclk";
+
+ in-ports {
+ port {
+ dlct0_funnel_in0: endpoint {
+ remote-endpoint = <&dlct0_tpda_out>;
+ };
+ };
+ };
+
+ out-ports {
+ port {
+ dlct0_funnel_out: endpoint {
+ remote-endpoint = <&funnel1_in5>;
+ };
+ };
+ };
+ };
+
funnel@4b04000 {
compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
reg = <0x0 0x4b04000 0x0 0x1000>;
@@ -3390,6 +3452,35 @@ aoss_cti: cti@4b13000 {
clock-names = "apb_pclk";
};
+ funnel@4b83000 {
+ compatible = "arm,coresight-dynamic-funnel", "arm,primecell";
+ reg = <0x0 0x4b83000 0x0 0x1000>;
+
+ clocks = <&aoss_qmp>;
+ clock-names = "apb_pclk";
+
+ in-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@1 {
+ reg = <1>;
+
+ turing0_funnel_in1: endpoint {
+ remote-endpoint = <&turing_llm_tpdm_out>;
+ };
+ };
+ };
+
+ out-ports {
+ port {
+ turing0_funnel_out: endpoint {
+ remote-endpoint = <&dlct0_tpda_in16>;
+ };
+ };
+ };
+ };
+
etm@6040000 {
compatible = "arm,primecell";
reg = <0x0 0x6040000 0x0 0x1000>;
@@ -8256,6 +8347,20 @@ arch_timer: timer {
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(8) | IRQ_TYPE_LEVEL_LOW)>;
};
+ turing-llm-tpdm {
+ compatible = "qcom,coresight-static-tpdm";
+
+ qcom,cmb-element-bits = <32>;
+
+ out-ports {
+ port {
+ turing_llm_tpdm_out: endpoint {
+ remote-endpoint = <&turing0_funnel_in1>;
+ };
+ };
+ };
+ };
+
pcie0: pcie@1c00000 {
compatible = "qcom,pcie-sa8775p";
reg = <0x0 0x01c00000 0x0 0x3000>,
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] coresight: add static TPDM support
2025-10-13 6:11 [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
` (2 preceding siblings ...)
2025-10-13 6:11 ` [PATCH v3 3/3] arm64: dts: qcom: lemans: enable static TPDM Jie Gan
@ 2025-10-27 1:12 ` Jie Gan
3 siblings, 0 replies; 7+ messages in thread
From: Jie Gan @ 2025-10-27 1:12 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel, Konrad Dybcio
On 10/13/2025 2:11 PM, Jie Gan wrote:
> The static TPDM function as a dummy source, however, it is essential
> to enable the port connected to the TPDA and configure the element size.
> Without this, the TPDA cannot correctly receive trace data from the
> static TPDM. Since the static TPDM does not require MMIO mapping to
> access its registers, a clock controller is not mandatory for its
> operation.
>
> Meanwhile, a function has been introduced to determine whether the
> current csdev is a static TPDM. This check enables the TPDA device
> to correctly read the element size and activate its port accordingly.
> Otherwise the TPDA cannot receive the trace data from the TPDM device.
>
Gentle reminder.
Thanks,
Jie
> Changes in V3:
> 1. rebased on next-20251010
> Link to V2 - https://lore.kernel.org/all/20250911-add_static_tpdm_support-v2-0-608559d36f74@oss.qualcomm.com/
>
> Changes in V2:
> 1. Remove the dependency.
> 2. Collect tags from Rob and Konard for patchset 1 and patchset 3.
> Link to V1 - https://lore.kernel.org/all/20250822103008.1029-1-jie.gan@oss.qualcomm.com/
>
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
> ---
> Jie Gan (3):
> dt-bindings: arm: document the static TPDM compatible
> coresight: tpdm: add static tpdm support
> arm64: dts: qcom: lemans: enable static TPDM
>
> .../bindings/arm/qcom,coresight-tpdm.yaml | 23 +++-
> arch/arm64/boot/dts/qcom/lemans.dtsi | 105 +++++++++++++++
> drivers/hwtracing/coresight/coresight-tpda.c | 9 ++
> drivers/hwtracing/coresight/coresight-tpdm.c | 148 ++++++++++++++++-----
> drivers/hwtracing/coresight/coresight-tpdm.h | 8 ++
> 5 files changed, 256 insertions(+), 37 deletions(-)
> ---
> base-commit: 2b763d4652393c90eaa771a5164502ec9dd965ae
> change-id: 20251013-add-static-tpdm-support-330b71d6d0f8
>
> Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/3] coresight: tpdm: add static tpdm support
2025-10-13 6:11 ` [PATCH v3 2/3] coresight: tpdm: add static tpdm support Jie Gan
@ 2025-10-27 9:17 ` Suzuki K Poulose
2025-10-28 8:38 ` Jie Gan
0 siblings, 1 reply; 7+ messages in thread
From: Suzuki K Poulose @ 2025-10-27 9:17 UTC (permalink / raw)
To: Jie Gan, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel
On 13/10/2025 07:11, Jie Gan wrote:
> The static TPDM function as a dummy source, however, it is essential
> to enable the port connected to the TPDA and configure the element size.
> Without this, the TPDA cannot correctly receive trace data from the
> static TPDM. Since the static TPDM does not require MMIO mapping to
> access its registers, a clock controller is not mandatory for its
> operation.
>
> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
> ---
> drivers/hwtracing/coresight/coresight-tpda.c | 9 ++
> drivers/hwtracing/coresight/coresight-tpdm.c | 148 +++++++++++++++++++++------
> drivers/hwtracing/coresight/coresight-tpdm.h | 8 ++
> 3 files changed, 131 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
> index 333b3cb23685..4e93fa5bace4 100644
> --- a/drivers/hwtracing/coresight/coresight-tpda.c
> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
> @@ -68,6 +68,15 @@ static int tpdm_read_element_size(struct tpda_drvdata *drvdata,
> int rc = -EINVAL;
> struct tpdm_drvdata *tpdm_data = dev_get_drvdata(csdev->dev.parent);
>
> + if (coresight_is_static_tpdm(csdev)) {
> + rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
> + "qcom,dsb-element-bits", &drvdata->dsb_esize);
> + rc &= fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
> + "qcom,cmb-element-bits", &drvdata->cmb_esize);
> +
This doesn't match the "dynamic" tpdm case ? We mandate that static
TPDMs have DSB and CMB. I would rather set the appropriate flags in
tpdm_drvdata->dsb/cmb in the TPDM driver for static tpdms and not
let the "static" vs "dynamic" creep into the TPDA and other users.
e.g., in TPDM driver:
if (static_tpdm()) {
tpdm_data->dsb = has_dsb_element_bits_property;
tpdm_data->cmb = has_cmb_element_bits_property;
}
> + goto out;
> + }
> +
> if (tpdm_data->dsb) {
> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
> "qcom,dsb-element-bits", &drvdata->dsb_esize);
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
> index 7214e65097ec..1766b0182819 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
> @@ -495,7 +495,9 @@ static int tpdm_enable(struct coresight_device *csdev, struct perf_event *event,
> return -EBUSY;
> }
>
> - __tpdm_enable(drvdata);
> + if (!coresight_is_static_tpdm(csdev))
> + __tpdm_enable(drvdata);
> +
> drvdata->enable = true;
> spin_unlock(&drvdata->spinlock);
>
> @@ -551,7 +553,9 @@ static void tpdm_disable(struct coresight_device *csdev,
> return;
> }
>
> - __tpdm_disable(drvdata);
> + if (!coresight_is_static_tpdm(csdev))
> + __tpdm_disable(drvdata);
minor nit: It is much safer to do this check in __tpdm_xxable() and
return early.
> +
> coresight_set_mode(csdev, CS_MODE_DISABLED);
> drvdata->enable = false;
> spin_unlock(&drvdata->spinlock);
> @@ -1342,10 +1346,9 @@ static const struct attribute_group *tpdm_attr_grps[] = {
> NULL,
> };
>
> -static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
> +static int tpdm_probe(struct device *dev, struct resource *res)
> {
> void __iomem *base;
> - struct device *dev = &adev->dev;
> struct coresight_platform_data *pdata;
> struct tpdm_drvdata *drvdata;
> struct coresight_desc desc = { 0 };
> @@ -1354,32 +1357,33 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
> pdata = coresight_get_platform_data(dev);
> if (IS_ERR(pdata))
> return PTR_ERR(pdata);
> - adev->dev.platform_data = pdata;
> + dev->platform_data = pdata;
>
> /* driver data*/
> drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> if (!drvdata)
> return -ENOMEM;
> - drvdata->dev = &adev->dev;
> + drvdata->dev = dev;
> dev_set_drvdata(dev, drvdata);
>
> - base = devm_ioremap_resource(dev, &adev->res);
> - if (IS_ERR(base))
> - return PTR_ERR(base);
> + if (res) {
> + base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
>
> - drvdata->base = base;
> + drvdata->base = base;
> + ret = tpdm_datasets_setup(drvdata);
> + if (ret)
> + return ret;
>
> - ret = tpdm_datasets_setup(drvdata);
> - if (ret)
> - return ret;
> + if (drvdata && tpdm_has_dsb_dataset(drvdata))
> + of_property_read_u32(drvdata->dev->of_node,
> + "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
>
> - if (drvdata && tpdm_has_dsb_dataset(drvdata))
> - of_property_read_u32(drvdata->dev->of_node,
> - "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
> -
> - if (drvdata && tpdm_has_cmb_dataset(drvdata))
> - of_property_read_u32(drvdata->dev->of_node,
> - "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
> + if (drvdata && tpdm_has_cmb_dataset(drvdata))
> + of_property_read_u32(drvdata->dev->of_node,
> + "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
> + }
>
> /* Set up coresight component description */
> desc.name = coresight_alloc_device_name(&tpdm_devs, dev);
> @@ -1388,34 +1392,51 @@ static int tpdm_probe(struct amba_device *adev, const struct amba_id *id)
> desc.type = CORESIGHT_DEV_TYPE_SOURCE;
> desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM;
> desc.ops = &tpdm_cs_ops;
> - desc.pdata = adev->dev.platform_data;
> - desc.dev = &adev->dev;
> + desc.pdata = dev->platform_data;
> + desc.dev = dev;
> desc.access = CSDEV_ACCESS_IOMEM(base);
> - desc.groups = tpdm_attr_grps;
> + if (res)
> + desc.groups = tpdm_attr_grps;
> drvdata->csdev = coresight_register(&desc);
> if (IS_ERR(drvdata->csdev))
> return PTR_ERR(drvdata->csdev);
>
> spin_lock_init(&drvdata->spinlock);
>
> - /* Decrease pm refcount when probe is done.*/
> - pm_runtime_put(&adev->dev);
> -
> return 0;
> }
>
> -static void tpdm_remove(struct amba_device *adev)
> +static int tpdm_remove(struct device *dev)
> {
> - struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev);
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev);
>
> coresight_unregister(drvdata->csdev);
> +
> + return 0;
> +}
> +
> +static int dynamic_tpdm_probe(struct amba_device *adev,
> + const struct amba_id *id)
> +{
> + int ret;
> +
> + ret = tpdm_probe(&adev->dev, &adev->res);
> + if (!ret)
> + pm_runtime_put(&adev->dev);
> +
> + return ret;
> +}
> +
> +static void dynamic_tpdm_remove(struct amba_device *adev)
> +{
> + tpdm_remove(&adev->dev);
> }
>
> /*
> * Different TPDM has different periph id.
> * The difference is 0-7 bits' value. So ignore 0-7 bits.
> */
> -static const struct amba_id tpdm_ids[] = {
> +static const struct amba_id dynamic_tpdm_ids[] = {
> {
> .id = 0x001f0e00,
> .mask = 0x00ffff00,
> @@ -1423,17 +1444,76 @@ static const struct amba_id tpdm_ids[] = {
> { 0, 0, NULL },
> };
>
> -static struct amba_driver tpdm_driver = {
> +MODULE_DEVICE_TABLE(amba, dynamic_tpdm_ids);
> +
> +static struct amba_driver dynamic_tpdm_driver = {
> .drv = {
> .name = "coresight-tpdm",
> .suppress_bind_attrs = true,
> },
> - .probe = tpdm_probe,
> - .id_table = tpdm_ids,
> - .remove = tpdm_remove,
> + .probe = dynamic_tpdm_probe,
> + .id_table = dynamic_tpdm_ids,
> + .remove = dynamic_tpdm_remove,
> };
>
> -module_amba_driver(tpdm_driver);
> +static int tpdm_platform_probe(struct platform_device *pdev)
> +{
> + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + int ret;
> +
> + pm_runtime_get_noresume(&pdev->dev);
> + pm_runtime_set_active(&pdev->dev);
> + pm_runtime_enable(&pdev->dev);
> +
> + ret = tpdm_probe(&pdev->dev, res);
> + pm_runtime_put(&pdev->dev);
> + if (ret)
> + pm_runtime_disable(&pdev->dev);
> +
> + return ret;
> +}
> +
> +static void tpdm_platform_remove(struct platform_device *pdev)
> +{
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
> +
> + if (WARN_ON(!drvdata))
> + return;
> +
> + tpdm_remove(&pdev->dev);
> + pm_runtime_disable(&pdev->dev);
> +}
> +
> +static const struct of_device_id static_tpdm_match[] = {
> + {.compatible = "qcom,coresight-static-tpdm"},
> + {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, static_tpdm_match);
> +
> +static struct platform_driver static_tpdm_driver = {
> + .probe = tpdm_platform_probe,
> + .remove = tpdm_platform_remove,
> + .driver = {
> + .name = "coresight-static-tpdm",
> + .of_match_table = static_tpdm_match,
> + .suppress_bind_attrs = true,
> + },
> +};
> +
> +static int __init tpdm_init(void)
> +{
> + return coresight_init_driver("tpdm", &dynamic_tpdm_driver, &static_tpdm_driver,
> + THIS_MODULE);
> +}
> +
> +static void __exit tpdm_exit(void)
> +{
> + coresight_remove_driver(&dynamic_tpdm_driver, &static_tpdm_driver);
> +}
> +
> +module_init(tpdm_init);
> +module_exit(tpdm_exit);
>
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Monitor driver");
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h
> index b11754389734..9f52c88ce5c1 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
> @@ -343,4 +343,12 @@ struct tpdm_dataset_attribute {
> enum dataset_mem mem;
> u32 idx;
> };
> +
> +static inline bool coresight_is_static_tpdm(struct coresight_device *csdev)
> +{
> + struct device_node *node = csdev->dev.parent->of_node;
> +
> + return (csdev &&
> + of_device_is_compatible(node, "qcom,coresight-static-tpdm"));
Why do we have to go check the firmware table all the time ? Could we
not cache this in drvdata ? Or even better, we can use the csdev->access
by using : coresight_device_is_tpdm()
return (coresight_device_is_tpdm(csdev) && !csdev->access->base);
Suzuki
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/3] coresight: tpdm: add static tpdm support
2025-10-27 9:17 ` Suzuki K Poulose
@ 2025-10-28 8:38 ` Jie Gan
0 siblings, 0 replies; 7+ messages in thread
From: Jie Gan @ 2025-10-28 8:38 UTC (permalink / raw)
To: Suzuki K Poulose, Mike Leach, James Clark, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Tingwei Zhang, Mao Jinlong,
Tao Zhang, Alexander Shishkin, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, coresight, linux-arm-kernel, devicetree,
linux-kernel
On 10/27/2025 5:17 PM, Suzuki K Poulose wrote:
> On 13/10/2025 07:11, Jie Gan wrote:
>> The static TPDM function as a dummy source, however, it is essential
>> to enable the port connected to the TPDA and configure the element size.
>> Without this, the TPDA cannot correctly receive trace data from the
>> static TPDM. Since the static TPDM does not require MMIO mapping to
>> access its registers, a clock controller is not mandatory for its
>> operation.
>>
>> Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
>> ---
>> drivers/hwtracing/coresight/coresight-tpda.c | 9 ++
>> drivers/hwtracing/coresight/coresight-tpdm.c | 148 +++++++++++++++++
>> ++++------
>> drivers/hwtracing/coresight/coresight-tpdm.h | 8 ++
>> 3 files changed, 131 insertions(+), 34 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/
>> hwtracing/coresight/coresight-tpda.c
>> index 333b3cb23685..4e93fa5bace4 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpda.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
>> @@ -68,6 +68,15 @@ static int tpdm_read_element_size(struct
>> tpda_drvdata *drvdata,
>> int rc = -EINVAL;
>> struct tpdm_drvdata *tpdm_data = dev_get_drvdata(csdev-
>> >dev.parent);
>> + if (coresight_is_static_tpdm(csdev)) {
>> + rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
>> + "qcom,dsb-element-bits", &drvdata->dsb_esize);
>> + rc &= fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
>> + "qcom,cmb-element-bits", &drvdata-
>> >cmb_esize);
>> +
>
> This doesn't match the "dynamic" tpdm case ? We mandate that static
> TPDMs have DSB and CMB. I would rather set the appropriate flags in
>
> tpdm_drvdata->dsb/cmb in the TPDM driver for static tpdms and not
> let the "static" vs "dynamic" creep into the TPDA and other users.
>
> e.g., in TPDM driver:
>
> if (static_tpdm()) {
> tpdm_data->dsb = has_dsb_element_bits_property;
> tpdm_data->cmb = has_cmb_element_bits_property;
> }
Well noted, will fix in next version.
>
>
>> + goto out;
>> + }
>> +
>> if (tpdm_data->dsb) {
>> rc = fwnode_property_read_u32(dev_fwnode(csdev->dev.parent),
>> "qcom,dsb-element-bits", &drvdata->dsb_esize);
>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/
>> hwtracing/coresight/coresight-tpdm.c
>> index 7214e65097ec..1766b0182819 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
>> @@ -495,7 +495,9 @@ static int tpdm_enable(struct coresight_device
>> *csdev, struct perf_event *event,
>> return -EBUSY;
>> }
>> - __tpdm_enable(drvdata);
>> + if (!coresight_is_static_tpdm(csdev))
>> + __tpdm_enable(drvdata);
>> +
>> drvdata->enable = true;
>> spin_unlock(&drvdata->spinlock);
>> @@ -551,7 +553,9 @@ static void tpdm_disable(struct coresight_device
>> *csdev,
>> return;
>> }
>> - __tpdm_disable(drvdata);
>> + if (!coresight_is_static_tpdm(csdev))
>> + __tpdm_disable(drvdata);
>
> minor nit: It is much safer to do this check in __tpdm_xxable() and
> return early.
>
well noted, will fix it in next version.
>> +
>> coresight_set_mode(csdev, CS_MODE_DISABLED);
>> drvdata->enable = false;
>> spin_unlock(&drvdata->spinlock);
>> @@ -1342,10 +1346,9 @@ static const struct attribute_group
>> *tpdm_attr_grps[] = {
>> NULL,
>> };
>> -static int tpdm_probe(struct amba_device *adev, const struct amba_id
>> *id)
>> +static int tpdm_probe(struct device *dev, struct resource *res)
>> {
>> void __iomem *base;
>> - struct device *dev = &adev->dev;
>> struct coresight_platform_data *pdata;
>> struct tpdm_drvdata *drvdata;
>> struct coresight_desc desc = { 0 };
>> @@ -1354,32 +1357,33 @@ static int tpdm_probe(struct amba_device
>> *adev, const struct amba_id *id)
>> pdata = coresight_get_platform_data(dev);
>> if (IS_ERR(pdata))
>> return PTR_ERR(pdata);
>> - adev->dev.platform_data = pdata;
>> + dev->platform_data = pdata;
>> /* driver data*/
>> drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
>> if (!drvdata)
>> return -ENOMEM;
>> - drvdata->dev = &adev->dev;
>> + drvdata->dev = dev;
>> dev_set_drvdata(dev, drvdata);
>> - base = devm_ioremap_resource(dev, &adev->res);
>> - if (IS_ERR(base))
>> - return PTR_ERR(base);
>> + if (res) {
>> + base = devm_ioremap_resource(dev, res);
>> + if (IS_ERR(base))
>> + return PTR_ERR(base);
>> - drvdata->base = base;
>> + drvdata->base = base;
>> + ret = tpdm_datasets_setup(drvdata);
>> + if (ret)
>> + return ret;
>> - ret = tpdm_datasets_setup(drvdata);
>> - if (ret)
>> - return ret;
>> + if (drvdata && tpdm_has_dsb_dataset(drvdata))
>> + of_property_read_u32(drvdata->dev->of_node,
>> + "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
>> - if (drvdata && tpdm_has_dsb_dataset(drvdata))
>> - of_property_read_u32(drvdata->dev->of_node,
>> - "qcom,dsb-msrs-num", &drvdata->dsb_msr_num);
>> -
>> - if (drvdata && tpdm_has_cmb_dataset(drvdata))
>> - of_property_read_u32(drvdata->dev->of_node,
>> - "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
>> + if (drvdata && tpdm_has_cmb_dataset(drvdata))
>> + of_property_read_u32(drvdata->dev->of_node,
>> + "qcom,cmb-msrs-num", &drvdata->cmb_msr_num);
>> + }
>> /* Set up coresight component description */
>> desc.name = coresight_alloc_device_name(&tpdm_devs, dev);
>> @@ -1388,34 +1392,51 @@ static int tpdm_probe(struct amba_device
>> *adev, const struct amba_id *id)
>> desc.type = CORESIGHT_DEV_TYPE_SOURCE;
>> desc.subtype.source_subtype = CORESIGHT_DEV_SUBTYPE_SOURCE_TPDM;
>> desc.ops = &tpdm_cs_ops;
>> - desc.pdata = adev->dev.platform_data;
>> - desc.dev = &adev->dev;
>> + desc.pdata = dev->platform_data;
>> + desc.dev = dev;
>> desc.access = CSDEV_ACCESS_IOMEM(base);
>> - desc.groups = tpdm_attr_grps;
>> + if (res)
>> + desc.groups = tpdm_attr_grps;
>> drvdata->csdev = coresight_register(&desc);
>> if (IS_ERR(drvdata->csdev))
>> return PTR_ERR(drvdata->csdev);
>> spin_lock_init(&drvdata->spinlock);
>> - /* Decrease pm refcount when probe is done.*/
>> - pm_runtime_put(&adev->dev);
>> -
>> return 0;
>> }
>> -static void tpdm_remove(struct amba_device *adev)
>> +static int tpdm_remove(struct device *dev)
>> {
>> - struct tpdm_drvdata *drvdata = dev_get_drvdata(&adev->dev);
>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev);
>> coresight_unregister(drvdata->csdev);
>> +
>> + return 0;
>> +}
>> +
>> +static int dynamic_tpdm_probe(struct amba_device *adev,
>> + const struct amba_id *id)
>> +{
>> + int ret;
>> +
>> + ret = tpdm_probe(&adev->dev, &adev->res);
>> + if (!ret)
>> + pm_runtime_put(&adev->dev);
>> +
>> + return ret;
>> +}
>> +
>> +static void dynamic_tpdm_remove(struct amba_device *adev)
>> +{
>> + tpdm_remove(&adev->dev);
>> }
>> /*
>> * Different TPDM has different periph id.
>> * The difference is 0-7 bits' value. So ignore 0-7 bits.
>> */
>> -static const struct amba_id tpdm_ids[] = {
>> +static const struct amba_id dynamic_tpdm_ids[] = {
>> {
>> .id = 0x001f0e00,
>> .mask = 0x00ffff00,
>> @@ -1423,17 +1444,76 @@ static const struct amba_id tpdm_ids[] = {
>> { 0, 0, NULL },
>> };
>> -static struct amba_driver tpdm_driver = {
>> +MODULE_DEVICE_TABLE(amba, dynamic_tpdm_ids);
>> +
>> +static struct amba_driver dynamic_tpdm_driver = {
>> .drv = {
>> .name = "coresight-tpdm",
>> .suppress_bind_attrs = true,
>> },
>> - .probe = tpdm_probe,
>> - .id_table = tpdm_ids,
>> - .remove = tpdm_remove,
>> + .probe = dynamic_tpdm_probe,
>> + .id_table = dynamic_tpdm_ids,
>> + .remove = dynamic_tpdm_remove,
>> };
>> -module_amba_driver(tpdm_driver);
>> +static int tpdm_platform_probe(struct platform_device *pdev)
>> +{
>> + struct resource *res = platform_get_resource(pdev,
>> IORESOURCE_MEM, 0);
>> + int ret;
>> +
>> + pm_runtime_get_noresume(&pdev->dev);
>> + pm_runtime_set_active(&pdev->dev);
>> + pm_runtime_enable(&pdev->dev);
>> +
>> + ret = tpdm_probe(&pdev->dev, res);
>> + pm_runtime_put(&pdev->dev);
>> + if (ret)
>> + pm_runtime_disable(&pdev->dev);
>> +
>> + return ret;
>> +}
>> +
>> +static void tpdm_platform_remove(struct platform_device *pdev)
>> +{
>> + struct tpdm_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
>> +
>> + if (WARN_ON(!drvdata))
>> + return;
>> +
>> + tpdm_remove(&pdev->dev);
>> + pm_runtime_disable(&pdev->dev);
>> +}
>> +
>> +static const struct of_device_id static_tpdm_match[] = {
>> + {.compatible = "qcom,coresight-static-tpdm"},
>> + {}
>> +};
>> +
>> +MODULE_DEVICE_TABLE(of, static_tpdm_match);
>> +
>> +static struct platform_driver static_tpdm_driver = {
>> + .probe = tpdm_platform_probe,
>> + .remove = tpdm_platform_remove,
>> + .driver = {
>> + .name = "coresight-static-tpdm",
>> + .of_match_table = static_tpdm_match,
>> + .suppress_bind_attrs = true,
>> + },
>> +};
>> +
>> +static int __init tpdm_init(void)
>> +{
>> + return coresight_init_driver("tpdm", &dynamic_tpdm_driver,
>> &static_tpdm_driver,
>> + THIS_MODULE);
>> +}
>> +
>> +static void __exit tpdm_exit(void)
>> +{
>> + coresight_remove_driver(&dynamic_tpdm_driver, &static_tpdm_driver);
>> +}
>> +
>> +module_init(tpdm_init);
>> +module_exit(tpdm_exit);
>> MODULE_LICENSE("GPL");
>> MODULE_DESCRIPTION("Trace, Profiling & Diagnostic Monitor driver");
>> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/
>> hwtracing/coresight/coresight-tpdm.h
>> index b11754389734..9f52c88ce5c1 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpdm.h
>> +++ b/drivers/hwtracing/coresight/coresight-tpdm.h
>> @@ -343,4 +343,12 @@ struct tpdm_dataset_attribute {
>> enum dataset_mem mem;
>> u32 idx;
>> };
>> +
>> +static inline bool coresight_is_static_tpdm(struct coresight_device
>> *csdev)
>> +{
>> + struct device_node *node = csdev->dev.parent->of_node;
>> +
>> + return (csdev &&
>> + of_device_is_compatible(node, "qcom,coresight-static-tpdm"));
>
> Why do we have to go check the firmware table all the time ? Could we
> not cache this in drvdata ? Or even better, we can use the csdev->access
>
> by using : coresight_device_is_tpdm()
>
> return (coresight_device_is_tpdm(csdev) && !csdev->access->base);
That's much better than mine, will fix it in next version.
Thanks,
Jie
>
> Suzuki
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-28 8:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-13 6:11 [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
2025-10-13 6:11 ` [PATCH v3 1/3] dt-bindings: arm: document the static TPDM compatible Jie Gan
2025-10-13 6:11 ` [PATCH v3 2/3] coresight: tpdm: add static tpdm support Jie Gan
2025-10-27 9:17 ` Suzuki K Poulose
2025-10-28 8:38 ` Jie Gan
2025-10-13 6:11 ` [PATCH v3 3/3] arm64: dts: qcom: lemans: enable static TPDM Jie Gan
2025-10-27 1:12 ` [PATCH v3 0/3] coresight: add static TPDM support Jie Gan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).