From patchwork Wed Nov 29 07:01:05 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: 10081499 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 15B396020B for ; Wed, 29 Nov 2017 07:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 080D02959A for ; Wed, 29 Nov 2017 07:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0A572966A; Wed, 29 Nov 2017 07:01:13 +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 563352959A for ; Wed, 29 Nov 2017 07:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbdK2HBM (ORCPT ); Wed, 29 Nov 2017 02:01:12 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46673 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751355AbdK2HBL (ORCPT ); Wed, 29 Nov 2017 02:01:11 -0500 Received: by mail-pl0-f66.google.com with SMTP id i6so1539075plt.13; Tue, 28 Nov 2017 23:01:11 -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=M5OTAflHYCUrtJGb6vy01lqTL78PiT2LHPcO48JnwGY=; b=GrYacnvRFjw6bpuRLBeHcvZGpmgS8HI1sUdOAXNbTpruds9ToiqLySXJDmYWZcG9xv xu2qhxdJcfrcUVHP5If0E+cMUNLwKx3sbXTB++96nA0GDnK85ZatBspyPKRn9KWyz0rd YypJEgq5Wme6/vDWerl1I+XAgcCckFwAsWxr4NfQ8+ViwC2Me7PkqlPKWHGWKs5E2z39 XGIo5rS9J4OAqTnyOJ6dPU1dQ9+lDSAvn0SwavozdcPjWVO6t3doSKFlcsP0Y1V7cwBC Jrq2ueqjBo7FVlr4tQctc5oj9DvyhyGWg81AbWbn1JvHut1h6Njfd5YosDvQjFS+M9Wd 7agw== 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=M5OTAflHYCUrtJGb6vy01lqTL78PiT2LHPcO48JnwGY=; b=KIlB4u4tfeoN6s94MKkEy8MvM9NSL9AH11+Qnpi/lRE/NAHl4n8QIy6gRInn/IN337 ecbJUMAj334WrHqQepBqx26R/VLlFBwU5mzS9S7ECkvZzitMxbKEIRH8/dtOxw7kqgkg mZWAA5ohekmbgW1nFVZnnYmse0SNPkP8JAVmAYJLKNqRdCN0sFoSVqWTR+cuiMuXHgen uEghWxcc9Kp71+TtJ1ayeFB5WL9wmUpcp/1+f16NTmk244f7Tx9MPwlJ7EeR6+eijeJs biekpSz5t8XsFQrF/2Mkkm5AYqM31oaSrqW7gF2aScsa3T+u8M0mbS/YbFcGUY5YHpIs N3ZQ== X-Gm-Message-State: AJaThX5dOP3YDtFUQIp9j00/MyFTkwCsfP784U+M4fOH58Xs3TxaS/kr 7LMk+NZetXDt8+IRQk9g+t4= X-Google-Smtp-Source: AGs4zMZ8DQPmJOQGDGhQj8dCGG8Yk6ZmBd/jVSIxQys2122ru7kLoNQFbJm0Jlu2AI+yXvQ5iSOC4Q== X-Received: by 10.159.206.200 with SMTP id x8mr1900988plo.273.1511938870837; Tue, 28 Nov 2017 23:01:10 -0800 (PST) Received: from localhost (p2218-ipad303aobadori.miyagi.ocn.ne.jp. [123.216.73.218]) by smtp.gmail.com with ESMTPSA id g9sm1695722pfk.0.2017.11.28.23.01.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Nov 2017 23:01:10 -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: Wed, 29 Nov 2017 16:01:05 +0900 Message-Id: <20171129070105.5540-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 --- drivers/input/mouse/alps.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 850b00e3ad8e..dd2c9e9f4830 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -2541,13 +2541,31 @@ 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; + if (!is_dual) { + /* 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 +2588,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; }