From: "jingle.wu" <jingle.wu@emc.com.tw>
To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
dmitry.torokhov@gmail.com
Cc: phoenix@emc.com.tw, "jingle.wu" <jingle.wu@elan.corp-partner.google.com>
Subject: [PATCH] Input: trackpoint - Add Suspend mode for Elan TrackPoint
Date: Fri, 4 Sep 2020 10:42:31 +0800 [thread overview]
Message-ID: <20200904024231.26812-1-jingle.wu@emc.com.tw> (raw)
From: "jingle.wu" <jingle.wu@elan.corp-partner.google.com>
Add suspend command for elan trackpoint
---
drivers/input/mouse/trackpoint.c | 16 ++++++++++++++++
drivers/input/mouse/trackpoint.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 3eefee2ee2a1..b3cba973a4eb 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -389,6 +389,20 @@ static int trackpoint_reconnect(struct psmouse *psmouse)
return 0;
}
+static void trackpoint_cleanup(struct psmouse *psmouse)
+{
+ struct trackpoint_data *tp = psmouse->private;
+ u8 param[3] = { TP_TOGGLE, TP_TOGGLE_BURST, TP_TOGGLE_ELAN_SLEEP };
+
+ if (tp->variant_id == TP_VARIANT_ELAN) {
+ if (ps2_command(&psmouse->ps2dev, param,
+ MAKE_PS2_CMD(3, 0, TP_COMMAND))) {
+ psmouse_err(psmouse,
+ "failed to suspend trackpont.\n");
+ }
+ }
+}
+
int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -421,6 +435,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
psmouse->reconnect = trackpoint_reconnect;
psmouse->disconnect = trackpoint_disconnect;
+ psmouse->cleanup = trackpoint_cleanup;
+
if (variant_id != TP_VARIANT_IBM) {
/* Newer variants do not support extended button query. */
button_info = 0x33;
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
index 5cb93ed26085..c7fa75452976 100644
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -107,6 +107,7 @@
#define TP_TOGGLE_EXT_TAG 0x22 /* Bit 3 of the first packet coming from the
external device will be forced to 1 */
#define TP_MASK_EXT_TAG 0x04
+#define TP_TOGGLE_ELAN_SLEEP 0x8
/* Power on Self Test Results */
--
2.17.1
next reply other threads:[~2020-09-04 2:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 2:42 jingle.wu [this message]
2022-03-23 17:27 ` Dmitry Torokhov
2022-03-24 1:13 ` Jingle.Wu
2022-03-24 1:50 ` Josh.Chen
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=20200904024231.26812-1-jingle.wu@emc.com.tw \
--to=jingle.wu@emc.com.tw \
--cc=dmitry.torokhov@gmail.com \
--cc=jingle.wu@elan.corp-partner.google.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®