Re: [PATCH net v2] net: phy: qca808x: handle the active-high LED polarity mode
From: Rosen Penev
Date: Mon Sep 14 2026 - 20:21:40 EST
On Mon, Sep 14, 2026 at 2:47 PM Donggeun Yoo
<donggeunyoo.kernel@xxxxxxxxx> wrote:
>
> Commit a274465cc3be ("net: phy: support 'active-high' property for PHY
> LEDs") added PHY_LED_ACTIVE_HIGH but did not cover qca808x, so
> qca808x_led_polarity_set() returns -EINVAL for it. phy_probe() propagates
> that, leaving the mdio device unbound and phy_attach_direct() falling back
> to the genphy driver.
>
> Accepting the mode alone is not enough: led_polarity_mode records
> active_low, so an explicit 'active-high' node stores 0, while
> qca808x_config_init() re-asserts QCA808X_LED_ACTIVE_HIGH only for -1. The
> bit does not survive the reset phy_init_hw() runs first, so the LED would
> come up active-low.
>
> An 'active-low' node needs nothing here: the bit is clear after the reset,
> which is the polarity it asks for.
>
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908105959.70453-1-donggeunyoo.kernel%40gmail.com
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: a274465cc3be ("net: phy: support 'active-high' property for PHY LEDs")
> Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@xxxxxxxxx>
> Assisted-by: Claude:claude-fable-5 sparse
> ---
> v2:
> - No code change. Rebased onto net/main.
> - Cc Rosen Penev and Christian Marangi, per Andrew Lunn -- they may have
> QCA808x hardware.
In my case, qca8k controls the LEDs. I don't think I have any devices
that control LEDs through qca808x.
> Christian wrote f203c8c77c76 ("net: phy: qcom:
> qca808x: default to LED active High if not set"), the default this
> patch extends. If either of you can put an 'active-high' LED node on
> a QCA8081 and confirm the LED comes up the right way round, I would
> appreciate it.
> - Say why an 'active-low' node needs nothing in qca808x_config_init().
> v1: https://lore.kernel.org/netdev/20260912012819.2072067-1-donggeunyoo.kernel@xxxxxxxxx/
> - Supersedes [PATCH net v3 3/3],
> 20260908105959.70453-4-donggeunyoo.kernel@xxxxxxxxx, whose
> Reviewed-by from Andrew Lunn is dropped: that version only accepted
> the mode, this one also makes it survive the reset.
>
> Compile-tested only (W=1, sparse). I have no QCA808x hardware, and there is
> no KUnit suite or MDIO mock under drivers/net/phy to exercise the MMD7 write
> without it.
>
> drivers/net/phy/qcom/qca808x.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c
> index 8eb51b1a006c..68fd4d0fe31b 100644
> --- a/drivers/net/phy/qcom/qca808x.c
> +++ b/drivers/net/phy/qcom/qca808x.c
> @@ -200,8 +200,8 @@ static int qca808x_config_init(struct phy_device *phydev)
> struct qca808x_priv *priv = phydev->priv;
> int ret;
>
> - /* Default to LED Active High if active-low not in DT */
> - if (priv->led_polarity_mode == -1) {
> + /* Set LED Active High unless active-low was requested in DT */
> + if (priv->led_polarity_mode != 1) {
> ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN,
> QCA808X_MMD7_LED_POLARITY_CTRL,
> QCA808X_LED_ACTIVE_HIGH);
> @@ -603,6 +603,9 @@ static int qca808x_led_polarity_set(struct phy_device *phydev, int index,
> case PHY_LED_ACTIVE_LOW:
> active_low = true;
> break;
> + case PHY_LED_ACTIVE_HIGH:
> + active_low = false;
> + break;
> default:
> return -EINVAL;
> }
>
> base-commit: e6b6078ea1731b05b3b552497b3bce4bf8b014ae
> --
> 2.53.0
>