Add OLPC AP-SP input driver
Subsystems (3)
PATCH v3 1/1 Add OLPC AP-SP input driver
The OLPC XO-1.75 and XO-4 laptops include a PS/2 touchpad and an AT keyboard, yet they do not have a hardware PS/2 controller. Instead, a firmware runs on a dedicated core ("Security Processor", part of the SoC) that acts as a PS/2 controller through bit-banging.
Communication between the main cpu (Application Processor) and the Security Processor happens via a standard command mechanism implemented by the SoC. Add a driver for this interface to enable keyboard/mouse input on this platform.
Original author: Saadia Baloch
--- .../devicetree/bindings/serio/olpc,ap-sp.txt | 13 + drivers/input/serio/Kconfig | 10 + drivers/input/serio/Makefile | 1 + drivers/input/serio/olpc_apsp.c | 280 +++++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 Documentation/devicetree/bindings/serio/olpc,ap-sp.txt create mode 100644 drivers/input/serio/olpc_apsp.c
v2: Use dev_dbg(). Disable interrupts during unload, and remove bad use of devm.
v3: Avoid sleep in write function. Reference count open/close operations as both ports share the same interrupt. Fix devm_ioremap_resource() error handling. Use SERIO_8042 type. Only register IRQ handler after port structure is ready.
Documentation/devicetree/bindings/serio/olpc,ap-sp.txt new file +13 -0
@@ -0,0 +1,13 @@ +OLPC AP-SP serio interface + +Required properties: +- compatible : "olpc,ap-sp" +- reg : base address and length of SoC's WTM registers +- interrupts : SP-AP interrupt + +Example: + ap-sp@d4290000 { + compatible = "olpc,ap-sp"; + reg = <0xd4290000 0x1000>; + interrupts = <40>; + }
drivers/input/serio/Kconfig +10 -0
@@ -256,4 +256,14 @@ config SERIO_APBPS2 To compile this driver as a module, choose M here: the module will be called apbps2. +config SERIO_OLPC_APSP + tristate "OLPC AP-SP input support" + depends on OF + help + Say Y here if you want support for the keyboard and touchpad included + in the OLPC XO-1.75 and XO-4 laptops. + + To compile this driver as a module, choose M here: the module will + be called olpc_apsp. + endif
drivers/input/serio/Makefile +1 -0
@@ -27,3 +27,4 @@ obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o obj-$(CONFIG_SERIO_ARC_PS2) += arc_ps2.o obj-$(CONFIG_SERIO_APBPS2) += apbps2.o +obj-$(CONFIG_SERIO_OLPC_APSP) += olpc_apsp.o
drivers/input/serio/olpc_apsp.c new file +280 -0
280 lines not on this page · raw message
Signature · 1 line
1.8.1.4
Dmitry Torokhov
maintainerHi Daniel,
Quoted 10 lines · Daniel Drake
drivers/input/serio/olpc_apsp.c new file +10
-0+static int olpc_apsp_open (struct serio *port) +{ +struct olpc_apsp *priv = port->port_data; +unsigned int tmp; + +if (priv->open_count++ ==0 ) { +/* Enable interrupt 0 by clearing its bit */ + tmp =readl (priv->base +PJ_INTERRUPT_MASK ); +writel (tmp & ~INT_0 , priv->base +PJ_INTERRUPT_MASK ); + }
drivers/input/serio/olpc_apsp.c line 161
Quoted 10 lines
drivers/input/serio/olpc_apsp.c new file +10
-0+ +return 0 ; +} + +static void olpc_apsp_close (struct serio *port) +{ +struct olpc_apsp *priv = port->port_data; +unsigned int tmp; + +if (--priv->open_count ==0 ) {
Both need locking. It looks like you need the song and dance similar to what i8042 has to do with it's multiplexed ports. Or ps2mult.c...
Signature · 1 line
Dmitry
Quoted 9 lines · Dmitry Torokhov
drivers/input/serio/olpc_apsp.c line 161
Quoted 6 lines
drivers/input/serio/olpc_apsp.c new file +6
-0+static void olpc_apsp_close (struct serio *port) +{ +struct olpc_apsp *priv = port->port_data; +unsigned int tmp; + +if (--priv->open_count ==0 ) {Both need locking. It looks like you need the song and dance similar to what i8042 has to do with it's multiplexed ports. Or
ps2mult.c...
I thought they would both be locked already, due to this comment in serio.c:
/* called from serio_driver->connect/disconnect methods under serio_mutex */
Or am I missing something there?
Thanks
Daniel
Dmitry Torokhov
maintainerQuoted 12 lines · Daniel Drake
Quoted 9 lines · Dmitry Torokhov
drivers/input/serio/olpc_apsp.c line 161
Quoted 6 lines
drivers/input/serio/olpc_apsp.c new file +6
-0+static void olpc_apsp_close (struct serio *port) +{ +struct olpc_apsp *priv = port->port_data; +unsigned int tmp; + +if (--priv->open_count ==0 ) {Both need locking. It looks like you need the song and dance similar to what i8042 has to do with it's multiplexed ports. Or
ps2mult.c...
Quoted 5 lines
I thought they would both be locked already, due to this comment in
serio.c:/* called from serio_driver->connect/disconnect methods under
serio_mutex*/Or am I missing something there?
Hmm, you are right... I'll add a comment there to remind myself.
Signature · 1 line
Dmitry