Skip to contentSkip to conversation

wifi: ath9k: ahb: add OF LED support

PATCH Superseded Rosen Penev 3 participants 7 messages Aug 25, 2025 – Aug 26, 2025

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover wifi: ath9k: ahb: add OF LED support

A port of the prior platform code to use OF.

v2: use reg instead of led-sources
v3: fix documentation from v2 change. remove of_device_is_available. makes no sense for it to be disabled.

Rosen Penev (3):
dt-bindings: net: wireless: ath9k: add led bindings
wifi: ath9k: ahb: add led pin OF support
mips: qca: specify WMAC LED directly

 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 10 +++++-----
 arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts   | 10 ++++------
 arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts      | 10 ++++------
 drivers/net/wireless/ath/ath9k/init.c            | 11 +++++++++++
 5 files changed, 40 insertions(+), 17 deletions(-)
Signature · 1 line
2.50.1
#1 lore raw

PATCH v3 1/3 dt-bindings: net: wireless: ath9k: add led bindings

The ath9k driver has various pin GPIO numbers for different chipsets which are not always correct for every device.

Add bindings to specify the correct number and if it should be active-low.

---
 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +16 -0
index d16ca8e0a25d..bbac017d34d0 100644
@@ -50,6 +50,18 @@ properties:
 
   ieee80211-freq-limit: true
 
+  led:
+    type: object
+    additionalProperties: false
+    properties:
+      reg:
+        maxItems: 1
+
+      led-active-low:
+        description:
+          LED is enabled with ground signal.
+        type: boolean
+
   qca,no-eeprom:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
@@ -102,5 +114,9 @@ examples:
         compatible = "qca,ar9130-wifi";
         reg = <0x180c0000 0x230000>;
         interrupts = <2>;
+        led {
+          reg = <0>;
+          led-active-low;
+        };
       };
     };
Signature · 1 line
2.50.1
#2 lore raw

Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings

Quoted 17 lines · Rosen Penev

The ath9k driver has various pin GPIO numbers for different chipsets which are not always correct for every device.

Add bindings to specify the correct number and if it should be active-low.

---
 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +0 -0
index d16ca8e0a25d..bbac017d34d0 100644
@@ -50,6 +50,18 @@ properties:
 

Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml properties: · line 60

Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +8 -0
   ieee80211-freq-limit: true
 
+  led:
+    type: object
+    additionalProperties: false
+    properties:
+      reg:
+        maxItems: 1
+
+      led-active-low:

How come you are not including leds/common.yaml and making use of the active-low property defined there? Seems to be in use by mediatek,mt76.yaml

Quoted 20 lines
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +8 -0
+        description:
+          LED is enabled with ground signal.
+        type: boolean
+
   qca,no-eeprom:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
@@ -102,5 +114,9 @@ examples:
         compatible = "qca,ar9130-wifi";
         reg = <0x180c0000 0x230000>;
         interrupts = <2>;
+        led {
+          reg = <0>;
+          led-active-low;
+        };
       };
     };
Signature · 1 line
2.50.1
#3 lore raw

Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings

Quoted 21 lines · Conor Dooley
Quoted 19 lines · Rosen Penev

The ath9k driver has various pin GPIO numbers for different chipsets which are not always correct for every device.

Add bindings to specify the correct number and if it should be active-low.

---
 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +0 -0
index d16ca8e0a25d..bbac017d34d0 100644
@@ -50,6 +50,18 @@ properties:
 
   ieee80211-freq-limit: true
 
Quoted 11 lines

Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml properties: · line 60

Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +8 -0
+  led:
+    type: object
+    additionalProperties: false
+    properties:
+      reg:
+        maxItems: 1
+
+      led-active-low:

How come you are not including leds/common.yaml and making use of the active-low property defined there? Seems to be in use by mediatek,mt76.yaml

Probably makes more sense to use active-high instead. Will do so in next series.

Quoted 21 lines
Quoted 21 lines
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml +8 -1
+        description:
+          LED is enabled with ground signal.
+        type: boolean
+
   qca,no-eeprom:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
