[PATCH net-next] net: phy: mediatek-ge-soc: support PHY LEDs
Vadim Fedorenko
vadim.fedorenko at linux.dev
Fri Aug 11 09:30:01 PDT 2023
On 11/08/2023 04:35, Daniel Golle wrote:
> Implement netdev trigger and primitive bliking offloading as well as
> simple set_brigthness function for both PHY LEDs of the in-SoC PHYs
> found in MT7981 and MT7988.
>
> On MT7988 it is necessary to read the boottrap register and apply LED
> polarities accordingly to get uniform behavior from all LEDs.
>
> Signed-off-by: Daniel Golle <daniel at makrotopia.org>
[...]
> +
> +static int mt7988_phy_fix_leds_polarities(struct phy_device *phydev)
> +{
> + struct pinctrl *pinctrl;
> + int index;
> +
> + /* Setup LED polarity according to bootstrap use of LED pins */
> + for (index = 0; index < 2; ++index)
> + phy_modify_mmd(phydev, MDIO_MMD_VEND2, index ?
> + MTK_PHY_LED1_ON_CTRL : MTK_PHY_LED0_ON_CTRL,
> + MTK_PHY_LED_ON_POLARITY,
> + mt7988_phy_led_get_polarity(phydev, index) ?
> + MTK_PHY_LED_ON_POLARITY : 0);
> +
> + /* Only now setup pinctrl to avoid bogus blinking */
> + pinctrl = devm_pinctrl_get_select(&phydev->mdio.dev, "gbe-led");
This function gets reference on phydev->mdio.dev, but there is no code
to release it. It looks like a leak which will prevent module unload,
but I don't have hardware now to prove it.
> + if (IS_ERR(pinctrl))
> + dev_err(&phydev->mdio.bus->dev, "Failed to setup PHY LED pinctrl\n");
> +
> + return 0;
> +}
More information about the Linux-mediatek
mailing list