Received: by 10.213.65.68 with SMTP id h4csp705017imn; Fri, 6 Apr 2018 07:34:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+TNNTtL9gLo+XIL1jgbCFpjzI4Na95LXerqVbdIOlWa2udME2i25XoK2WwZtTiXdTVm3FD X-Received: by 2002:a17:902:f44:: with SMTP id 62-v6mr15910504ply.318.1523025260115; Fri, 06 Apr 2018 07:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025260; cv=none; d=google.com; s=arc-20160816; b=hosMS/xxJGNsf6ggnZGevhVJGUCAWXM/XqQKwoUyw4zhE80wv9qqUC9pMDXu3n2qUx jjbR9xAaaplk17M1gYNzMdLEOH+t2ZzYUZ5k6CI0K+9VZEbC/u8TSNGK8l4JNk5ZE0JG pqCVjsM8YVhJ+vexTBCTnhaohSASpOUUjVcWKUnEO1eCDNb6QoL1QmtNxjHevTVtuUEL Tu+Oi7ZW0VXPs5G+mtEWzLZxvFlw8NV+BtXnG+W2z/gKSlr5IfoaXviPjnVKAsMiRTGW Bsz2hSRjsNXQ+3pr+tR6me1Lg90oEMNGOEcn71oT2xYgobWLyjtRr1D19BRczCJSg1Dh cw2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jYSCqGiTE43XzNfCXUvubwBYzVyYNVWBKo2P1EAqJBE=; b=QiafsMnBsCssKgjNut6gp/DXY7MUv2nM0bgbPRkiZ8p7rMrNI2twHPbQIYqObEtQzd NFAlrQ4TI+IjjTuEy/q/cYI6ojDqywWRzvxUS9qG5T5DrUe5HgLtFEWFU9DQYOSvlT0l TcOdV9MS8gHzMXYVWfgmCmvsDEVXSI47WUiuhI6Ryehce9nlA40dREwwZMn/jGBLZpkq 7ieDOebTGqOBJOr20XWJs5T/6Cd9QLTWIbsIfrUoydLbm86jxxdiRWd/nj2VFiuMVj6L MeJQIDKBiioDIMS8LTqMAOl5ksRf1bLXmipTFLsiogxUY8ZcMV6CZtDU4Q/eYz0GPhOn Fzcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2si7998411pfb.39.2018.04.06.07.34.06; Fri, 06 Apr 2018 07:34:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932093AbeDFNgT (ORCPT + 99 others); Fri, 6 Apr 2018 09:36:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59132 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932079AbeDFNgP (ORCPT ); Fri, 6 Apr 2018 09:36:15 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 78EC5DC8; Fri, 6 Apr 2018 13:36:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masaki Ota , Aaron Ma , Jonathan Liu , Jaak Ristioja , Dmitry Torokhov Subject: [PATCH 4.9 086/102] Input: ALPS - fix TrackStick detection on Thinkpad L570 and Latitude 7370 Date: Fri, 6 Apr 2018 15:24:07 +0200 Message-Id: <20180406084343.568999055@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masaki Ota commit 567b9b549cfa1cbc202762ae97b5385c29ade1e3 upstream. The primary interface for the touchpad device in Thinkpad L570 is SMBus, so ALPS overlooked PS2 interface Firmware setting of TrackStick, and shipped with TrackStick otp bit is disabled. The address 0xD7 contains device number information, so we can identify the device by checking this value, but to access it we need to enable Command mode, and then re-enable the device. Devices shipped in Thinkpad L570 report either 0x0C or 0x1D as device numbers, if we see them we assume that the devices are DualPoints. The same issue exists on Dell Latitude 7370. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196929 Fixes: 646580f793 ("Input: ALPS - fix multi-touch decoding on SS4 plus touchpads") Signed-off-by: Masaki Ota Tested-by: Aaron Ma Tested-by: Jonathan Liu Tested-by: Jaak Ristioja Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/alps.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -2538,13 +2538,31 @@ static int alps_update_btn_info_ss4_v2(u } static int alps_update_dual_info_ss4_v2(unsigned char otp[][4], - struct alps_data *priv) + struct alps_data *priv, + struct psmouse *psmouse) { bool is_dual = false; + int reg_val = 0; + struct ps2dev *ps2dev = &psmouse->ps2dev; - if (IS_SS4PLUS_DEV(priv->dev_id)) + if (IS_SS4PLUS_DEV(priv->dev_id)) { is_dual = (otp[0][0] >> 4) & 0x01; + if (!is_dual) { + /* For support TrackStick of Thinkpad L/E series */ + if (alps_exit_command_mode(psmouse) == 0 && + alps_enter_command_mode(psmouse) == 0) { + reg_val = alps_command_mode_read_reg(psmouse, + 0xD7); + } + alps_exit_command_mode(psmouse); + ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); + + if (reg_val == 0x0C || reg_val == 0x1D) + is_dual = true; + } + } + if (is_dual) priv->flags |= ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE; @@ -2567,7 +2585,7 @@ static int alps_set_defaults_ss4_v2(stru alps_update_btn_info_ss4_v2(otp, priv); - alps_update_dual_info_ss4_v2(otp, priv); + alps_update_dual_info_ss4_v2(otp, priv, psmouse); return 0; }