goldfish: virtual input event driver
Subsystems (3)
PATCH 1/1 goldfish: virtual input event driver
From: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
---
drivers/input/keyboard/Kconfig | 10 ++ drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/goldfish_events.c | 186 ++++++++++++++++++++++++++++++ drivers/tty/goldfish.c | 19 +-- 4 files changed, 204 insertions(+), 12 deletions(-) create mode 100644 drivers/input/keyboard/goldfish_events.c
drivers/input/keyboard/Kconfig +10 -0
@@ -482,6 +482,16 @@ config KEYBOARD_SAMSUNG To compile this driver as a module, choose M here: the module will be called samsung-keypad. +config KEYBOARD_GOLDFISH_EVENTS + depends on GOLDFISH + tristate "Generic Input Event device for Goldfish" + help + Say Y here to get an input event device for the Goldfish virtual + device emulator. + + To compile this driver as a module, choose M here: the + module will be called goldfish-events. + if TTY config KEYBOARD_STOWAWAY
drivers/input/keyboard/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o +obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
drivers/input/keyboard/goldfish_events.c new file +186 -0
186 lines not on this page · raw message
drivers/tty/goldfish.c +7 -12
@@ -72,23 +72,18 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void *dev_id)unsigned long irq_flags;unsigned char *buf;u32 count; -struct tty_struct *tty; count =readl (base +GOLDFISH_TTY_BYTES_READY );if (count ==0 )return IRQ_NONE ; - tty =tty_port_tty_get (&qtty->port); -if (tty) { - count =tty_prepare_flip_string (tty, &buf, count); -spin_lock_irqsave (&qtty->lock, irq_flags); -writel ((u32 )buf, base +GOLDFISH_TTY_DATA_PTR ); -writel (count, base +GOLDFISH_TTY_DATA_LEN ); -writel (GOLDFISH_TTY_CMD_READ_BUFFER , base +GOLDFISH_TTY_CMD ); -spin_unlock_irqrestore (&qtty->lock, irq_flags); -tty_schedule_flip (tty); -tty_kref_put (tty); - } + count =tty_prepare_flip_string (&qtty->port, &buf, count); +spin_lock_irqsave (&qtty->lock, irq_flags); +writel ((u32 )buf, base +GOLDFISH_TTY_DATA_PTR ); +writel (count, base +GOLDFISH_TTY_DATA_LEN ); +writel (GOLDFISH_TTY_CMD_READ_BUFFER , base +GOLDFISH_TTY_CMD ); +spin_unlock_irqrestore (&qtty->lock, irq_flags); +tty_schedule_flip (&qtty->port);return IRQ_HANDLED ; }
Dmitry Torokhov
maintainerHi Alan,
Quoted 8 lines · Alan Cox
From: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
Quoted 11 lines
Signed-off-by Mike A. Chan <[email protected]>[Tided up to work on x86]Signed-off-by Sheng Yang <[email protected]>Signed-off-by Yunhong Jiang <[email protected]>Signed-off-by Xiaohui Xin <[email protected]>Signed-off-by Jun Nakajima <[email protected]>Signed-off-by Bruce Beare <[email protected]>[Ported to 3.4]Signed-off-by Tom Keel <[email protected]>[Cleaned up for 3.7 and submission]Signed-off-by Alan Cox <[email protected]>
I do not have drivers/tty/goldfish.c so I dropped that change... I also had a few more cleanups, the result is below.
I know you stepping away for a while so unless I hear from you in a day or so I will apply the patch as is.
Thanks!
Signature · 30 lines
Dmitry Input: goldfish - virtual input event driver From: Brian Swetland <[email protected]> This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!). As with the other submissions this driver is cross architecture. Signed-off-by: Mike A. Chan <[email protected]> [Tided up to work on x86] Signed-off-by: Sheng Yang <[email protected]> Signed-off-by: Yunhong Jiang <[email protected]> Signed-off-by: Xiaohui Xin <[email protected]> Signed-off-by: Jun Nakajima <[email protected]> Signed-off-by: Bruce Beare <[email protected]> [Ported to 3.4] Signed-off-by: Tom Keel <[email protected]> [Cleaned up for 3.7 and submission] Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> --- drivers/input/keyboard/Kconfig | 10 ++ drivers/input/keyboard/Makefile | 1 drivers/input/keyboard/goldfish_events.c | 194 ++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 drivers/input/keyboard/goldfish_events.c
drivers/input/keyboard/Kconfig +10 -0
@@ -488,6 +488,16 @@ config KEYBOARD_SAMSUNG To compile this driver as a module, choose M here: the module will be called samsung-keypad. +config KEYBOARD_GOLDFISH_EVENTS + depends on GOLDFISH + tristate "Generic Input Event device for Goldfish" + help + Say Y here to get an input event device for the Goldfish virtual + device emulator. + + To compile this driver as a module, choose M here: the + module will be called goldfish-events. + config KEYBOARD_STOWAWAY tristate "Stowaway keyboard" select SERIO
drivers/input/keyboard/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o +obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS) += goldfish_events.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o
drivers/input/keyboard/goldfish_events.c new file +194 -0
194 lines not on this page · raw message
Quoted 23 lines · On Wed, 23 Jan 2013 20:15:47 -0800 Dmitry Torokhov <[email protected]>…
Hi Alan,
Quoted 8 lines · Alan Cox
From: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
Quoted 11 lines
Signed-off-by Mike A. Chan <[email protected]>[Tided up to work on x86]Signed-off-by Sheng Yang <[email protected]>Signed-off-by Yunhong Jiang <[email protected]>Signed-off-by Xiaohui Xin <[email protected]>Signed-off-by Jun Nakajima <[email protected]>Signed-off-by Bruce Beare <[email protected]>[Ported to 3.4]Signed-off-by Tom Keel <[email protected]>[Cleaned up for 3.7 and submission]Signed-off-by Alan Cox <[email protected]>
Quoted 2 lines
I do not have
drivers/tty/goldfish.cso I dropped that change... I also had a few more cleanups, the result is below.
Looks good to me - I wasn't sure about the remove method so I copied the other keyboard drivers that still had one even though they used devm_ methods for the allocation.
Alan
Dmitry Torokhov
maintainerQuoted 26 lines · Alan Cox
Quoted 23 lines · On Wed, 23 Jan 2013 20:15:47 -0800 Dmitry Torokhov <[email protected]>…
Hi Alan,
Quoted 19 lines · Alan Cox
From: Brian Swetland <[email protected]>
This device is a direct pipe from "hardware" to the input event subsystem, allowing us to avoid having to route "keypad" style events through an AT keyboard driver (gross!)
As with the other submissions this driver is cross architecture.
Signed-off-by Mike A. Chan <[email protected]>[Tided up to work on x86]Signed-off-by Sheng Yang <[email protected]>Signed-off-by Yunhong Jiang <[email protected]>Signed-off-by Xiaohui Xin <[email protected]>Signed-off-by Jun Nakajima <[email protected]>Signed-off-by Bruce Beare <[email protected]>[Ported to 3.4]Signed-off-by Tom Keel <[email protected]>[Cleaned up for 3.7 and submission]Signed-off-by Alan Cox <[email protected]>
Quoted 7 lines
Quoted 2 lines
I do not have
drivers/tty/goldfish.cso I dropped that change... I also had a few more cleanups, the result is below.Looks good to me - I wasn't sure about the remove method so I copied the other keyboard drivers that still had one even though they used
devm_methods for the allocation.
Probably because some other resources are not devm managed and we need to preserve order. Or maybe just bugs...
Thanks.
Signature · 1 line
Dmitry