From patchwork Tue Dec 17 02:20:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ninad Palsule X-Patchwork-Id: 851538 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 98072F9FE; Tue, 17 Dec 2024 02:21:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402094; cv=none; b=HliuZ13b81muaDcgodnxOx1Hgcusfo1/hun/IoHWAELkZb9Qu38jk/fSUnYd5cIWYHB4I732boS/nE5kFNcAMcfOJ1bOWw8fUNpX/1WMTDblzg0CHmQu+2K+k/1jbWmWAXlBzjVAxf2dca/NofNsjuuhZ6cA/sGYAkEtKEIaC64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734402094; c=relaxed/simple; bh=u2UOHJSHr66xoPKDC3Lf0TWe6yPspuuHr0QQ24/UwF4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tRJvinDZauBNoov1aZg3Tg+ZDk+CFj/3zKK8+OR+ceL2tvvHz+PWCuAHM5tLJ2qewk05WQfmshfS6AENk03F7muWRICX4RCWdCen+iv23xlz2xgf4Ky5fYekRg/dqlJ1PEOJf1PaHdV7NfWNd3LKNj/yEyWSPqUqvIl+GAWND3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=dymMaBWf; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="dymMaBWf" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH1RnSi019974; Tue, 17 Dec 2024 02:20:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=AsDAqIMu5OeVPY661 bWbJiymnpLSWD2TsLjT9CDADno=; b=dymMaBWfWmwziaQMM/pSxoIREzA9yZrFm 3z4nlxy45ytc0Y8yCiybAsjNQRV8eI9hOIzz10l2Lrthf3jlyqZ988SORqQtbtsb Im8fiRgPfFhjfw7lX63vFtOcjSU8oLMYmrD9bmhCXZWyenOiHGa0ubw1YciCEcvP xU5TnxSvZ8DoaSsdKhlLWwtSJxC4LHLqzSLreAKtCkABG0ey2PeAEYuriLdntbS3 Q31v/cJpUKAOr10MwU9XL4AYY8dPasZ8fFS0KhuPBoLkEKutiBFvAc8Y6xmU0UkC Ad3CfOAxLSZ92dW1CXiRuML4c/Wi7Btpcv9F1a5qJ/1raB4elyNzg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43jcpgws3k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 02:20:56 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4BH2KuY2015122; Tue, 17 Dec 2024 02:20:56 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43jcpgws3g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 02:20:56 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4BH2DbpX005549; Tue, 17 Dec 2024 02:20:54 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 43hnbn0taq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 17 Dec 2024 02:20:54 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4BH2KreU15270652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Dec 2024 02:20:53 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A53E158055; Tue, 17 Dec 2024 02:20:53 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E1B85803F; Tue, 17 Dec 2024 02:20:51 +0000 (GMT) Received: from gfwa153.aus.stglabs.ibm.com (unknown [9.3.84.127]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 17 Dec 2024 02:20:51 +0000 (GMT) From: Ninad Palsule To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, eajames@linux.ibm.com, jdelvare@suse.com, linux@roeck-us.net, corbet@lwn.net, joel@jms.id.au, andrew@codeconstruct.com.au, Delphine_CC_Chiu@Wiwynn.com, broonie@kernel.org, peteryin.openbmc@gmail.com, noahwang.wang@outlook.com, naresh.solanki@9elements.com, lukas@wunner.de, jbrunet@baylibre.com, patrick.rudolph@9elements.com, gregkh@linuxfoundation.org, peterz@infradead.org, pbiel7@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-i2c@vger.kernel.org Cc: Ninad Palsule Subject: [PATCH v3 1/4] hwmon: (pmbus/core) Add PMBUS_REVISION in debugfs Date: Mon, 16 Dec 2024 20:20:39 -0600 Message-ID: <20241217022046.113830-2-ninad@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241217022046.113830-1-ninad@linux.ibm.com> References: <20241217022046.113830-1-ninad@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vm7WmghfJNx8qz6xWi1CMW3xXaqNVGcp X-Proofpoint-ORIG-GUID: exCA8cDQCPjJnn5TJ4jfbuLFO_0Qf5L3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 mlxscore=0 phishscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412170015 Add debugfs file for the PMBUS_REVISION command. This command provides information about PMBus protocol revision number. Signed-off-by: Ninad Palsule --- drivers/hwmon/pmbus/pmbus_core.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index a7000314e5ad..787683e83db6 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -3534,11 +3534,11 @@ static int pmbus_init_debugfs(struct i2c_client *client, /* * Allocate the max possible entries we need. - * 6 entries device-specific + * 7 entries device-specific * 10 entries page-specific */ entries = devm_kcalloc(data->dev, - 6 + data->info->pages * 10, sizeof(*entries), + 7 + data->info->pages * 10, sizeof(*entries), GFP_KERNEL); if (!entries) return -ENOMEM; @@ -3551,6 +3551,15 @@ static int pmbus_init_debugfs(struct i2c_client *client, * assume that values of the following registers are the same for all * pages and report values only for page 0. */ + if (pmbus_check_byte_register(client, 0, PMBUS_REVISION)) { + entries[idx].client = client; + entries[idx].page = 0; + entries[idx].reg = PMBUS_REVISION; + debugfs_create_file("revision", 0444, data->debugfs, + &entries[idx++], + &pmbus_debugfs_ops); + } + if (pmbus_check_block_register(client, 0, PMBUS_MFR_ID)) { entries[idx].client = client; entries[idx].page = 0;