From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Guenter Roeck <linux@roeck-us.net>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Simon Horman <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
Jean Delvare <jdelvare@suse.com>
Subject: Re: [PATCH net-next 3/3] net: phy: realtek: add hwmon support for temp sensor on RTL822x
Date: Fri, 10 Jan 2025 22:41:12 +0100 [thread overview]
Message-ID: <dca1302a-82d2-482c-acf7-d6af76241a6b@gmail.com> (raw)
In-Reply-To: <8d052f8f-d539-45ba-ba21-0a459057f313@lunn.ch>
On 10.01.2025 22:10, Andrew Lunn wrote:
>> - over-temp alarm remains set, even if temperature drops below threshold
>
>> +int rtl822x_hwmon_init(struct phy_device *phydev)
>> +{
>> + struct device *hwdev, *dev = &phydev->mdio.dev;
>> + const char *name;
>> +
>> + /* Ensure over-temp alarm is reset. */
>> + phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_TSALRM, 3);
>
> So it is possible to clear the alarm.
>
> I know you wanted to experiment with this some more....
>
> If the alarm is still set, does that prevent the PHY renegotiating the
> higher link speed? If you clear the alarm, does that allow it to
> renegotiate the higher link speed? Or is a down/up still required?
> Does an down/up clear the alarm if the temperature is below the
> threshold?
>
I tested wrt one of your previous questions, when exceeding the
temperature threshold the chip actually removes 2.5Gbps from the
advertisement register.
If the alarm is set, the chip won't switch back automatically to
2.5Gbps even if the temperature drops below the alarm threshold.
When clearing the alarm the chip adds 2.5Gbps back to the advertisement
register. Worth to be mentioned:
The temperature is checked only if the link speed is 2.5Gbps.
Therefore the chip thinks it's safe to add back the 2.5Gbps mode
when the alarm is cleared.
What I didn't test is whether it's possible to manually add 2.5Gbps
to the advertisement register whilst the alarm is set.
But I assume that's the case.
> Also, does HWMON support clearing alarms? Writing a 0 to the file? Or
> are they supported to self clear on read?
>
Documentation/hwmon/sysfs-interface.rst states that the alarm
is a read-only attribute:
+-------------------------------+-----------------------+
| **`in[0-*]_alarm`, | Channel alarm |
| `curr[1-*]_alarm`, | |
| `power[1-*]_alarm`, | - 0: no alarm |
| `fan[1-*]_alarm`, | - 1: alarm |
| `temp[1-*]_alarm`** | |
| | RO |
+-------------------------------+-----------------------+
Self-clearing is neither mentioned in the documentation nor
implemented in hwmon core.
@Guenter:
If alarm would just mean "current value > alarm threshold", then we
wouldn't need an extra alarm attribute, as this is something which
can be checked in user space.
Has it ever been considered that a user may have to explicitly ack
an alarm to clear it? Would you consider it an ABI violation if
alarm is configured as R/W for being able to clear the alarm?
> I'm wondering if we are heading towards ABI issues? You have defined:
>
> - over-temp alarm remains set, even if temperature drops below threshold
>
> so that kind of eliminates the possibility of implementing self
> clearing any time in the future. Explicit clearing via a write is
> probably O.K, because the user needs to take an explicit action. Are
> there other ABI issues i have not thought about.
>
> Andrew
Heiner
next prev parent reply other threads:[~2025-01-10 21:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3e2784e3-4670-4d54-932f-b25440747b65@gmail.com>
2025-01-10 11:48 ` [PATCH net-next 3/3] net: phy: realtek: add hwmon support for temp sensor on RTL822x Heiner Kallweit
2025-01-10 21:10 ` Andrew Lunn
2025-01-10 21:41 ` Heiner Kallweit [this message]
2025-01-11 0:20 ` Guenter Roeck
2025-01-11 8:52 ` Heiner Kallweit
2025-01-11 0:08 ` Guenter Roeck
2025-01-11 10:16 ` Heiner Kallweit
2025-01-11 17:00 ` Andrew Lunn
2025-01-11 17:32 ` Heiner Kallweit
2025-01-11 17:44 ` Andrew Lunn
2025-01-11 18:06 ` Heiner Kallweit
2025-01-11 8:52 ` kernel test robot
2025-01-11 9:48 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dca1302a-82d2-482c-acf7-d6af76241a6b@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jdelvare@suse.com \
--cc=kuba@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox