diff mbox

[OpenWrt-Devel] Archer C7, leds and led trigger for ath10k

Message ID 20150116185726.GA13845@sottospazio.it
State Accepted
Headers show

Commit Message

gianluca Jan. 16, 2015, 6:57 p.m. UTC
Hi,

I noticed that on Archer C7 the 2.4Ghz and 5Ghz leds are swapped: this
is the relevant section of /etc/config/system

config led 'led_wlan2g'
       option name 'WLAN2G'
       option sysfs 'tp-link:blue:wlan2g'
       option trigger 'phy0tpt'

config led 'led_wlan5g'
       option name 'WLAN5G'
       option sysfs 'tp-link:blue:wlan5g'
       option trigger 'phy1tpt'

However on Archer C7 the 5G interface is on phy0 and 2.4G is on phy1.

I've yet to find where (and how) this section is autogenerated but I noticed
that the phy0pt trigger doesn't even exist on my system.

There is also a bugreport in the bug tracking system pointing at this issue:
https://dev.openwrt.org/ticket/18188

I looked at the ath9k implementation and I've come up with the attached patch.

Do you think a patch like this is acceptable?

Thank you,

Gianluca

Comments

John Crispin Jan. 17, 2015, 6:41 a.m. UTC | #1
On 16/01/2015 19:57, Gianluca Anzolin wrote:
> Hi,
> 
> I noticed that on Archer C7 the 2.4Ghz and 5Ghz leds are swapped:
> this is the relevant section of /etc/config/system
> 
> config led 'led_wlan2g' option name 'WLAN2G' option sysfs
> 'tp-link:blue:wlan2g' option trigger 'phy0tpt'
> 
> config led 'led_wlan5g' option name 'WLAN5G' option sysfs
> 'tp-link:blue:wlan5g' option trigger 'phy1tpt'
> 
> However on Archer C7 the 5G interface is on phy0 and 2.4G is on
> phy1.
> 
> I've yet to find where (and how) this section is autogenerated but
> I noticed that the phy0pt trigger doesn't even exist on my system.
> 

look at

target/linux/ar71xx/base-files/etc/uci-defaults/01_leds



> There is also a bugreport in the bug tracking system pointing at
> this issue: https://dev.openwrt.org/ticket/18188
> 
> I looked at the ath9k implementation and I've come up with the
> attached patch.
> 
> Do you think a patch like this is acceptable?
> 


it is not


> Thank you,
> 
> Gianluca
> 
> 
> 
> _______________________________________________ openwrt-devel
> mailing list openwrt-devel@lists.openwrt.org 
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
gianluca Jan. 17, 2015, 7:42 a.m. UTC | #2
Il 17/01/2015 07:41, John Crispin ha scritto:
>> There is also a bugreport in the bug tracking system pointing at
>> this issue: https://dev.openwrt.org/ticket/18188
>>
>> I looked at the ath9k implementation and I've come up with the
>> attached patch.
>>
>> Do you think a patch like this is acceptable?
>>
>
>
> it is not

do you care to elaborate? what's wrong with it?

Gianluca
John Crispin Jan. 17, 2015, 12:53 p.m. UTC | #3
On 17/01/2015 08:42, Gianluca Anzolin wrote:
> Il 17/01/2015 07:41, John Crispin ha scritto:
>>> There is also a bugreport in the bug tracking system pointing at
>>> this issue: https://dev.openwrt.org/ticket/18188
>>>
>>> I looked at the ath9k implementation and I've come up with the
>>> attached patch.
>>>
>>> Do you think a patch like this is acceptable?
>>>
>>
>>
>> it is not
> 
> do you care to elaborate? what's wrong with it?
> 
> Gianluca
> _____________________________

imho fixing target/linux/ar71xx/base-files/etc/uci-defaults/01_leds is
enough nd not driver patch is required
gianluca Jan. 17, 2015, 6:19 p.m. UTC | #4
Il 17/01/2015 13:53, John Crispin ha scritto:
>
> On 17/01/2015 08:42, Gianluca Anzolin wrote:
>> Il 17/01/2015 07:41, John Crispin ha scritto:
>>>> There is also a bugreport in the bug tracking system pointing at
>>>> this issue: https://dev.openwrt.org/ticket/18188
>>>>
>>>> I looked at the ath9k implementation and I've come up with the
>>>> attached patch.
>>>>
>>>> Do you think a patch like this is acceptable?
>>>>
>>>
>>> it is not
>> do you care to elaborate? what's wrong with it?
>>
>> Gianluca
>> _____________________________
> imho fixing target/linux/ar71xx/base-files/etc/uci-defaults/01_leds is
> enough nd not driver patch is required
>
I don't get it, how do you create a throughput trigger by changing a script?

Gianluca
John Crispin Jan. 17, 2015, 6:27 p.m. UTC | #5
On 17/01/2015 19:19, Gianluca Anzolin wrote:
> Il 17/01/2015 13:53, John Crispin ha scritto:
>> 
>> On 17/01/2015 08:42, Gianluca Anzolin wrote:
>>> Il 17/01/2015 07:41, John Crispin ha scritto:
>>>>> There is also a bugreport in the bug tracking system
>>>>> pointing at this issue:
>>>>> https://dev.openwrt.org/ticket/18188
>>>>> 
>>>>> I looked at the ath9k implementation and I've come up with
>>>>> the attached patch.
>>>>> 
>>>>> Do you think a patch like this is acceptable?
>>>>> 
>>>> 
>>>> it is not
>>> do you care to elaborate? what's wrong with it?
>>> 
>>> Gianluca _____________________________
>> imho fixing
>> target/linux/ar71xx/base-files/etc/uci-defaults/01_leds is enough
>> nd not driver patch is required
>> 
> I don't get it, how do you create a throughput trigger by changing
> a script?


ok, i misread your patch. the first half says the leds are swapped so
i pointed you at the code that sets up the leds. i will talk to felix
about the patch



> 
> Gianluca _______________________________________________ 
> openwrt-devel mailing list openwrt-devel@lists.openwrt.org 
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
diff mbox

Patch

From c0f16f5008b3ad52f8a0c8554503beb655e11928 Mon Sep 17 00:00:00 2001
From: Gianluca Anzolin <gianluca@sottospazio.it>
Date: Fri, 16 Jan 2015 19:19:30 +0100
Subject: [PATCH] ath10k: add throughput led trigger

This patch add a throughput led trigger for the ath10k wifi driver.

The throughputs in the table are chosen to be linear in a logarithmic
scale.

Signed-off-by: Gianluca Anzolin <gianluca@sottospazio.it>
---
 .../patches/930-ath10k_add_tpt_led_trigger.patch   | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch

diff --git a/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
new file mode 100644
index 0000000..150e008
--- /dev/null
+++ b/package/kernel/mac80211/patches/930-ath10k_add_tpt_led_trigger.patch
@@ -0,0 +1,37 @@ 
+--- a/drivers/net/wireless/ath/ath10k/mac.c
++++ b/drivers/net/wireless/ath/ath10k/mac.c
+@@ -4824,6 +4824,21 @@ struct ath10k_vif *ath10k_get_arvif(stru
+ 	return arvif_iter.arvif;
+ }
+ 
++#ifdef CPTCFG_MAC80211_LEDS
++static const struct ieee80211_tpt_blink ath10k_tpt_blink[] = {
++	{ .throughput = 0 * 1024, .blink_time = 334 },
++	{ .throughput = 1 * 1024, .blink_time = 260 },
++	{ .throughput = 2 * 1024, .blink_time = 220 },
++	{ .throughput = 5 * 1024, .blink_time = 190 },
++	{ .throughput = 10 * 1024, .blink_time = 170 },
++	{ .throughput = 25 * 1024, .blink_time = 150 },
++	{ .throughput = 54 * 1024, .blink_time = 130 },
++	{ .throughput = 120 * 1024, .blink_time = 110 },
++	{ .throughput = 265 * 1024, .blink_time = 80 },
++	{ .throughput = 586 * 1024, .blink_time = 50 },
++};
++#endif
++
+ int ath10k_mac_register(struct ath10k *ar)
+ {
+ 	struct ieee80211_supported_band *band;
+@@ -4965,6 +4980,12 @@ int ath10k_mac_register(struct ath10k *a
+ 		goto err_free;
+ 	}
+ 
++#if CPTCFG_MAC80211_LEDS
++	ieee80211_create_tpt_led_trigger(ar->hw,
++		IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
++		ARRAY_SIZE(ath10k_tpt_blink));
++#endif
++
+ 	ret = ieee80211_register_hw(ar->hw);
+ 	if (ret) {
+ 		ath10k_err(ar, "failed to register ieee80211: %d\n", ret);
-- 
2.2.2