@@ -102,5 +114,9 @@ examples:
         compatible = "qca,ar9130-wifi";
         reg = <0x180c0000 0x230000>;
         interrupts = <2>;
+        led {
+          reg = <0>;
+          led-active-low;
+        };
       };
     };
--

2.50.1

#4 lore raw

Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings

In reply to Rosen Penev
Quoted 11 lines · Rosen Penev

The ath9k driver has various pin GPIO numbers for different chipsets which are not always correct for every device.

Add bindings to specify the correct number and if it should be active-low.

---
 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dts:92.15-25: Warning (reg_format): /example-2/ahb/wifi@180c0000/led:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dts:91.17-94.15: Warning (unit_address_vs_reg): /example-2/ahb/wifi@180c0000/led: node has a reg or ranges property, but no unit name Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dts:91.17-94.15: Warning (avoid_default_addr_size): /example-2/ahb/wifi@180c0000/led: Relying on default #address-cells value Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dts:91.17-94.15: Warning (avoid_default_addr_size): /example-2/ahb/wifi@180c0000/led: Relying on default #size-cells value Documentation/devicetree/bindings/net/wireless/qca,ath9k.example.dtb: Warning (unique_unit_address_if_enabled): Failed prerequisite 'avoid_default_addr_size'

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#5 lore raw

PATCH v3 2/3 wifi: ath9k: ahb: add led pin OF support

In reply to Rosen Penev

The old and removed platform code had support for assigning a value for the LED pin for when the default is not correct. Effectively a fix for a non working LED.

For setting an LED to active high, a negation of led-active-low is used, as two drivers currently use that and no drivers use led-active-high or something similar.

---
 drivers/net/wireless/ath/ath9k/init.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath9k/init.c +11 -0
index c911b178dcc2..269a792c3256 100644
@@ -662,6 +662,17 @@ static int ath9k_of_init(struct ath_softc *sc)
 	if (ret == -EPROBE_DEFER)
 		return ret;
 
+	np = of_get_child_by_name(np, "led");
+	if (np) {
+		u32 led_pin;
+
+		if (!of_property_read_u32(np, "reg", &led_pin))
+			ah->led_pin = led_pin;
+
+		ah->config.led_active_high = !of_property_read_bool(np, "led-active-low");
+		of_node_put(np);
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.50.1
#6 lore raw

PATCH v3 3/3 mips: qca: specify WMAC LED directly

In reply to Rosen Penev

The ath9k driver creates an LED unconditionally being driven with sometimes the wrong pin. Not only that, the current dts definitions have LEDs for the WMAC that do not behave in response to it. Fix both issues.

---
 arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 10 +++++-----
 arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts   | 10 ++++------
 arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts      | 10 ++++------
 3 files changed, 13 insertions(+), 17 deletions(-)
arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts +5 -5
index a7901bb040ce..344e1a2ee6ea 100644
@@ -56,11 +56,6 @@ led-2 {
 			label = "tp-link:green:qss";
 			gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
 		};
-
-		led-3 {
-			label = "tp-link:green:wlan";
-			gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
-		};
 	};
 };
 
@@ -111,4 +106,9 @@ partition@2 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <9>;
+		led-active-low;
+	};
 };
arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts +4 -6
index 37a74aabe4b4..573ca7752698 100644
@@ -22,12 +22,6 @@ memory@0 {
 	leds {
 		compatible = "gpio-leds";
 
-		led-wlan {
-			label = "dragino2:red:wlan";
-			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
-			default-state = "off";
-		};
-
 		led-lan {
 			label = "dragino2:red:lan";
 			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
@@ -101,4 +95,8 @@ spiflash: w25q128@0 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <0>;
+	};
 };
arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts +4 -6
index a7108c803eb3..6891d9589b68 100644
@@ -22,12 +22,6 @@ memory@0 {
 	leds {
 		compatible = "gpio-leds";
 
-		led-wlan {
-			label = "tp-link:green:wlan";
-			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
-			default-state = "off";
-		};
-
 		led-lan {
 			label = "tp-link:green:lan";
 			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
@@ -117,4 +111,8 @@ spiflash: s25sl032p@0 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <0>;
+	};
 };
Signature · 1 line
2.50.1