🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12519

[PATCH net-next v2 3/3] net: phy: realtek: register hwmon thermal zones

#12519
From: Hleb Shauchenka via B4 Relay
Date: Sat, 07 Nov 2026 17:00
45 lines
12204 bytes
From: Hleb Shauchenka <me@marleb.org>

The Realtek PHY hwmon device exposes the PHY temperature, but its
channel info lacks HWMON_C_REGISTER_TZ, so the hwmon core does not
register the sensor with the thermal framework and device-tree
thermal zones that reference the PHY cannot bind.

Set the flag, as the Aquantia PHY driver does. In mainline this
affects the PHYs whose hwmon device rtl822x_probe() registers, the
RTL8221B-VB-CG, RTL8221B-VM-CG and RTL8251B, when the device tree
describes them. The internal NBASE-T PHYs normally have no device
tree node, so the hwmon core registers no thermal zone for them.

I tested this on a Zyxel XGS1250-12 B1 with OpenWrt's Linux 6.18.55,
where OpenWrt's out-of-tree RTL8261N support calls
rtl822x_hwmon_init(): the three PHY thermal zones register, and an
emulated 85 C reading on one of them (CONFIG_THERMAL_EMULATION)
switches the fan on through an 80 C trip and off again once cleared.

This patch was prepared with AI assistance (Claude Opus 5.5 and Sol
6.1), which also helped investigate the problem and run the tests on
my switch.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Hleb Shauchenka <me@marleb.org>
---
 drivers/net/phy/realtek/realtek_hwmon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/realtek/realtek_hwmon.c b/drivers/net/phy/realtek/realtek_hwmon.c
index b6b2806e2..021064edd 100644
--- a/drivers/net/phy/realtek/realtek_hwmon.c
+++ b/drivers/net/phy/realtek/realtek_hwmon.c
@@ -55,6 +55,7 @@ static const struct hwmon_ops rtl822x_hwmon_ops = {
 };
 
 static const struct hwmon_channel_info * const rtl822x_hwmon_info[] = {
+	HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
 	HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX),
 	NULL
 };

-- 
2.56.0
Technical Details
Message-ID: <20261107-realtek-hwmon-tz-v2-3-6b9a69d44470@marleb.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358434-linux-kernel-netdev=dewy.ru
References: <20261107-realtek-hwmon-tz-v2-0-6b9a69d44470@marleb.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358434-linux-kernel-netdev=dewy.ru
From: devnull+me.marleb.org@kernel.org (Hleb Shauchenka via B4 Relay)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 3/3] net: phy: realtek: register hwmon thermal
 zones
Date: Sat, 07 Nov 2026 18:00:47 +0100
Organization: Usenet Network
Message-ID: <20261107-realtek-hwmon-tz-v2-3-6b9a69d44470@marleb.org>
References: <20261107-realtek-hwmon-tz-v2-0-6b9a69d44470@marleb.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4147816"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:tRgs+WDnjydJKjP//w3fse5E5SQ= sha256:isDBM0wP+1RHiq1whsLVcJSrUFRrdBGVlGjAksQXtH8=
	sha1:R/ls248jjE/FohSQyXwUgq0/OG8= sha256:NLATv0oZdcTMwTmhIT4vkytnvdQPxumFY1vT/vljDMo=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id C7D221132E6; Sat,  7 Nov 2026 20:04:08 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.301
