From patchwork Mon Dec 29 22:51:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5550411 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8FE379F1BF for ; Mon, 29 Dec 2014 22:51:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 857702017D for ; Mon, 29 Dec 2014 22:51:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 722FD20176 for ; Mon, 29 Dec 2014 22:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbaL2WvT (ORCPT ); Mon, 29 Dec 2014 17:51:19 -0500 Received: from mail-ie0-f174.google.com ([209.85.223.174]:63837 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbaL2WvS (ORCPT ); Mon, 29 Dec 2014 17:51:18 -0500 Received: by mail-ie0-f174.google.com with SMTP id at20so12933045iec.19; Mon, 29 Dec 2014 14:51:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=BxwOAv0oe4Le2OIq5Q0hMUTHZiF0QKFqMplb821Xjk0=; b=mHN+dQq48mWQ+tMnTvDTH7GYbzZvkWfkQNmrUO1csrSA8PaODJUZe8MRCWwiwMyHy+ VguDboUnHR1sT6RycV/7BsDy5Pt9Q+Q8Nfo7pdp140WZ+PfclVKVBpNCLUwCKRz8ZyAa N1IdsNwUylC/lkAZfDxeHNVjX6XLlwWYANxX7hd0kHamfCkpxok92yf4SsNOAkGI3fiM ZIdu+dkvzzxRnHA4mpG+7GOjqFO5LqtSXm2FMo2KIhyOti3Xg0JWpxPZ5YohBnUBqKlO 8kvc/wUhqJ5pzCfeilUbS3Ko/e2i0J/4cHQZ2Gdh+bX9LNaRG7x0sW4kOxzAVjhDtw/9 70Bg== X-Received: by 10.107.130.197 with SMTP id m66mr52756216ioi.10.1419893477691; Mon, 29 Dec 2014 14:51:17 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1301:8870:d2cb:6b9f:370a]) by mx.google.com with ESMTPSA id b7sm14843662igx.15.2014.12.29.14.51.15 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 29 Dec 2014 14:51:16 -0800 (PST) Date: Mon, 29 Dec 2014 14:51:13 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Hans de Goede , Benjamin Tissoires , Andrew Duggan , Christopher Heiny , linux-kernel@vger.kernel.org Subject: [PATCH] Input: synaptics - switch ForcePad detection to PNP IDs Message-ID: <20141229225113.GA13847@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to Synaptics devices with ForcePads use SYN300D and SYN3014 as PNP IDs, so let's switch from DMI-bases detection scheme to PNP-based one, which should be more reliable. Suggested-by: Hans de Goede Signed-off-by: Dmitry Torokhov Acked-by: Hans de Goede Reviewed-by: Benjamin Tissoires --- drivers/input/mouse/synaptics.c | 35 ++++++++++++++--------------------- drivers/input/mouse/synaptics.h | 1 + 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index d2ab13a..f04017e 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -190,6 +190,13 @@ static const char * const topbuttonpad_pnp_ids[] = { NULL }; +/* This list has been kindly provided by Synaptics. */ +static const char * const forcepad_pnp_ids[] = { + "SYN300D", + "SYN3014", + NULL +}; + /***************************************************************************** * Synaptics communications functions ****************************************************************************/ @@ -601,8 +608,6 @@ static void synaptics_parse_agm(const unsigned char buf[], } } -static bool is_forcepad; - static int synaptics_parse_hw_state(const unsigned char buf[], struct synaptics_data *priv, struct synaptics_hw_state *hw) @@ -632,7 +637,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[], hw->left = (buf[0] & 0x01) ? 1 : 0; hw->right = (buf[0] & 0x02) ? 1 : 0; - if (is_forcepad) { + if (priv->is_forcepad) { /* * ForcePads, like Clickpads, use middle button * bits to report primary button clicks. @@ -1307,29 +1312,11 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = { { } }; -static const struct dmi_system_id forcepad_dmi_table[] __initconst = { -#if defined(CONFIG_DMI) && defined(CONFIG_X86) - { - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"), - }, - }, -#endif - { } -}; - void __init synaptics_module_init(void) { impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); broken_olpc_ec = dmi_check_system(olpc_dmi_table); cr48_profile_sensor = dmi_check_system(cr48_dmi_table); - - /* - * Unfortunately ForcePad capability is not exported over PS/2, - * so we have to resort to checking DMI. - */ - is_forcepad = dmi_check_system(forcepad_dmi_table); } static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) @@ -1364,6 +1351,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) if (SYN_ID_DISGEST_SUPPORTED(priv->identity)) priv->disable_gesture = true; + /* + * Unfortunately ForcePad capability is not exported over PS/2, + * so we have to resort to checking PNP IDs. + */ + priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids); + if (synaptics_set_mode(psmouse)) { psmouse_err(psmouse, "Unable to initialize device.\n"); goto init_fail; diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index aedc329..fb3838c 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h @@ -168,6 +168,7 @@ struct synaptics_data { unsigned long press_start; bool press; bool report_press; + bool is_forcepad; }; void synaptics_module_init(void);