* [PATCH v3] serio: add support for PS2Mult multiplexer protocol
@ 2010-09-23 16:44 Dmitry Eremin-Solenikov
2010-09-29 12:45 ` Dmitry Eremin-Solenikov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-09-23 16:44 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
into one serial data stream. It's used e.g. on TQM85xx serie of boards.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
It actually depends on "serio: multiple children" patch. I'm not resending it
as you were the originator of the latest version of the patch.
drivers/input/serio/Kconfig | 8 +
drivers/input/serio/Makefile | 1 +
drivers/input/serio/ps2mult.c | 283 +++++++++++++++++++++++++++++++++++++++++
include/linux/serio.h | 2 +
4 files changed, 294 insertions(+), 0 deletions(-)
create mode 100644 drivers/input/serio/ps2mult.c
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 3bfe8fa..63f4658 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -226,4 +226,12 @@ config SERIO_AMS_DELTA
To compile this driver as a module, choose M here;
the module will be called ams_delta_serio.
+config SERIO_PS2MULT
+ tristate "TQC PS/2 multiplexer"
+ help
+ Say Y here if you have the PS/2 line multiplexer like present on TQC boads
+
+ To compile this driver as a module, choose M here: the
+ module will be called ps2mult.
+
endif
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index 84c80bf..26714c5 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_SERIO_RAW) += serio_raw.o
obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o
obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o
obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o
+obj-$(CONFIG_SERIO_PS2MULT) += ps2mult.o
diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
new file mode 100644
index 0000000..bd45e76
--- /dev/null
+++ b/drivers/input/serio/ps2mult.c
@@ -0,0 +1,283 @@
+/*
+ * TQC PS/2 Multiplexer driver
+ *
+ * Copyright (C) 2010 Dmitry Eremin-Solenikov
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+#include <linux/serio.h>
+
+MODULE_AUTHOR("Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>");
+MODULE_DESCRIPTION("TQC PS/2 Multiplexer driver");
+MODULE_LICENSE("GPL");
+
+#define PS2MULT_KB_SELECTOR 0xA0
+#define PS2MULT_MS_SELECTOR 0xA1
+#define PS2MULT_ESCAPE 0x7D
+#define PS2MULT_BSYNC 0x7E
+#define PS2MULT_SESSION_START 0x55
+#define PS2MULT_SESSION_END 0x56
+
+struct ps2mult_port {
+ struct serio *serio;
+ unsigned char sel;
+};
+
+#define PS2MULT_NUM_PORTS 2
+
+struct ps2mult {
+ struct serio *serio;
+ struct ps2mult_port ports[PS2MULT_NUM_PORTS];
+
+ spinlock_t lock;
+ struct serio *in_serio;
+ struct serio *out_serio;
+ bool escape;
+};
+
+/* First MUST com PS2MULT_NUM_PORTS selectors */
+static unsigned char ps2mult_controls[] = {
+ PS2MULT_KB_SELECTOR, PS2MULT_MS_SELECTOR,
+ PS2MULT_ESCAPE, PS2MULT_BSYNC,
+ PS2MULT_SESSION_START, PS2MULT_SESSION_END,
+};
+
+static struct serio_device_id ps2mult_serio_ids[] = {
+ {
+ .type = SERIO_RS232,
+ .proto = SERIO_PS2MULT,
+ .id = SERIO_ANY,
+ .extra = SERIO_ANY,
+ },
+ { 0 }
+};
+
+MODULE_DEVICE_TABLE(serio, ps2mult_serio_ids);
+
+static int ps2mult_serio_write(struct serio *serio, unsigned char data)
+
+{
+ struct ps2mult *psm = serio_get_drvdata(serio->parent);
+ struct ps2mult_port *psmp = serio->port_data;
+ bool need_escape;
+ unsigned long flags;
+
+ spin_lock_irqsave(&psm->lock, flags);
+ if (psm->out_serio != serio) {
+ psm->serio->write(psm->serio, psmp->sel);
+ psm->out_serio = serio;
+ dev_dbg(&serio->dev, "switched to sel %02x\n", psmp->sel);
+ }
+
+ need_escape = memchr(ps2mult_controls, data, sizeof(ps2mult_controls));
+
+ dev_dbg(&serio->dev, "write: %s%02x\n",
+ need_escape ? "ESC " : "", data);
+
+ if (need_escape)
+ psm->serio->write(psm->serio, PS2MULT_ESCAPE);
+ psm->serio->write(psm->serio, data);
+
+ spin_unlock_irqrestore(&psm->lock, flags);
+
+ return 0;
+}
+
+static void ps2mult_serio_stop(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio->parent);
+ struct ps2mult_port *psmp = serio->port_data;
+
+ unsigned long flags;
+
+ spin_lock_irqsave(&psm->lock, flags);
+
+ psmp->serio = NULL;
+ if (psm->in_serio == serio)
+ psm->in_serio = NULL;
+ if (psm->out_serio == serio)
+ psm->out_serio = NULL;
+
+ spin_unlock_irqrestore(&psm->lock, flags);
+
+}
+
+static int ps2mult_create_port(struct ps2mult *psm, int i)
+{
+ struct serio *serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+ if (!serio)
+ return -ENOMEM;
+
+ strlcpy(serio->name, "TQC PS/2 Multiplexer", sizeof(serio->name));
+ snprintf(serio->phys, sizeof(serio->phys),
+ "%s/port%d", psm->serio->phys, i);
+ serio->id.type = SERIO_8042;
+ serio->id.proto = SERIO_PS2MULT;
+ serio->write = ps2mult_serio_write;
+ serio->stop = ps2mult_serio_stop;
+ serio->parent = psm->serio;
+
+ serio->port_data = &psm->ports[i];
+
+ psm->ports[i].serio = serio;
+ psm->ports[i].sel = ps2mult_controls[i];
+
+ serio_register_port(serio);
+ dev_info(&serio->dev, "%s port at %s\n", serio->name, psm->serio->phys);
+
+ return 0;
+}
+
+static int ps2mult_reconnect(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio);
+ unsigned long flags;
+
+ serio->write(serio, PS2MULT_SESSION_END);
+ serio->write(serio, PS2MULT_SESSION_START);
+
+ spin_lock_irqsave(&psm->lock, flags);
+ psm->out_serio = psm->ports[0].serio;
+ serio->write(serio, psm->ports[0].sel);
+ spin_unlock_irqrestore(&psm->lock, flags);
+
+ return 0;
+}
+
+static void ps2mult_disconnect(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio);
+
+ serio->write(serio, PS2MULT_SESSION_END);
+
+ serio_close(serio);
+ serio_set_drvdata(serio, NULL);
+
+ kfree(psm);
+}
+
+static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
+{
+ struct ps2mult *psm;
+ int i;
+ int rc;
+
+ if (!serio->write)
+ return -EINVAL;
+
+ psm = kzalloc(sizeof(*psm), GFP_KERNEL);
+ if (!psm)
+ return -ENOMEM;
+
+ spin_lock_init(&psm->lock);
+ psm->serio = serio;
+
+ serio_set_drvdata(serio, psm);
+
+ for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
+ rc = ps2mult_create_port(psm, i);
+ if (rc)
+ goto err_out;
+ }
+
+ serio_open(serio, drv);
+
+ rc = ps2mult_reconnect(serio);
+ if (rc)
+ goto err_out;
+
+ return 0;
+
+err_out:
+ ps2mult_disconnect(serio);
+
+ return rc;
+}
+
+static irqreturn_t ps2mult_interrupt(struct serio *serio, unsigned char data,
+ unsigned int flags)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio);
+
+ dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags);
+ if (psm->escape) {
+ spin_lock(&psm->lock);
+ if (psm->in_serio)
+ serio_interrupt(psm->in_serio, data, flags);
+ spin_unlock(&psm->lock);
+
+ psm->escape = 0;
+ } else
+ switch (data) {
+ case PS2MULT_ESCAPE:
+ dev_dbg(&serio->dev, "ESCAPE\n");
+ psm->escape = 1;
+ break;
+ case PS2MULT_BSYNC:
+ dev_dbg(&serio->dev, "BSYNC\n");
+ spin_lock(&psm->lock);
+ psm->in_serio = psm->out_serio;
+ spin_unlock(&psm->lock);
+ break;
+ case PS2MULT_SESSION_START:
+ dev_dbg(&serio->dev, "SS\n");
+ break;
+ case PS2MULT_SESSION_END:
+ dev_dbg(&serio->dev, "SE\n");
+ break;
+ case PS2MULT_KB_SELECTOR:
+ dev_dbg(&serio->dev, "KB\n");
+
+ spin_lock(&psm->lock);
+ psm->in_serio = psm->ports[0].serio;
+ spin_unlock(&psm->lock);
+
+ break;
+ case PS2MULT_MS_SELECTOR:
+ dev_dbg(&serio->dev, "MS\n");
+
+ spin_lock(&psm->lock);
+ psm->in_serio = psm->ports[1].serio;
+ spin_unlock(&psm->lock);
+
+ break;
+ default:
+ spin_lock(&psm->lock);
+ if (psm->in_serio)
+ serio_interrupt(psm->in_serio, data, flags);
+ spin_unlock(&psm->lock);
+ }
+ return IRQ_HANDLED;
+}
+
+static struct serio_driver ps2mult_drv = {
+ .driver = {
+ .name = "ps2mult",
+ },
+ .description = "TQC PS/2 Multiplexer driver",
+ .id_table = ps2mult_serio_ids,
+ .interrupt = ps2mult_interrupt,
+ .connect = ps2mult_connect,
+ .disconnect = ps2mult_disconnect,
+ .reconnect = ps2mult_reconnect,
+};
+
+static int __init ps2mult_init(void)
+{
+ return serio_register_driver(&ps2mult_drv);
+}
+
+static void __exit ps2mult_exit(void)
+{
+ serio_unregister_driver(&ps2mult_drv);
+}
+
+module_init(ps2mult_init);
+module_exit(ps2mult_exit);
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 8e495ba..136863c 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -155,6 +155,7 @@ static inline void serio_continue_rx(struct serio *serio)
#define SERIO_HIL_MLC 0x03
#define SERIO_PS_PSTHRU 0x05
#define SERIO_8042_XL 0x06
+#define SERIO_PS2MULT_T 0x07
/*
* Serio protocols
@@ -199,5 +200,6 @@ static inline void serio_continue_rx(struct serio *serio)
#define SERIO_W8001 0x39
#define SERIO_DYNAPRO 0x3a
#define SERIO_HAMPSHIRE 0x3b
+#define SERIO_PS2MULT 0x3c
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-09-23 16:44 [PATCH v3] serio: add support for PS2Mult multiplexer protocol Dmitry Eremin-Solenikov
@ 2010-09-29 12:45 ` Dmitry Eremin-Solenikov
2010-09-30 6:25 ` Dmitry Torokhov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-09-29 12:45 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:
> PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> into one serial data stream. It's used e.g. on TQM85xx serie of boards.
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>
> It actually depends on "serio: multiple children" patch. I'm not resending it
> as you were the originator of the latest version of the patch.
So, what about this version of patch?
>
> drivers/input/serio/Kconfig | 8 +
> drivers/input/serio/Makefile | 1 +
> drivers/input/serio/ps2mult.c | 283 +++++++++++++++++++++++++++++++++++++++++
> include/linux/serio.h | 2 +
> 4 files changed, 294 insertions(+), 0 deletions(-)
> create mode 100644 drivers/input/serio/ps2mult.c
--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-09-29 12:45 ` Dmitry Eremin-Solenikov
@ 2010-09-30 6:25 ` Dmitry Torokhov
2010-10-07 15:19 ` Dmitry Eremin-Solenikov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2010-09-30 6:25 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> <dbaryshkov@gmail.com> wrote:
> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> >
> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> > ---
> >
> > It actually depends on "serio: multiple children" patch. I'm not resending it
> > as you were the originator of the latest version of the patch.
>
> So, what about this version of patch?
>
Looks better but I think you also need ->start() to make sure you do not
try to deliver events too early. Does the following still work for you?
Thanks.
--
Dmitry
Input: ps2mutl - assorted changes
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/serio/ps2mult.c | 261 +++++++++++++++++++++++------------------
1 files changed, 146 insertions(+), 115 deletions(-)
diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
index bd45e76..3664398 100644
--- a/drivers/input/serio/ps2mult.c
+++ b/drivers/input/serio/ps2mult.c
@@ -31,25 +31,27 @@ struct ps2mult_port {
};
#define PS2MULT_NUM_PORTS 2
+#define PS2MULT_KBD_PORT 0
+#define PS2MULT_MOUSE_PORT 1
struct ps2mult {
- struct serio *serio;
+ struct serio *mx_serio;
struct ps2mult_port ports[PS2MULT_NUM_PORTS];
spinlock_t lock;
- struct serio *in_serio;
- struct serio *out_serio;
+ struct ps2mult_port *in_port;
+ struct ps2mult_port *out_port;
bool escape;
};
-/* First MUST com PS2MULT_NUM_PORTS selectors */
-static unsigned char ps2mult_controls[] = {
+/* First MUST come PS2MULT_NUM_PORTS selectors */
+static const unsigned char ps2mult_controls[] = {
PS2MULT_KB_SELECTOR, PS2MULT_MS_SELECTOR,
PS2MULT_ESCAPE, PS2MULT_BSYNC,
PS2MULT_SESSION_START, PS2MULT_SESSION_END,
};
-static struct serio_device_id ps2mult_serio_ids[] = {
+static const struct serio_device_id ps2mult_serio_ids[] = {
{
.type = SERIO_RS232,
.proto = SERIO_PS2MULT,
@@ -61,113 +63,112 @@ static struct serio_device_id ps2mult_serio_ids[] = {
MODULE_DEVICE_TABLE(serio, ps2mult_serio_ids);
-static int ps2mult_serio_write(struct serio *serio, unsigned char data)
+static void ps2mult_select_port(struct ps2mult *psm, struct ps2mult_port *port)
+{
+ struct serio *mx_serio = psm->mx_serio;
+
+ serio_write(mx_serio, port->sel);
+ psm->out_port = port;
+ dev_dbg(&mx_serio->dev, "switched to sel %02x\n", port->sel);
+}
+static int ps2mult_serio_write(struct serio *serio, unsigned char data)
{
- struct ps2mult *psm = serio_get_drvdata(serio->parent);
- struct ps2mult_port *psmp = serio->port_data;
+ struct serio *mx_port = serio->parent;
+ struct ps2mult *psm = serio_get_drvdata(mx_port);
+ struct ps2mult_port *port = serio->port_data;
bool need_escape;
unsigned long flags;
spin_lock_irqsave(&psm->lock, flags);
- if (psm->out_serio != serio) {
- psm->serio->write(psm->serio, psmp->sel);
- psm->out_serio = serio;
- dev_dbg(&serio->dev, "switched to sel %02x\n", psmp->sel);
- }
+
+ if (psm->out_port != port)
+ ps2mult_select_port(psm, port);
need_escape = memchr(ps2mult_controls, data, sizeof(ps2mult_controls));
- dev_dbg(&serio->dev, "write: %s%02x\n",
- need_escape ? "ESC " : "", data);
+ dev_dbg(&serio->dev,
+ "write: %s%02x\n", need_escape ? "ESC " : "", data);
if (need_escape)
- psm->serio->write(psm->serio, PS2MULT_ESCAPE);
- psm->serio->write(psm->serio, data);
+ serio_write(mx_port, PS2MULT_ESCAPE);
+
+ serio_write(mx_port, data);
spin_unlock_irqrestore(&psm->lock, flags);
return 0;
}
-static void ps2mult_serio_stop(struct serio *serio)
+static int ps2mult_serio_start(struct serio *serio)
{
struct ps2mult *psm = serio_get_drvdata(serio->parent);
- struct ps2mult_port *psmp = serio->port_data;
-
+ struct ps2mult_port *port = serio->port_data;
unsigned long flags;
spin_lock_irqsave(&psm->lock, flags);
+ port->serio = serio;
+ spin_unlock_irqrestore(&psm->lock, flags);
- psmp->serio = NULL;
- if (psm->in_serio == serio)
- psm->in_serio = NULL;
- if (psm->out_serio == serio)
- psm->out_serio = NULL;
+ return 0;
+}
- spin_unlock_irqrestore(&psm->lock, flags);
+static void ps2mult_serio_stop(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio->parent);
+ struct ps2mult_port *port = serio->port_data;
+ unsigned long flags;
+ spin_lock_irqsave(&psm->lock, flags);
+ port->serio = NULL;
+ spin_unlock_irqrestore(&psm->lock, flags);
}
static int ps2mult_create_port(struct ps2mult *psm, int i)
{
- struct serio *serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+ struct serio *mx_serio = psm->mx_serio;
+ struct serio *serio;
+
+ serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!serio)
return -ENOMEM;
strlcpy(serio->name, "TQC PS/2 Multiplexer", sizeof(serio->name));
snprintf(serio->phys, sizeof(serio->phys),
- "%s/port%d", psm->serio->phys, i);
+ "%s/port%d", mx_serio->phys, i);
serio->id.type = SERIO_8042;
serio->id.proto = SERIO_PS2MULT;
serio->write = ps2mult_serio_write;
+ serio->start = ps2mult_serio_start;
serio->stop = ps2mult_serio_stop;
- serio->parent = psm->serio;
-
+ serio->parent = psm->mx_serio;
serio->port_data = &psm->ports[i];
- psm->ports[i].serio = serio;
- psm->ports[i].sel = ps2mult_controls[i];
-
serio_register_port(serio);
- dev_info(&serio->dev, "%s port at %s\n", serio->name, psm->serio->phys);
+ dev_info(&serio->dev, "%s port at %s\n", serio->name, mx_serio->phys);
return 0;
}
-static int ps2mult_reconnect(struct serio *serio)
+static void ps2mult_reset(struct ps2mult *psm)
{
- struct ps2mult *psm = serio_get_drvdata(serio);
unsigned long flags;
- serio->write(serio, PS2MULT_SESSION_END);
- serio->write(serio, PS2MULT_SESSION_START);
-
spin_lock_irqsave(&psm->lock, flags);
- psm->out_serio = psm->ports[0].serio;
- serio->write(serio, psm->ports[0].sel);
- spin_unlock_irqrestore(&psm->lock, flags);
-
- return 0;
-}
-
-static void ps2mult_disconnect(struct serio *serio)
-{
- struct ps2mult *psm = serio_get_drvdata(serio);
- serio->write(serio, PS2MULT_SESSION_END);
+ serio_write(psm->mx_serio, PS2MULT_SESSION_END);
+ serio_write(psm->mx_serio, PS2MULT_SESSION_START);
- serio_close(serio);
- serio_set_drvdata(serio, NULL);
+ ps2mult_select_port(psm, &psm->ports[PS2MULT_KBD_PORT]);
- kfree(psm);
+ spin_unlock_irqrestore(&psm->lock, flags);
}
static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
{
struct ps2mult *psm;
int i;
- int rc;
+ int error;
if (!serio->write)
return -EINVAL;
@@ -177,83 +178,113 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
return -ENOMEM;
spin_lock_init(&psm->lock);
- psm->serio = serio;
+ psm->mx_serio = serio;
- serio_set_drvdata(serio, psm);
-
- for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
- rc = ps2mult_create_port(psm, i);
- if (rc)
+ for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
+ psm->ports[i].sel = ps2mult_controls[i];
+ error = ps2mult_create_port(psm, i);
+ if (error)
goto err_out;
}
- serio_open(serio, drv);
+ psm->in_port = psm->out_port = &psm->ports[PS2MULT_KBD_PORT];
- rc = ps2mult_reconnect(serio);
- if (rc)
+ serio_set_drvdata(serio, psm);
+ error = serio_open(serio, drv);
+ if (error)
goto err_out;
+ ps2mult_reset(psm);
+
+ for (i = 0; i < PS2MULT_NUM_PORTS; i++)
+ serio_register_port(psm->ports[i].serio);
+
return 0;
err_out:
- ps2mult_disconnect(serio);
+ while (--i >= 0)
+ kfree(psm->ports[i].serio);
+ kfree(serio);
+ return error;
+}
+
+static void ps2mult_disconnect(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio);
+
+ /* Note that serio core already take care of children ports */
+ serio_write(serio, PS2MULT_SESSION_END);
+ serio_close(serio);
+ kfree(psm);
- return rc;
+ serio_set_drvdata(serio, NULL);
+}
+
+static int ps2mult_reconnect(struct serio *serio)
+{
+ struct ps2mult *psm = serio_get_drvdata(serio);
+
+ ps2mult_reset(psm);
+
+ return 0;
}
-static irqreturn_t ps2mult_interrupt(struct serio *serio, unsigned char data,
- unsigned int flags)
+static irqreturn_t ps2mult_interrupt(struct serio *serio,
+ unsigned char data, unsigned int dfl)
{
struct ps2mult *psm = serio_get_drvdata(serio);
+ struct ps2mult_port *in_port;
+ unsigned long flags;
+
+ dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, dfl);
+
+ spin_lock_irqsave(&psm->lock, flags);
- dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags);
if (psm->escape) {
- spin_lock(&psm->lock);
- if (psm->in_serio)
- serio_interrupt(psm->in_serio, data, flags);
- spin_unlock(&psm->lock);
-
- psm->escape = 0;
- } else
- switch (data) {
- case PS2MULT_ESCAPE:
- dev_dbg(&serio->dev, "ESCAPE\n");
- psm->escape = 1;
- break;
- case PS2MULT_BSYNC:
- dev_dbg(&serio->dev, "BSYNC\n");
- spin_lock(&psm->lock);
- psm->in_serio = psm->out_serio;
- spin_unlock(&psm->lock);
- break;
- case PS2MULT_SESSION_START:
- dev_dbg(&serio->dev, "SS\n");
- break;
- case PS2MULT_SESSION_END:
- dev_dbg(&serio->dev, "SE\n");
- break;
- case PS2MULT_KB_SELECTOR:
- dev_dbg(&serio->dev, "KB\n");
-
- spin_lock(&psm->lock);
- psm->in_serio = psm->ports[0].serio;
- spin_unlock(&psm->lock);
-
- break;
- case PS2MULT_MS_SELECTOR:
- dev_dbg(&serio->dev, "MS\n");
-
- spin_lock(&psm->lock);
- psm->in_serio = psm->ports[1].serio;
- spin_unlock(&psm->lock);
-
- break;
- default:
- spin_lock(&psm->lock);
- if (psm->in_serio)
- serio_interrupt(psm->in_serio, data, flags);
- spin_unlock(&psm->lock);
- }
+ psm->escape = false;
+ in_port = psm->in_port;
+ if (in_port->serio)
+ serio_interrupt(in_port->serio, data, dfl);
+ goto out;
+ }
+
+ switch (data) {
+ case PS2MULT_ESCAPE:
+ dev_dbg(&serio->dev, "ESCAPE\n");
+ psm->escape = true;
+ break;
+
+ case PS2MULT_BSYNC:
+ dev_dbg(&serio->dev, "BSYNC\n");
+ psm->in_port = psm->out_port;
+ break;
+
+ case PS2MULT_SESSION_START:
+ dev_dbg(&serio->dev, "SS\n");
+ break;
+
+ case PS2MULT_SESSION_END:
+ dev_dbg(&serio->dev, "SE\n");
+ break;
+
+ case PS2MULT_KB_SELECTOR:
+ dev_dbg(&serio->dev, "KB\n");
+ psm->in_port = &psm->ports[PS2MULT_KBD_PORT];
+ break;
+
+ case PS2MULT_MS_SELECTOR:
+ dev_dbg(&serio->dev, "MS\n");
+ psm->in_port = &psm->ports[PS2MULT_MOUSE_PORT];
+ break;
+
+ default:
+ in_port = psm->in_port;
+ if (in_port->serio)
+ serio_interrupt(in_port->serio, data, dfl);
+ }
+
+ out:
+ spin_unlock_irqrestore(&psm->lock, flags);
return IRQ_HANDLED;
}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-09-30 6:25 ` Dmitry Torokhov
@ 2010-10-07 15:19 ` Dmitry Eremin-Solenikov
2010-10-07 16:36 ` Dmitry Torokhov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-10-07 15:19 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
[-- Attachment #1: Type: text/plain, Size: 940 bytes --]
Hello,
On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
>> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
>> <dbaryshkov@gmail.com> wrote:
>> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
>> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
>> >
>> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> > ---
>> >
>> > It actually depends on "serio: multiple children" patch. I'm not resending it
>> > as you were the originator of the latest version of the patch.
>>
>> So, what about this version of patch?
>>
>
> Looks better but I think you also need ->start() to make sure you do not
> try to deliver events too early. Does the following still work for you?
Sorry for the delay. Crashes w/o the attached patch.
--
With best wishes
Dmitry
[-- Attachment #2: 0001-ps2mult-don-t-try-to-register-empty-serio-pointers.patch --]
[-- Type: text/x-patch, Size: 812 bytes --]
From f3307e6693e04285c5be6c9dcf3aabc091f47686 Mon Sep 17 00:00:00 2001
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Date: Thu, 7 Oct 2010 18:32:26 +0400
Subject: [PATCH] ps2mult: don't try to register empty serio pointers
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
drivers/input/serio/ps2mult.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
index 3664398..15341d1 100644
--- a/drivers/input/serio/ps2mult.c
+++ b/drivers/input/serio/ps2mult.c
@@ -196,9 +196,6 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
ps2mult_reset(psm);
- for (i = 0; i < PS2MULT_NUM_PORTS; i++)
- serio_register_port(psm->ports[i].serio);
-
return 0;
err_out:
--
1.7.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-07 15:19 ` Dmitry Eremin-Solenikov
@ 2010-10-07 16:36 ` Dmitry Torokhov
2010-10-08 8:50 ` Dmitry Eremin-Solenikov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2010-10-07 16:36 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
> Hello,
>
> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> >> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> >> <dbaryshkov@gmail.com> wrote:
> >> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> >> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> >> >
> >> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> > ---
> >> >
> >> > It actually depends on "serio: multiple children" patch. I'm not resending it
> >> > as you were the originator of the latest version of the patch.
> >>
> >> So, what about this version of patch?
> >>
> >
> > Looks better but I think you also need ->start() to make sure you do not
> > try to deliver events too early. Does the following still work for you?
>
> Sorry for the delay. Crashes w/o the attached patch.
>
Ah, I see, however what I actually wanted is to create ports before hand
and handle any errors that might arise and then enable the device and
register child ports.
If you apply the patch below instead of yours does it still work?
Thanks.
--
Dmitry
Input: ps2mult - don't register ports twice
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/serio/ps2mult.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
index 3664398..52b58de 100644
--- a/drivers/input/serio/ps2mult.c
+++ b/drivers/input/serio/ps2mult.c
@@ -144,9 +144,6 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
serio->parent = psm->mx_serio;
serio->port_data = &psm->ports[i];
- serio_register_port(serio);
- dev_info(&serio->dev, "%s port at %s\n", serio->name, mx_serio->phys);
-
return 0;
}
@@ -196,8 +193,12 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
ps2mult_reset(psm);
- for (i = 0; i < PS2MULT_NUM_PORTS; i++)
- serio_register_port(psm->ports[i].serio);
+ for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
+ struct serio *s = psm->ports[i].serio;
+
+ dev_info(&serio->dev, "%s port at %s\n", s->name, serio->phys);
+ serio_register_port(s);
+ }
return 0;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-07 16:36 ` Dmitry Torokhov
@ 2010-10-08 8:50 ` Dmitry Eremin-Solenikov
2010-10-14 9:43 ` Dmitry Eremin-Solenikov
2010-10-14 14:23 ` Dmitry Torokhov
0 siblings, 2 replies; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-10-08 8:50 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
Hello,
On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
>> Hello,
>>
>> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
>> <dmitry.torokhov@gmail.com> wrote:
>> > On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
>> >> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
>> >> <dbaryshkov@gmail.com> wrote:
>> >> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
>> >> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
>> >> >
>> >> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> >> > ---
>> >> >
>> >> > It actually depends on "serio: multiple children" patch. I'm not resending it
>> >> > as you were the originator of the latest version of the patch.
>> >>
>> >> So, what about this version of patch?
>> >>
>> >
>> > Looks better but I think you also need ->start() to make sure you do not
>> > try to deliver events too early. Does the following still work for you?
>>
>> Sorry for the delay. Crashes w/o the attached patch.
>>
>
> Ah, I see, however what I actually wanted is to create ports before hand
> and handle any errors that might arise and then enable the device and
> register child ports.
>
> If you apply the patch below instead of yours does it still work?
It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
>
> Thanks.
>
> --
> Dmitry
>
> Input: ps2mult - don't register ports twice
>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> ---
>
> drivers/input/serio/ps2mult.c | 11 ++++++-----
> 1 files changed, 6 insertions(+), 5 deletions(-)
>
>
> diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
> index 3664398..52b58de 100644
> --- a/drivers/input/serio/ps2mult.c
> +++ b/drivers/input/serio/ps2mult.c
> @@ -144,9 +144,6 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
> serio->parent = psm->mx_serio;
> serio->port_data = &psm->ports[i];
>
> - serio_register_port(serio);
> - dev_info(&serio->dev, "%s port at %s\n", serio->name, mx_serio->phys);
> -
> return 0;
> }
>
> @@ -196,8 +193,12 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
>
> ps2mult_reset(psm);
>
> - for (i = 0; i < PS2MULT_NUM_PORTS; i++)
> - serio_register_port(psm->ports[i].serio);
> + for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
> + struct serio *s = psm->ports[i].serio;
> +
> + dev_info(&serio->dev, "%s port at %s\n", s->name, serio->phys);
> + serio_register_port(s);
> + }
>
> return 0;
>
>
--
With best wishes
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-08 8:50 ` Dmitry Eremin-Solenikov
@ 2010-10-14 9:43 ` Dmitry Eremin-Solenikov
2010-10-14 14:23 ` Dmitry Torokhov
1 sibling, 0 replies; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-10-14 9:43 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
On Fri, Oct 8, 2010 at 12:50 PM, Dmitry Eremin-Solenikov
<dbaryshkov@gmail.com> wrote:
> Hello,
>
> On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
>>> Hello,
>>>
>>> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
>>> <dmitry.torokhov@gmail.com> wrote:
>>> > On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
>>> >> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
>>> >> <dbaryshkov@gmail.com> wrote:
>>> >> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
>>> >> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
>>> >> >
>>> >> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>>> >> > ---
>>> >> >
>>> >> > It actually depends on "serio: multiple children" patch. I'm not resending it
>>> >> > as you were the originator of the latest version of the patch.
>>> >>
>>> >> So, what about this version of patch?
>>> >>
>>> >
>>> > Looks better but I think you also need ->start() to make sure you do not
>>> > try to deliver events too early. Does the following still work for you?
>>>
>>> Sorry for the delay. Crashes w/o the attached patch.
>>>
>>
>> Ah, I see, however what I actually wanted is to create ports before hand
>> and handle any errors that might arise and then enable the device and
>> register child ports.
>>
>> If you apply the patch below instead of yours does it still work?
>
> It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
ping?
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-08 8:50 ` Dmitry Eremin-Solenikov
2010-10-14 9:43 ` Dmitry Eremin-Solenikov
@ 2010-10-14 14:23 ` Dmitry Torokhov
2010-10-18 11:24 ` Dmitry Eremin-Solenikov
1 sibling, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2010-10-14 14:23 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Fri, Oct 08, 2010 at 12:50:34PM +0400, Dmitry Eremin-Solenikov wrote:
> Hello,
>
> On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
> >> Hello,
> >>
> >> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
> >> <dmitry.torokhov@gmail.com> wrote:
> >> > On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> >> >> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> >> >> <dbaryshkov@gmail.com> wrote:
> >> >> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> >> >> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> >> >> >
> >> >> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> >> > ---
> >> >> >
> >> >> > It actually depends on "serio: multiple children" patch. I'm not resending it
> >> >> > as you were the originator of the latest version of the patch.
> >> >>
> >> >> So, what about this version of patch?
> >> >>
> >> >
> >> > Looks better but I think you also need ->start() to make sure you do not
> >> > try to deliver events too early. Does the following still work for you?
> >>
> >> Sorry for the delay. Crashes w/o the attached patch.
> >>
> >
> > Ah, I see, however what I actually wanted is to create ports before hand
> > and handle any errors that might arise and then enable the device and
> > register child ports.
> >
> > If you apply the patch below instead of yours does it still work?
>
> It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
>
Indeed. I guess we need to set the pointer immediately then and also add
a flag to the port structure telling whether it has been registered.
Does the following work for you by any chance?
Thanks.
--
Dmitry
Input: ps2mult - don't register ports twice
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/serio/ps2mult.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
index 3664398..ec8f8c1 100644
--- a/drivers/input/serio/ps2mult.c
+++ b/drivers/input/serio/ps2mult.c
@@ -28,6 +28,7 @@ MODULE_LICENSE("GPL");
struct ps2mult_port {
struct serio *serio;
unsigned char sel;
+ bool registered;
};
#define PS2MULT_NUM_PORTS 2
@@ -107,7 +108,7 @@ static int ps2mult_serio_start(struct serio *serio)
unsigned long flags;
spin_lock_irqsave(&psm->lock, flags);
- port->serio = serio;
+ port->registered = true;
spin_unlock_irqrestore(&psm->lock, flags);
return 0;
@@ -120,7 +121,7 @@ static void ps2mult_serio_stop(struct serio *serio)
unsigned long flags;
spin_lock_irqsave(&psm->lock, flags);
- port->serio = NULL;
+ port->registered = false;
spin_unlock_irqrestore(&psm->lock, flags);
}
@@ -144,8 +145,7 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
serio->parent = psm->mx_serio;
serio->port_data = &psm->ports[i];
- serio_register_port(serio);
- dev_info(&serio->dev, "%s port at %s\n", serio->name, mx_serio->phys);
+ psm->ports[i].serio = serio;
return 0;
}
@@ -196,8 +196,12 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
ps2mult_reset(psm);
- for (i = 0; i < PS2MULT_NUM_PORTS; i++)
- serio_register_port(psm->ports[i].serio);
+ for (i = 0; i < PS2MULT_NUM_PORTS; i++) {
+ struct serio *s = psm->ports[i].serio;
+
+ dev_info(&serio->dev, "%s port at %s\n", s->name, serio->phys);
+ serio_register_port(s);
+ }
return 0;
@@ -243,7 +247,7 @@ static irqreturn_t ps2mult_interrupt(struct serio *serio,
if (psm->escape) {
psm->escape = false;
in_port = psm->in_port;
- if (in_port->serio)
+ if (in_port->registered)
serio_interrupt(in_port->serio, data, dfl);
goto out;
}
@@ -279,8 +283,9 @@ static irqreturn_t ps2mult_interrupt(struct serio *serio,
default:
in_port = psm->in_port;
- if (in_port->serio)
+ if (in_port->registered)
serio_interrupt(in_port->serio, data, dfl);
+ break;
}
out:
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-14 14:23 ` Dmitry Torokhov
@ 2010-10-18 11:24 ` Dmitry Eremin-Solenikov
2010-10-18 15:56 ` Dmitry Torokhov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-10-18 11:24 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
Hello,
On 14.10.2010 18:23, Dmitry Torokhov wrote:
> On Fri, Oct 08, 2010 at 12:50:34PM +0400, Dmitry Eremin-Solenikov wrote:
>> Hello,
>>
>> On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
>> <dmitry.torokhov@gmail.com> wrote:
>>> On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
>>>> Hello,
>>>>
>>>> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
>>>> <dmitry.torokhov@gmail.com> wrote:
>>>>> On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
>>>>>> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
>>>>>> <dbaryshkov@gmail.com> wrote:
>>>>>>> PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
>>>>>>> into one serial data stream. It's used e.g. on TQM85xx serie of boards.
>>>>>>>
>>>>>>> Signed-off-by: Dmitry Eremin-Solenikov<dbaryshkov@gmail.com>
>>>>>>> ---
>>>>>>>
>>>>>>> It actually depends on "serio: multiple children" patch. I'm not resending it
>>>>>>> as you were the originator of the latest version of the patch.
>>>>>>
>>>>>> So, what about this version of patch?
>>>>>>
>>>>>
>>>>> Looks better but I think you also need ->start() to make sure you do not
>>>>> try to deliver events too early. Does the following still work for you?
>>>>
>>>> Sorry for the delay. Crashes w/o the attached patch.
>>>>
>>>
>>> Ah, I see, however what I actually wanted is to create ports before hand
>>> and handle any errors that might arise and then enable the device and
>>> register child ports.
>>>
>>> If you apply the patch below instead of yours does it still work?
>>
>> It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
>>
>
> Indeed. I guess we need to set the pointer immediately then and also add
> a flag to the port structure telling whether it has been registered.
> Does the following work for you by any chance?
Yeah, works w/o any glitches. Thank you.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-18 11:24 ` Dmitry Eremin-Solenikov
@ 2010-10-18 15:56 ` Dmitry Torokhov
2010-10-18 16:11 ` Dmitry Torokhov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2010-10-18 15:56 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Mon, Oct 18, 2010 at 03:24:51PM +0400, Dmitry Eremin-Solenikov wrote:
> Hello,
>
> On 14.10.2010 18:23, Dmitry Torokhov wrote:
> >On Fri, Oct 08, 2010 at 12:50:34PM +0400, Dmitry Eremin-Solenikov wrote:
> >>Hello,
> >>
> >>On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
> >><dmitry.torokhov@gmail.com> wrote:
> >>>On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
> >>>>Hello,
> >>>>
> >>>>On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
> >>>><dmitry.torokhov@gmail.com> wrote:
> >>>>>On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> >>>>>>On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> >>>>>><dbaryshkov@gmail.com> wrote:
> >>>>>>>PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> >>>>>>>into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> >>>>>>>
> >>>>>>>Signed-off-by: Dmitry Eremin-Solenikov<dbaryshkov@gmail.com>
> >>>>>>>---
> >>>>>>>
> >>>>>>>It actually depends on "serio: multiple children" patch. I'm not resending it
> >>>>>>>as you were the originator of the latest version of the patch.
> >>>>>>
> >>>>>>So, what about this version of patch?
> >>>>>>
> >>>>>
> >>>>>Looks better but I think you also need ->start() to make sure you do not
> >>>>>try to deliver events too early. Does the following still work for you?
> >>>>
> >>>>Sorry for the delay. Crashes w/o the attached patch.
> >>>>
> >>>
> >>>Ah, I see, however what I actually wanted is to create ports before hand
> >>>and handle any errors that might arise and then enable the device and
> >>>register child ports.
> >>>
> >>>If you apply the patch below instead of yours does it still work?
> >>
> >>It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
> >>
> >
> >Indeed. I guess we need to set the pointer immediately then and also add
> >a flag to the port structure telling whether it has been registered.
> >Does the following work for you by any chance?
>
> Yeah, works w/o any glitches. Thank you.
>
Thanks Dmitry.
--
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-18 15:56 ` Dmitry Torokhov
@ 2010-10-18 16:11 ` Dmitry Torokhov
2010-10-21 20:54 ` Dmitry Eremin-Solenikov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Torokhov @ 2010-10-18 16:11 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Mon, Oct 18, 2010 at 08:56:27AM -0700, Dmitry Torokhov wrote:
> On Mon, Oct 18, 2010 at 03:24:51PM +0400, Dmitry Eremin-Solenikov wrote:
> > Hello,
> >
> > On 14.10.2010 18:23, Dmitry Torokhov wrote:
> > >On Fri, Oct 08, 2010 at 12:50:34PM +0400, Dmitry Eremin-Solenikov wrote:
> > >>Hello,
> > >>
> > >>On Thu, Oct 7, 2010 at 8:36 PM, Dmitry Torokhov
> > >><dmitry.torokhov@gmail.com> wrote:
> > >>>On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
> > >>>>Hello,
> > >>>>
> > >>>>On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
> > >>>><dmitry.torokhov@gmail.com> wrote:
> > >>>>>On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> > >>>>>>On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> > >>>>>><dbaryshkov@gmail.com> wrote:
> > >>>>>>>PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> > >>>>>>>into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> > >>>>>>>
> > >>>>>>>Signed-off-by: Dmitry Eremin-Solenikov<dbaryshkov@gmail.com>
> > >>>>>>>---
> > >>>>>>>
> > >>>>>>>It actually depends on "serio: multiple children" patch. I'm not resending it
> > >>>>>>>as you were the originator of the latest version of the patch.
> > >>>>>>
> > >>>>>>So, what about this version of patch?
> > >>>>>>
> > >>>>>
> > >>>>>Looks better but I think you also need ->start() to make sure you do not
> > >>>>>try to deliver events too early. Does the following still work for you?
> > >>>>
> > >>>>Sorry for the delay. Crashes w/o the attached patch.
> > >>>>
> > >>>
> > >>>Ah, I see, however what I actually wanted is to create ports before hand
> > >>>and handle any errors that might arise and then enable the device and
> > >>>register child ports.
> > >>>
> > >>>If you apply the patch below instead of yours does it still work?
> > >>
> > >>It won't work, as we don't set psm->ports[i].serio before ps2mult_serio_start()
> > >>
> > >
> > >Indeed. I guess we need to set the pointer immediately then and also add
> > >a flag to the port structure telling whether it has been registered.
> > >Does the following work for you by any chance?
> >
> > Yeah, works w/o any glitches. Thank you.
> >
>
> Thanks Dmitry.
>
BTW, is there corresponding patches to inputattach?
--
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-18 16:11 ` Dmitry Torokhov
@ 2010-10-21 20:54 ` Dmitry Eremin-Solenikov
2010-10-22 4:57 ` Dmitry Torokhov
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-10-21 20:54 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
[-- Attachment #1: Type: text/plain, Size: 181 bytes --]
On Mon, Oct 18, 2010 at 8:11 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> BTW, is there corresponding patches to inputattach?
>
Attached.
--
With best wishes
Dmitry
[-- Attachment #2: support-ps2mult.patch --]
[-- Type: application/octet-stream, Size: 1029 bytes --]
Index: joystick-20051019/utils/inputattach.c
===================================================================
--- joystick-20051019.orig/utils/inputattach.c 2010-07-15 16:22:42.055006642 +0400
+++ joystick-20051019/utils/inputattach.c 2010-07-15 16:22:45.243005398 +0400
@@ -536,6 +536,9 @@
{ "--fujitsu", "-fjt", "Fujitsu serial touchscreen",
B9600, CS8,
SERIO_FUJITSU, 0x00, 0x00, 1, fujitsu_init },
+{ "--ps2mult", "-ps2m", "PS/2 serial multiplexer",
+ B57600, CS8,
+ SERIO_PS2MULT, 0x00, 0x00, 1, NULL },
{ "--dump", "-dump", "Just enable device",
B2400, CS8,
0, 0x00, 0x00, 0, dump_init },
Index: joystick-20051019/utils/serio-ids.h
===================================================================
--- joystick-20051019.orig/utils/serio-ids.h 2010-07-15 16:20:58.659005602 +0400
+++ joystick-20051019/utils/serio-ids.h 2010-07-15 16:21:17.007007397 +0400
@@ -122,5 +122,8 @@
#ifndef SERIO_W8001
# define SERIO_W8001 0x39
#endif
+#ifndef SERIO_PSMULT
+# define SERIO_PS2MULT 0x3c
+#endif
#endif
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
2010-10-21 20:54 ` Dmitry Eremin-Solenikov
@ 2010-10-22 4:57 ` Dmitry Torokhov
0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Torokhov @ 2010-10-22 4:57 UTC (permalink / raw)
To: Dmitry Eremin-Solenikov; +Cc: linux-input
On Fri, Oct 22, 2010 at 12:54:45AM +0400, Dmitry Eremin-Solenikov wrote:
> On Mon, Oct 18, 2010 at 8:11 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > BTW, is there corresponding patches to inputattach?
> >
>
> Attached.
>
Thank you. Could I get your sign off for it as well, please?
--
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2010-10-22 4:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 16:44 [PATCH v3] serio: add support for PS2Mult multiplexer protocol Dmitry Eremin-Solenikov
2010-09-29 12:45 ` Dmitry Eremin-Solenikov
2010-09-30 6:25 ` Dmitry Torokhov
2010-10-07 15:19 ` Dmitry Eremin-Solenikov
2010-10-07 16:36 ` Dmitry Torokhov
2010-10-08 8:50 ` Dmitry Eremin-Solenikov
2010-10-14 9:43 ` Dmitry Eremin-Solenikov
2010-10-14 14:23 ` Dmitry Torokhov
2010-10-18 11:24 ` Dmitry Eremin-Solenikov
2010-10-18 15:56 ` Dmitry Torokhov
2010-10-18 16:11 ` Dmitry Torokhov
2010-10-21 20:54 ` Dmitry Eremin-Solenikov
2010-10-22 4:57 ` Dmitry Torokhov
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).