From patchwork Thu Mar 31 15:00:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 89085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id C253CB6ED0 for ; Fri, 1 Apr 2011 02:01:00 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q5JMf-0004WJ-IE; Thu, 31 Mar 2011 15:00:49 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q5JMe-0004W3-C7 for kernel-team@lists.ubuntu.com; Thu, 31 Mar 2011 15:00:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q5JMe-00011k-8S for ; Thu, 31 Mar 2011 15:00:48 +0000 Received: from c-69-254-227-224.hsd1.ks.comcast.net ([69.254.227.224] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Q5JMd-0006sj-QP for kernel-team@lists.ubuntu.com; Thu, 31 Mar 2011 15:00:48 +0000 From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH][Natty] UBUNTU: SAUCE: (drop after 2.6.38) eeepc-wmi: Add support for T101MT Home/Express Gate key Date: Thu, 31 Mar 2011 10:00:46 -0500 Message-Id: <1301583646-13730-1-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.7.4.1 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This key is different than other hotkeys, having seperate scan codes for press, release, and hold, so it requires some special filtering. Press and release events are passed on, and hold events are ignored since sparse-keymap does not support hardware autorepeat. Instead, the input core's software autorepeat is enabled for the input device. Note that "Home" in the context of this button doesn't mean the same thing as the usual Home key, and it really isn't clear at all what is meant by "Home". The manufacurer's description of the button indicates that it should launch some sort of touch screen settings interface on short press and apply a desktop rotation on long press. Signed-off-by: Seth Forshee --- Note that this patch is based off master-next since it has a number of patches to eeepc-wmi.c not present in master. drivers/platform/x86/eeepc-wmi.c | 40 ++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index eea8c94..a44a510 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c @@ -104,6 +104,13 @@ MODULE_PARM_DESC(hotplug_wireless, "If your laptop needs that, please report to " "acpi4asus-user@lists.sourceforge.net."); +/* Values for T101MT "Home" key */ +#define HOME_PRESS 0xe4 +#define HOME_HOLD 0xea +#define HOME_RELEASE 0xe5 + +#define EEEPC_WMI_KEY_IGNORE (-1) + static const struct key_entry eeepc_wmi_keymap[] = { /* Sleep already handled via generic ACPI code */ { KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } }, @@ -118,6 +125,7 @@ static const struct key_entry eeepc_wmi_keymap[] = { { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */ { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ + { KE_KEY, HOME_PRESS, { KEY_CONFIG } }, { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, { KE_END, 0}, }; @@ -178,6 +186,7 @@ static int eeepc_wmi_input_init(struct eeepc_wmi *eeepc) eeepc->inputdev->phys = EEEPC_WMI_FILE "/input0"; eeepc->inputdev->id.bustype = BUS_HOST; eeepc->inputdev->dev.parent = &eeepc->platform_device->dev; + __set_bit(EV_REP, eeepc->inputdev->evbit); err = sparse_keymap_setup(eeepc->inputdev, eeepc_wmi_keymap, NULL); if (err) @@ -917,6 +926,25 @@ static void eeepc_wmi_backlight_exit(struct eeepc_wmi *eeepc) eeepc->backlight_device = NULL; } +static void eeepc_wmi_homekey_filter(struct eeepc_wmi *eeepc, int *code, + unsigned int *value, bool *autorelease) +{ + switch (*code) { + case HOME_PRESS: + *value = 1; + *autorelease = 0; + break; + case HOME_HOLD: + *code = EEEPC_WMI_KEY_IGNORE; + break; + case HOME_RELEASE: + *code = HOME_PRESS; + *value = 0; + *autorelease = 0; + break; + } +} + static void eeepc_wmi_notify(u32 value, void *context) { struct eeepc_wmi *eeepc = context; @@ -925,6 +953,8 @@ static void eeepc_wmi_notify(u32 value, void *context) acpi_status status; int code; int orig_code; + unsigned int key_value = 1; + bool autorelease = 1; status = wmi_get_event_data(value, &response); if (status != AE_OK) { @@ -938,6 +968,11 @@ static void eeepc_wmi_notify(u32 value, void *context) code = obj->integer.value; orig_code = code; + eeepc_wmi_homekey_filter(eeepc, &code, &key_value, + &autorelease); + if (code == EEEPC_WMI_KEY_IGNORE) + goto exit; + if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) code = NOTIFY_BRNUP_MIN; else if (code >= NOTIFY_BRNDOWN_MIN && @@ -949,11 +984,12 @@ static void eeepc_wmi_notify(u32 value, void *context) eeepc_wmi_backlight_notify(eeepc, orig_code); } - if (!sparse_keymap_report_event(eeepc->inputdev, - code, 1, true)) + if (!sparse_keymap_report_event(eeepc->inputdev, code, + key_value, autorelease)) pr_info("Unknown key %x pressed\n", code); } +exit: kfree(obj); }