All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: kt.liao@emc.com.tw, Oliver Haessler <oliver@redhat.com>,
	Benjamin Berg <bberg@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: [PATCH 8/8] input: psmouse-smbus: allow to control psmouse_deactivate
Date: Thu,  5 Apr 2018 15:25:37 +0200	[thread overview]
Message-ID: <20180405132537.3218-9-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <20180405132537.3218-1-benjamin.tissoires@redhat.com>

This seems to be Synaptics specific, as some Elan touchpads are not
correctly switching to SMBus if we call deactivate before switching to
SMBus on cold boot and on resume.

Tested with the T480s

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/input/mouse/elantech.c      |  2 +-
 drivers/input/mouse/psmouse-smbus.c | 13 ++++++++++---
 drivers/input/mouse/psmouse.h       |  1 +
 drivers/input/mouse/synaptics.c     |  2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 29f55e8e07e9..6009fb7d0d31 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1771,7 +1771,7 @@ static int elantech_create_smbus(struct psmouse *psmouse,
 	};
 
 	return psmouse_smbus_init(psmouse, &smbus_board, &pdata,
-				  sizeof(pdata), leave_breadcrumbs);
+				  sizeof(pdata), false, leave_breadcrumbs);
 }
 
 /**
diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
index c7ac24d119c1..facfe902b073 100644
--- a/drivers/input/mouse/psmouse-smbus.c
+++ b/drivers/input/mouse/psmouse-smbus.c
@@ -23,6 +23,7 @@ struct psmouse_smbus_dev {
 	struct i2c_client *client;
 	struct list_head node;
 	bool dead;
+	bool need_deactivate;
 };
 
 static LIST_HEAD(psmouse_smbus_list);
@@ -118,7 +119,10 @@ static psmouse_ret_t psmouse_smbus_process_byte(struct psmouse *psmouse)
 
 static int psmouse_smbus_reconnect(struct psmouse *psmouse)
 {
-	psmouse_deactivate(psmouse);
+	struct psmouse_smbus_dev *smbdev = psmouse->private;
+
+	if (smbdev->need_deactivate)
+		psmouse_deactivate(psmouse);
 
 	return 0;
 }
@@ -225,6 +229,7 @@ void psmouse_smbus_cleanup(struct psmouse *psmouse)
 int psmouse_smbus_init(struct psmouse *psmouse,
 		       const struct i2c_board_info *board,
 		       const void *pdata, size_t pdata_size,
+		       bool need_deactivate,
 		       bool leave_breadcrumbs)
 {
 	struct psmouse_smbus_dev *smbdev;
@@ -236,6 +241,7 @@ int psmouse_smbus_init(struct psmouse *psmouse,
 
 	smbdev->psmouse = psmouse;
 	smbdev->board = *board;
+	smbdev->need_deactivate = need_deactivate;
 
 	smbdev->board.platform_data = kmemdup(pdata, pdata_size, GFP_KERNEL);
 	if (!smbdev->board.platform_data) {
@@ -243,6 +249,9 @@ int psmouse_smbus_init(struct psmouse *psmouse,
 		return -ENOMEM;
 	}
 
+	if (need_deactivate)
+		psmouse_deactivate(psmouse);
+
 	psmouse->private = smbdev;
 	psmouse->protocol_handler = psmouse_smbus_process_byte;
 	psmouse->reconnect = psmouse_smbus_reconnect;
@@ -250,8 +259,6 @@ int psmouse_smbus_init(struct psmouse *psmouse,
 	psmouse->disconnect = psmouse_smbus_disconnect;
 	psmouse->resync_time = 0;
 
-	psmouse_deactivate(psmouse);
-
 	mutex_lock(&psmouse_smbus_mutex);
 	list_add_tail(&smbdev->node, &psmouse_smbus_list);
 	mutex_unlock(&psmouse_smbus_mutex);
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index dd4ec1f602d7..64c3a5d3fb3e 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -225,6 +225,7 @@ struct i2c_board_info;
 int psmouse_smbus_init(struct psmouse *psmouse,
 		       const struct i2c_board_info *board,
 		       const void *pdata, size_t pdata_size,
+		       bool need_deactivate,
 		       bool leave_breadcrumbs);
 void psmouse_smbus_cleanup(struct psmouse *psmouse);
 
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 14a1188561aa..6b1ed53a8b03 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1751,7 +1751,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse,
 	};
 
 	return psmouse_smbus_init(psmouse, &intertouch_board,
-				  &pdata, sizeof(pdata),
+				  &pdata, sizeof(pdata), true,
 				  leave_breadcrumbs);
 }
 
-- 
2.14.3

  parent reply	other threads:[~2018-04-05 13:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 13:25 [PATCH 0/8] Input: support for latest Lenovo thinkpads (series 80) Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 1/8] Input: synaptics - add Lenovo 80 series ids to SMBus Benjamin Tissoires
2018-04-09  3:37   ` Sasha Levin
2018-04-09  9:02     ` Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 2/8] input: elan_i2c_smbus - fix corrupted stack Benjamin Tissoires
2018-04-09  3:37   ` Sasha Levin
2018-04-09  9:01     ` Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 3/8] Input: elan_i2c - add trackstick report Benjamin Tissoires
2018-04-05 23:46   ` Dmitry Torokhov
2018-04-06  6:51     ` Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 4/8] Input: elantech - split device info into a separate structure Benjamin Tissoires
2018-04-06  7:33   ` [RFC PATCH] Input: elantech_query_info() can be static kbuild test robot
2018-04-06  7:33     ` kbuild test robot
2018-04-06  7:33   ` [PATCH 4/8] Input: elantech - split device info into a separate structure kbuild test robot
2018-04-06  7:33     ` kbuild test robot
2018-04-05 13:25 ` [PATCH 5/8] Input: elantech - query the resolution in query_info Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 6/8] Input: elantech - add support for SMBus devices Benjamin Tissoires
2018-04-05 13:25 ` [PATCH 7/8] Input: elantech - detect new ICs and setup Host Notify for them Benjamin Tissoires
2018-04-05 13:25 ` Benjamin Tissoires [this message]
2018-04-05 23:51 ` [PATCH 0/8] Input: support for latest Lenovo thinkpads (series 80) Dmitry Torokhov
2018-04-06  6:51   ` Benjamin Tissoires
2018-04-10  5:45     ` 廖崇榮
2018-04-10  7:35       ` Benjamin Tissoires
2018-04-11  4:32         ` 廖崇榮

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=20180405132537.3218-9-benjamin.tissoires@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=bberg@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kt.liao@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.