From patchwork Fri Dec 6 03:27:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dave.Wang" X-Patchwork-Id: 11275613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B168112B for ; Fri, 6 Dec 2019 03:27:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78EFE21823 for ; Fri, 6 Dec 2019 03:27:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbfLFD1c convert rfc822-to-8bit (ORCPT ); Thu, 5 Dec 2019 22:27:32 -0500 Received: from emcscan.emc.com.tw ([192.72.220.5]:29657 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbfLFD1c (ORCPT ); Thu, 5 Dec 2019 22:27:32 -0500 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="33172740" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 06 Dec 2019 11:27:30 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(71502:0:AUTH_RELAY) (envelope-from ); Fri, 06 Dec 2019 11:27:30 +0800 (CST) Received: from 192.168.33.57 by webmail.emc.com.tw with Mail2000 ESMTP Server V7.00(101175:0:AUTH_RELAY) (envelope-from ); Fri, 06 Dec 2019 11:27:30 +0800 (CST) From: "Dave.Wang" To: , , "'Benjamin Tissoires'" , Cc: "'Josh.Chen'" , , "'phoenix'" Subject: [PATCH 2/6] Input: elantech - Add the function to get more bytes from register Date: Fri, 6 Dec 2019 11:27:29 +0800 Message-ID: <000f01d5abe5$170f8050$452e80f0$@emc.com.tw> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 15.0 Thread-Index: AdWr5PQ5JBetVFlBQySby4AZLfqsUw== Content-Language: zh-tw x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcMDYxMjlcYXBwZGF0YVxyb2FtaW5nXDA5ZDg0OWI2LTMyZDMtNGE0MC04NWVlLTZiODRiYTI5ZTM1Ylxtc2dzXG1zZy01NDQ4MDhlYi0xN2Q4LTExZWEtYWExOS04OGQ3ZjY1NjczMzBcYW1lLXRlc3RcNTQ0ODA4ZWQtMTdkOC0xMWVhLWFhMTktODhkN2Y2NTY3MzMwYm9keS50eHQiIHN6PSIxMzgzIiB0PSIxMzIyMDA3NjQ0OTI2ODgzMzIiIGg9Ijg2NjcvVjVGN0FySWVrNUwvY2ZhelNJaE44UT0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= x-dg-rorf: true Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Send an Elantech style special command to read three bytes from register. Signed-off-by: Dave Wang --- drivers/input/mouse/elantech.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)   */ diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 1f0d914acd78..afb87122b766 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -89,6 +89,24 @@ static int elantech_ps2_command(struct psmouse *psmouse,       return rc; } +/* + * Send an Elantech style special command to read 3 bytes from a register + */ +static int elantech_read_reg_params(struct psmouse *psmouse, unsigned char reg, +                              unsigned char *param) +{ +      int rc = 0; + +      if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || +          elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || +          elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || +          elantech_ps2_command(psmouse, NULL, reg) || +          elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) +              rc = -1; + +      return rc; +} + /*   * Send an Elantech style special command to read a value from a register