From nobody Tue Feb 10 00:57:46 2026 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 370512D9EED for ; Fri, 19 Dec 2025 06:59:31 +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=1766127573; cv=none; b=hlvGx/1TLHm0VPSAMnRDkM04K0nfyOqk5mw2dBpBiMTQjiv0/WlitoIJ8+1pwP/3b/aWJnD12V+/7EI4GDMgWYHsstYNc+nScavUcF7AG09FaX3n0A8Riqi/x4TIZ2SE71R3ya1cutoQIVp+KrPGYbT7XP32Gu2ZmQOEdKUOdeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766127573; c=relaxed/simple; bh=IOPGPV7MmoA/0qT89i+KyRMOFH5+t65ggdYuvCX6SRI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WK10Wn9p9RlBFr8Ss+AYcmibtoG1DXRYJzc/4rfeyi3XqXvgpAb0uY+nc8VAsfDrqxy3/7n6eP/VcOq8nnQ8adK6plmd3ZlqfILVqYK6KHjmvx2aaDMuGkIfEzSEAxK3zhgfuT3hDgqTWbB9gbhorVm4jAnXMu449vtPSjdiU44= 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=pxWxRxwj; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=M3Pp8yWj; 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="pxWxRxwj"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="M3Pp8yWj" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BJ4bxL24153900 for ; Fri, 19 Dec 2025 06:59:30 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=T2gqUfcxUo7 OzT2+W/flRobk/FmSpbVousEo4UlUkZE=; b=pxWxRxwjv3ZRFst8ig87kLvVrHb M6OkyutrIHBldwkUYff5/HDPjNi0sibQZdwTmmTeYFVsq16/8suEmIQAHPk6PA95 C3zXlBNR8Ik+pA647FVWrV0GzylkKUrXiDYaH3sLreohynUl0+jXtHXJCTR998pz eqbEU+26DLNMLKKeAJX29J5XuGoTkvbU/bdwBYSKvdz5p1SIcFGes84ClLTkxblO 1Yr4ruz0aHtM2JlOO2vy8XpbV2GJG7PyrM4s6ta7aomJwZo9Qe02m+Yo4pyyQMk4 xCygBf9h/guAtgHAqTv/Roc6eI3YSBy+rmxAqtsjKRhEYG0OP8hXmCFW/gQ== Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b4r2csmg5-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 19 Dec 2025 06:59:30 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-b5edecdf94eso2543324a12.2 for ; Thu, 18 Dec 2025 22:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1766127570; x=1766732370; 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=T2gqUfcxUo7OzT2+W/flRobk/FmSpbVousEo4UlUkZE=; b=M3Pp8yWjhGXn3BKx7+JWO+zia1kL8uvXzb9CTRQp9lkW+iAbxpD4L9qG87MzhwjRnR oTZtJZPwos5TPVBlJQg2clKwKrmeZmpO0pGClK+DO2AlnsbU8K5X55SVh+/XhYGyI62z 1OJQ7x3pm1pjG4D4yHQ/MTxiGF/9i5tH+Fd2GF8DtEdencU023AJ8fA6Ul0OPXmuswev R3h6RvQLt8RmEOXspXtJNDl1JVKPkCjAwOJ8kuU/1X2njktSO7nw+izT3Gsi5oCdWg6N vNDVJ5W17UfENctWO/tptM3uBXmRgny/ixr7LXrAx+7sP+IYNQNiCS4X3eWvDvYoMvlk fT1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766127570; x=1766732370; 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=T2gqUfcxUo7OzT2+W/flRobk/FmSpbVousEo4UlUkZE=; b=BEKFysuh63wX5LW94dzQVARdxMGxW6irn55QTjbzuOSNKPff7MqdxfezAU86Lytdw8 Al0le64oHejcRJi7T+sSRDvM6Ltd18bXi9P2de/jRzvG8utWqVqzikVmqvXqbXeqdt0l Ve4l8cJiQw/KFJMjqV0RSI4HnMea0ro1YtpiUKJWN7bHOcdDJtg2PcKjvlz3jJYlhAIy EAOeeq6FeN4/uC9NB5c+/TGyunGIwa4LgRmMzLCGFUNMAsaXUw/bFZc4uWbwBtIoHGBX xnWRWj9u8BKh5aWHSfayB1/Lr27wOwNxTK+P9XqrfupI/BSB6fOGlQEY2Nhi3MWxi0mo +X9Q== X-Forwarded-Encrypted: i=1; AJvYcCVezOpisbipZDhFy/w31GsEwJXzIEH/Y5R6IPUxGOBGo8FhBu3p9U7XJ1z6N7WJyZKZs9Nvo5Bo8+ZCZvA=@vger.kernel.org X-Gm-Message-State: AOJu0YybtYRF/MvpChtDmiMAkqpp/GISPT0/7V8Juvdk/iHAKz1NFRnU ckIFaUhOqRBaS5Gx5VBWlr5cWjFfgQlushvXe4VoSESDc9enfuqWaxx/NZAsNQ093U56gkBm8qI LdGmZg9vJmV148tUlVgMLfgEZ9HJEYKTIt7imYebusIE3ve/jfi+38orFa9xeh9A4kYI= X-Gm-Gg: AY/fxX6j8MJbDIL26BB7AEwF0R3huUsSJDbMeqwYwLPwolI+K66z1mvO5jG13EC56S1 Qe4pqeYooaUKYVYvmyy7M351TUDNGl3geDb2p2F8d51eKKoffh9eU24J/XVgr1SeNmlPpkcADv5 v1gEuv+3Yf4ak//yXNLjHKDMgQpQB3dJh92zVC3poUDwTFiQm7VpHIfZWyiIw5gtRnQPPXogT1J nGxXqds34kJX9bMQRMeoYn1nL9CH6BUOs2OyeR19SjcNnEe2HeUoiQCl0Y57ej3LYKvJQ+7OjN6 0o/1VS1TTpZ22fR8tM9KhI1T/GFSJBgrJpahJKFEeUxdvSGtZn2UX9DKDj6+scSZr2ZoucV/4qn NWoTYe4ghIyYdRLiCNoVtLE3AKsXKsheQkRyIHE1MsfLvoVQBJFddcr+mF5PYx4kl X-Received: by 2002:a05:7300:d58b:b0:2b0:4f34:eed3 with SMTP id 5a478bee46e88-2b05ec3d5e0mr1826197eec.27.1766127569532; Thu, 18 Dec 2025 22:59:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7swjLusQQIOvIKFd3PQZZgezJc+x5C5ggajZ3DgdWXn3peWCSIOGlOTBo845VJVlqdE3v9A== X-Received: by 2002:a05:7300:d58b:b0:2b0:4f34:eed3 with SMTP id 5a478bee46e88-2b05ec3d5e0mr1826167eec.27.1766127568835; Thu, 18 Dec 2025 22:59:28 -0800 (PST) Received: from hu-songchai-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b05fcfc1b7sm3614954eec.0.2025.12.18.22.59.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 22:59:28 -0800 (PST) From: Songwei Chai To: andersson@kernel.org, alexander.shishkin@linux.intel.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, gregkh@linuxfoundation.org Subject: [PATCH v9 4/7] qcom-tgu: Add TGU decode support Date: Thu, 18 Dec 2025 22:58:59 -0800 Message-Id: <20251219065902.2296896-5-songwei.chai@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251219065902.2296896-1-songwei.chai@oss.qualcomm.com> References: <20251219065902.2296896-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-GUID: hj3vRPtPdx6LGMbClkCYucNNK2Zq2C40 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE5MDA1NiBTYWx0ZWRfX9N3/ZdqTeHnq tqTtumXWwnAB7k+MsFy3lb2QkQb/ed4I3FxKsOeeTj3UMQask38DXpBjZmkoM2SlYm7sJZOEaDW cOS7OBics3UFrgkkutCmuu7ijKk9jhxxabX6p1i8prum+BTc/9nKb+g10cr+oZecJTQV5WQiUgj CHm1E7Bgb5AfIPyBCRO1/tVi6DWpLUQqBdzerbYpqh2ZRY6EPcIg7O6bGsFYDfWVXWEF5ri/nja HaqDMh7VfQQjMUuYbImrWjpDMHQRN7HCoznEZ+ora4u9U8WbLS61Cwx/v+Q5q9WadlS7OuHcJEv H2vTwqRlezZZHYT6myl8vtynFuKoOnByDmJ2WJkaZbI984639ZSYWvzIR7DmbNgLdDeZvI4UIYS Lkx3SYW8E2Vf8P2H4Qvb25U4k9zxocc0qdwZGwmWemqJBKQ5woDgmh2A3MeyBGfqOqYKTgxfmcs zO/heICxXaC6Ne70LaQ== X-Proofpoint-ORIG-GUID: hj3vRPtPdx6LGMbClkCYucNNK2Zq2C40 X-Authority-Analysis: v=2.4 cv=Lp2fC3dc c=1 sm=1 tr=0 ts=6944f7d2 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=cgLhVu-Bd7kgOx2TuvUA:9 a=3WC7DwWrALyhR5TkjVHa:22 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-19_02,2025-12-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2512190056 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 --- .../ABI/testing/sysfs-bus-amba-devices-tgu | 7 + drivers/hwtracing/qcom/tgu.c | 156 ++++++++++++++++-- drivers/hwtracing/qcom/tgu.h | 27 +++ 3 files changed, 173 insertions(+), 17 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu b/Documen= tation/ABI/testing/sysfs-bus-amba-devices-tgu index d04a01368089..c0e50ee95839 100644 --- a/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu +++ b/Documentation/ABI/testing/sysfs-bus-amba-devices-tgu @@ -14,3 +14,10 @@ KernelVersion 6.19 Contact: Jinlong Mao , Songwei Chai Description: (RW) Set/Get the sensed signal with specific step and priority for TGU. + +What: /sys/bus/amba/devices//step[0:7]_condition_decode/reg[0:3] +Date: December 2025 +KernelVersion 6.19 +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 447d7e68d132..4140dc544e5e 100644 --- a/drivers/hwtracing/qcom/tgu.c +++ b/drivers/hwtracing/qcom/tgu.c @@ -18,8 +18,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->dev, "%s - Fail\n", __func__); + + return result; } =20 static ssize_t tgu_dataset_show(struct device *dev, @@ -30,12 +58,26 @@ static ssize_t tgu_dataset_show(struct device *dev, struct tgu_attribute *tgu_attr =3D container_of(attr, struct tgu_attribute, attr); =20 - index =3D calculate_array_location(drvdata, tgu_attr->step_index, - tgu_attr->operation_index, - tgu_attr->reg_num); + 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; =20 - return sysfs_emit(buf, "0x%x\n", - drvdata->value_table->priority[index]); + 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, @@ -43,6 +85,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); @@ -50,15 +93,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, @@ -75,13 +135,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 @@ -89,8 +163,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 + @@ -98,9 +174,23 @@ 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 < 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: TGU_LOCK(drvdata->base); + return index >=3D 0 ? 0 : -EINVAL; } =20 static void tgu_set_reg_number(struct tgu_drvdata *drvdata) @@ -129,18 +219,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 + TGU_DEVID); + drvdata->max_condition_decode =3D TGU_DEVID_CONDITIONS(devid); +} + static int tgu_enable(struct device *dev) { + int ret =3D 0; struct tgu_drvdata *drvdata =3D dev_get_drvdata(dev); =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 device *dev) @@ -245,6 +349,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 @@ -269,6 +381,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 ret =3D sysfs_create_groups(&dev->kobj, tgu_attr_groups); if (ret) { @@ -290,6 +403,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; =20 pm_runtime_put(&adev->dev); diff --git a/drivers/hwtracing/qcom/tgu.h b/drivers/hwtracing/qcom/tgu.h index 2cf95c239ee7..732126b896e1 100644 --- a/drivers/hwtracing/qcom/tgu.h +++ b/drivers/hwtracing/qcom/tgu.h @@ -15,6 +15,7 @@ #define BMVAL(val, lsb, msb) ((val & GENMASK(msb, lsb)) >> lsb) #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 @@ -48,6 +49,7 @@ */ #define STEP_OFFSET 0x1D8 #define PRIORITY_START_OFFSET 0x0074 +#define CONDITION_DECODE_OFFSET 0x0050 #define PRIORITY_OFFSET 0x60 #define REG_OFFSET 0x4 =20 @@ -56,6 +58,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), \ @@ -68,6 +73,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), \ @@ -90,6 +98,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),\ @@ -97,11 +113,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 */ @@ -116,6 +140,7 @@ struct tgu_attribute { =20 struct value_table { unsigned int *priority; + unsigned int *condition_decode; }; =20 static inline void TGU_LOCK(void __iomem *addr) @@ -145,6 +170,7 @@ static inline void TGU_UNLOCK(void __iomem *addr) * @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 @@ -159,6 +185,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