Re: [PATCH net-next v9 3/3] net: dsa: motorcomm: Add LED support

From: David Yang

Date: Fri Jul 31 2026 - 15:16:53 EST


On Thu, Jul 30, 2026 at 6:38 PM Paolo Abeni <pabeni@xxxxxxxxxx> wrote:
>
> On 7/26/26 6:27 PM, David Yang wrote:
> > +int yt921x_leds_setup(struct yt921x_priv *priv)
> > +{
> > + struct device *dev = to_device(priv);
> > + struct dsa_switch *ds = &priv->ds;
> > + struct dsa_port *dp;
> > + u32 inv_ctrl = 0;
> > + u32 inv_mask = 0;
> > + u32 ctrl;
> > + u32 mask;
> > + int res;
> > +
> > + dsa_switch_for_each_port(dp, ds) {
> > + int port = dp->index;
> > +
> > + if (!dp->dn)
> > + continue;
> > +
> > + res = yt921x_leds_setup_port(priv, port, &inv_mask, &inv_ctrl);
> > + if (res)
> > + dev_warn(dev, "Failed to setup LEDs for port %d: %d\n",
> > + port, res);
> > + }
>
>
> Sashiko noted that at this point the leds are already exposed to the
> user-space and settings can be applied before the following take place.

The register values are correctly latched in the hardware so the leds
will behave as expected eventually. Also, the chip will always enable
LEDs despite LED_CTRL_EN, see comments in v6.