Skip to contentSkip to conversation

wifi: ath9k: ahb: add OF LED support

PATCH In review Rosen Penev 3 participants 9 messages Aug 27, 2025 – Aug 29, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 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.
v4: add back leds/common.yaml in documentation and rename property to led-active-high, which is more in line with the code.

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 v4 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-high.

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

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

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-high.

---
 .../bindings/net/wireless/qca,ath9k.yaml        | 17 +++++++++++++++++
 1 file changed, 17 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.

#3 lore raw

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

Quoted 31 lines · Rob Herring (Arm)
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-high.

---
 .../bindings/net/wireless/qca,ath9k.yaml        | 17 +++++++++++++++++
 1 file changed, 17 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'

Quoted 3 lines

doc reference errors (make refcheckdocs):

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

FFS. These reviews were garbage. The next series will effectively be the same as the initial.

Quoted 14 lines

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.

#4 lore raw

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

Quoted 12 lines · Rosen Penev
Quoted 12 lines

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'

Quoted 4 lines
Quoted 3 lines

doc reference errors (make refcheckdocs):

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

FFS. These reviews were garbage. The next series will effectively be

What? My and Conor reviews were garbage?

It is your patches which never got tested, code was completely messed up (see v2 mixing two different things).

I am not going to review your patches.

Best regards,
Krzysztof

#5 lore raw

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

Quoted 14 lines · Krzysztof Kozlowski
Quoted 12 lines · Rosen Penev
Quoted 12 lines

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'

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

doc reference errors (make refcheckdocs):

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

FFS. These reviews were garbage. The next series will effectively be

What? My and Conor reviews were garbage?

I was specifically referring to replacing led-sources with reg. The latter needs address and size-cells specified which is verbose for no good reason.

Meaning the initial patchset was almost ideal. Just of_device_is_available needed to be fixed.

I'm irritated as this will be up to v5 when it should have been up to v2.

Quoted 8 lines

It is your patches which never got tested, code was completely messed up (see v2 mixing two different things).

I am not going to review your patches.

Best regards,
Krzysztof

#6 lore raw

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

Quoted 15 lines · Rosen Penev
Quoted 14 lines · Krzysztof Kozlowski
Quoted 12 lines · Rosen Penev
Quoted 12 lines

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'

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

doc reference errors (make refcheckdocs):

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

FFS. These reviews were garbage. The next series will effectively be

What? My and Conor reviews were garbage?

I was specifically referring to replacing led-sources with reg. The

You sent untested, broken code and you complain that reviews were garbage?

Quoted 7 lines

latter needs address and size-cells specified which is verbose for no good reason.

Meaning the initial patchset was almost ideal. Just of_device_is_available needed to be fixed.

I'm irritated as this will be up to v5 when it should have been up to v2.

Start testing your patches finally!

That's your job, not our infrastructure!

I think every damn patch from you was completely broken, because you did not bother to test, but you call reviews of others "garbage".

That's not acceptable.

#7 lore raw

PATCH v4 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.

Added led-active-high to set the LED to active high.

---
 drivers/net/wireless/ath/ath9k/init.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath9k/init.c +11 -0
index c911b178dcc2..28dc6c0e27aa 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-high");
+		of_node_put(np);
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.50.1
#8 lore raw

PATCH v4 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 |  9 ++++-----
 arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts   | 11 +++++------
 arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts      | 11 +++++------
 3 files changed, 14 insertions(+), 17 deletions(-)
arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts +4 -5
index a7901bb040ce..0e813c38c31c 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,8 @@ partition@2 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <9>;
+	};
 };
arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts +5 -6
index 37a74aabe4b4..19d72a0fdd8d 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,9 @@ spiflash: w25q128@0 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <0>;
+		led-active-high;
+	};
 };
arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts +5 -6
index a7108c803eb3..c12dd4a72772 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,9 @@ spiflash: s25sl032p@0 {
 
 &wifi {
 	status = "okay";
+
+	led {
+		reg = <0>;
+		led-active-high;
+	};
 };
Signature · 1 line
2.50.1