diff mbox

ath9k_htc: Add a module parameter to disable blink

Message ID 1420968029-1222-1-git-send-email-hong@topbug.net (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show

Commit Message

Hong Xu Jan. 11, 2015, 9:20 a.m. UTC
Add an option "blink" to enable or disable the LED blink. The default
value is set to 1 so that existing users would not experience any
unexpected changes.
---
 drivers/net/wireless/ath/ath9k/htc.h          | 1 +
 drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 ++++
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++
 3 files changed, 9 insertions(+)

Comments

Arend van Spriel Jan. 11, 2015, 9:40 a.m. UTC | #1
On 01/11/15 10:20, Hong Xu wrote:
> Add an option "blink" to enable or disable the LED blink. The default
> value is set to 1 so that existing users would not experience any
> unexpected changes.
> ---
>   drivers/net/wireless/ath/ath9k/htc.h          | 1 +
>   drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 ++++
>   drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++
>   3 files changed, 9 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
> index 9dde265..5697097 100644
> --- a/drivers/net/wireless/ath/ath9k/htc.h
> +++ b/drivers/net/wireless/ath/ath9k/htc.h
> @@ -44,6 +44,7 @@
>
>   extern struct ieee80211_ops ath9k_htc_ops;
>   extern int htc_modparam_nohwcrypt;
> +extern int led_blink;
>
>   enum htc_phymode {
>   	HTC_MODE_11NA		= 0,
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
> index 50f74a2..998b558 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
> @@ -279,6 +279,10 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv)
>   	else
>   		priv->ah->led_pin = ATH_LED_PIN_DEF;
>
> +	if (!led_blink)
> +		priv->led_cdev.default_trigger =
> +			ieee80211_get_radio_led_name(priv->hw);
> +
>   	ath9k_configure_leds(priv);
>
>   	snprintf(priv->led_name, sizeof(priv->led_name),
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
> index e8fa944..c762d84 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
> @@ -38,6 +38,10 @@ static int ath9k_ps_enable;
>   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
>   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
>
> +int led_blink = 1;
> +module_param_named(blink, led_blink, int, 0444);
> +MODULE_PARM_DESC(blink, "Enable LED blink on activity");
> +

Seems like this module parameter is only applicable if 
CONFIG_MAC80211_LEDS is set.

Regards,
Arend

>   #ifdef CONFIG_MAC80211_LEDS
>   static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
>   	{ .throughput = 0 * 1024, .blink_time = 334 },

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksij Rempel Jan. 11, 2015, 9:50 a.m. UTC | #2
Am 11.01.2015 um 10:40 schrieb Arend van Spriel:
> On 01/11/15 10:20, Hong Xu wrote:
>> Add an option "blink" to enable or disable the LED blink. The default
>> value is set to 1 so that existing users would not experience any
>> unexpected changes.
>> ---
>>   drivers/net/wireless/ath/ath9k/htc.h          | 1 +
>>   drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 ++++
>>   drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++
>>   3 files changed, 9 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/htc.h
>> b/drivers/net/wireless/ath/ath9k/htc.h
>> index 9dde265..5697097 100644
>> --- a/drivers/net/wireless/ath/ath9k/htc.h
>> +++ b/drivers/net/wireless/ath/ath9k/htc.h
>> @@ -44,6 +44,7 @@
>>
>>   extern struct ieee80211_ops ath9k_htc_ops;
>>   extern int htc_modparam_nohwcrypt;
>> +extern int led_blink;
>>
>>   enum htc_phymode {
>>       HTC_MODE_11NA        = 0,
>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>> b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>> index 50f74a2..998b558 100644
>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>> @@ -279,6 +279,10 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv)
>>       else
>>           priv->ah->led_pin = ATH_LED_PIN_DEF;
>>
>> +    if (!led_blink)
>> +        priv->led_cdev.default_trigger =
>> +            ieee80211_get_radio_led_name(priv->hw);
>> +
>>       ath9k_configure_leds(priv);
>>
>>       snprintf(priv->led_name, sizeof(priv->led_name),
>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>> b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>> index e8fa944..c762d84 100644
>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>> @@ -38,6 +38,10 @@ static int ath9k_ps_enable;
>>   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
>>   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
>>
>> +int led_blink = 1;
>> +module_param_named(blink, led_blink, int, 0444);
>> +MODULE_PARM_DESC(blink, "Enable LED blink on activity");
>> +
> 
> Seems like this module parameter is only applicable if
> CONFIG_MAC80211_LEDS is set.

This patch is copy&paste of ath9k version. So if some one really care,
then it can be fixed in this patch and ath9k as well.


> Regards,
> Arend
> 
>>   #ifdef CONFIG_MAC80211_LEDS
>>   static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
>>       { .throughput = 0 * 1024, .blink_time = 334 },
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe
> linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hong Xu Jan. 11, 2015, 9:59 a.m. UTC | #3
Oleksij Rempel <linux@rempel-privat.de> writes:

> Am 11.01.2015 um 10:40 schrieb Arend van Spriel:
>> On 01/11/15 10:20, Hong Xu wrote:
>>> Add an option "blink" to enable or disable the LED blink. The default
>>> value is set to 1 so that existing users would not experience any
>>> unexpected changes.
>>> ---
>>>   drivers/net/wireless/ath/ath9k/htc.h          | 1 +
>>>   drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 ++++
>>>   drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++
>>>   3 files changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/htc.h
>>> b/drivers/net/wireless/ath/ath9k/htc.h
>>> index 9dde265..5697097 100644
>>> --- a/drivers/net/wireless/ath/ath9k/htc.h
>>> +++ b/drivers/net/wireless/ath/ath9k/htc.h
>>> @@ -44,6 +44,7 @@
>>>
>>>   extern struct ieee80211_ops ath9k_htc_ops;
>>>   extern int htc_modparam_nohwcrypt;
>>> +extern int led_blink;
>>>
>>>   enum htc_phymode {
>>>       HTC_MODE_11NA        = 0,
>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>> b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>> index 50f74a2..998b558 100644
>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>> @@ -279,6 +279,10 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv)
>>>       else
>>>           priv->ah->led_pin = ATH_LED_PIN_DEF;
>>>
>>> +    if (!led_blink)
>>> +        priv->led_cdev.default_trigger =
>>> +            ieee80211_get_radio_led_name(priv->hw);
>>> +
>>>       ath9k_configure_leds(priv);
>>>
>>>       snprintf(priv->led_name, sizeof(priv->led_name),
>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>> b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>> index e8fa944..c762d84 100644
>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>> @@ -38,6 +38,10 @@ static int ath9k_ps_enable;
>>>   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
>>>   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
>>>
>>> +int led_blink = 1;
>>> +module_param_named(blink, led_blink, int, 0444);
>>> +MODULE_PARM_DESC(blink, "Enable LED blink on activity");
>>> +
>> 
>> Seems like this module parameter is only applicable if
>> CONFIG_MAC80211_LEDS is set.
>
> This patch is copy&paste of ath9k version. So if some one really care,
> then it can be fixed in this patch and ath9k as well.
>
True, I also noticed parameter btcoex_enabled is also only applicable
if CONFIG_ATH9K_BTCOEX_SUPPORT is set, for both ath9k and ath9k_htc.

Best,
Hong

>> Regards,
>> Arend
>> 
>>>   #ifdef CONFIG_MAC80211_LEDS
>>>   static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
>>>       { .throughput = 0 * 1024, .blink_time = 334 },
>>
Oleksij Rempel Jan. 11, 2015, 10:08 a.m. UTC | #4
Am 11.01.2015 um 10:59 schrieb Hong Xu:
> 
> Oleksij Rempel <linux@rempel-privat.de> writes:
> 
>> Am 11.01.2015 um 10:40 schrieb Arend van Spriel:
>>> On 01/11/15 10:20, Hong Xu wrote:
>>>> Add an option "blink" to enable or disable the LED blink. The default
>>>> value is set to 1 so that existing users would not experience any
>>>> unexpected changes.
>>>> ---
>>>>   drivers/net/wireless/ath/ath9k/htc.h          | 1 +
>>>>   drivers/net/wireless/ath/ath9k/htc_drv_gpio.c | 4 ++++
>>>>   drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++
>>>>   3 files changed, 9 insertions(+)
>>>>
>>>> diff --git a/drivers/net/wireless/ath/ath9k/htc.h
>>>> b/drivers/net/wireless/ath/ath9k/htc.h
>>>> index 9dde265..5697097 100644
>>>> --- a/drivers/net/wireless/ath/ath9k/htc.h
>>>> +++ b/drivers/net/wireless/ath/ath9k/htc.h
>>>> @@ -44,6 +44,7 @@
>>>>
>>>>   extern struct ieee80211_ops ath9k_htc_ops;
>>>>   extern int htc_modparam_nohwcrypt;
>>>> +extern int led_blink;
>>>>
>>>>   enum htc_phymode {
>>>>       HTC_MODE_11NA        = 0,
>>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>>> b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>>> index 50f74a2..998b558 100644
>>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
>>>> @@ -279,6 +279,10 @@ void ath9k_init_leds(struct ath9k_htc_priv *priv)
>>>>       else
>>>>           priv->ah->led_pin = ATH_LED_PIN_DEF;
>>>>
>>>> +    if (!led_blink)
>>>> +        priv->led_cdev.default_trigger =
>>>> +            ieee80211_get_radio_led_name(priv->hw);
>>>> +
>>>>       ath9k_configure_leds(priv);
>>>>
>>>>       snprintf(priv->led_name, sizeof(priv->led_name),
>>>> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>>> b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>>> index e8fa944..c762d84 100644
>>>> --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>>> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
>>>> @@ -38,6 +38,10 @@ static int ath9k_ps_enable;
>>>>   module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
>>>>   MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
>>>>
>>>> +int led_blink = 1;
>>>> +module_param_named(blink, led_blink, int, 0444);
>>>> +MODULE_PARM_DESC(blink, "Enable LED blink on activity");
>>>> +
>>>
>>> Seems like this module parameter is only applicable if
>>> CONFIG_MAC80211_LEDS is set.
>>
>> This patch is copy&paste of ath9k version. So if some one really care,
>> then it can be fixed in this patch and ath9k as well.
>>
> True, I also noticed parameter btcoex_enabled is also only applicable
> if CONFIG_ATH9K_BTCOEX_SUPPORT is set, for both ath9k and ath9k_htc.

I prefer to keep ath9k_htc close to ath9k as possible, including bugs.
Process of merging this two drivers is not finished, and i didn't gave
up on it.
Bob Copeland Jan. 12, 2015, 6:54 a.m. UTC | #5
On Sun, Jan 11, 2015 at 01:20:29AM -0800, Hong Xu wrote:
> Add an option "blink" to enable or disable the LED blink. The default
> value is set to 1 so that existing users would not experience any
> unexpected changes.

Been a while since I looked, but isn't there a way to achieve same
result by just echoing 'none' into the relevant LED's sysfs file
(something like /sys/class/leds/phy0-led/trigger)?
Hong Xu Jan. 12, 2015, 7:09 a.m. UTC | #6
Bob Copeland <me@bobcopeland.com> writes:

> On Sun, Jan 11, 2015 at 01:20:29AM -0800, Hong Xu wrote:
>> Add an option "blink" to enable or disable the LED blink. The default
>> value is set to 1 so that existing users would not experience any
>> unexpected changes.
>
> Been a while since I looked, but isn't there a way to achieve same
> result by just echoing 'none' into the relevant LED's sysfs file
> (something like /sys/class/leds/phy0-led/trigger)?

It's a bit different. echo 'none' to the trigger would cause the LED
light to be dark, but if turn off the blink option here, the LED is
bright but without blinking.

Hong
Julian Calaby Jan. 13, 2015, 2:55 a.m. UTC | #7
Hi Hong,

On Mon, Jan 12, 2015 at 6:09 PM, Hong Xu <hong@topbug.net> wrote:
>
> Bob Copeland <me@bobcopeland.com> writes:
>
>> On Sun, Jan 11, 2015 at 01:20:29AM -0800, Hong Xu wrote:
>>> Add an option "blink" to enable or disable the LED blink. The default
>>> value is set to 1 so that existing users would not experience any
>>> unexpected changes.
>>
>> Been a while since I looked, but isn't there a way to achieve same
>> result by just echoing 'none' into the relevant LED's sysfs file
>> (something like /sys/class/leds/phy0-led/trigger)?
>
> It's a bit different. echo 'none' to the trigger would cause the LED
> light to be dark, but if turn off the blink option here, the LED is
> bright but without blinking.
>
> Hong

I.e. it doesn't blink, it's just on when linked (isn't there a trigger
for that?) or is on solid? (echo 255 >
/sys/class/leds/phy0-led/brightness)

Thanks,
Hong Xu Jan. 13, 2015, 5:21 a.m. UTC | #8
Julian Calaby <julian.calaby@gmail.com> writes:

> Hi Hong,
>
> On Mon, Jan 12, 2015 at 6:09 PM, Hong Xu <hong@topbug.net> wrote:
>>
>> Bob Copeland <me@bobcopeland.com> writes:
>>
>>> On Sun, Jan 11, 2015 at 01:20:29AM -0800, Hong Xu wrote:
>>>> Add an option "blink" to enable or disable the LED blink. The default
>>>> value is set to 1 so that existing users would not experience any
>>>> unexpected changes.
>>>
>>> Been a while since I looked, but isn't there a way to achieve same
>>> result by just echoing 'none' into the relevant LED's sysfs file
>>> (something like /sys/class/leds/phy0-led/trigger)?
>>
>> It's a bit different. echo 'none' to the trigger would cause the LED
>> light to be dark, but if turn off the blink option here, the LED is
>> bright but without blinking.
>>
>> Hong
>
> I.e. it doesn't blink, it's just on when linked (isn't there a trigger
> for that?) or is on solid? (echo 255 >
> /sys/class/leds/phy0-led/brightness)

It is solid on, but will be off if you turn off wifi (which echo 255 >
/.../brightness will not do). Replace ieee80211_get_radio_led_name with
ieee80211_get_assoc_led_name will use the linking trigger. I think using
linking makes more sense.

Hong
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 9dde265..5697097 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -44,6 +44,7 @@ 
 
 extern struct ieee80211_ops ath9k_htc_ops;
 extern int htc_modparam_nohwcrypt;
+extern int led_blink;
 
 enum htc_phymode {
 	HTC_MODE_11NA		= 0,
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
index 50f74a2..998b558 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_gpio.c
@@ -279,6 +279,10 @@  void ath9k_init_leds(struct ath9k_htc_priv *priv)
 	else
 		priv->ah->led_pin = ATH_LED_PIN_DEF;
 
+	if (!led_blink)
+		priv->led_cdev.default_trigger =
+			ieee80211_get_radio_led_name(priv->hw);
+
 	ath9k_configure_leds(priv);
 
 	snprintf(priv->led_name, sizeof(priv->led_name),
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index e8fa944..c762d84 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -38,6 +38,10 @@  static int ath9k_ps_enable;
 module_param_named(ps_enable, ath9k_ps_enable, int, 0444);
 MODULE_PARM_DESC(ps_enable, "Enable WLAN PowerSave");
 
+int led_blink = 1;
+module_param_named(blink, led_blink, int, 0444);
+MODULE_PARM_DESC(blink, "Enable LED blink on activity");
+
 #ifdef CONFIG_MAC80211_LEDS
 static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
 	{ .throughput = 0 * 1024, .blink_time = 334 },