From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Andrew Duggan <aduggan@synaptics.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: [PATCH v2 1/3] input: serio - allow others to specify a driver for a serio device
Date: Thu, 16 Feb 2017 18:50:58 +0100 [thread overview]
Message-ID: <20170216175100.1668-2-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <20170216175100.1668-1-benjamin.tissoires@redhat.com>
The Lenovo Thinkpads use RMI4 over SMBus in addition to PS/2 for their
trackpad. The problem is that the device doesn't enumerate itself besides
some registers in PS/2.
Once the initial PS/2 initialization has been made, we need a way to unbind
psmouse from the touchpad and use a different (dummy) serio driver to
not interfere with SMBus.
This patch adds the mechanisms to unbind psmouse and use a different serio
driver, driver which can be marked as manual_bind to not be picked up
by inadvertence.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
new in v2
drivers/input/serio/serio.c | 20 ++++++++++++++++++++
include/linux/serio.h | 5 +++++
2 files changed, 25 insertions(+)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 1ca7f55..14cc383 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -704,6 +704,23 @@ void serio_reconnect(struct serio *serio)
}
EXPORT_SYMBOL(serio_reconnect);
+void serio_bind_manual_driver(struct serio *serio, struct serio_driver *drv)
+{
+ mutex_lock(&serio_mutex);
+ serio->manual_bind = true;
+ serio->manual_drv = &drv->driver;
+ mutex_unlock(&serio_mutex);
+ serio_rescan(serio);
+}
+EXPORT_SYMBOL(serio_bind_manual_driver);
+
+void serio_clear_manual_driver(struct serio *serio)
+{
+ serio->manual_bind = false;
+ serio->manual_drv = NULL;
+}
+EXPORT_SYMBOL(serio_clear_manual_driver);
+
/*
* Submits register request to kseriod for subsequent execution.
* Note that port registration is always asynchronous.
@@ -902,6 +919,9 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
struct serio *serio = to_serio_port(dev);
struct serio_driver *serio_drv = to_serio_driver(drv);
+ if (serio->manual_drv && serio->manual_drv == drv)
+ return serio_match_port(serio_drv->id_table, serio);
+
if (serio->manual_bind || serio_drv->manual_bind)
return 0;
diff --git a/include/linux/serio.h b/include/linux/serio.h
index c733cff..1a6f4db 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -64,6 +64,9 @@ struct serio {
* may get indigestion when exposed to concurrent access (i8042).
*/
struct mutex *ps2_cmd_mutex;
+
+ /* Used when forcing a driver instead of the default one. */
+ struct device_driver *manual_drv;
};
#define to_serio_port(d) container_of(d, struct serio, dev)
@@ -88,6 +91,8 @@ int serio_open(struct serio *serio, struct serio_driver *drv);
void serio_close(struct serio *serio);
void serio_rescan(struct serio *serio);
void serio_reconnect(struct serio *serio);
+void serio_bind_manual_driver(struct serio *serio, struct serio_driver *drv);
+void serio_clear_manual_driver(struct serio *serio);
irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags);
void __serio_register_port(struct serio *serio, struct module *owner);
--
2.9.3
next prev parent reply other threads:[~2017-02-16 17:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-16 17:50 [PATCH v2 0/3] Bind RMI4 over SMBus from PS/2 Benjamin Tissoires
2017-02-16 17:50 ` Benjamin Tissoires [this message]
2017-02-16 17:50 ` [PATCH v2 2/3] Input: synaptics - allocate a Synaptics Intertouch device Benjamin Tissoires
2017-02-16 21:44 ` kbuild test robot
2017-02-16 21:44 ` [PATCH] Input: fix ptr_ret.cocci warnings kbuild test robot
2017-02-16 17:51 ` [PATCH v2 3/3] Input: add a PS/2 to SMBus platform module Benjamin Tissoires
2017-02-16 22:06 ` kbuild test robot
2017-02-17 11:46 ` [PATCH v2 4/3] Input: ps2smbus - force PS/2 disable before SMBus gets resumed Benjamin Tissoires
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=20170216175100.1668-2-benjamin.tissoires@redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=aduggan@synaptics.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).