From patchwork Wed Mar 21 20:07:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 10300321 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 6F05460386 for ; Wed, 21 Mar 2018 20:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6379F28D9F for ; Wed, 21 Mar 2018 20:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5840E28DB8; Wed, 21 Mar 2018 20:08:01 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 F2E0428D9F for ; Wed, 21 Mar 2018 20:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753119AbeCUUH7 (ORCPT ); Wed, 21 Mar 2018 16:07:59 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38583 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021AbeCUUH6 (ORCPT ); Wed, 21 Mar 2018 16:07:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id l16so12136205wmh.3; Wed, 21 Mar 2018 13:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Nse+Nb2DiPMMdLc96eBQezF0Sl7uG3txScltwv660ho=; b=roV6+D2b+c9VyOZG7utMBO57Xpx89J6WoPAdycKzt+zsIaKAViYZ7undUqouhBiyB6 ttO/vOiZLHVA55cehp7s1mMWpqiiTQDo1yNzPItrZY78Uv49WY7goWXqf7OhNFxCvXfU ljXOq+inpwjf85eV2ViA6IJ9X++mYFQQBfLnMXkXEgP2XdAGGCKuFa7NsOi8zwdLTOaQ w7bIpOSgJ5j2BmpBh0hnrYqcdCQ2tS2aJKu3nvukPE0mJ3E9t5uSjMCI1ijdO9Fe6Y4W Sg75PvhE6cJ1k84pXDHwNYF4Ig4maLjXA3/eD+QIkxu+GMpzeNMyBkuEZ3RsbvBMzohd QpLw== 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:mime-version :content-transfer-encoding; bh=Nse+Nb2DiPMMdLc96eBQezF0Sl7uG3txScltwv660ho=; b=RhOADbgs79UWMFhRYF35tE/NaPEPJHlGxKZ0UFqgXh4hp4/cYYLMhex/IiXoLbzt9z 3nJphyRZYYm/7X2mFxIrOxYlFLjZEpFizMJoadXpc9FiDSbi3Sz4CZfVNyegk14xQzmG Eo6RqYkidl4k00uTr90S8LVtBvZp68YmM2q3mM/RbGngaJfzdnM9h55nZM3IQ+n22sk1 NzG5DNFw7mTRjjQDaf5lx3H9WLKlYRzIsEprgi2xZGxvYLibzuIHiMfP6Hoa2lj0cWVa pbbxA81jpiNRlCI1NqHanZWMrqkE1YQSLSoakMdDTol059pMb1aCZmGm67wxKGPUOV5D jy5g== X-Gm-Message-State: AElRT7Ei5Cd4/nZgZg4aplha3BktnQW0s2MjmZLxtRSPOnFXEZWt6v6P ZaGRNle5jUrrmHfpktvvi6Siqg== X-Google-Smtp-Source: AG47ELtpFehlWRZjAQKR/W73e9pdK87e3ypHLbjpbZIdaPY4h8Fp7uIdWavmiMn+wY1VGAZL2pcpzg== X-Received: by 10.28.135.140 with SMTP id j134mr3868373wmd.157.1521662877679; Wed, 21 Mar 2018 13:07:57 -0700 (PDT) Received: from Pali-Latitude.lan (pali.kolej.mff.cuni.cz. [78.128.193.202]) by smtp.gmail.com with ESMTPSA id a185sm5341772wmf.1.2018.03.21.13.07.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 13:07:56 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Dmitry Torokhov , Masaki Ota Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: alps - Report pressure of v3 and v7 trackstick Date: Wed, 21 Mar 2018 21:07:36 +0100 Message-Id: <20180321200736.32406-1-pali.rohar@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 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 ALPS v3 and v7 packet formats reports trackstick pressure. This information is already parsed in unused "z" variable. ALPS SS4 S2 devices already reports trackstick pressure as ABS_PRESSURE attribute, therefore reports pressure in the same way also for v3 and v7. This patch also updates parsing v3 pressure information, it is also stored in 7 bits. Signed-off-by: Pali Rohár --- drivers/input/mouse/alps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 010c1bcdb06d..0a9e6a3a2f9f 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -139,11 +139,11 @@ static const struct alps_model_info alps_model_data[] = { }; static const struct alps_protocol_info alps_v3_protocol_data = { - ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT + ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v3_rushmore_data = { - ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT + ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v4_protocol_data = { @@ -155,7 +155,7 @@ static const struct alps_protocol_info alps_v5_protocol_data = { }; static const struct alps_protocol_info alps_v7_protocol_data = { - ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT + ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v8_protocol_data = { @@ -583,7 +583,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f)); y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f)); - z = (packet[4] & 0x7c) >> 2; + z = packet[4] & 0x7c; /* * The x and y values tend to be quite large, and when used @@ -595,6 +595,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) input_report_rel(dev, REL_X, x); input_report_rel(dev, REL_Y, -y); + input_report_abs(dev, ABS_PRESSURE, z); /* * Most ALPS models report the trackstick buttons in the touchpad @@ -1118,6 +1119,7 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse) input_report_rel(dev2, REL_X, (char)x); input_report_rel(dev2, REL_Y, -((char)y)); + input_report_abs(dev2, ABS_PRESSURE, z); input_report_key(dev2, BTN_LEFT, left); input_report_key(dev2, BTN_RIGHT, right);