mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Corentin Chary <corentincj@iksaif.net>
To: Matthew Garrett <mjg@redhat.com>
Cc: Corentin Chary <corentincj@iksaif.net>,
	acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 07/18] eeepc-wmi: add hibernate/resume callbacks
Date: Sun,  6 Feb 2011 13:28:32 +0100	[thread overview]
Message-ID: <1296995324-5462-8-git-send-email-corentincj@iksaif.net> (raw)
In-Reply-To: <1296995324-5462-1-git-send-email-corentincj@iksaif.net>

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/platform/x86/eeepc-wmi.c |   49 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index de501fb..583ba78 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -1183,10 +1183,59 @@ static int eeepc_wmi_remove(struct platform_device *device)
 	return 0;
 }
 
+/*
+ * Platform driver - hibernate/resume callbacks
+ */
+static int eeepc_hotk_thaw(struct device *device)
+{
+	struct eeepc_wmi *eeepc = dev_get_drvdata(device);
+
+	if (eeepc->wlan_rfkill) {
+		bool wlan;
+
+		/*
+		 * Work around bios bug - acpi _PTS turns off the wireless led
+		 * during suspend.  Normally it restores it on resume, but
+		 * we should kick it ourselves in case hibernation is aborted.
+		 */
+		wlan = eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WLAN);
+		eeepc_wmi_set_devstate(EEEPC_WMI_DEVID_WLAN, wlan, NULL);
+	}
+
+	return 0;
+}
+
+static int eeepc_hotk_restore(struct device *device)
+{
+	struct eeepc_wmi *eeepc = dev_get_drvdata(device);
+	int bl;
+
+	/* Refresh both wlan rfkill state and pci hotplug */
+	if (eeepc->wlan_rfkill)
+		eeepc_rfkill_hotplug(eeepc);
+
+	if (eeepc->bluetooth_rfkill) {
+		bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_BLUETOOTH);
+		rfkill_set_sw_state(eeepc->bluetooth_rfkill, bl);
+}
+	if (eeepc->wwan3g_rfkill) {
+		bl = !eeepc_wmi_get_devstate_simple(EEEPC_WMI_DEVID_WWAN3G);
+		rfkill_set_sw_state(eeepc->wwan3g_rfkill, bl);
+	}
+
+	return 0;
+}
+
+static const struct dev_pm_ops eeepc_pm_ops = {
+	.thaw = eeepc_hotk_thaw,
+	.restore = eeepc_hotk_restore,
+};
+
 static struct platform_driver platform_driver = {
 	.driver = {
 		.name = EEEPC_WMI_FILE,
 		.owner = THIS_MODULE,
+		.pm = &eeepc_pm_ops,
 	},
 };
 
-- 
1.7.4.rc3


  parent reply	other threads:[~2011-02-06 12:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 12:28 [PATCH v2 00/18] eeepc-wmi updates Corentin Chary
2011-02-06 12:28 ` [PATCH v2 01/18] eeepc-wmi: reorder keymap Corentin Chary
2011-02-06 12:28 ` [PATCH v2 02/18] eeepc-wmi: add wlan key found on 1015P Corentin Chary
2011-02-06 12:28 ` [PATCH v2 03/18] eeepc-wmi: add hotplug code for Eeepc 1000H Corentin Chary
2011-02-06 12:28 ` [PATCH v2 04/18] eeepc-wmi: serialize access to wmi method Corentin Chary
2011-02-06 12:28 ` [PATCH v2 05/18] eeepc-wmi: return proper error code in eeepc_rfkill_set() Corentin Chary
2011-02-06 12:28 ` [PATCH v2 06/18] eeepc-wmi: add an helper using simple return codes Corentin Chary
2011-02-06 12:28 ` Corentin Chary [this message]
2011-02-06 12:28 ` [PATCH v2 08/18] eeepc-wmi: switch to platform_create_bundle() Corentin Chary
2011-02-06 12:28 ` [PATCH v2 09/18] eeepc-wmi: reorder defines Corentin Chary
2011-02-06 12:28 ` [PATCH v2 10/18] eeepc-wmi: use the presence bit correctly Corentin Chary
2011-02-06 12:28 ` [PATCH v2 11/18] eeepc-wmi: add camera and card reader support Corentin Chary
2011-02-06 12:28 ` [PATCH v2 12/18] eeepc-wmi: add wimax support Corentin Chary
2011-02-06 12:28 ` [PATCH v2 13/18] eeepc-wmi: set the right key code for 0xe9 Corentin Chary
2011-02-06 12:28 ` [PATCH v2 14/18] eeepc-wmi: support backlight power (bl_power) attribute Corentin Chary
2011-02-06 12:28 ` [PATCH v2 15/18] eeepc-wmi: respect wireless_hotplug setting Corentin Chary
2011-02-06 12:28 ` [PATCH v2 16/18] eeepc-wmi: real touchpad led device id is 0x001000012 Corentin Chary
2011-02-06 12:28 ` [PATCH v2 17/18] eeepc-wmi: add touchpad sysfs file Corentin Chary
2011-02-06 12:28 ` [PATCH v2 18/18] eeepc-wmi: reorder device ids Corentin Chary
2011-02-07 19:39 ` [PATCH v2 00/18] eeepc-wmi updates Matthew Garrett
2011-02-07 19:40   ` Matthew Garrett

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=1296995324-5462-8-git-send-email-corentincj@iksaif.net \
    --to=corentincj@iksaif.net \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.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

all inboxes | Powered by JetHome®