From patchwork Mon Nov 20 07:55:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masaki Ota <012nexus@gmail.com> X-Patchwork-Id: 10066143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0962E60375 for ; Mon, 20 Nov 2017 07:55:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED4DD29077 for ; Mon, 20 Nov 2017 07:55:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1C852907C; Mon, 20 Nov 2017 07:55:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4464F29077 for ; Mon, 20 Nov 2017 07:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751021AbdKTHzi (ORCPT ); Mon, 20 Nov 2017 02:55:38 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44477 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbdKTHzh (ORCPT ); Mon, 20 Nov 2017 02:55:37 -0500 Received: by mail-pf0-f194.google.com with SMTP id r14so198778pfl.11; Sun, 19 Nov 2017 23:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tbtMj9Z8cueKYF94ON8uh3sqQYJ0Haf7IztW/lT7+Ho=; b=pDG5S1DggCfy5KSa+Wz8iwpQlerGVq1H0QciDRxGpl58Mu5rRpVa+zfeIbb0LqWj/H 7GPZzGYfBlCKuqtpax0xz74uJp1/fv33OIZNNLcVVPN36NWZOStRi2BTyQCJJS8R0G7b T2VztbcGUZ6csT2J/fgY75UIVnhc3Qh2Jo+JM6zZ9yMqX0CYORW0Xyuy549v5r4iEcJB TQA7EFa+d7hs3p5RoLTEXiNymDk9lCTl9pjhIfQky/7xln3k8b7WiSYyGnGbg7PtGHlL +7GMpknoEKigy5ikKY0N84uBEj8ZxvMM2JVAvRls+QsjusrYKZXBNQtXicjEj+OnjSnT 1DCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tbtMj9Z8cueKYF94ON8uh3sqQYJ0Haf7IztW/lT7+Ho=; b=TI0oYbMaCbRRN7gCKVDMcaG2epfi2DciMepDpv2zupzO1coFJobq8YNVPSSyeH+VGK drKVD3RhQ9z2JnjCrfZeEkSWg7q7pCAJU9SMbw/UraJGCgeT+u28D13T6cY0HpamPxLP UcYrDM6VcwBHD4JH9FiQihgpw/BJuDAJLeG1E7dFnybyJNlO9beuo74BOmyA4Iif+O/T WbbH8o8OeDqL3buVnCmJpggq79T0Y2McG2BN96if5fYJ5BPpvXtNbFHQnRQQnWjLbSYO Xt5RlYKo8nKUDK9BcsPsgRQ+4jXUudDuW/ArV1C9pAWmxCf9ocyJr3gBMIVLWL248adw WmvA== X-Gm-Message-State: AJaThX4jZVDuMZaUrgzoYMWpFOdz4jcUASQSm2iuMz1zfmLaUBT+kpmY jDzubFqNHK3vMzvMkcH8bh0= X-Google-Smtp-Source: AGs4zMYYYGN6CbixoT+mikzqSjvQ1HCHEdFs3en0iSm18EX+mTKxjhxq91cS6svRup9oXewm26lPzQ== X-Received: by 10.101.101.217 with SMTP id y25mr4038133pgv.360.1511164536682; Sun, 19 Nov 2017 23:55:36 -0800 (PST) Received: from localhost (p2218-ipad303aobadori.miyagi.ocn.ne.jp. [123.216.73.218]) by smtp.gmail.com with ESMTPSA id s68sm3508219pfj.81.2017.11.19.23.55.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 19 Nov 2017 23:55:36 -0800 (PST) From: Masaki Ota <012nexus@gmail.com> X-Google-Original-From: Masaki Ota To: dmitry.torokhov@gmail.com, benjamin.tissoires@redhat.com, pali.rohar@gmail.com, aaron.ma@canonical.com, jaak@ristioja.ee, masaki.ota@jp.alps.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Support TrackStick of Thinkpad L570 Date: Mon, 20 Nov 2017 16:55:30 +0900 Message-Id: <20171120075530.4880-1-masaki.ota@jp.alps.com> X-Mailer: git-send-email 2.14.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Masaki Ota - The issue is that Thinkpad L570 TrackStick does not work. Because the main interface of Thinkpad L570 device is SMBus, so ALPS overlooked PS2 interface Firmware setting of TrackStick. The detail is that TrackStick otp bit is disabled. - Add the code that checks 0xD7 address value. This value is device number information, so we can identify the device by checking this value. - If we check 0xD7 value, we need to enable Command mode and after check the value we need to disable Command mode, then we have to enable the device(0xF4 command). - Thinkpad L570 device number is 0x0C or 0x1D. If it is TRUE, enable ALPS_DUALPOINT flag. Signed-off-by: Masaki Ota Tested-by: Aaron Ma Tested-by: Jonathan Liu --- drivers/input/mouse/alps.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 850b00e3ad8e..cce52104ed5a 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -2541,13 +2541,28 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], } 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; + /* For support TrackStick of Thinkpad L570 device */ + 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; @@ -2570,7 +2585,7 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, 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; }