From patchwork Sat Nov 28 18:15:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrique de Moraes Holschuh X-Patchwork-Id: 63488 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nASIFIpi016053 for ; Sat, 28 Nov 2009 18:15:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751852AbZK1SPK (ORCPT ); Sat, 28 Nov 2009 13:15:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752105AbZK1SPK (ORCPT ); Sat, 28 Nov 2009 13:15:10 -0500 Received: from out4.smtp.messagingengine.com ([66.111.4.28]:49973 "EHLO out4.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbZK1SPJ (ORCPT ); Sat, 28 Nov 2009 13:15:09 -0500 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 5CAEDC3A03; Sat, 28 Nov 2009 13:15:15 -0500 (EST) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Sat, 28 Nov 2009 13:15:15 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=date:from:to:cc:subject:message-id:references:mime-version:content-type:in-reply-to; s=smtpout; bh=6tbdcpFn9q/re2SRZWUzWWNjUuw=; b=PKvb9gECDHqpCFcZwZ4QuUZXLGdn7kKx8CF51FDJ+YhuuznhoAUrLHHIAxsSFJetpaqJEJ92nuLYyRks/s75MPuNEXQ3GgAbHCAL3FllLqW7lJYO7e6ixhjNS9H9qowcU91OhFsGVhG65WNqy8EWzEgzcYav5LFOyWgnb4kZVaE= X-Sasl-enc: 1aLDBKBd2EPM3XOTG7U1n9eoLB/v+tbgK5Jne+yjukJy 1259432114 Received: from khazad-dum.debian.net (unknown [201.82.165.62]) by mail.messagingengine.com (Postfix) with ESMTPSA id CA07849B389; Sat, 28 Nov 2009 13:15:14 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by localhost.khazad-dum.debian.net (Postfix) with ESMTP id 0A22028234; Sat, 28 Nov 2009 16:15:13 -0200 (BRST) X-Virus-Scanned: Debian amavisd-new at khazad-dum.debian.net Received: from khazad-dum.debian.net ([127.0.0.1]) by localhost (khazad-dum.debian.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wUOoz6+BmMLZ; Sat, 28 Nov 2009 16:15:12 -0200 (BRST) Received: by khazad-dum.debian.net (Postfix, from userid 1000) id 68F1128238; Sat, 28 Nov 2009 16:15:12 -0200 (BRST) Date: Sat, 28 Nov 2009 16:15:12 -0200 From: Henrique de Moraes Holschuh To: Ian Molton Cc: linux-acpi@vger.kernel.org Subject: Re: Thinkpad X200s Message-ID: <20091128181512.GA32630@khazad-dum.debian.net> References: <4B0FB618.7020204@collabora.co.uk> <20091127221134.GC21775@khazad-dum.debian.net> <20091128120711.GA17894@khazad-dum.debian.net> <4B111C58.5050006@collabora.co.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B111C58.5050006@collabora.co.uk> X-GPG-Fingerprint: 1024D/1CDB0FE3 5422 5C61 F6B7 06FB 7E04 3738 EE25 DE3F 1CDB 0FE3 User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org commit 03dd8d5357d8fe2d91bff4ccdecd7e26f73e92e9 Author: Henrique de Moraes Holschuh Date: Sat Nov 28 00:31:47 2009 -0200 thinkpad-acpi: preserve rfkill state across suspend/resume Since the rfkill rework in 2.6.31, the driver is always resuming with the radios all in blocked state. We used to resume with radios blocked, and then depend on the rfkill core to re-enable them. This doesn't work with the new rfkill core and thinkpad-acpi rfkill code for various reasons. Change thinkpad-acpi to ask the firmware to resume with the radios in the last state when possible, and preserve that state in the driver itself when that's not possible. This fixes a regression from 2.6.30. Reported-by: Ian Molton Signed-off-by: Henrique de Moraes Holschuh Cc: stable@kernel.org diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 915e054..4abde23 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -3877,15 +3877,6 @@ enum { #define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw" -static void bluetooth_suspend(pm_message_t state) -{ - /* Try to make sure radio will resume powered off */ - if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd", - TP_ACPI_BLTH_PWR_OFF_ON_RESUME)) - vdbg_printk(TPACPI_DBG_RFKILL, - "bluetooth power down on resume request failed\n"); -} - static int bluetooth_get_status(void) { int status; @@ -3919,10 +3910,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state) #endif /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */ + status = TP_ACPI_BLUETOOTH_RESUMECTRL; if (state == TPACPI_RFK_RADIO_ON) - status = TP_ACPI_BLUETOOTH_RADIOSSW; - else - status = 0; + status |= TP_ACPI_BLUETOOTH_RADIOSSW; if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status)) return -EIO; @@ -4061,7 +4051,6 @@ static struct ibm_struct bluetooth_driver_data = { .read = bluetooth_read, .write = bluetooth_write, .exit = bluetooth_exit, - .suspend = bluetooth_suspend, .shutdown = bluetooth_shutdown, }; @@ -4079,15 +4068,6 @@ enum { #define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw" -static void wan_suspend(pm_message_t state) -{ - /* Try to make sure radio will resume powered off */ - if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd", - TP_ACPI_WGSV_PWR_OFF_ON_RESUME)) - vdbg_printk(TPACPI_DBG_RFKILL, - "WWAN power down on resume request failed\n"); -} - static int wan_get_status(void) { int status; @@ -4120,11 +4100,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state) } #endif - /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */ + /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */ + status = TP_ACPI_WANCARD_RESUMECTRL; if (state == TPACPI_RFK_RADIO_ON) - status = TP_ACPI_WANCARD_RADIOSSW; - else - status = 0; + status |= TP_ACPI_WANCARD_RADIOSSW; if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) return -EIO; @@ -4262,7 +4241,6 @@ static struct ibm_struct wan_driver_data = { .read = wan_read, .write = wan_write, .exit = wan_exit, - .suspend = wan_suspend, .shutdown = wan_shutdown, };