From nobody Tue Dec 16 22:37:46 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EACA2DC781 for ; Wed, 3 Dec 2025 09:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764752512; cv=none; b=cR2+MJ02b1vZCc4gNFPKbPA+zlyprd+uO78/xKrgQ4TGsFlq21ZKGbcX3Bnx8d8mDcuWQSzJqg+/0wtU9FbUS8QAzRH4uXj1lv5o9VduFbgJukhQY+ZEzvHQpanad+5GCDCzVCme00VENUoRKVwSgmbXIpP2EN6bgd2fIDo4FEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764752512; c=relaxed/simple; bh=Z90iT31gx2TdhPShR6J+FUYSiuTz8w9sVulPmvlv/kw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NT4XD6FuArxDFNwBKSAPVEvuU9v6zD6v5w+c++VZg15XSKlqc0uc4CeJlUO6DzNrxjk/yoenafQzilY0Nd83CKRc1A7kqZmRpRGo2jIKjT95C8bZ6z1yEAcQlt4f1wMzPV4jnCx2PccgBNa+ouj4x28RZQruvzbTaaRlNC8ABZQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Kqm9mjQq; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IZE5L+Ee; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Kqm9mjQq"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IZE5L+Ee" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B381clI4011051 for ; Wed, 3 Dec 2025 09:01:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=HeqvFSmO/X5 NfVnoW+j+jvl+LvG9c0Flpsq25vj+uJM=; b=Kqm9mjQqmAAWdQWir7f1A25P0CY /6lxOs75yOFYasUcJ7mLcuScNj4DQIV1rb/twGwXOn0gy4y87BVtP2MjYFZp/tkZ v6mY3+fUSQ9XUlRcyMqacV3HEKNF7fGb95CGabA57EsIB5ZHOg1j70F4uP1GniC6 XUDsPGJBiFc39hgvhK5aVhyiNGXL/uExdjNN8lwyvoHcgTsXANX1PkBAIGZOjgIo sf2azAJ+nj+XDkbPfIurTWcSEjTFUqbePk+sxZy3Y0hNL8OlR0Tyxyoor4syCzlh jzqsXTJ2nllyVkClrYlh+mWZlt548hDPkZCCPmXuyijCgW+NWGaGAJIIpyA== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4at8d9hr44-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 03 Dec 2025 09:01:49 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-7d481452732so6930966b3a.1 for ; Wed, 03 Dec 2025 01:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764752509; x=1765357309; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HeqvFSmO/X5NfVnoW+j+jvl+LvG9c0Flpsq25vj+uJM=; b=IZE5L+EeJoJoGntcJlIHS4KuteCsVNsCwjhL2+BZBHHWxmVaXqd9kZmSae/uuw7ekm em+356tUf2pv+PzuzCZS+cfz774JGAk2Ntk9WZ1eQ8CPARZdAuzJ+lkReIfWJvANFIpe Usol1VpD97e8Abpy2c9l0Um9zFfIwFa2mvritgfQo3B8TuZH2FNAsCmpIfnteHRLY0b5 nWNDDEy8zCX/929Iwte8owB9rNcrFYzbhGBd82/Z0ruoYRCeF5D9BVTyNYsVZbclLYZN pss36cLgs0MFwQooiGkRdPBbKMV8PbAv4EoQNl0DDOlKYLBUKNInNlCJcIsa9QTRoEMM vOig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764752509; x=1765357309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HeqvFSmO/X5NfVnoW+j+jvl+LvG9c0Flpsq25vj+uJM=; b=U42K07cmICJged/wJQv2tLIe9yTVkKDcOhb4YeNI4DWRoSNoRGGrQurMZ1br5nlUiE wQBUIR6NAis+9Yh3X6mLIkqoHolO8mevr+yYhBDfa7JrCEcu7UhsSsMVdiaKAjeyKVGL KELYY17yYFCGuoz+eVkYJpLgWaG6H2da49a7mM7uG/gi91mHJyCbRYkq3KeT4DqHkUPY oOMtgSr1Ef+NgL/o4Q6hSxQ/1PN4ctd9CIyK2AARvfPAjgd7RUnHaIXfBvuGaS+JlqWU qksTSyZO0oiPhixbH4yy1YXw9ZSkFM6omZizI8vJJMp6pGb3hyajiK3jZ8T3nZ7RBWH/ RyDw== X-Forwarded-Encrypted: i=1; AJvYcCWGIKSo5NjEGi06wqcOVeETvSlTrcMLNuFiCZBmEnxoeIyFPxEtuixwJQ/b5zf/tckOx3hICmcW8sbUBoo=@vger.kernel.org X-Gm-Message-State: AOJu0Yzwkqz/MzXxNlQmfdrpOD5b31gZIi9BaYXEyvnuOwDWRWIXyIuQ 0lSwiOL8f2Hx5yO+v0WwK9kvmjsxGaCOjEA1vWm1QqeZCP7CgZo0aRwF9+ssClD8miu8bBWYTHT /oTxfUv65cvVabxzxcX5ONVM5eB7an9LuN4kmfpxEWU8ORXuqc9ojyWgdTRr1DI5XvYA= X-Gm-Gg: ASbGncun68rMEOPQl8WFS8C4vFfp1z3PyWo9SOvW7XuUv6JComM5gY3kbTKCnYFzEZ2 wqw72AH2Y1YQpbHuOPkpyfPA5nJfoLEsPIoCDL7qOFOgd/ovcKWBM5q6NqjSHJWsuWk80CwEQ+u +FYAYk40kpbMdiwjOgzeIvDaW4pZRXVMhDBLxO2ewrEXKUI/PC/Fz5Nav59Q/gcf1vk9eTTpO2J hXb+9rGkjM5VIDfgDyU7h5iHQylXOY3NFDc/YT0TIl0II2tYlE/7yjcMC9232ScUXKq2w5aILGC 6TPpEo1WuP9Kf6ny09/jXhIkHRrT2eG2I49yPnSvMoQUIOAKUZXswwk8rCdCvtcrGIyjrfNjmJz mNccrFGmRLlWK9yGG7uzl4961fj1/OxAGtfSJSZD5d4fr/9/CMFXb8w/3GfvVFjYO X-Received: by 2002:a05:7022:2594:b0:11a:26dc:eb61 with SMTP id a92af1059eb24-11df0bd1607mr1425385c88.7.1764752508387; Wed, 03 Dec 2025 01:01:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFypXEuJz7No3/j7ICVa2eD+6Rpgcb47Oq7j1Ii9KUfoZ+Bk3aepHX6cHoDOUML9Ec3RbqfAA== X-Received: by 2002:a05:7022:2594:b0:11a:26dc:eb61 with SMTP id a92af1059eb24-11df0bd1607mr1425364c88.7.1764752507750; Wed, 03 Dec 2025 01:01:47 -0800 (PST) Received: from hu-songchai-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-11dcb057cb0sm100001866c88.9.2025.12.03.01.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Dec 2025 01:01:45 -0800 (PST) From: Songwei Chai To: andersson@kernel.org, alexander.shishkin@linux.intel.com, kernel@oss.qualcomm.com, mike.leach@linaro.org, suzuki.poulose@arm.com, james.clark@arm.com, krzk+dt@kernel.org, conor+dt@kernel.org Cc: Songwei Chai , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, coresight@lists.linaro.org, devicetree@vger.kernel.org Subject: [PATCH v8 4/7] qcom-tgu: Add TGU decode support Date: Wed, 3 Dec 2025 01:00:52 -0800 Message-Id: <20251203090055.2432719-5-songwei.chai@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251203090055.2432719-1-songwei.chai@oss.qualcomm.com> References: <20251203090055.2432719-1-songwei.chai@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjAzMDA3MCBTYWx0ZWRfX4H6a+kdKoEkF xifXSgm0/rS/Bn4io5VlJZhTdeZel3w4qPEVyKWzZfBWlHR2X2Xtyb1arPZpukyvXP9iP6nnf43 QGYZZoB6WI1UDjXOXQt8t+eg7aLGCShMkzLDWv2QfsVTYKIhLRQZAZ1e7dIgftBlXqa66u1+REc 1cQtN215uqDLfnUmhAjdBziCFzbmeSXn72KEmB7UJmsP25B//t3kveslMbJtpYusydLh7wnXIBy fQPfOt7Hdw4ZBG/CpvAGD508axizRjl4AEDSEmZzZOyVvS2XkNm12sksfe0zNNcmeQNscne88Xs IV0k0SXGqoR3x10RwDL/Dg4hWv6ymt0DnoeOpsG7us9kHKMLRDJt9wYNAaXbLChRSUWrb1QQ3zh zyliV1asUNVmDKi7s+1R8CY52VmEaw== X-Authority-Analysis: v=2.4 cv=A7th/qWG c=1 sm=1 tr=0 ts=692ffc7d cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=DXd_79bSlwW_W-LZS_AA:9 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-ORIG-GUID: Gr_wGAUf1oh04UHulL-Hs_qfahflkksW X-Proofpoint-GUID: Gr_wGAUf1oh04UHulL-Hs_qfahflkksW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-02_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512030070 Content-Type: text/plain; charset="utf-8" Decoding is when all the potential pieces for creating a trigger are brought together for a given step. Example - there may be a counter keeping track of some occurrences and a priority-group that is being used to detect a pattern on the sense inputs. These 2 inputs to condition_decode must be programmed, for a given step, to establish the condition for the trigger, or movement to another steps. Signed-off-by: Songwei Chai --- .../testing/sysfs-bus-coresight-devices-tgu | 7 + drivers/hwtracing/qcom/tgu.c | 153 ++++++++++++++++-- drivers/hwtracing/qcom/tgu.h | 27 ++++ 3 files changed, 173 insertions(+), 14 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu b/Do= cumentation/ABI/testing/sysfs-bus-coresight-devices-tgu index eafb0e0dd030..df73a9d5043e 100644 --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tgu @@ -14,3 +14,10 @@ KernelVersion 6.18 Contact: Jinlong Mao , Songwei Chai Description: (RW) Set/Get the sensed signal with specific step and priority for TGU. + +What: /sys/bus/coresight/devices//step[0:7]_condition_decode/re= g[0:3] +Date: December 2025 +KernelVersion 6.18 +Contact: Jinlong Mao , Songwei Chai +Description: + (RW) Set/Get the decode mode with specific step for TGU. diff --git a/drivers/hwtracing/qcom/tgu.c b/drivers/hwtracing/qcom/tgu.c index a1ad8d97e9d2..b4ff41cf0a11 100644 --- a/drivers/hwtracing/qcom/tgu.c +++ b/drivers/hwtracing/qcom/tgu.c @@ -21,8 +21,36 @@ static int calculate_array_location(struct tgu_drvdata *= drvdata, int step_index, int operation_index, int reg_index) { - return operation_index * (drvdata->max_step) * (drvdata->max_reg) + - step_index * (drvdata->max_reg) + reg_index; + int ret =3D -EINVAL; + + switch (operation_index) { + case TGU_PRIORITY0: + case TGU_PRIORITY1: + case TGU_PRIORITY2: + case TGU_PRIORITY3: + ret =3D operation_index * (drvdata->max_step) * + (drvdata->max_reg) + + step_index * (drvdata->max_reg) + reg_index; + break; + case TGU_CONDITION_DECODE: + ret =3D step_index * (drvdata->max_condition_decode) + + reg_index; + break; + default: + break; + } + return ret; +} + +static int check_array_location(struct tgu_drvdata *drvdata, int step, + int ops, int reg) +{ + int result =3D calculate_array_location(drvdata, step, ops, reg); + + if (result =3D=3D -EINVAL) + dev_err(&drvdata->csdev->dev, "%s - Fail\n", __func__); + + return result; } =20 static ssize_t tgu_dataset_show(struct device *dev, @@ -37,8 +65,26 @@ static ssize_t tgu_dataset_show(struct device *dev, tgu_attr->operation_index, tgu_attr->reg_num); =20 - return sysfs_emit(buf, "0x%x\n", - drvdata->value_table->priority[index]); + index =3D check_array_location(drvdata, tgu_attr->step_index, + tgu_attr->operation_index, tgu_attr->reg_num); + + if (index =3D=3D -EINVAL) + return -EINVAL; + + switch (tgu_attr->operation_index) { + case TGU_PRIORITY0: + case TGU_PRIORITY1: + case TGU_PRIORITY2: + case TGU_PRIORITY3: + return sysfs_emit(buf, "0x%x\n", + drvdata->value_table->priority[index]); + case TGU_CONDITION_DECODE: + return sysfs_emit(buf, "0x%x\n", + drvdata->value_table->condition_decode[index]); + default: + break; + } + return -EINVAL; } =20 static ssize_t tgu_dataset_store(struct device *dev, @@ -46,6 +92,7 @@ static ssize_t tgu_dataset_store(struct device *dev, const char *buf, size_t size) { int index; + int ret =3D -EINVAL; unsigned long val; =20 struct tgu_drvdata *tgu_drvdata =3D dev_get_drvdata(dev->parent); @@ -53,15 +100,32 @@ static ssize_t tgu_dataset_store(struct device *dev, container_of(attr, struct tgu_attribute, attr); =20 if (kstrtoul(buf, 0, &val)) - return -EINVAL; + return ret; =20 guard(spinlock)(&tgu_drvdata->lock); - index =3D calculate_array_location(tgu_drvdata, tgu_attr->step_index, + index =3D check_array_location(tgu_drvdata, tgu_attr->step_index, tgu_attr->operation_index, tgu_attr->reg_num); =20 - tgu_drvdata->value_table->priority[index] =3D val; - return size; + if (index =3D=3D -EINVAL) + return ret; + + switch (tgu_attr->operation_index) { + case TGU_PRIORITY0: + case TGU_PRIORITY1: + case TGU_PRIORITY2: + case TGU_PRIORITY3: + tgu_drvdata->value_table->priority[index] =3D val; + ret =3D size; + break; + case TGU_CONDITION_DECODE: + tgu_drvdata->value_table->condition_decode[index] =3D val; + ret =3D size; + break; + default: + break; + } + return ret; } =20 static umode_t tgu_node_visible(struct kobject *kobject, @@ -78,13 +142,27 @@ static umode_t tgu_node_visible(struct kobject *kobjec= t, container_of(dev_attr, struct tgu_attribute, attr); =20 if (tgu_attr->step_index < drvdata->max_step) { - ret =3D (tgu_attr->reg_num < drvdata->max_reg) ? - attr->mode : 0; + switch (tgu_attr->operation_index) { + case TGU_PRIORITY0: + case TGU_PRIORITY1: + case TGU_PRIORITY2: + case TGU_PRIORITY3: + ret =3D (tgu_attr->reg_num < drvdata->max_reg) ? + attr->mode : 0; + break; + case TGU_CONDITION_DECODE: + ret =3D (tgu_attr->reg_num < + drvdata->max_condition_decode) ? + attr->mode : 0; + break; + default: + break; + } } return ret; } =20 -static void tgu_write_all_hw_regs(struct tgu_drvdata *drvdata) +static ssize_t tgu_write_all_hw_regs(struct tgu_drvdata *drvdata) { int i, j, k, index; =20 @@ -92,8 +170,10 @@ static void tgu_write_all_hw_regs(struct tgu_drvdata *d= rvdata) for (i =3D 0; i < drvdata->max_step; i++) { for (j =3D 0; j < MAX_PRIORITY; j++) { for (k =3D 0; k < drvdata->max_reg; k++) { - index =3D calculate_array_location( + index =3D check_array_location( drvdata, i, j, k); + if (index =3D=3D -EINVAL) + goto exit; =20 writel(drvdata->value_table->priority[index], drvdata->base + @@ -101,9 +181,23 @@ static void tgu_write_all_hw_regs(struct tgu_drvdata *= drvdata) } } } + + for (i =3D 0; i < drvdata->max_step; i++) { + for (j =3D 0; j < drvdata->max_condition_decode; j++) { + index =3D check_array_location(drvdata, i, + TGU_CONDITION_DECODE, j); + if (index =3D=3D -EINVAL) + goto exit; + + writel(drvdata->value_table->condition_decode[index], + drvdata->base + CONDITION_DECODE_STEP(i, j)); + } + } /* Enable TGU to program the triggers */ writel(1, drvdata->base + TGU_CONTROL); +exit: CS_LOCK(drvdata->base); + return index >=3D 0 ? 0 : -EINVAL; } =20 static void tgu_set_reg_number(struct tgu_drvdata *drvdata) @@ -131,19 +225,32 @@ static void tgu_set_steps(struct tgu_drvdata *drvdata) drvdata->max_step =3D TGU_DEVID_STEPS(devid); } =20 +static void tgu_set_conditions(struct tgu_drvdata *drvdata) +{ + u32 devid; + + devid =3D readl(drvdata->base + CORESIGHT_DEVID); + drvdata->max_condition_decode =3D TGU_DEVID_CONDITIONS(devid); +} + static int tgu_enable(struct coresight_device *csdev, enum cs_mode mode, void *data) { + int ret =3D 0; struct tgu_drvdata *drvdata =3D dev_get_drvdata(csdev->dev.parent); =20 guard(spinlock)(&drvdata->lock); if (drvdata->enable) return -EBUSY; =20 - tgu_write_all_hw_regs(drvdata); + ret =3D tgu_write_all_hw_regs(drvdata); + + if (ret =3D=3D -EINVAL) + goto exit; drvdata->enable =3D true; =20 - return 0; +exit: + return ret; } =20 static int tgu_disable(struct coresight_device *csdev, void *data) @@ -260,6 +367,14 @@ static const struct attribute_group *tgu_attr_groups[]= =3D { PRIORITY_ATTRIBUTE_GROUP_INIT(7, 1), PRIORITY_ATTRIBUTE_GROUP_INIT(7, 2), PRIORITY_ATTRIBUTE_GROUP_INIT(7, 3), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(0), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(1), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(2), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(3), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(4), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(5), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(6), + CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(7), NULL, }; =20 @@ -296,6 +411,7 @@ static int tgu_probe(struct amba_device *adev, const st= ruct amba_id *id) =20 tgu_set_reg_number(drvdata); tgu_set_steps(drvdata); + tgu_set_conditions(drvdata); =20 drvdata->value_table =3D devm_kzalloc(dev, sizeof(*drvdata->value_table), GFP_KERNEL); @@ -311,6 +427,15 @@ static int tgu_probe(struct amba_device *adev, const s= truct amba_id *id) if (!drvdata->value_table->priority) return -ENOMEM; =20 + drvdata->value_table->condition_decode =3D devm_kzalloc( + dev, + drvdata->max_condition_decode * drvdata->max_step * + sizeof(*(drvdata->value_table->condition_decode)), + GFP_KERNEL); + + if (!drvdata->value_table->condition_decode) + return -ENOMEM; + drvdata->enable =3D false; desc.type =3D CORESIGHT_DEV_TYPE_HELPER; desc.pdata =3D adev->dev.platform_data; diff --git a/drivers/hwtracing/qcom/tgu.h b/drivers/hwtracing/qcom/tgu.h index 444804e52337..cac5efeee1e9 100644 --- a/drivers/hwtracing/qcom/tgu.h +++ b/drivers/hwtracing/qcom/tgu.h @@ -11,6 +11,7 @@ =20 #define TGU_DEVID_SENSE_INPUT(devid_val) ((int) BMVAL(devid_val, 10, 17)) #define TGU_DEVID_STEPS(devid_val) ((int)BMVAL(devid_val, 3, 6)) +#define TGU_DEVID_CONDITIONS(devid_val) ((int)BMVAL(devid_val, 0, 2)) #define NUMBER_BITS_EACH_SIGNAL 4 #define LENGTH_REGISTER 32 =20 @@ -44,6 +45,7 @@ */ #define STEP_OFFSET 0x1D8 #define PRIORITY_START_OFFSET 0x0074 +#define CONDITION_DECODE_OFFSET 0x0050 #define PRIORITY_OFFSET 0x60 #define REG_OFFSET 0x4 =20 @@ -52,6 +54,9 @@ (PRIORITY_START_OFFSET + PRIORITY_OFFSET * priority +\ REG_OFFSET * reg + STEP_OFFSET * step) =20 +#define CONDITION_DECODE_STEP(step, decode) \ + (CONDITION_DECODE_OFFSET + REG_OFFSET * decode + STEP_OFFSET * step) + #define tgu_dataset_rw(name, step_index, type, reg_num) \ (&((struct tgu_attribute[]){ { \ __ATTR(name, 0644, tgu_dataset_show, tgu_dataset_store), \ @@ -64,6 +69,9 @@ tgu_dataset_rw(reg##reg_num, step_index, TGU_PRIORITY##priority, \ reg_num) =20 +#define STEP_DECODE(step_index, reg_num) \ + tgu_dataset_rw(reg##reg_num, step_index, TGU_CONDITION_DECODE, reg_num) + #define STEP_PRIORITY_LIST(step_index, priority) \ {STEP_PRIORITY(step_index, 0, priority), \ STEP_PRIORITY(step_index, 1, priority), \ @@ -86,6 +94,14 @@ NULL \ } =20 +#define STEP_DECODE_LIST(n) \ + {STEP_DECODE(n, 0), \ + STEP_DECODE(n, 1), \ + STEP_DECODE(n, 2), \ + STEP_DECODE(n, 3), \ + NULL \ + } + #define PRIORITY_ATTRIBUTE_GROUP_INIT(step, priority)\ (&(const struct attribute_group){\ .attrs =3D (struct attribute*[])STEP_PRIORITY_LIST(step, priority),\ @@ -93,11 +109,19 @@ .name =3D "step" #step "_priority" #priority \ }) =20 +#define CONDITION_DECODE_ATTRIBUTE_GROUP_INIT(step)\ + (&(const struct attribute_group){\ + .attrs =3D (struct attribute*[])STEP_DECODE_LIST(step),\ + .is_visible =3D tgu_node_visible,\ + .name =3D "step" #step "_condition_decode" \ + }) + enum operation_index { TGU_PRIORITY0, TGU_PRIORITY1, TGU_PRIORITY2, TGU_PRIORITY3, + TGU_CONDITION_DECODE, }; =20 /* Maximum priority that TGU supports */ @@ -112,6 +136,7 @@ struct tgu_attribute { =20 struct value_table { unsigned int *priority; + unsigned int *condition_decode; }; =20 /** @@ -124,6 +149,7 @@ struct value_table { * @value_table: Store given value based on relevant parameters. * @max_reg: Maximum number of registers * @max_step: Maximum step size + * @max_condition_decode: Maximum number of condition_decode * * This structure defines the data associated with a TGU device, * including its base address, device pointers, clock, spinlock for @@ -139,6 +165,7 @@ struct tgu_drvdata { struct value_table *value_table; int max_reg; int max_step; + int max_condition_decode; }; =20 #endif --=20 2.34.1