* [PATCH] input: Use platform-provided devices as i8042 serio parents
@ 2014-02-23 17:03 Matthew Garrett
2014-03-07 17:54 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Garrett @ 2014-02-23 17:03 UTC (permalink / raw)
To: dmitry.torokhov
Cc: linux-input, linux-kernel, benjamin.tissoires, Matthew Garrett
i8042 devices exposed via platform firmware interfaces such as ACPI or
Device Tree may provide additional information of use to userspace. Right
now we don't associate the serio devices with the firmware device, and so
there's no straightforward way for userspace to make use of that
information. This patch simply moves the serio parent device to the firmware
provided device.
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
drivers/input/serio/i8042-sparcio.h | 2 ++
drivers/input/serio/i8042-x86ia64io.h | 2 ++
drivers/input/serio/i8042.c | 12 ++++++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index d6aa4c6..7bd8e2c 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -65,6 +65,7 @@ static int sparc_i8042_probe(struct platform_device *op)
kbd_iobase = of_ioremap(&kbd->resource[0],
0, 8, "kbd");
kbd_res = &kbd->resource[0];
+ i8042_kbd_parent = &kbd->dev;
} else if (!strcmp(dp->name, OBP_PS2MS_NAME1) ||
!strcmp(dp->name, OBP_PS2MS_NAME2)) {
struct platform_device *ms = of_find_device_by_node(dp);
@@ -72,6 +73,7 @@ static int sparc_i8042_probe(struct platform_device *op)
if (irq == 0xffffffff)
irq = op->archdata.irqs[0];
i8042_aux_irq = irq;
+ i8042_aux_parent = &ms->dev;
}
dp = dp->sibling;
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 0ec9abb..47dcdf1 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -723,6 +723,7 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
device_set_wakeup_enable(&dev->dev, true);
i8042_pnp_kbd_devices++;
+ i8042_kbd_parent = &dev->dev;
return 0;
}
@@ -744,6 +745,7 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
}
i8042_pnp_aux_devices++;
+ i8042_aux_parent = &dev->dev;
return 0;
}
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 020053f..86da76f 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
#endif
static bool i8042_bypass_aux_irq_test;
+static struct device *i8042_kbd_parent;
+static struct device *i8042_aux_parent;
#include "i8042.h"
@@ -1215,7 +1217,10 @@ static int __init i8042_create_kbd_port(void)
serio->stop = i8042_stop;
serio->close = i8042_port_close;
serio->port_data = port;
- serio->dev.parent = &i8042_platform_device->dev;
+ if (i8042_kbd_parent)
+ serio->dev.parent = i8042_kbd_parent;
+ else
+ serio->dev.parent = &i8042_platform_device->dev;
strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name));
strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys));
@@ -1240,7 +1245,10 @@ static int __init i8042_create_aux_port(int idx)
serio->start = i8042_start;
serio->stop = i8042_stop;
serio->port_data = port;
- serio->dev.parent = &i8042_platform_device->dev;
+ if (i8042_aux_parent)
+ serio->dev.parent = i8042_aux_parent;
+ else
+ serio->dev.parent = &i8042_platform_device->dev;
if (idx < 0) {
strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name));
strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys));
--
1.8.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: Use platform-provided devices as i8042 serio parents
2014-02-23 17:03 [PATCH] input: Use platform-provided devices as i8042 serio parents Matthew Garrett
@ 2014-03-07 17:54 ` Dmitry Torokhov
2014-03-07 19:24 ` Matthew Garrett
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2014-03-07 17:54 UTC (permalink / raw)
To: Matthew Garrett; +Cc: linux-input, linux-kernel, benjamin.tissoires
Hi Matthew,
On Sun, Feb 23, 2014 at 12:03:16PM -0500, Matthew Garrett wrote:
> i8042 devices exposed via platform firmware interfaces such as ACPI or
> Device Tree may provide additional information of use to userspace. Right
> now we don't associate the serio devices with the firmware device, and so
> there's no straightforward way for userspace to make use of that
> information. This patch simply moves the serio parent device to the firmware
> provided device.
Hmm, are we sure it will not mess up power management now that children
serio ports are disconnected from i8042 device?
I also wonder if we need to restructure the whole thing so that we
create AUX and KBD ports separately and convert i8042 code into a
library of sorts...
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] input: Use platform-provided devices as i8042 serio parents
2014-03-07 17:54 ` Dmitry Torokhov
@ 2014-03-07 19:24 ` Matthew Garrett
0 siblings, 0 replies; 3+ messages in thread
From: Matthew Garrett @ 2014-03-07 19:24 UTC (permalink / raw)
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
benjamin.tissoires@redhat.com
On Fri, 2014-03-07 at 09:54 -0800, Dmitry Torokhov wrote:
> Hi Matthew,
>
> On Sun, Feb 23, 2014 at 12:03:16PM -0500, Matthew Garrett wrote:
> > i8042 devices exposed via platform firmware interfaces such as ACPI or
> > Device Tree may provide additional information of use to userspace. Right
> > now we don't associate the serio devices with the firmware device, and so
> > there's no straightforward way for userspace to make use of that
> > information. This patch simply moves the serio parent device to the firmware
> > provided device.
>
> Hmm, are we sure it will not mess up power management now that children
> serio ports are disconnected from i8042 device?
Urh. Yeah, that's a point - we probably no longer guarantee that the
i8042 resume code runs before any driver resume code. That's
inconvenient. We could probably add resume callbacks to the PNP devices,
but then we need to ensure that they only run once. I think we can do
that without too much trouble, but it's not going to be beautiful.
--
Matthew Garrett <matthew.garrett@nebula.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-07 19:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 17:03 [PATCH] input: Use platform-provided devices as i8042 serio parents Matthew Garrett
2014-03-07 17:54 ` Dmitry Torokhov
2014-03-07 19:24 ` Matthew Garrett
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).