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: mxl-gpy: correctly describe LED polarity

According the datasheet covering the LED (0x1b) register:
0B Active High LEDx pin driven high when activated
1B Active Low LEDx pin driven low when activated

Make use of the now available 'active-high' property and correctly
reflect the polarity setting which was previously inverted.

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

authored by

Daniel Golle and committed by
Paolo Abeni
eb89c79c 9d55e68b

+12 -4
+12 -4
drivers/net/phy/mxl-gpy.c
··· 989 989 static int gpy_led_polarity_set(struct phy_device *phydev, int index, 990 990 unsigned long modes) 991 991 { 992 - bool active_low = false; 992 + bool force_active_low = false, force_active_high = false; 993 993 u32 mode; 994 994 995 995 if (index >= GPY_MAX_LEDS) ··· 998 998 for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { 999 999 switch (mode) { 1000 1000 case PHY_LED_ACTIVE_LOW: 1001 - active_low = true; 1001 + force_active_low = true; 1002 + break; 1003 + case PHY_LED_ACTIVE_HIGH: 1004 + force_active_high = true; 1002 1005 break; 1003 1006 default: 1004 1007 return -EINVAL; 1005 1008 } 1006 1009 } 1007 1010 1008 - return phy_modify(phydev, PHY_LED, PHY_LED_POLARITY(index), 1009 - active_low ? 0 : PHY_LED_POLARITY(index)); 1011 + if (force_active_low) 1012 + return phy_set_bits(phydev, PHY_LED, PHY_LED_POLARITY(index)); 1013 + 1014 + if (force_active_high) 1015 + return phy_clear_bits(phydev, PHY_LED, PHY_LED_POLARITY(index)); 1016 + 1017 + unreachable(); 1010 1018 } 1011 1019 1012 1020 static struct phy_driver gpy_drivers[] = {