Skip to content

Commit 126f008

Browse files
Tao ZhangSuzuki K Poulose
authored andcommitted
coresight-tpdm: Add reset node to TPDM node
TPDM device need a node to reset the configurations and status of it. This change provides a node to reset the configurations and disable the TPDM if it has been enabled. Signed-off-by: Tao Zhang <quic_taozha@quicinc.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/1695882586-10306-7-git-send-email-quic_taozha@quicinc.com
1 parent 03f0ff5 commit 126f008

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ Description:
1111
Accepts only one of the 2 values - 1 or 2.
1212
1 : Generate 64 bits data
1313
2 : Generate 32 bits data
14+
15+
What: /sys/bus/coresight/devices/<tpdm-name>/reset_dataset
16+
Date: March 2023
17+
KernelVersion 6.7
18+
Contact: Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang (QUIC) <quic_taozha@quicinc.com>
19+
Description:
20+
(Write) Reset the dataset of the tpdm.
21+
22+
Accepts only one value - 1.
23+
1 : Reset the dataset of the tpdm

drivers/hwtracing/coresight/coresight-tpdm.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,27 @@ static int tpdm_datasets_setup(struct tpdm_drvdata *drvdata)
162162
return 0;
163163
}
164164

165+
static ssize_t reset_dataset_store(struct device *dev,
166+
struct device_attribute *attr,
167+
const char *buf,
168+
size_t size)
169+
{
170+
int ret = 0;
171+
unsigned long val;
172+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
173+
174+
ret = kstrtoul(buf, 0, &val);
175+
if (ret || val != 1)
176+
return -EINVAL;
177+
178+
spin_lock(&drvdata->spinlock);
179+
tpdm_reset_datasets(drvdata);
180+
spin_unlock(&drvdata->spinlock);
181+
182+
return size;
183+
}
184+
static DEVICE_ATTR_WO(reset_dataset);
185+
165186
/*
166187
* value 1: 64 bits test data
167188
* value 2: 32 bits test data
@@ -202,6 +223,7 @@ static ssize_t integration_test_store(struct device *dev,
202223
static DEVICE_ATTR_WO(integration_test);
203224

204225
static struct attribute *tpdm_attrs[] = {
226+
&dev_attr_reset_dataset.attr,
205227
&dev_attr_integration_test.attr,
206228
NULL,
207229
};

0 commit comments

Comments
 (0)