Re: [net-next PATCH v8 5/5] net: phy: at803x: add LED support for qca808x

Christian Marangi
2024-01-04T13:11:15Z

On Thu, Jan 04, 2024 at 12:48:05PM +0100, Maxime Chevallier wrote:
> Hello Christian,
>
> On Thu, 4 Jan 2024 12:01:12 +0100
> Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> > Add LED support for QCA8081 PHY.
> >
> > Documentation for this LEDs PHY is very scarce even with NDA access
> > to Documentation for OEMs. Only the blink pattern are documented and are
> > very confusing most of the time. No documentation is present about
> > forcing the LED on/off or to always blink.
> >
> > Those settings were reversed by poking the regs and trying to find the
> > correct bits to trigger these modes. Some bits mode are not clear and
> > maybe the documentation option are not 100% correct. For the sake of LED
> > support the reversed option are enough to add support for current LED
> > APIs.
>
> I have one small comment below :
>
> > +static int qca808x_led_blink_set(struct phy_device *phydev, u8 index,
> > + unsigned long *delay_on,
> > + unsigned long *delay_off)
> > +{
> > + int ret;
> > + u16 reg;
> > +
> > + if (index > 2)
> > + return -EINVAL;
> > +
> > + reg = QCA808X_MMD7_LED_FORCE_CTRL(index);
> > +
> > + /* Set blink to 50% off, 50% on at 4Hz by default */
> > + ret = phy_modify_mmd(phydev, MDIO_MMD_AN, QCA808X_MMD7_LED_GLOBAL,
> > + QCA808X_LED_BLINK_FREQ_MASK | QCA808X_LED_BLINK_DUTY_MASK,
> > + QCA808X_LED_BLINK_FREQ_256HZ | QCA808X_LED_BLINK_DUTY_50_50);
>
> The comment (4Hz) and the blink frequency (256Hz) don't match, is that
> right ? because I see there exists a QCA808X_LED_BLINK_FREQ_4HZ
> definition, shouldn't it be used ?
>

Thanks for checking this, oversight by me! Will fix. (the blink
frequency was discovered only lately)

--
Ansuel