netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger
       [not found] ` <1450193442-7930-4-git-send-email-jprvita@endlessm.com>
@ 2015-12-19  0:22   ` Darren Hart
  2015-12-19  0:36     ` João Paulo Rechi Vita
  2015-12-19  2:25     ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Darren Hart @ 2015-12-19  0:22 UTC (permalink / raw)
  To: João Paulo Rechi Vita, Johannes Berg, David S. Miller
  Cc: Corentin Chary, platform-driver-x86, acpi4asus-user,
	João Paulo Rechi Vita, linux-wireless, netdev

On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
> For platform drivers to be able to correctly drive the "Airplane Mode"
> indicative LED there needs to be a RFKill LED trigger tied to the global
> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
> works in an inverted manner of regular RFKill LED triggers, that is, the
> LED is ON when the state is blocked, and OFF otherwise.
> 
> This commit implements such a trigger, which will be used by the
> asus-wrc x86 platform driver.

So this will need to go through Johannes and David per get_maintainer.pl before
we can use it in platform drivers.

+Johannes
+David
+wireless
+netdev

-- 
Darren Hart
Intel Open Source Technology Center

> 
> Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
> ---
>  net/rfkill/core.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> index b41e9ea..3effc29 100644
> --- a/net/rfkill/core.c
> +++ b/net/rfkill/core.c
> @@ -124,6 +124,26 @@ static bool rfkill_epo_lock_active;
>  
>  
>  #ifdef CONFIG_RFKILL_LEDS
> +static void airplane_mode_led_trigger_activate(struct led_classdev *led);
> +
> +static struct led_trigger airplane_mode_led_trigger = {
> +	.name     = "rfkill-airplane-mode",
> +	.activate = airplane_mode_led_trigger_activate,
> +};
> +
> +static void airplane_mode_led_trigger_event(void)
> +{
> +	if (rfkill_global_states[RFKILL_TYPE_ALL].cur & RFKILL_BLOCK_ANY)
> +		led_trigger_event(&airplane_mode_led_trigger, LED_FULL);
> +	else
> +		led_trigger_event(&airplane_mode_led_trigger, LED_OFF);
> +}
> +
> +static void airplane_mode_led_trigger_activate(struct led_classdev *led)
> +{
> +	airplane_mode_led_trigger_event();
> +}
> +
>  static void rfkill_led_trigger_event(struct rfkill *rfkill)
>  {
>  	struct led_trigger *trigger;
> @@ -175,6 +195,10 @@ static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
>  	led_trigger_unregister(&rfkill->led_trigger);
>  }
>  #else
> +static void airplane_mode_led_trigger_event(void)
> +{
> +}
> +
>  static void rfkill_led_trigger_event(struct rfkill *rfkill)
>  {
>  }
> @@ -346,6 +370,7 @@ static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
>  
>  		for (i = 0; i < NUM_RFKILL_TYPES; i++)
>  			rfkill_global_states[i].cur = blocked;
> +		airplane_mode_led_trigger_event();
>  	} else {
>  		rfkill_global_states[type].cur = blocked;
>  	}
> @@ -1177,6 +1202,7 @@ static ssize_t rfkill_fop_write(struct file *file, const char __user *buf,
>  			enum rfkill_type i;
>  			for (i = 0; i < NUM_RFKILL_TYPES; i++)
>  				rfkill_global_states[i].cur = ev.soft;
> +			airplane_mode_led_trigger_event();
>  		} else {
>  			rfkill_global_states[ev.type].cur = ev.soft;
>  		}
> @@ -1293,6 +1319,10 @@ static int __init rfkill_init(void)
>  	}
>  #endif
>  
> +#ifdef CONFIG_RFKILL_LEDS
> +	led_trigger_register(&airplane_mode_led_trigger);
> +#endif
> +
>   out:
>  	return error;
>  }
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger
  2015-12-19  0:22   ` [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger Darren Hart
@ 2015-12-19  0:36     ` João Paulo Rechi Vita
  2015-12-19  2:25     ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: João Paulo Rechi Vita @ 2015-12-19  0:36 UTC (permalink / raw)
  To: Darren Hart
  Cc: Johannes Berg, David S. Miller, Corentin Chary,
	platform-driver-x86, acpi4asus-user, João Paulo Rechi Vita,
	linux-wireless, netdev

On 18 December 2015 at 19:22, Darren Hart <dvhart@infradead.org> wrote:
> On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
>> For platform drivers to be able to correctly drive the "Airplane Mode"
>> indicative LED there needs to be a RFKill LED trigger tied to the global
>> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
>> works in an inverted manner of regular RFKill LED triggers, that is, the
>> LED is ON when the state is blocked, and OFF otherwise.
>>
>> This commit implements such a trigger, which will be used by the
>> asus-wrc x86 platform driver.
>
> So this will need to go through Johannes and David per get_maintainer.pl before
> we can use it in platform drivers.
>

Yes, I am aware of that. I just wanted to get feedback and validate
the new platform driver that makes use of this new RFKill LED trigger
before proposing it, since I expect that will be their first
questioning.

For those who were not in the original message, this is patch is part
of a series implementing a new platform driver for the airplane mode
hotkey and LED present in some Asus laptops, which is a separate ACPI
device (not part of WMI) with ACPI _HID "ASHS" and named "Wireless
Radio Control" by Asus.

Thanks for your feedback!

--
João Paulo Rechi Vita
http://about.me/jprvita

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

* Re: [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger
  2015-12-19  0:22   ` [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger Darren Hart
  2015-12-19  0:36     ` João Paulo Rechi Vita
@ 2015-12-19  2:25     ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-12-19  2:25 UTC (permalink / raw)
  To: dvhart
  Cc: jprvita, johannes, corentin.chary, platform-driver-x86,
	acpi4asus-user, jprvita, linux-wireless, netdev

From: Darren Hart <dvhart@infradead.org>
Date: Fri, 18 Dec 2015 16:22:12 -0800

> On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
>> For platform drivers to be able to correctly drive the "Airplane Mode"
>> indicative LED there needs to be a RFKill LED trigger tied to the global
>> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
>> works in an inverted manner of regular RFKill LED triggers, that is, the
>> LED is ON when the state is blocked, and OFF otherwise.
>> 
>> This commit implements such a trigger, which will be used by the
>> asus-wrc x86 platform driver.
> 
> So this will need to go through Johannes and David per get_maintainer.pl before
> we can use it in platform drivers.
> 
> +Johannes
> +David
> +wireless
> +netdev

RFKILL changes go via the wireless tree.

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

end of thread, other threads:[~2015-12-19  2:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1450193442-7930-1-git-send-email-jprvita@endlessm.com>
     [not found] ` <1450193442-7930-4-git-send-email-jprvita@endlessm.com>
2015-12-19  0:22   ` [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger Darren Hart
2015-12-19  0:36     ` João Paulo Rechi Vita
2015-12-19  2:25     ` David Miller

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