]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: phy: qcom: qca808x: default to LED active High if not set
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 1 Feb 2024 13:46:01 +0000 (14:46 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 3 Feb 2024 12:50:45 +0000 (12:50 +0000)
qca808x PHY provide support for the led_polarity_set OP to configure
and apply the active-low property but on PHY reset, the Active High bit
is not set resulting in the LED driven as active-low.

To fix this, check if active-low is not set in DT and enable Active High
polarity by default to restore correct funcionality of the LED.

Fixes: 7196062b64ee ("net: phy: at803x: add LED support for qca808x")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/qcom/qca808x.c

index 00db4b2742640103096f325e6fc625b03a51c446..d88e04278fc4bfeb188c3f94f7393044a44b581d 100644 (file)
@@ -290,8 +290,18 @@ static int qca808x_probe(struct phy_device *phydev)
 
 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) {
+               ret = phy_set_bits_mmd(phydev, MDIO_MMD_AN,
+                                      QCA808X_MMD7_LED_POLARITY_CTRL,
+                                      QCA808X_LED_ACTIVE_HIGH);
+               if (ret)
+                       return ret;
+       }
+
        /* Active adc&vga on 802.3az for the link 1000M and 100M */
        ret = phy_modify_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_ADDR_CLD_CTRL7,
                             QCA808X_8023AZ_AFE_CTRL_MASK, QCA808X_8023AZ_AFE_EN);