From: Ivo van Doorn <ivdoorn@gmail.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: John Linville <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org, Matthew Garrett <mjg@redhat.com>,
Andrew Bird <ajb@spheresystems.co.uk>,
Greg Kroah-Hartman <gregkh@suse.de>,
Cezary Jackiewicz <cezary.jackiewicz@gmail.com>,
Philip Langdale <philipl@overt.org>
Subject: Re: [PATCH 5/5] rfkill: remove transmitter blocking on suspend
Date: Tue, 26 Aug 2008 18:13:55 +0200 [thread overview]
Message-ID: <200808261813.56050.IvDoorn@gmail.com> (raw)
In-Reply-To: <1219762681-26911-6-git-send-email-hmh@hmh.eng.br>
On Tuesday 26 August 2008, Henrique de Moraes Holschuh wrote:
> Currently, rfkill would stand in the way of properly supporting wireless
> devices that are capable of waking the system up from sleep or hibernation
> when they receive a special wireless message. It would also get in the way
> of mesh devices that need to remain operational even during platform
> suspend.
>
> To avoid that, stop trying to block the transmitters on the rfkill class
> suspend handler.
>
> Drivers that need rfkill's older behaviour will have to implement it by
> themselves in their own suspend handling.
>
> Do note that rfkill *will* attempt to restore the transmitter state on
> resume in any situation. This happens after the driver's resume method is
> called by the suspend core (class devices resume after the devices they are
> attached to have been resumed).
>
> The following drivers need to check if they need to explicitly block
> their transmitters in their own suspend handlers (maintainers Cc'd):
> arch/arm/mach-pxa/tosa-bt.c
> drivers/net/usb/hso.c
> drivers/net/wireless/rt2x00/* (USB might need it?)
rt2x00 doesn't have rfkill support for the USB drivers, only the PCI drivers,
(because only those cards could have an actual rfkill switch.
Other then that no changes are required in rt2x00 with this patch.
> drivers/net/wireless/b43/ (SSB over USB might need it?)
> drivers/misc/hp-wmi.c
> eeepc-laptop w/rfkill support (not in mainline yet)
> Compal laptop w/rfkill support (not in mainline yet)
> toshiba-acpi w/rfkill support (not in mainline yet)
>
> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Cc: Ivo van Doorn <IvDoorn@gmail.com>
> Cc: Matthew Garrett <mjg@redhat.com>
> Cc: Andrew Bird <ajb@spheresystems.co.uk>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
> Cc: Philip Langdale <philipl@overt.org>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> Documentation/rfkill.txt | 32 ++++++++++++++++++++++++++++----
> net/rfkill/rfkill.c | 16 ++--------------
> 2 files changed, 30 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
> index 6fcb306..b65f079 100644
> --- a/Documentation/rfkill.txt
> +++ b/Documentation/rfkill.txt
> @@ -341,6 +341,8 @@ key that does nothing by itself, as well as any hot key that is type-specific
> 3.1 Guidelines for wireless device drivers
> ------------------------------------------
>
> +(in this text, rfkill->foo means the foo field of struct rfkill).
> +
> 1. Each independent transmitter in a wireless device (usually there is only one
> transmitter per device) should have a SINGLE rfkill class attached to it.
>
> @@ -363,10 +365,32 @@ This rule exists because users of the rfkill subsystem expect to get (and set,
> when possible) the overall transmitter rfkill state, not of a particular rfkill
> line.
>
> -5. During suspend, the rfkill class will attempt to soft-block the radio
> -through a call to rfkill->toggle_radio, and will try to restore its previous
> -state during resume. After a rfkill class is suspended, it will *not* call
> -rfkill->toggle_radio until it is resumed.
> +5. The wireless device driver MUST NOT leave the transmitter enabled during
> +suspend and hibernation unless:
> +
> + 5.1. The transmitter has to be enabled for some sort of functionality
> + like wake-on-wireless-packet or autonomous packed forwarding in a mesh
> + network, and that functionality is enabled for this suspend/hibernation
> + cycle.
> +
> +AND
> +
> + 5.2. The device was not on a user-requested BLOCKED state before
> + the suspend (i.e. the driver must NOT unblock a device, not even
> + to support wake-on-wireless-packet or remain in the mesh).
> +
> +In other words, there is absolutely no allowed scenario where a driver can
> +automatically take action to unblock a rfkill controller (obviously, this deals
> +with scenarios where soft-blocking or both soft and hard blocking is happening.
> +Scenarios where hardware rfkill lines are the only ones blocking the
> +transmitter are outside of this rule, since the wireless device driver does not
> +control its input hardware rfkill lines in the first place).
> +
> +6. During resume, rfkill will try to restore its previous state.
> +
> +7. After a rfkill class is suspended, it will *not* call rfkill->toggle_radio
> +until it is resumed.
> +
>
> Example of a WLAN wireless driver connected to the rfkill subsystem:
> --------------------------------------------------------------------
> diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
> index d573579..ea0dc04 100644
> --- a/net/rfkill/rfkill.c
> +++ b/net/rfkill/rfkill.c
> @@ -512,21 +512,9 @@ static void rfkill_release(struct device *dev)
> #ifdef CONFIG_PM
> static int rfkill_suspend(struct device *dev, pm_message_t state)
> {
> - struct rfkill *rfkill = to_rfkill(dev);
> -
> - if (dev->power.power_state.event != state.event) {
> - if (state.event & PM_EVENT_SLEEP) {
> - /* Stop transmitter, keep state, no notifies */
> - update_rfkill_state(rfkill);
> -
> - mutex_lock(&rfkill->mutex);
> - rfkill->toggle_radio(rfkill->data,
> - RFKILL_STATE_SOFT_BLOCKED);
> - mutex_unlock(&rfkill->mutex);
> - }
> -
> + /* mark class device as suspended */
> + if (dev->power.power_state.event != state.event)
> dev->power.power_state = state;
> - }
>
> return 0;
> }
next prev parent reply other threads:[~2008-08-26 16:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-26 14:57 [GIT PATCH] rfkill changes for 2.6.28, set 1a Henrique de Moraes Holschuh
2008-08-26 14:57 ` [PATCH 1/5] rfkill: use strict_strtoul (v2) Henrique de Moraes Holschuh
2008-08-26 14:57 ` [PATCH 2/5] rfkill: add missing line break Henrique de Moraes Holschuh
2008-08-26 14:57 ` [PATCH 3/5] rfkill: add WARN and BUG_ON paranoia (v2) Henrique de Moraes Holschuh
2008-08-26 15:56 ` Ivo van Doorn
2008-08-26 14:58 ` [PATCH 4/5] rfkill: rename rfkill_mutex to rfkill_global_mutex Henrique de Moraes Holschuh
2008-08-26 14:58 ` [PATCH 5/5] rfkill: remove transmitter blocking on suspend Henrique de Moraes Holschuh
2008-08-26 15:39 ` Greg KH
2008-08-27 4:56 ` Henrique de Moraes Holschuh
2008-08-26 16:13 ` Ivo van Doorn [this message]
2008-08-26 19:49 ` Tomas Winkler
2008-08-27 23:01 ` Henrique de Moraes Holschuh
2008-08-28 14:29 ` Ivo van Doorn
2008-08-26 22:56 ` Philip Langdale
2008-09-03 19:05 ` John W. Linville
2008-09-03 21:20 ` Henrique de Moraes Holschuh
2008-09-03 21:31 ` Michael Buesch
2008-09-09 19:22 ` John W. Linville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200808261813.56050.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=ajb@spheresystems.co.uk \
--cc=cezary.jackiewicz@gmail.com \
--cc=gregkh@suse.de \
--cc=hmh@hmh.eng.br \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mjg@redhat.com \
--cc=philipl@overt.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).