[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9b090ac-b154-eef7-7872-78f7fe388f61@arm.com>
Date: Mon, 24 Oct 2022 11:32:40 +0100
From: Suzuki K Poulose <suzuki.poulose@....com>
To: Tao Zhang <quic_taozha@...cinc.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Konrad Dybcio <konradybcio@...il.com>,
Mike Leach <mike.leach@...aro.org>
Cc: Jinlong Mao <quic_jinlmao@...cinc.com>,
Leo Yan <leo.yan@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Tingwei Zhang <quic_tingweiz@...cinc.com>,
Yuanfang Zhang <quic_yuanfang@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Hao Zhang <quic_hazha@...cinc.com>,
linux-arm-msm@...r.kernel.org, bjorn.andersson@...aro.org
Subject: Re: [PATCH 5/9] coresight-tpdm: Add nodes to set trigger timestamp
and type
On 08/09/2022 09:45, Tao Zhang wrote:
> The nodes are needed to set or show the trigger timestamp and
> trigger type. This change is to add these nodes to achieve these
> function.
>
> Signed-off-by: Tao Zhang <quic_taozha@...cinc.com>
> ---
> drivers/hwtracing/coresight/coresight-tpdm.c | 90 ++++++++++++++++++++++++++++
> 1 file changed, 90 insertions(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c
> index 74cc653..fae9963 100644
> --- a/drivers/hwtracing/coresight/coresight-tpdm.c
> +++ b/drivers/hwtracing/coresight/coresight-tpdm.c
> @@ -232,8 +232,98 @@ static struct attribute_group tpdm_attr_grp = {
> .attrs = tpdm_attrs,
> };
>
> +static ssize_t dsb_trig_type_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
> +
> + if (!(drvdata->datasets & TPDM_PIDR0_DS_DSB))
> + return -EPERM;
> +
> + return scnprintf(buf, PAGE_SIZE, "%u\n",
> + (unsigned int)drvdata->dsb->trig_type);
> +}
> +
> +/*
> + * value 0: set trigger type as enablement
> + * value 1: set trigger type as disablement
> + */
> +static ssize_t dsb_trig_type_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf,
> + size_t size)
> +{
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
> + unsigned long val;
> +
> + if ((kstrtoul(buf, 16, &val)) || val < 0 || val > 1)
> + return -EINVAL;
> + if (!(drvdata->datasets & TPDM_PIDR0_DS_DSB))
> + return -EPERM;
> +
> + spin_lock(&drvdata->spinlock);
> + if (val)
> + drvdata->dsb->trig_type = true;
> + else
> + drvdata->dsb->trig_type = false;
> + spin_unlock(&drvdata->spinlock);
> + return size;
> +}
> +static DEVICE_ATTR_RW(dsb_trig_type);
> +
> +static ssize_t dsb_trig_ts_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
> +
> + if (!(drvdata->datasets & TPDM_PIDR0_DS_DSB))
> + return -EPERM;
> +
> + return scnprintf(buf, PAGE_SIZE, "%u\n",
> + (unsigned int)drvdata->dsb->trig_ts);
> +}
> +
> +/*
> + * value 0: set trigger timestamp as enablement
> + * value 1: set trigger timestamp as disablement
> + */
> +static ssize_t dsb_trig_ts_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf,
> + size_t size)
> +{
> + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
> + unsigned long val;
> +
> + if ((kstrtoul(buf, 16, &val)) || val < 0 || val > 1)
> + return -EINVAL;
> + if (!(drvdata->datasets & TPDM_PIDR0_DS_DSB))
> + return -EPERM;
> +
> + spin_lock(&drvdata->spinlock);
> + if (val)
> + drvdata->dsb->trig_ts = true;
> + else
> + drvdata->dsb->trig_ts = false;
> + spin_unlock(&drvdata->spinlock);
> + return size;
> +}
> +static DEVICE_ATTR_RW(dsb_trig_ts);
> +static struct attribute *tpdm_dsb_attrs[] = {
> + &dev_attr_dsb_trig_ts.attr,
> + &dev_attr_dsb_trig_type.attr,
> + NULL,
> +};
> +
> +static struct attribute_group tpdm_dsb_attr_grp = {
> + .attrs = tpdm_dsb_attrs,
> +};
> +
Please could we hide the "DSB" related knobs, if the
the Data sets are missing using is_visible() hook ?
Suzuki
Powered by blists - more mailing lists