X-Spam-Status: No, score=-2.301 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id h2-A29R0O3Bn;
	Sat,  7 Nov 2026 20:04:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358434-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id A1EB0113453; Sat,  7 Nov 2026 20:03:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 3A3A76071F; Sat,  7 Nov 2026 17:01:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794070895;
	b=39laoI3bIomJWVyA8s0xiEdJhqLFmd3opd8gt7GNlD7ftgxMFhAz11y/OA9sKlQxRtQH
	 v3Dy2RcPSkMsTNBtd+6YyByDsVEAOO+ro7pzEg3Ro8Tan4BSzrFrP+70cX2LCe7dQx9Ak
	 LTmfyxL3gDGeL5F/xWH4ij8nZTAM6k/AylA+CuA6a0RL6F0aKtdhd8C9+3RgQxiymmlfA
	 1Ofj8tgQmY7yp22oOeC+zItrd2raje4SpYZYj+/ZDgXosLt0pVEsEk5LEOGBaWIcfvu1H
	 CpKPEZeLeqzF6tHBgXX74/qMEdp5dfOW7zspb5JHqYlT4s95h1FjcSOW0q8n0KqlseA==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794070895;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=f5J8oAfO/kInnm9/wvYn12c6zn0qOkt1NdzUehcv5Ag=;
	b=N7yjooUztuQ6wgKaFg8g4YAPhgGG/2bBZwqmUyd/Pcdl31u+iP/Psr4W6ugXsDjB+CzQ
	 PoCLlXJmdaBXFN3lxd0vfTaEwK0jTWojul06lpziqyBj3lyL9PIcefQF7PxT/sZAgNmqz
	 0FZ0xHwg/sSIxj97uyVQmy0tu+rwVBih2ePQRC41DuxtCEuCMgzyKTDaDKi6rzkr2ugKd
	 F5NoXxK7h6BVQOPObJPR2DggDk6gFKD2Zp7T9TawgZkNXILHQ8ml+yoyJtxrtJRBIeAqC
	 XDErnob7bT5uBFDu5Y4las9dm/8ynU94LFOoU8GChQJN4RzA7KcssoYnwyw56z8LfuQ==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=INsRyrY7;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 34EA2606EE85;
	Sat,  7 Nov 2026 17:01:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=INsRyrY7
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794070889;
	b=M7hXFpG0T4WPhPTugOohJXZgAJFC2VBWhm8mLBJ+FxQTjNK/j2flXx9j6/lCWyrfekYq
	 k7goam1A+lDAThJ2ILFtx+7N3q8vzGyI/gIlcsVVbaoDE8KLzpKOGeXKzLi/puYOs3pH6
	 /ij9Lwxd2LENBiBat9cBCAaqgSRT+jUVDMEcMemVxlZw3J+804JdjXYF+UkIbRlMdL94f
	 1f0LHHgpIYrIK2R7AluFuoQWOvoLz8Tvp8GteTmo3GYno49YD6lxUbt/uZR34QVJ12Bco
	 w1V4C/0MaqTpLm4PjzYDa7QduufoGJZierU0mIjOvx7BrQbP8kIuxc4ui21bL5F+eXA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794070889;
	h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version:
	 Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=f5J8oAfO/kInnm9/wvYn12c6zn0qOkt1NdzUehcv5Ag=;
	b=vzBpYqpj6eSQVgqE3F2aJSTvyZh4GDpQa1xMcFn6zAaMQ2u/BwZcidWXBiBj5PYH/dGl
	 L6aOMfQS9qOGqDG9+IvJdDNFL5MwjEKL8jUstm4L66So9ZR5cahpEnpeT8n5DivaecvEH
	 Dj0g8/D8Solmu36MCpcmpq28EF5qeZnKOUnP6KIrrSJDJi7cU4t8pXirJ4Ydyk4trR1jN
	 6zp0ZdOO+H8MDgCl+Gdlvv3LZhFq7dw6a6rbA1m2EdooUYNsJQOQpfWlzulosCCWxEFyL
	 lhcNSFgFrBkv5etfABWdWOnOxZPyw/Z80gxya4bWIdxUx7HAQsDnGHgJjMWpS136PQQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=INsRyrY7;
	arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95CE1606A333;
	Sat,  7 Nov 2026 17:01:28 +0000 (UTC)
