From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B1354364046; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=Pax7XIRBT1AC5+dNBkOifjkN1IU69s5zAuNf1s6SoapmJQz3fzCECFTg3iI2kaKnnR4kn1+jMOPzFUrJ+ExzwgV2Scvta/xuSBrjGAs22lHy2zbqIDvz28TSxY1iLswRRBhPk9d9TeEMBfGqtdtd7he2cHf1KqUY007ziwpr5ZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=gIuFREtXSdo0yURYZ7Qg+gE1/pFmvMN1yO8A49M1xbU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cDkI0tLjw3/Nb//E1Pfyy64MZLB/v9k0/lEysdNrSL60FtD5hkaMm1cYFx2BPUGd4UyYHdPEAkl3z0kFoEELr3zDmp/Ey6OOB84lxvIhSovzeZETGXPm2YCj2RrcC9SYKJwSW+MVnF/G/u46+5ffSCoom1K5QEnokVtiae1VlPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XeNyDzF9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XeNyDzF9" Received: by smtp.kernel.org (Postfix) with ESMTPS id 62B72C2BCC9; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=gIuFREtXSdo0yURYZ7Qg+gE1/pFmvMN1yO8A49M1xbU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XeNyDzF9Pk5YY9ijooPoIC4pMCp2oXdZl1tA0ir8lwo9eCaaBS0h6jQUTfsUXgelO rKNnzfXSP2qFNvcNcUJ8aBB5G9RAho9/lRH1SK3kkmOurwzSkD6OEWxtBYb/OYojMa 9QdXE/O1gR9SX94I1nCdY5ffQNHRbpNjrgWL4bsyBJ3mj2B5jF0ZZeoIpVJQp6nDlA ZpJtMHLseIxO4v9Pyn7WjUZuFmB9AgKzImeLacHCoYIak5OAdjlQ5QLIabMsn/krEz fbYOA0rBdUesOizoeWxMA5oHPjQu45vKfEH4GguQufzg7OlgoTi1G0CbjBgQ6OJHHJ 71wMUZXMWA3Vg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55F4ACD3445; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:13 -0700 Subject: [PATCH 1/7] hwmon: (pmbus/adm1266) use wall-clock seconds for SET_RTC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-1-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1535; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=ilxPiiB4ccinJ7vJjFyIeKd85ogX/E6EI9hbrqCCbB4=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOnyAdcas3bP+hx03nBD3QepsOosI999zO3wkl 728phiwesvajlIWBjEuBlkxRZY5j/zftHW0RWyIOWQPM4eVCWQIAxenAEzkdAQjQ4vja+cQ87/y 15yOGaqz/r9pWCoiP1N/5keWuW4eZ8PtrBgZdrRytZpE5vLOeyiRsUHL5/6MewknN6g1vjN8uZn 7qME2NgCWJU2l X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The ADM1266 RTC seeds the timestamp embedded in every blackbox record. The driver currently sets it from ktime_get_seconds(), which returns CLOCK_MONOTONIC seconds (i.e. seconds since boot). The intent of the register, per the data sheet (Rev. D, "Setting UNIX Time Using SET_RTC"), is the elapsed time since 1970-01-01 UTC. As a result, blackbox records are stamped with "seconds since this boot," making cross-reboot correlation against host syslog impossible and making the timestamps in two records taken on different boots non-comparable. Switch to ktime_get_real_seconds() so the device is seeded with wall-clock time, as the data sheet specifies. The internal RTC will drift from this seed (the data sheet recommends periodic re-sync from the host); a follow-up patch exposes the device via rtc_class so standard userspace time-sync tooling can keep it aligned. Fixes: 15609d189302 ("hwmon: (pmbus/adm1266) read blackbox") Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index d90f8f80be8e..a86666c73a5e 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -432,7 +432,7 @@ static int adm1266_set_rtc(struct adm1266_data *data) char write_buf[6]; int i; =20 - kt =3D ktime_get_seconds(); + kt =3D ktime_get_real_seconds(); =20 memset(write_buf, 0, sizeof(write_buf)); =20 --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B124C363C75; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=EBes9wqu46lRWxC5ap1Y7oFISXYuFXZr8Jq1taohElzklDLDluDm0IuJTULiwMbznZeAHMmrjEF7hCNFCOA3CLCYbQKW17AX/JMC8eALgEbTCkVA+vDRECXc/CQZzpR13uITuZaYwMYSAOLRHhiRRFsF8XmZNnQ2vjvD3ST6TuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=M0amAFMEIsEZpyl4hB4XgE7zBr4BM5r9Kw3gxVPXmwI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p9eRp0UhFlD7QWO8gJ1ryae7cam0X7g8G4gFfAKlhD7DnPPCV7hJZg01vqKFIe54SMjk24rMlnFrfXyLlv0GiVVKr+jgfPklmS+9W86XU1s9TkdG3U/lQvngPvGb8QbqT8beDz7L+kf4dwlIpfX3qMnkkSHRifp2fPcHkyckyfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FJrJilll; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FJrJilll" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6ED36C2BCB4; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=M0amAFMEIsEZpyl4hB4XgE7zBr4BM5r9Kw3gxVPXmwI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=FJrJilll6HGYWlVePE65YjzVqVNfmn/HgUFrgnBysV68N8UAgjT8arIsTeVp6BZUD 5LNTsLzPEvssafKUFYFgrofa8qMbghdxWUaNVYe8CD+aIH6whx6QpOSDl/H9dJH1PH nJw85ZorMqTvUtlvPgnyFt/Ocwk8G8gzXH/Q+3/0un8FcVL6T5CNXWgRdtMrlpSDsE RwS3DEI9SPL+/bKJpN5VHTtAJTm53EHOjq6uLW7AavCPdrvXpU3dntdPF6iTInlX1y yggCSEriI5L2NRPM5Xptcn+Zr0a0dVqT8hONZ7BTmI+hCKo18vSx5S1fUukctyn21j Lsxxuj4RpGkyg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64C32CD37AF; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:14 -0700 Subject: [PATCH 2/7] hwmon: (pmbus/adm1266) write fractional-seconds field of SET_RTC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-2-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1736; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=zgclZid47CWbHlZWQwfDY1h7EjKE5ZC3dtjfgCW8+38=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOtK/4lPRG2eD5cw+Kx7tlT0ZuFNWb5tUrzVDQ fz3WSuvPjzWUcrCIMbFICumyDLnkf+bto62iA0xh+xh5rAygQxh4OIUgIlwz2T4X2ywM7jk1v/w zb8+VMpcm7v27/IH5Ukfylfkz5+bdD8iKJSR4UaSPeOLa194uf5dDz4qyKVk/3XjwqmNCyauWOQ 66cqCmbwAw5BUjQ== X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The SET_RTC register is six bytes wide: bytes [1:0] hold fractional seconds (LSB =3D 1/65536 s) and bytes [5:2] hold whole seconds. The driver was zeroing the fractional bytes, which loses sub-second resolution when timestamping blackbox records. Sample wall-clock time as a struct timespec64 and convert tv_nsec to the device's 16-bit fractional representation. The conversion uses 64-bit arithmetic to avoid overflow on the (nsec << 16) intermediate. Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index a86666c73a5e..ba8a02509528 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -428,16 +428,23 @@ static int adm1266_config_nvmem(struct adm1266_data *= data) =20 static int adm1266_set_rtc(struct adm1266_data *data) { - time64_t kt; + struct timespec64 ts; char write_buf[6]; + u16 frac; int i; =20 - kt =3D ktime_get_real_seconds(); - - memset(write_buf, 0, sizeof(write_buf)); + ktime_get_real_ts64(&ts); =20 + /* + * SET_RTC frame layout (datasheet Rev. D, Table 84): + * bytes [1:0] =3D fractional seconds, LSB =3D 1/65536 s + * bytes [5:2] =3D seconds since 1970-01-01 UTC + */ + frac =3D (u16)(((u64)ts.tv_nsec << 16) / NSEC_PER_SEC); + for (i =3D 0; i < 2; i++) + write_buf[i] =3D (frac >> (i * 8)) & 0xFF; for (i =3D 0; i < 4; i++) - write_buf[2 + i] =3D (kt >> (i * 8)) & 0xFF; + write_buf[2 + i] =3D (ts.tv_sec >> (i * 8)) & 0xFF; =20 return i2c_smbus_write_block_data(data->client, ADM1266_SET_RTC, sizeof(w= rite_buf), write_buf); --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B12DC363C7F; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=aObDr9dkBv09SVPRvXCLbSCVfGFWg8J/oRW5Y2cbeBEj2bs3H0kc+Vb8sZ8j4R977pM07fqt7EgkIe5aYt/aOcCRuDebQhwpxLLwPS/YoFSy1KUDCG1I3rGx78nsMGgVsDY6VyQOex906iH29o6NHjCL8QHH2kq7x3v9HRR+KtI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=Kp9OWsNd69fna56PlBxX9vAuCmIkeeuN2ejOzP4x7lA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qC7BUq2GYrpr56b/Xi3BvVMztpEegf5DXAtvspVPK0JDqnPn70cUkUsmsSks5jD64urn9BcUCCpcbjj3mKcrfsxCQieJD0k0V4XmOP6DgnimgaK5qIoDXTccQce7VBRREQzwCiG8lJRIuBG532FZoVmzuKpgTMo+ayY13Fa86qg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DOmg3M/Q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DOmg3M/Q" Received: by smtp.kernel.org (Postfix) with ESMTPS id 7B818C2BCF5; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=Kp9OWsNd69fna56PlBxX9vAuCmIkeeuN2ejOzP4x7lA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=DOmg3M/QhC6AfMR/y86caiowNCVufDNyVhFXGLN5DGlSM0mz+Yo/QnQJKQRHAtG4Y 8I+mOfzuQY+niwL7sJfuNk1V3HOhw3pHQOB5SQoD6xC4ah0E7li4nlb67C1k6R9oX0 7d/dh1XdxYbxkgahtjlRo6UMnrJjnpdAjKAzuZo1Ej6H7S3sl/LZQB0xSU6j9/dPaS dgRlERjtoV4GPtztltqIglW3y7/c6QFMTFKR6KBdHVrnZqUs64CC04KVoeM6YZIyz+ NFEg6yJseQKVJ2UKRi6EXDWYDMzCvtyR7t360Jc5xfung5uOyRB6P+yNm8BDj/xPx3 bc1nuP9w1WDLA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73215CD342F; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:15 -0700 Subject: [PATCH 3/7] hwmon: (pmbus/adm1266) add firmware_revision debugfs entry Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-3-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2492; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=Lr4zRQ0939Un6oq1rHCP45etCsvvO2r0j1vqw5pu5tU=; b=kA0DAAoWtFWF/avdEPQByyZiAGn+csSj5K92O2UEe1U95wB9zC3kBL3ORM0rLiJo7FHhIQxHC oh1BAAWCgAdFiEEnOJP7IaIhliwXMI/tFWF/avdEPQFAmn+csQACgkQtFWF/avdEPRipQEA7xJr AjPEt8jWPiW6xAtLyWAC9NyCBk2Ttsaea+9KexkA/1BOVSG9qkiFDr8KiI3CGvsT3e9VcSHvZ/P 6WxGoPPYD X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The ADM1266 reports its firmware revision via the IC_DEVICE_REV manufacturer-specific block-read command (0xAE, datasheet Rev. D Table 80). The first three returned bytes are the firmware major.minor.patch fields. This is useful when correlating field behaviour against ADI release notes; expose it through debugfs alongside the existing sequencer_state entry. The standard PMBus MFR_REVISION (0x9B) register is already exposed by pmbus_core's debugfs auto-create path and reports the manufacturer revision, which is a separate thing from the firmware running on the device. Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index ba8a02509528..5cfca00a4468 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -21,6 +21,7 @@ #include #include =20 +#define ADM1266_IC_DEVICE_REV 0xAE #define ADM1266_BLACKBOX_CONFIG 0xD3 #define ADM1266_PDIO_CONFIG 0xD4 #define ADM1266_READ_STATE 0xD9 @@ -331,6 +332,30 @@ static int adm1266_state_read(struct seq_file *s, void= *pdata) return 0; } =20 +/* + * IC_DEVICE_REV (0xAE) returns an 8-byte block (datasheet Rev. D, Table 8= 0): + * [2:0] firmware revision major.minor.patch + * [5:3] bootloader revision major.minor.patch + * [7:6] silicon revision two ASCII characters + */ +static int adm1266_firmware_revision_read(struct seq_file *s, void *pdata) +{ + struct device *dev =3D s->private; + struct i2c_client *client =3D to_i2c_client(dev); + u8 buf[I2C_SMBUS_BLOCK_MAX]; + int ret; + + ret =3D i2c_smbus_read_block_data(client, ADM1266_IC_DEVICE_REV, buf); + if (ret < 0) + return ret; + if (ret < 3) + return -EIO; + + seq_printf(s, "%u.%u.%u\n", buf[0], buf[1], buf[2]); + + return 0; +} + static void adm1266_init_debugfs(struct adm1266_data *data) { struct dentry *root; @@ -343,6 +368,8 @@ static void adm1266_init_debugfs(struct adm1266_data *d= ata) =20 debugfs_create_devm_seqfile(&data->client->dev, "sequencer_state", data->= debugfs_dir, adm1266_state_read); + debugfs_create_devm_seqfile(&data->client->dev, "firmware_revision", data= ->debugfs_dir, + adm1266_firmware_revision_read); } =20 static int adm1266_nvmem_read_blackbox(struct adm1266_data *data, u8 *read= _buff) --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A41B2363C6A; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=Y4TIACotEyJGOzVd64JWt96uf9wOYrtEIXKUl4jD+YDDL7Kt3y7CMrnnT1x2fKdwvYuECNz7XSj5jBMBBzhX5Gu0msTLn3nxv47kY/RvOiI1Q1mlCuE/nV1EcskPUxp3EidIxl66z0gu8C66YOB152o7FmITL0HSIjUAyljQeSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=3Jk+MCPJV9A6mfPn4xgNbIiXSnu2WaJ3tVt2NCsUpQc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LXLdTa72faNDC2PwUTflqbNMvwW9c8nVHSPyfraQmY977jsMe1M97en5hSyr6c8F4OD5yTU9yLTeL1UeYxJb/DixLZ9iF4s+LYOtaubhQTSj4conGtebDKBU5MLY902WuVCmyfGmfOxe1d5+pBALvR9evsew2WZJDIpIzwWRdbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lX/bKh+m; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lX/bKh+m" Received: by smtp.kernel.org (Postfix) with ESMTPS id 88E3DC2BCF4; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=3Jk+MCPJV9A6mfPn4xgNbIiXSnu2WaJ3tVt2NCsUpQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=lX/bKh+mz9tmrZk9kVeWGg9VpFk9f8+sDDpfG9dLg7drPGxqBbIQ7PJ+ak4h1Tadx JSuF0rUrT2iKacdeYLPfY3HCXBTgtNbKMdXpFh8E1fvG9QKDv+TQefY+1IKnlGj1rl ZeWtxpMKBap+iajLW+sbvodsjSlKC23ouo29dUR0YhJC7b6RR8mjsMeUd4Xtypv55U SjdkfpY3l9R1XuVnzgM2TItAI4rfeJV9iPWTxkryu7q3u6XXOpmZ3iuE2tvozilb7A uqH7LpMB0U72UGHlkpGPqR6FBRL2QYT0FbMAwEam9WAiEk5Y5kVVMlfJS97D4JMVxQ RNEY7dl0qTYEw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81619CD37B6; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:16 -0700 Subject: [PATCH 4/7] hwmon: (pmbus/adm1266) add clear_blackbox debugfs entry Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-4-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2640; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=k9XGGAziLKna9OD3zoDFGbWFq64Y+DfU8TmPayUhAPg=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOhLF4R476eTDJDWTCnnva0bvAw4UeUy4p5mxi N152uW81486SlkYxLgYZMUUWeY88n/T1tEWsSHmkD3MHFYmkCEMXJwCMBEOKUaGqRVNVgni0ic7 raZn7j77sKDzv+WP5z1cNdv3zTjnu/VXOsNPxoiuH5+d8nJ9Q9jfS4g+qXPp2Zw1p/z5vociV5l Fgo4zAQA54U+X X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The ADM1266 blackbox can be configured in two recording modes via BLACKBOX_CONFIG[0]: cyclic, where the device overwrites the oldest record once the 32-record buffer fills, and single, where it stops recording until the buffer is cleared. Deployments that need to preserve the full record history across multiple fault episodes typically run in single mode and need a way to clear the buffer after the records have been collected. Expose a write-only debugfs file alongside sequencer_state. Writing any data to it issues the documented clear-blackbox sub-command: a 2-byte block-write to READ_BLACKBOX (0xDE) with payload {0xFE, 0x00} (datasheet Rev. D). Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 5cfca00a4468..4c8d2e9e07dd 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -356,6 +356,36 @@ static int adm1266_firmware_revision_read(struct seq_f= ile *s, void *pdata) return 0; } =20 +/* + * Clearing the blackbox is required when the device is configured in + * single-recording mode (BLACKBOX_CONFIG[0] =3D 0): once the 32-record + * buffer is full the device stops recording until cleared. + * + * The clear is issued as a 2-byte block-write to READ_BLACKBOX with + * payload {0xFE, 0x00} per the datasheet. + */ +static ssize_t adm1266_clear_blackbox_write(struct file *file, const char = __user *ubuf, + size_t count, loff_t *ppos) +{ + struct i2c_client *client =3D file->private_data; + u8 payload[2] =3D { 0xFE, 0x00 }; + int ret; + + ret =3D i2c_smbus_write_block_data(client, ADM1266_READ_BLACKBOX, + sizeof(payload), payload); + if (ret < 0) + return ret; + + return count; +} + +static const struct file_operations adm1266_clear_blackbox_fops =3D { + .owner =3D THIS_MODULE, + .open =3D simple_open, + .write =3D adm1266_clear_blackbox_write, + .llseek =3D noop_llseek, +}; + static void adm1266_init_debugfs(struct adm1266_data *data) { struct dentry *root; @@ -370,6 +400,8 @@ static void adm1266_init_debugfs(struct adm1266_data *d= ata) adm1266_state_read); debugfs_create_devm_seqfile(&data->client->dev, "firmware_revision", data= ->debugfs_dir, adm1266_firmware_revision_read); + debugfs_create_file("clear_blackbox", 0200, data->debugfs_dir, data->clie= nt, + &adm1266_clear_blackbox_fops); } =20 static int adm1266_nvmem_read_blackbox(struct adm1266_data *data, u8 *read= _buff) --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B11D7363C6B; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=be1X+MVIAn9Ih4fLV1JV2dkVbg6XZnJ/fFTohJMb/8fojypNJ9/kn4mN/6/ZzFCybVhZbnwUK/LVed/jpWV3MEOv2SitGg3EChznJU4x9dJTdOSlTO/VLvckJyFeXj54xwiZhKQB1XkI2i5051+yFUcsLN0yML2PLT1TEd9ETdA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=XyPD4HZ2I2akRjuUwLysi3XwhZNfWpG01pRTy/Bl05U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fn0Oug5iBJVYbvhqiTBNHQCZe9mCZu/wpPBJNEmqcwERcedo0rt1PON8x/q7KPGNJb6Bmss5bVyliErysL1sQVVtPFvTB/Y+N3o6HB+fDTj5//MMwauDnKFUdEkwovVRpaNFxU+eokwdxBj1tWndd7r1LjwtYBnmMp2wIDTj/Vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hQeeUq38; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hQeeUq38" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9562DC2BCF6; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=XyPD4HZ2I2akRjuUwLysi3XwhZNfWpG01pRTy/Bl05U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hQeeUq38zFke+199YDlrzB3srsCpmwXdAewSjITS2XDFMeR3V+Foo30E5fLR450wE 8zokQgm15OA1sZggW6VQa49IRi+ei+jRVxszq3cu8FVcDkVEWFZkXuf9FGf8FfsFil q0sm4QPd6Z8K+X5khw9hNzZiBowPAUN5RS+48WjzGVOzL+gDGQKjERls4FLMLm990g md+7NL9cykLnBjw77kY77KLJYuI3XdDD4D8G/FecWQAfRDVU/X0lvc2dqlpjnnQ9tc ssmIWrT8AZ2XX1kgDOZe8KB6ER793LDlo2lAG/AxgolSpYIHi4xW2Mbo89tiYRzX3C bM8FLxYF+Fi0g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F426CD37AC; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:17 -0700 Subject: [PATCH 5/7] hwmon: (pmbus/adm1266) add powerup_counter debugfs entry Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-5-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2726; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=enCxKzecGJQP+K1oC89viiJPWaPvVQEAVH/Tn3UpTfQ=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOiJUKWyz6OjGJ2f9zM62t3yrWaJ2pOeO/49bn /2FqnkZeP51lLIwiHExyIopssx55P+mraMtYkPMIXuYOaxMIEMYuDgFYCLO9YwMkx50vD/e+dn2 ai57bYrBmcXBEt+7DeuPMs8/3+1UPjluIiPD216Zr9zvdkoVaSQq2m8N/yJ3fKOsd2pU1omp03I VtL4xAgAJX09g X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The ADM1266 maintains a 16-bit non-volatile POWERUP_COUNTER register (0xE4, datasheet Rev. D, Table 93) that increments on every power cycle and cannot be reset by the host. Each blackbox record already embeds the counter at record time, so the standalone live value is primarily useful for matching a captured record back to the boot it came from when correlating logs. Expose it as a read-only debugfs file alongside firmware_revision. The block-read returns two payload bytes in little-endian order. Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 4c8d2e9e07dd..a058616d4215 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -28,6 +28,7 @@ #define ADM1266_READ_BLACKBOX 0xDE #define ADM1266_SET_RTC 0xDF #define ADM1266_GPIO_CONFIG 0xE1 +#define ADM1266_POWERUP_COUNTER 0xE4 #define ADM1266_BLACKBOX_INFO 0xE6 #define ADM1266_PDIO_STATUS 0xE9 #define ADM1266_GPIO_STATUS 0xEA @@ -356,6 +357,31 @@ static int adm1266_firmware_revision_read(struct seq_f= ile *s, void *pdata) return 0; } =20 +/* + * POWERUP_COUNTER (0xE4) is a 2-byte little-endian non-volatile counter + * that increments on every device power cycle (datasheet Rev. D, Table + * 93). It saturates at 65535 and cannot be reset by the host. Each + * blackbox record embeds the counter value at record time, so this live + * read is mainly useful for matching a record back to its boot. + */ +static int adm1266_powerup_counter_read(struct seq_file *s, void *pdata) +{ + struct device *dev =3D s->private; + struct i2c_client *client =3D to_i2c_client(dev); + u8 buf[I2C_SMBUS_BLOCK_MAX]; + int ret; + + ret =3D i2c_smbus_read_block_data(client, ADM1266_POWERUP_COUNTER, buf); + if (ret < 0) + return ret; + if (ret !=3D 2) + return -EIO; + + seq_printf(s, "%u\n", buf[0] | (buf[1] << 8)); + + return 0; +} + /* * Clearing the blackbox is required when the device is configured in * single-recording mode (BLACKBOX_CONFIG[0] =3D 0): once the 32-record @@ -400,6 +426,8 @@ static void adm1266_init_debugfs(struct adm1266_data *d= ata) adm1266_state_read); debugfs_create_devm_seqfile(&data->client->dev, "firmware_revision", data= ->debugfs_dir, adm1266_firmware_revision_read); + debugfs_create_devm_seqfile(&data->client->dev, "powerup_counter", data->= debugfs_dir, + adm1266_powerup_counter_read); debugfs_create_file("clear_blackbox", 0200, data->debugfs_dir, data->clie= nt, &adm1266_clear_blackbox_fops); } --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BF84D364055; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=KumIExNKB4O6mrSfAg4AVez1XEQdOXOtdnCQr62su+1yj8DtS/dXJ5GYXGzoxhOWDgLoxUd+F+ERsNKyQT1Y1qZNhZ6UUVfA9k+69wF3gxrJju4e5OcvG1x8nYYUxtXd4Q6Rozr8dCN0Tb7+Uvv6Q6jr3tOK/DZxkekz0kZUAAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=6D6Y4xWtx9w4HG/QpmwEl/Q5vXLx5+qGb17Hj62nT8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qx/oiK7ZN5tlcKKZJhOdQ3dUqMgXEEUq0Wu7HRzQcg+8U9TUDrdPsYXYdJZP6iIlRFCqIU7nqNeTIE7yJUgNoikJL1PsK4IwwN4orryTwql75FTGPCsJtu2FA59WrDGaGiham26RGNA0wV5JFDZDO0tW0tqswbnUI32h/ImPWmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iPDTEeTI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iPDTEeTI" Received: by smtp.kernel.org (Postfix) with ESMTPS id A3D81C2BCF7; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=6D6Y4xWtx9w4HG/QpmwEl/Q5vXLx5+qGb17Hj62nT8Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=iPDTEeTI6okTr519yV5yUZeL+AECzTNlNzcSevylrcgsU+6mNICkcdvkTl1PM3aE5 t+lj3dCYBxJ/SNkxbOQgF9JgYlLHOieoC9S/xGxTdZ8nbM2n4zXaq5rWLTimZJen2w gjZLZ+wsym4qMyixP61/BWl9/bFySyDC5KC6tR1bOL6yATIoxyIvyPvGvpalAbyCe9 8BJKgzBB7r8oid7nCayUBqXrUw6K49T+3keUrlOrjKQRpVL1FQDb176sRuyiQhqLzA M7JmzwpQF/zaLIYWXvgsBYDZcxwKDA+xCXmqPC8f6KkNL2FaGZH3t+4pu7dcbMs8JG bKZM2TkdSwwcQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D882CD3445; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:18 -0700 Subject: [PATCH 6/7] hwmon: (pmbus/adm1266) register rtc_class device backed by SET_RTC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-6-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4580; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=Sbalav5wpk7aw5LhFxxqpIjXgttjJK4J1yM10NZgh4g=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOtL6fVH/4WoW1Y13jF/utZVOsXC8JG/Otm3Lb XG+jvdvL8/oKGVhEONikBVTZJnzyP9NW0dbxIaYQ/Ywc1iZQIYwcHEKwETMvzEy7CvU/VF1kZE9 si1bKGrzm8gJjiV3l4dlzL6hnTM7Q7uVm5Hh1NLqqBmrk+zmFm9qX5T4zO7LCY4vtZuPTZS34Zj Y8dmPHQCjYU9s X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain The ADM1266 internal oscillator is not specified for accurate time keeping. Per the datasheet Rev. D, page 22, host software should "frequently send the time stamp to the ADM1266 to synchronize the UNIX time and reduce the time from drifting." Today the driver seeds the RTC once at probe and provides no way for userspace to re-seed it later, so blackbox record timestamps drift unboundedly on long-uptime systems. Register an rtc_class device backed by the SET_RTC block-R/W register (0xDF, datasheet Rev. D, Table 84). This creates a standard /dev/rtcN device whose ->set_time and ->read_time write and read the same 6-byte SET_RTC frame (32-bit seconds since 1970-01-01 UTC plus a 16-bit fractional-seconds field). Standard userspace tooling (hwclock --systohc, chrony, systemd-timesyncd) can now drive the periodic re-sync the data sheet recommends, with no driver-specific sysfs ABI. The probe-time wall-clock seed is preserved so the device has a sane RTC even before userspace runs. Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 90 ++++++++++++++++++++++++++++++++++++---= ---- 1 file changed, 76 insertions(+), 14 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index a058616d4215..07c20746f083 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -18,6 +18,7 @@ #include #include #include "pmbus.h" +#include #include #include =20 @@ -513,28 +514,85 @@ static int adm1266_config_nvmem(struct adm1266_data *= data) return 0; } =20 -static int adm1266_set_rtc(struct adm1266_data *data) +/* + * SET_RTC frame layout (datasheet Rev. D, Table 84): + * bytes [1:0] =3D fractional seconds, LSB =3D 1/65536 s + * bytes [5:2] =3D seconds since 1970-01-01 UTC + */ +static int adm1266_write_rtc(struct i2c_client *client, const struct times= pec64 *ts) { - struct timespec64 ts; - char write_buf[6]; + u8 buf[6]; u16 frac; int i; =20 + frac =3D (u16)(((u64)ts->tv_nsec << 16) / NSEC_PER_SEC); + for (i =3D 0; i < 2; i++) + buf[i] =3D (frac >> (i * 8)) & 0xFF; + for (i =3D 0; i < 4; i++) + buf[2 + i] =3D (ts->tv_sec >> (i * 8)) & 0xFF; + + return i2c_smbus_write_block_data(client, ADM1266_SET_RTC, sizeof(buf), b= uf); +} + +static int adm1266_set_rtc(struct adm1266_data *data) +{ + struct timespec64 ts; + ktime_get_real_ts64(&ts); + return adm1266_write_rtc(data->client, &ts); +} =20 - /* - * SET_RTC frame layout (datasheet Rev. D, Table 84): - * bytes [1:0] =3D fractional seconds, LSB =3D 1/65536 s - * bytes [5:2] =3D seconds since 1970-01-01 UTC - */ - frac =3D (u16)(((u64)ts.tv_nsec << 16) / NSEC_PER_SEC); - for (i =3D 0; i < 2; i++) - write_buf[i] =3D (frac >> (i * 8)) & 0xFF; +static int adm1266_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + struct i2c_client *client =3D to_i2c_client(dev); + u8 buf[I2C_SMBUS_BLOCK_MAX]; + u32 secs; + int ret; + int i; + + ret =3D i2c_smbus_read_block_data(client, ADM1266_SET_RTC, buf); + if (ret < 0) + return ret; + if (ret !=3D 6) + return -EIO; + + secs =3D 0; for (i =3D 0; i < 4; i++) - write_buf[2 + i] =3D (ts.tv_sec >> (i * 8)) & 0xFF; + secs |=3D (u32)buf[2 + i] << (i * 8); =20 - return i2c_smbus_write_block_data(data->client, ADM1266_SET_RTC, sizeof(w= rite_buf), - write_buf); + rtc_time64_to_tm(secs, tm); + return 0; +} + +static int adm1266_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct i2c_client *client =3D to_i2c_client(dev); + struct timespec64 ts =3D { + .tv_sec =3D rtc_tm_to_time64(tm), + .tv_nsec =3D 0, + }; + + return adm1266_write_rtc(client, &ts); +} + +static const struct rtc_class_ops adm1266_rtc_ops =3D { + .read_time =3D adm1266_rtc_read_time, + .set_time =3D adm1266_rtc_set_time, +}; + +static int adm1266_register_rtc(struct adm1266_data *data) +{ + struct rtc_device *rtc; + + rtc =3D devm_rtc_allocate_device(&data->client->dev); + if (IS_ERR(rtc)) + return PTR_ERR(rtc); + + rtc->ops =3D &adm1266_rtc_ops; + rtc->range_min =3D 0; + rtc->range_max =3D U32_MAX; + + return devm_rtc_register_device(rtc); } =20 static int adm1266_probe(struct i2c_client *client) @@ -564,6 +622,10 @@ static int adm1266_probe(struct i2c_client *client) if (ret < 0) return ret; =20 + ret =3D adm1266_register_rtc(data); + if (ret < 0) + return ret; + ret =3D adm1266_config_nvmem(data); if (ret < 0) return ret; --=20 2.53.0 From nobody Sat Jun 13 07:54:18 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CBD343644A6; Fri, 8 May 2026 23:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; cv=none; b=CF+l1p/nNzKd+kmH74nRvAtX3zDByqxlG3LNoJAhzZe8GiDmkOchZcxap0pz75QYuxsf3kb1oJ5OUKlOwridtl0ChhI9tc7XA0llEXJOVc3Gwb8vw68/zY2Ekxg1B+QUQ0Z4fsSpknSn+64mVNllDw16nCpAAaPsb/n5fwMgaPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778283205; c=relaxed/simple; bh=J1t1jn2xzc7sdDgOm5cf7hQ76myxsDTXZJjXDI/vkUc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TbPa/StnBQ3qL9g/a9t2ryNb87PMHPmBjVpaLpCjf1/PTGlFAr2NHgdH9p0/1lov7xL99w58wkOFv1HVdzkUQYVka5q7qfYxWP3XpMt6QArkLlRSETBrli+p/ZtquF+SwgB2LS7HtwRIT+SSernbLQQOQ64vVu2PYHw/Wq+Ad6c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nFmfID/F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nFmfID/F" Received: by smtp.kernel.org (Postfix) with ESMTPS id B2580C2BCFA; Fri, 8 May 2026 23:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778283205; bh=J1t1jn2xzc7sdDgOm5cf7hQ76myxsDTXZJjXDI/vkUc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nFmfID/FhnLMia1tZykLnzhkAiULoTEtJrcx4iFNvHw+ZVTbVKSuS6xw/0i9AGqY9 JcifTHqV/Pbw2xrxOfUOBdFLsXNhoqzmvnWZUNgH4d+48iRzmJZUFPGdAgCcgsq2e8 lCFgbjepOE1xMS0uyrAVhXFPAc9O5GLTbZLhTMfxdxa5wamw9/b5Iz7BX/Z3J+2LML qyrUoxHl1LAONaBK2y411RFKrOZAldX2hGfVyWjI2+yCelbU3x/A5YJ3rbjZd5XvKo Ko6P8imYVSthpE66EVI4WT1DYo8o4jnUcBljPnD33prKTvfbBXJe+MGyhA2gRSp8j5 GLhBp6HpYQZPA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF6BCD37AF; Fri, 8 May 2026 23:33:25 +0000 (UTC) From: Abdurrahman Hussain via B4 Relay Date: Fri, 08 May 2026 16:33:19 -0700 Subject: [PATCH 7/7] hwmon: (pmbus/adm1266) include adapter number in GPIO line label Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260508-adm1266-v1-7-ec08bf29e0ce@nexthop.ai> References: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> In-Reply-To: <20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai> To: Guenter Roeck , Alexandru Tachici Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1311; i=abdurrahman@nexthop.ai; h=from:subject:message-id; bh=+gb9rQVuX3txw2uuwV5b1v1Re6m0IUjLCe0dbdU21mk=; b=owJ4nJvAy8zAJbYltPXv6rsCXxhPqyUxZP4rOpIisG5KOtceX/+PzKf3yb98/M5V7adgQ6TPH aloAcH9V1M6SlkYxLgYZMUUWeY88n/T1tEWsSHmkD3MHFYmkCEMXJwCMJEsM4a/cls61kWyZN3Y lbm7yP9YgSGDuPdsHlfdnaGrirR3PhI5w/C/8tDCCXubz3z+2Lrn+860H5+6RWdZMC/XKHqf1mp 2eIMtAwA9C1Bp X-Developer-Key: i=abdurrahman@nexthop.ai; a=openpgp; fpr=9CE24FEC86888658B05CC23FB45585FDABDD10F4 X-Endpoint-Received: by B4 Relay for abdurrahman@nexthop.ai/default with auth_id=756 X-Original-From: Abdurrahman Hussain Reply-To: abdurrahman@nexthop.ai From: Abdurrahman Hussain Platforms that fit more than one ADM1266 on different I2C buses at the same 7-bit slave address (a common shelf-management pattern, e.g. one device per power domain) end up with duplicate GPIO line labels because the existing format only includes the slave address. Including the adapter number disambiguates them. The label is purely informational (visible via gpioinfo and the gpiochip /sys/class/gpio name); no DT or ABI consumer parses it. Signed-off-by: Abdurrahman Hussain --- drivers/hwmon/pmbus/adm1266.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c index 07c20746f083..ec6a2c9167d8 100644 --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -293,8 +293,9 @@ static int adm1266_config_gpio(struct adm1266_data *dat= a) int i; =20 for (i =3D 0; i < ARRAY_SIZE(data->gpio_names); i++) { - gpio_name =3D devm_kasprintf(&data->client->dev, GFP_KERNEL, "adm1266-%x= -%s", - data->client->addr, adm1266_names[i]); + gpio_name =3D devm_kasprintf(&data->client->dev, GFP_KERNEL, "adm1266-%x= -%x-%s", + data->client->adapter->nr, data->client->addr, + adm1266_names[i]); if (!gpio_name) return -ENOMEM; =20 --=20 2.53.0