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: support 'active-high' property for PHY LEDs

In addition to 'active-low' and 'inactive-high-impedance' also
support 'active-high' property for PHY LED pin configuration.
As only either 'active-high' or 'active-low' can be set at the
same time, WARN and return an error in case both are set.

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

authored by

Daniel Golle and committed by
Paolo Abeni
a274465c 9c5ad7bf

+9 -2
+6
drivers/net/phy/phy_device.c
··· 3358 3358 if (index > U8_MAX) 3359 3359 return -EINVAL; 3360 3360 3361 + if (of_property_read_bool(led, "active-high")) 3362 + set_bit(PHY_LED_ACTIVE_HIGH, &modes); 3361 3363 if (of_property_read_bool(led, "active-low")) 3362 3364 set_bit(PHY_LED_ACTIVE_LOW, &modes); 3363 3365 if (of_property_read_bool(led, "inactive-high-impedance")) 3364 3366 set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); 3367 + 3368 + if (WARN_ON(modes & BIT(PHY_LED_ACTIVE_LOW) && 3369 + modes & BIT(PHY_LED_ACTIVE_HIGH))) 3370 + return -EINVAL; 3365 3371 3366 3372 if (modes) { 3367 3373 /* Return error if asked to set polarity modes but not supported */
+3 -2
include/linux/phy.h
··· 877 877 878 878 /* Modes for PHY LED configuration */ 879 879 enum phy_led_modes { 880 - PHY_LED_ACTIVE_LOW = 0, 881 - PHY_LED_INACTIVE_HIGH_IMPEDANCE = 1, 880 + PHY_LED_ACTIVE_HIGH = 0, 881 + PHY_LED_ACTIVE_LOW = 1, 882 + PHY_LED_INACTIVE_HIGH_IMPEDANCE = 2, 882 883 883 884 /* keep it last */ 884 885 __PHY_LED_MODES_NUM,