From patchwork Fri Oct 1 07:39:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ike Panhc X-Patchwork-Id: 222782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o917dJAi008959 for ; Fri, 1 Oct 2010 07:39:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754641Ab0JAHjL (ORCPT ); Fri, 1 Oct 2010 03:39:11 -0400 Received: from adelie.canonical.com ([91.189.90.139]:36942 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754590Ab0JAHjK (ORCPT ); Fri, 1 Oct 2010 03:39:10 -0400 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1P1aCz-0000ij-U6; Fri, 01 Oct 2010 08:39:10 +0100 Received: from [210.242.151.101] (helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1P1aCy-0001gE-T6; Fri, 01 Oct 2010 08:39:09 +0100 From: Ike Panhc To: platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Matthew Garrett , Len Brown , Corentin Chary , David Woodhouse , Mario.Holbe@TU-Ilmenau.DE Subject: [PATCH 2/9] ideapad: check VPC bit before sync rfkill hw status Date: Fri, 1 Oct 2010 15:39:05 +0800 Message-Id: <1285918745-12913-1-git-send-email-ike.pan@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1285918660-12802-1-git-send-email-ike.pan@canonical.com> References: <1285918660-12802-1-git-send-email-ike.pan@canonical.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 01 Oct 2010 07:39:21 +0000 (UTC) diff --git a/drivers/platform/x86/ideapad_acpi.c b/drivers/platform/x86/ideapad_acpi.c index 1ecf679..15d7e7e 100644 --- a/drivers/platform/x86/ideapad_acpi.c +++ b/drivers/platform/x86/ideapad_acpi.c @@ -379,7 +379,21 @@ static int ideapad_acpi_remove(struct acpi_device *adevice, int type) static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event) { - ideapad_sync_rfk_state(adevice); + acpi_handle handle = adevice->handle; + unsigned long vpc1, vpc2, vpc_bit; + + if (read_ec_data(handle, 0x10, &vpc1)) + return; + if (read_ec_data(handle, 0x1A, &vpc2)) + return; + + vpc1 = (vpc2 << 8) | vpc1; + for (vpc_bit = 0; vpc_bit < 16; vpc_bit++) { + if (test_bit(vpc_bit, &vpc1)) { + if (vpc_bit == 9) + ideapad_sync_rfk_state(adevice); + } + } } static struct acpi_driver ideapad_acpi_driver = {