Re: [PATCH RFC net-next] net: phy: mxl-gpy: add basic LED support

From: Simon Horman
Date: Mon Sep 30 2024 - 11:40:35 EST


On Sun, Sep 29, 2024 at 11:02:16PM +0100, Daniel Golle wrote:
> Add basic support for LEDs connected to MaxLinear GPY2xx and GPY115 PHYs.
> The PHYs allow up to 4 LEDs to be connected.
> Implement controlling LEDs in software as well as netdev trigger offloading
> and LED polarity setup.
>
> The hardware claims to support 16 PWM brightness levels but there is no
> documentation on how to use that feature, hence this is not supported.
>
> Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>
> ---
> drivers/net/phy/mxl-gpy.c | 212 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 212 insertions(+)
>
> diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c

...

> +static int gpy_led_hw_control_set(struct phy_device *phydev, u8 index,
> + unsigned long rules)
> +{
> + int ret;
> + u16 val = 0;

nit: Please consider arranging local variables in reverse xmas tree order -
longest line to shortest.

u16 val = 0;
int ret;

> +
> + if (index >= GPY_MAX_LEDS)
> + return -EINVAL;

...