Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: aquantia: correctly describe LED polarity override

Use newly defined 'active-high' property to set the
VEND1_GLOBAL_LED_DRIVE_VDD bit and let 'active-low' clear that bit. This
reflects the technical reality which was inverted in the previous
description in which the 'active-low' property was used to actually set
the VEND1_GLOBAL_LED_DRIVE_VDD bit, which means that VDD (ie. supply
voltage) of the LED is driven rather than GND.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/86a413b4387c42dcb54f587cc2433a06f16aae83.1728558223.git.daniel@makrotopia.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Daniel Golle and committed by
Paolo Abeni
9d55e68b a274465c

+24 -8
+1
drivers/net/phy/aquantia/aquantia.h
··· 177 177 struct aqr107_priv { 178 178 u64 sgmii_stats[AQR107_SGMII_STAT_SZ]; 179 179 unsigned long leds_active_low; 180 + unsigned long leds_active_high; 180 181 }; 181 182 182 183 #if IS_REACHABLE(CONFIG_HWMON)
+14 -5
drivers/net/phy/aquantia/aquantia_leds.c
··· 121 121 { 122 122 return phy_modify_mmd(phydev, MDIO_MMD_VEND1, AQR_LED_DRIVE(index), 123 123 VEND1_GLOBAL_LED_DRIVE_VDD, 124 - enable ? VEND1_GLOBAL_LED_DRIVE_VDD : 0); 124 + enable ? 0 : VEND1_GLOBAL_LED_DRIVE_VDD); 125 125 } 126 126 127 127 int aqr_phy_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes) 128 128 { 129 + bool force_active_low = false, force_active_high = false; 129 130 struct aqr107_priv *priv = phydev->priv; 130 - bool active_low = false; 131 131 u32 mode; 132 132 133 133 if (index >= AQR_MAX_LEDS) ··· 136 136 for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { 137 137 switch (mode) { 138 138 case PHY_LED_ACTIVE_LOW: 139 - active_low = true; 139 + force_active_low = true; 140 + break; 141 + case PHY_LED_ACTIVE_HIGH: 142 + force_active_high = true; 140 143 break; 141 144 default: 142 145 return -EINVAL; ··· 147 144 } 148 145 149 146 /* Save LED driver vdd state to restore on SW reset */ 150 - if (active_low) 147 + if (force_active_low) 151 148 priv->leds_active_low |= BIT(index); 152 149 153 - return aqr_phy_led_active_low_set(phydev, index, active_low); 150 + if (force_active_high) 151 + priv->leds_active_high |= BIT(index); 152 + 153 + if (force_active_high || force_active_low) 154 + return aqr_phy_led_active_low_set(phydev, index, force_active_low); 155 + 156 + unreachable(); 154 157 }
+9 -3
drivers/net/phy/aquantia/aquantia_main.c
··· 530 530 static int aqr107_config_init(struct phy_device *phydev) 531 531 { 532 532 struct aqr107_priv *priv = phydev->priv; 533 - u32 led_active_low; 533 + u32 led_idx; 534 534 int ret; 535 535 536 536 /* Check that the PHY interface type is compatible */ ··· 561 561 return ret; 562 562 563 563 /* Restore LED polarity state after reset */ 564 - for_each_set_bit(led_active_low, &priv->leds_active_low, AQR_MAX_LEDS) { 565 - ret = aqr_phy_led_active_low_set(phydev, led_active_low, true); 564 + for_each_set_bit(led_idx, &priv->leds_active_low, AQR_MAX_LEDS) { 565 + ret = aqr_phy_led_active_low_set(phydev, led_idx, true); 566 + if (ret) 567 + return ret; 568 + } 569 + 570 + for_each_set_bit(led_idx, &priv->leds_active_high, AQR_MAX_LEDS) { 571 + ret = aqr_phy_led_active_low_set(phydev, led_idx, false); 566 572 if (ret) 567 573 return ret; 568 574 }