public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dave.Wang" <dave.wang@emc.com.tw>
To: <Linux-kernel@vger.kernel.org>, <Linux-input@vger.kernel.org>,
	"'Benjamin Tissoires'" <benjamin.tissoires@redhat.com>,
	<Dmitry.torokhov@gmail.com>
Cc: "'Josh.Chen'" <josh.chen@emc.com.tw>, <jingle.wu@emc.com.tw>,
	"'phoenix'" <phoenix@emc.com.tw>
Subject: [PATCH 2/6] Input: elantech - Add the function to get more bytes from register
Date: Fri, 6 Dec 2019 11:27:29 +0800	[thread overview]
Message-ID: <000f01d5abe5$170f8050$452e80f0$@emc.com.tw> (raw)

Send an Elantech style special command to read three bytes from
register.

Signed-off-by: Dave Wang <dave.wang@emc.com.tw>
---
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
  */
-- 
2.17.1


             reply	other threads:[~2019-12-06  3:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06  3:27 Dave.Wang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-12-09  3:14 [PATCH 2/6] Input: elantech - Add the function to get more bytes from register Dave Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000f01d5abe5$170f8050$452e80f0$@emc.com.tw' \
    --to=dave.wang@emc.com.tw \
    --cc=Dmitry.torokhov@gmail.com \
    --cc=Linux-input@vger.kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jingle.wu@emc.com.tw \
    --cc=josh.chen@emc.com.tw \
    --cc=phoenix@emc.com.tw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox