Add a new device property "airoha,led-hw-disable" that will disable the LED
HW control when set. This allows the "netdev" trigger to control the LEDs.
Signed-off-by: John Crispin <[email protected]>
--- /dev/null
+Index: linux-6.6.23/drivers/net/phy/air_en8811h.c
+===================================================================
+--- linux-6.6.23.orig/drivers/net/phy/air_en8811h.c
++++ linux-6.6.23/drivers/net/phy/air_en8811h.c
+@@ -157,6 +157,7 @@ struct led {
+ struct en8811h_priv {
+ u32 firmware_version;
+ struct led led[EN8811H_LED_COUNT];
++ bool led_hw_control;
+ };
+
+ enum {
+@@ -540,6 +541,9 @@ static int air_led_hw_control_get(struct
+ {
+ struct en8811h_priv *priv = phydev->priv;
+
++ if (!priv->led_hw_control)
++ return -EINVAL;
++
+ if (index >= EN8811H_LED_COUNT)
+ return -EINVAL;
+
+@@ -814,6 +818,8 @@ static int en8811h_config_init(struct ph
+ if (ret < 0)
+ return ret;
+
++ priv->led_hw_control = !device_property_read_bool(dev, "airoha,led-hw-disable");
++
+ ret = air_leds_init(phydev, EN8811H_LED_COUNT, AIR_PHY_LED_DUR,
+ AIR_LED_MODE_USER_DEFINE);
+ if (ret < 0) {
--- /dev/null
+Index: linux-6.6.23/drivers/net/phy/air_en8811h.c
+===================================================================
+--- linux-6.6.23.orig/drivers/net/phy/air_en8811h.c
++++ linux-6.6.23/drivers/net/phy/air_en8811h.c
+@@ -157,6 +157,7 @@ struct led {
+ struct en8811h_priv {
+ u32 firmware_version;
+ struct led led[EN8811H_LED_COUNT];
++ bool led_hw_control;
+ };
+
+ enum {
+@@ -540,6 +541,9 @@ static int air_led_hw_control_get(struct
+ {
+ struct en8811h_priv *priv = phydev->priv;
+
++ if (!priv->led_hw_control)
++ return -EINVAL;
++
+ if (index >= EN8811H_LED_COUNT)
+ return -EINVAL;
+
+@@ -814,6 +818,8 @@ static int en8811h_config_init(struct ph
+ if (ret < 0)
+ return ret;
+
++ priv->led_hw_control = !device_property_read_bool(dev, "airoha,led-hw-disable");
++
+ ret = air_leds_init(phydev, EN8811H_LED_COUNT, AIR_PHY_LED_DUR,
+ AIR_LED_MODE_USER_DEFINE);
+ if (ret < 0) {