[PATCH v2 4/8] coresight: tmc: move trigger_cntr into its own attribute group

From: Jie Gan

Date: Mon Nov 30 2026 - 02:12:46 EST


The trigger_cntr attribute sets the value programmed into the TMC_TRG
register when the TMC is enabled, while buffer_size and stop_on_flush
are consumed when the trace buffer and the formatter configuration
are set up.

Move trigger_cntr into a separate unnamed attribute group and add it
to both the ETB/ETF and the ETR group lists, so that a TMC driver which
does not program TMC_TRG can expose the remaining attributes without it.

The sysfs layout of existing TMC devices is unchanged.

Signed-off-by: Jie Gan <jie.gan@xxxxxxxxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-tmc-core.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
index ad2c99eae5ae..2361bb3d652f 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-core.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
@@ -559,7 +559,6 @@ static DEVICE_ATTR_RW(stop_on_flush);


static struct attribute *coresight_tmc_attrs[] = {
- &dev_attr_trigger_cntr.attr,
&dev_attr_buffer_size.attr,
&dev_attr_stop_on_flush.attr,
NULL,
@@ -569,6 +568,16 @@ static const struct attribute_group coresight_tmc_group = {
.attrs = coresight_tmc_attrs,
};

+/* trigger_cntr is programmed directly into the TMC_TRG register */
+static struct attribute *coresight_tmc_trg_attrs[] = {
+ &dev_attr_trigger_cntr.attr,
+ NULL,
+};
+
+static const struct attribute_group coresight_tmc_trg_group = {
+ .attrs = coresight_tmc_trg_attrs,
+};
+
static const struct attribute_group coresight_tmc_mgmt_group = {
.attrs = coresight_tmc_mgmt_attrs,
.name = "mgmt",
@@ -576,6 +585,7 @@ static const struct attribute_group coresight_tmc_mgmt_group = {

static const struct attribute_group *coresight_etf_groups[] = {
&coresight_tmc_group,
+ &coresight_tmc_trg_group,
&coresight_tmc_mgmt_group,
NULL,
};
@@ -583,6 +593,7 @@ static const struct attribute_group *coresight_etf_groups[] = {
static const struct attribute_group *coresight_etr_groups[] = {
&coresight_etr_group,
&coresight_tmc_group,
+ &coresight_tmc_trg_group,
&coresight_tmc_mgmt_group,
NULL,
};

--
2.34.1