linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 0/3] wifi: ath9k: ahb: add OF LED support
@ 2025-08-25  4:48 Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rosen Penev @ 2025-08-25  4:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

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(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-08-25  4:48 [PATCHv3 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
@ 2025-08-25  4:48 ` Rosen Penev
  2025-08-25 16:38   ` Conor Dooley
  2025-08-25 17:49   ` Rob Herring (Arm)
  2025-08-25  4:48 ` [PATCHv3 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 3/3] mips: qca: specify WMAC LED directly Rosen Penev
  2 siblings, 2 replies; 7+ messages in thread
From: Rosen Penev @ 2025-08-25  4:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

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.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
index d16ca8e0a25d..bbac017d34d0 100644
--- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
@@ -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;
+        };
       };
     };
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv3 2/3] wifi: ath9k: ahb: add led pin OF support
  2025-08-25  4:48 [PATCHv3 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
@ 2025-08-25  4:48 ` Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 3/3] mips: qca: specify WMAC LED directly Rosen Penev
  2 siblings, 0 replies; 7+ messages in thread
From: Rosen Penev @ 2025-08-25  4:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

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.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/ath/ath9k/init.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index c911b178dcc2..269a792c3256 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -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;
 }
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv3 3/3] mips: qca: specify WMAC LED directly
  2025-08-25  4:48 [PATCHv3 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
  2025-08-25  4:48 ` [PATCHv3 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
@ 2025-08-25  4:48 ` Rosen Penev
  2 siblings, 0 replies; 7+ messages in thread
From: Rosen Penev @ 2025-08-25  4:48 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

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.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 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(-)

diff --git a/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
index a7901bb040ce..344e1a2ee6ea 100644
--- a/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
+++ b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
@@ -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;
+	};
 };
diff --git a/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts b/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
index 37a74aabe4b4..573ca7752698 100644
--- a/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
+++ b/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
@@ -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>;
+	};
 };
diff --git a/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts b/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
index a7108c803eb3..6891d9589b68 100644
--- a/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
+++ b/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
@@ -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>;
+	};
 };
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
@ 2025-08-25 16:38   ` Conor Dooley
  2025-08-26  1:57     ` Rosen Penev
  2025-08-25 17:49   ` Rob Herring (Arm)
  1 sibling, 1 reply; 7+ messages in thread
From: Conor Dooley @ 2025-08-25 16:38 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Toke Høiland-Jørgensen, Johannes Berg,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

On Sun, Aug 24, 2025 at 09:48:10PM -0700, Rosen Penev wrote:
> 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.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> index d16ca8e0a25d..bbac017d34d0 100644
> --- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> +++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> @@ -50,6 +50,18 @@ properties:
>  
>    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

> +        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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
  2025-08-25 16:38   ` Conor Dooley
@ 2025-08-25 17:49   ` Rob Herring (Arm)
  1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2025-08-25 17:49 UTC (permalink / raw)
  To: Rosen Penev
  Cc: Conor Dooley, Thomas Bogendoerfer, devicetree, linux-kernel,
	Krzysztof Kozlowski, linux-mips, Johannes Berg,
	Toke Høiland-Jørgensen, linux-wireless


On Sun, 24 Aug 2025 21:48:10 -0700, Rosen Penev wrote:
> 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.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  .../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/20250825044812.1575524-2-rosenp@gmail.com

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-08-25 16:38   ` Conor Dooley
@ 2025-08-26  1:57     ` Rosen Penev
  0 siblings, 0 replies; 7+ messages in thread
From: Rosen Penev @ 2025-08-26  1:57 UTC (permalink / raw)
  To: Conor Dooley
  Cc: linux-wireless, Toke Høiland-Jørgensen, Johannes Berg,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

On Mon, Aug 25, 2025 at 9:38 AM Conor Dooley <conor@kernel.org> wrote:
>
> On Sun, Aug 24, 2025 at 09:48:10PM -0700, Rosen Penev wrote:
> > 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.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  .../bindings/net/wireless/qca,ath9k.yaml         | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> > index d16ca8e0a25d..bbac017d34d0 100644
> > --- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> > +++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> > @@ -50,6 +50,18 @@ properties:
> >
> >    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
Probably makes more sense to use active-high instead. Will do so in next series.
>
> > +        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
> >

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-26  1:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25  4:48 [PATCHv3 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
2025-08-25  4:48 ` [PATCHv3 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
2025-08-25 16:38   ` Conor Dooley
2025-08-26  1:57     ` Rosen Penev
2025-08-25 17:49   ` Rob Herring (Arm)
2025-08-25  4:48 ` [PATCHv3 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
2025-08-25  4:48 ` [PATCHv3 3/3] mips: qca: specify WMAC LED directly Rosen Penev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).