public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Chukun Pan <amadeus@jmu.edu.cn>
Cc: "David S . Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew@lunn.ch>, Paolo Abeni <pabeni@redhat.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Russell King <linux@armlinux.org.uk>,
	Daniel Golle <daniel@makrotopia.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 1/1] net: phy: realtek: Add support for PHY LEDs on RTL8221B
Date: Wed, 01 Apr 2026 13:13:21 +0200	[thread overview]
Message-ID: <28961808c3aa133f74257494f5e327c6@tipi-net.de> (raw)
In-Reply-To: <20260401100010.3079700-1-amadeus@jmu.edu.cn>

On 1.4.2026 12:00, Chukun Pan wrote:
> Realtek RTL8221B Ethernet PHY supports three LED pins which are used to
> indicate link status and activity. Add netdev trigger support for them.
> 
> Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
> ---
>  drivers/net/phy/realtek/realtek_main.c | 146 +++++++++++++++++++++++++
>  1 file changed, 146 insertions(+)
> 
> diff --git a/drivers/net/phy/realtek/realtek_main.c 
> b/drivers/net/phy/realtek/realtek_main.c
> index 023e47ad605b..8a22e18e5c56 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c
> @@ -150,6 +150,15 @@
> 

[...]

> 
> +static int rtl822xb_led_brightness_set(struct phy_device *phydev, u8 
> index,
> +				       enum led_brightness value)
> +{
> +	int ret;
> +
> +	if (index >= RTL8211x_LED_COUNT)
> +		return -EINVAL;
> +
> +	/* clear HW LED setup */
> +	ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
> +			    RTL822X_VND2_LED(index), 0);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* clear HW LED blink */
> +	return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
> +				  RTL822X_VND2_LCR6,
> +				  RTL822X_VND2_LED_ACT(index));
> +}

This clears HW triggers but never actually turns the LED on when
value != LED_OFF. Both paths do the same thing: clear link and
activity config (value isn't used at all).

For LED_OFF that works (no triggers = LED off), but for LED_ON the
LED stays off too since there's no force-on written anywhere.

Compare with bcm_phy_led_brightness_set() which explicitly switches
between BCM_LED_SRC_ON and BCM_LED_SRC_OFF based on value.

If the RTL8221B has a software force-on register, it needs to be
programmed here. If it doesn't, brightness_set should not be
implemented at all. The framework handles its absence.

[...]

Thanks

Nicolai

      reply	other threads:[~2026-04-01 11:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01 10:00 [PATCH 1/1] net: phy: realtek: Add support for PHY LEDs on RTL8221B Chukun Pan
2026-04-01 11:13 ` Nicolai Buchwitz [this message]

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=28961808c3aa133f74257494f5e327c6@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=amadeus@jmu.edu.cn \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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