X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77
X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none;
	t=1794070888;
	b=sEcB/hKuTeRFY5FPSAvOXDgiU4PB4Wba0c5QWC2FDUWK8Nn+4OHnkk1SNUcEocIRLOWE
	 kTqrQ9JYlVovlE418f80xxE0UJ1qrMyAzl581n0tJaDkBo43Zt1+78EHJuFISsgBa0qPD
	 ZFviNtzwfApLDXIlLdbMUsLABhl7Y8bPQUbWOt6q8BXlMB6c+HfTykKPxNMOM+AYHAaWb
	 FgGDgxlaMKBxv7gMXH75NFYnorgxZT6/SZhxAiie2sdrgQz4Sl7QCDg2DnnKYTiNk6Z9L
	 gYHyjiJtJIgVro02A6Cm0v7o+Vz40POhgZ3ch9DnV4Gz42g5QNWCFv1FerIQuKhKVuw==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1794070888;
	h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=f5J8oAfO/kInnm9/wvYn12c6zn0qOkt1NdzUehcv5Ag=;
	b=ZDf7+rXLLpctz5udNplKo7ZpxvFT/R3eMadFH9DVizTrRp04HglZ+PTox5TMfZhh6qJL
	 p9tEzY8dW3ORIqesruOpL2hdNibZZm8IxmHKwCcaevdAYDl+J2qT3g7wX9+uam9T9VGjW
	 hsMXADy0KZG5bJvE94ikNqdzxm5hWwH16PKlZcm0g+ir/lQFdJPoQqqv9m1yXbtMzfAMs
	 GV9lIzf/kQdiPs7+WOZQVUZVmA0WwLpxh1mVpsdV+U2OFu5hl0dxgXIxf8t1qL4U/vgaC
	 Hwb/mMNr8+jk11ln8TnImNKPUypzRJT/dzpAyUOAJnMEaSKSl9KTmQVWpUNGL8tZt8Q==
X-ARC-Authentication-Results: i=1; smtp.kernel.org; 
	arc=none smtp.remote-ip=100.80.115.77
X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.kernel.org (Postfix) with ESMTPS id 264E21F008A4;
	Sat,  7 Nov 2026 17:01:27 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794070888;
	bh=f5J8oAfO/kInnm9/wvYn12c6zn0qOkt1NdzUehcv5Ag=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To;
	b=INsRyrY70q6gEWXRE+4yD5VdDrh6QdRvUh+K6wrsxwBj1RrGwvidLy4pV+rmaxPQU
	 79eW6YFs5ywxy+PlG7KY6kGC7EvFUSsTElPmxr8mKRTHg+EvvEr3VhD7bcAYfu2qU3
	 xZSdJVCn5EYsW+0xTrHLT+cezmA3A1yaLOQCfpeYyxupV9hqynYNGsce/7aUraUxgG
	 u5OUp8sCUFGjo7fBYmVzqLz+FvH2DHeNhP4HRIIQQtgymo6RxhhujQ+xmXTHq2oRCw
	 Hp0/RnYT4eVI+rT0qAqd+/1Nr+15Rc7BUAmyt+6u17cx7SYqKUwFJC9+EdG3c6zi7y
	 +8zb3wtcfDirw==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id A41E447C91;
	Sat,  7 Nov 2026 17:01:26 +0000 (UTC)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261107-realtek-hwmon-tz-v2-0-6b9a69d44470@marleb.org>
X-Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, 
 linux-kernel@vger.kernel.org, Hleb Shauchenka <me@marleb.org>
X-Mailer: b4 0.15.2
X-Developer-Signature: v=1; a=openpgp-sha256; l=1760; i=me@marleb.org;
 h=from:subject:message-id;
 bh=HRvjZ9m/qJc8A0xrX1vhVTFReKgYes98W1JLF6cq46k=;
 b=owJ4nJvAy8zAJTZJnM368y8lXsbTakkMWe8jU538Op75bptzvW/PuZbUDslkk1MZT10m+wWbv
 +oNCt/8O7mjlIVBjItBVkyRZVNzkejTldFvXav3ZMHMYWUCGcLAxSkAE4ktZGQ4YS7769WX958N
 lsysmHBHONXXc2Zpo2XBxQP+dt6+CxS3MfyPbzmwPfLPm/70lh/T7hz+9npqo6hhxowLMu03Yiq
 zVQOZAE5xS/4=
X-Developer-Key: i=me@marleb.org; a=openpgp;
 fpr=B2837215E5A95BED457BBC6A9217063BF3FA220D
X-Endpoint-Received: by B4 Relay for me@marleb.org/default with
 auth_id=1394
X-Original-From: Hleb Shauchenka <me@marleb.org>
X-Reply-To: me@marleb.org