linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] wifi: ath9k: ahb: add OF LED support
@ 2025-07-04 21:42 Rosen Penev
  2025-07-04 21:42 ` [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rosen Penev @ 2025-07-04 21:42 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, nbd, jeff.johnson,
	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.

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

 .../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.0


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

* [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-07-04 21:42 [PATCH 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
@ 2025-07-04 21:42 ` Rosen Penev
  2025-07-08 17:26   ` Rob Herring
  2025-07-04 21:42 ` [PATCH 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
  2025-07-04 21:42 ` [PATCH 3/3] mips: qca: use led-sources for WMAC LED Rosen Penev
  2 siblings, 1 reply; 6+ messages in thread
From: Rosen Penev @ 2025-07-04 21:42 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, nbd, jeff.johnson,
	Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

This is used to override the various defaults the ath9k driver has for
LED pin values.

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..58c7b873cecb 100644
--- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
@@ -50,6 +50,19 @@ properties:
 
   ieee80211-freq-limit: true
 
+  led:
+    type: object
+    $ref: /schemas/leds/common.yaml#
+    additionalProperties: false
+    properties:
+      led-active-low:
+        description:
+          LED is enabled with ground signal.
+        type: boolean
+
+      led-sources:
+        maxItems: 1
+
   qca,no-eeprom:
     $ref: /schemas/types.yaml#/definitions/flag
     description:
@@ -102,5 +115,8 @@ examples:
         compatible = "qca,ar9130-wifi";
         reg = <0x180c0000 0x230000>;
         interrupts = <2>;
+        led {
+          led-sources = <0>;
+        };
       };
     };
-- 
2.50.0


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

* [PATCH 2/3] wifi: ath9k: ahb: add led pin OF support
  2025-07-04 21:42 [PATCH 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
  2025-07-04 21:42 ` [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
@ 2025-07-04 21:42 ` Rosen Penev
  2025-07-04 21:42 ` [PATCH 3/3] mips: qca: use led-sources for WMAC LED Rosen Penev
  2 siblings, 0 replies; 6+ messages in thread
From: Rosen Penev @ 2025-07-04 21:42 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, nbd, jeff.johnson,
	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.

It seems that it's preferred to use led-sources as the binding for this
instead of a vendor prefixed variant.

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 629f66a25307..4f967bc34460 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -650,6 +650,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 && of_device_is_available(np)) {
+		u32 led_pin;
+
+		if (!of_property_read_u32(np, "led-sources", &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.0


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

* [PATCH 3/3] mips: qca: use led-sources for WMAC LED
  2025-07-04 21:42 [PATCH 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
  2025-07-04 21:42 ` [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
  2025-07-04 21:42 ` [PATCH 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
@ 2025-07-04 21:42 ` Rosen Penev
  2 siblings, 0 replies; 6+ messages in thread
From: Rosen Penev @ 2025-07-04 21:42 UTC (permalink / raw)
  To: linux-wireless
  Cc: Toke Høiland-Jørgensen, nbd, jeff.johnson,
	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..ef4a08e1e35a 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 {
+		led-sources = <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..ce04e767cd2b 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 {
+		led-sources = <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..e69a67284f6f 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 {
+		led-sources = <0>;
+	};
 };
-- 
2.50.0


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

* Re: [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings
  2025-07-04 21:42 ` [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
@ 2025-07-08 17:26   ` Rob Herring
  2025-07-08 19:55     ` Rosen Penev
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2025-07-08 17:26 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Toke Høiland-Jørgensen, nbd,
	jeff.johnson, Johannes Berg, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS

On Fri, Jul 04, 2025 at 02:42:17PM -0700, Rosen Penev wrote:
> This is used to override the various defaults the ath9k driver has for
> LED pin values.
> 
> 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..58c7b873cecb 100644
> --- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> +++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> @@ -50,6 +50,19 @@ properties:
>  
>    ieee80211-freq-limit: true
>  
> +  led:
> +    type: object
> +    $ref: /schemas/leds/common.yaml#
> +    additionalProperties: false

You really don't want any other common properties? Like defining the 
function?

> +    properties:
> +      led-active-low:
> +        description:
> +          LED is enabled with ground signal.
> +        type: boolean
> +
> +      led-sources:
> +        maxItems: 1

This property is really for cases where the LED source is configurable 
from the LED instance. If that's not the case here just use 'reg' for 
each instance (assuming there's more than 1). I shouldn't be wondering 
what the h/w looks like though. Please describe it in the commit msg 
rather than what some driver does.

If you do need led-sources, you should define some constraints on the 
values, not just the length.

Rob


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

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

On Tue, Jul 8, 2025 at 10:26 AM Rob Herring <robh@kernel.org> wrote:
>
> On Fri, Jul 04, 2025 at 02:42:17PM -0700, Rosen Penev wrote:
> > This is used to override the various defaults the ath9k driver has for
> > LED pin values.
> >
> > 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..58c7b873cecb 100644
> > --- a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> > +++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
> > @@ -50,6 +50,19 @@ properties:
> >
> >    ieee80211-freq-limit: true
> >
> > +  led:
> > +    type: object
> > +    $ref: /schemas/leds/common.yaml#
> > +    additionalProperties: false
>
> You really don't want any other common properties? Like defining the
> function?
All of this was copy/paste from mediatek,mt76.yaml , where the same
binding is used for mostly the same purpose.
>
> > +    properties:
> > +      led-active-low:
> > +        description:
> > +          LED is enabled with ground signal.
> > +        type: boolean
> > +
> > +      led-sources:
> > +        maxItems: 1
>
> This property is really for cases where the LED source is configurable
> from the LED instance. If that's not the case here just use 'reg' for
> each instance (assuming there's more than 1). I shouldn't be wondering
> what the h/w looks like though. Please describe it in the commit msg
> rather than what some driver does.
>
> If you do need led-sources, you should define some constraints on the
> values, not just the length.
The original downstream version used a u8 for the number. But again,
I'm just copy/pasting.
>
> Rob
>

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

end of thread, other threads:[~2025-07-08 19:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 21:42 [PATCH 0/3] wifi: ath9k: ahb: add OF LED support Rosen Penev
2025-07-04 21:42 ` [PATCH 1/3] dt-bindings: net: wireless: ath9k: add led bindings Rosen Penev
2025-07-08 17:26   ` Rob Herring
2025-07-08 19:55     ` Rosen Penev
2025-07-04 21:42 ` [PATCH 2/3] wifi: ath9k: ahb: add led pin OF support Rosen Penev
2025-07-04 21:42 ` [PATCH 3/3] mips: qca: use led-sources for WMAC LED 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).