From patchwork Wed Dec 9 18:33:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 66034 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 nB9IY2Dj013120 for ; Wed, 9 Dec 2009 18:34:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756326AbZLISdy (ORCPT ); Wed, 9 Dec 2009 13:33:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756594AbZLISdy (ORCPT ); Wed, 9 Dec 2009 13:33:54 -0500 Received: from cavan.codon.org.uk ([93.93.128.6]:58721 "EHLO cavan.codon.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756326AbZLISdv (ORCPT ); Wed, 9 Dec 2009 13:33:51 -0500 Received: from 209-6-34-250.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.34.250] helo=localhost.localdomain) by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NIRMF-0005x1-2M; Wed, 09 Dec 2009 18:33:51 +0000 From: Matthew Garrett To: linux-input@vger.kernel.org Cc: linux-acpi@vger.kernel.org, dtor@mail.ru, lenb@kernel.org, Matthew Garrett Subject: [PATCH 2/2] dell-laptop: Update rfkill state on kill switch Date: Wed, 9 Dec 2009 13:33:29 -0500 Message-Id: <1260383609-7681-2-git-send-email-mjg@redhat.com> X-Mailer: git-send-email 1.6.5.2 In-Reply-To: <1260383609-7681-1-git-send-email-mjg@redhat.com> References: <1260383609-7681-1-git-send-email-mjg@redhat.com> X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 209.6.34.250 X-SA-Exim-Mail-From: mjg@redhat.com X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 9061111..9dbec0f 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "../../firmware/dcdbas.h" #define BRIGHTNESS_TOKEN 0x7d @@ -206,6 +207,16 @@ static const struct rfkill_ops dell_rfkill_ops = { .query = dell_rfkill_query, }; +static void dell_rfkill_update(void) +{ + if (wifi_rfkill) + dell_rfkill_query(wifi_rfkill, (void *)1); + if (bluetooth_rfkill) + dell_rfkill_query(bluetooth_rfkill, (void *)2); + if (wwan_rfkill) + dell_rfkill_query(wwan_rfkill, (void *)3); +} + static int dell_setup_rfkill(void) { struct calling_interface_buffer buffer; @@ -310,6 +321,26 @@ static struct backlight_ops dell_ops = { .update_status = dell_send_intensity, }; +bool dell_laptop_i8042_filter(unsigned char data, unsigned int flags, + struct serio *port) +{ + static bool extended; + + if (unlikely(data == 0xe0)) { + extended = true; + return false; + } else if (unlikely(extended)) { + switch (data) { + case 0x8: + dell_rfkill_update(); + break; + } + extended = false; + } + + return false; +} + static int __init dell_init(void) { struct calling_interface_buffer buffer; @@ -333,6 +364,13 @@ static int __init dell_init(void) goto out; } + ret = i8042_install_filter(I8042_KBD_PORT_NO, dell_laptop_i8042_filter); + if (ret) { + printk(KERN_WARNING + "dell-laptop: Unable to install key filter\n"); + goto out; + } + #ifdef CONFIG_ACPI /* In the event of an ACPI backlight being available, don't * register the platform controller. @@ -369,6 +407,7 @@ static int __init dell_init(void) return 0; out: + i8042_remove_filter(I8042_KBD_PORT_NO, dell_laptop_i8042_filter); if (wifi_rfkill) rfkill_unregister(wifi_rfkill); if (bluetooth_rfkill) @@ -381,6 +420,7 @@ out: static void __exit dell_exit(void) { + i8042_remove_filter(I8042_KBD_PORT_NO, dell_laptop_i8042_filter); backlight_device_unregister(dell_backlight_device); if (wifi_rfkill) rfkill_unregister(wifi_rfkill);