input: goldfish_events: add devicetree bindings
Subsystems (3)
PATCH 1/3 input: goldfish_events: add devicetree bindings
From: Greg Hackmann <[email protected]>
Add device tree bindings to the Goldfish virtual platform event driver.
--- .../devicetree/bindings/goldfish/events.txt | 17 +++++++++++++++++ drivers/input/keyboard/goldfish_events.c | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/goldfish/events.txt
Documentation/devicetree/bindings/goldfish/events.txt new file +17 -0
@@ -0,0 +1,17 @@ +Android Goldfish Events Keypad + +Android goldfish events keypad device generated by android emulator. + +Required properties: + +- compatible : should contain "google,goldfish-events-keypad" to match emulator +- reg : <registers mapping> +- interrupts : <interrupt mapping> + +Example: + + goldfish-events@9040000 { + compatible = "google,goldfish-events-keypad"; + reg = <0x9040000 0x1000>; + interrupts = <0x5>; + };
drivers/input/keyboard/goldfish_events.c +7 -0
@@ -178,10 +178,17 @@ static int events_probe(struct platform_device *pdev)return 0 ; } +static const struct of_device_id goldfish_events_of_match[] = { + { .compatible ="google,goldfish-events-keypad" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, goldfish_events_of_match); +static struct platform_driver events_driver = { .probe = events_probe, .driver = { .name ="goldfish_events" , + .of_match_table = goldfish_events_of_match, }, };
PATCH 2/3 goldfish: Enable ACPI-based enumeration for goldfish events
From: Jason Hu <[email protected]>
Add ACPI binding to the goldfish events driver.
--- drivers/input/keyboard/goldfish_events.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/keyboard/goldfish_events.c +8 -0
@@ -22,6 +22,7 @@#include <linux/slab.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/acpi.h> enum {REG_READ =0x00 ,
@@ -184,11 +185,18 @@ static const struct of_device_id goldfish_events_of_match[] = { };MODULE_DEVICE_TABLE (of, goldfish_events_of_match); +static const struct acpi_device_id goldfish_events_acpi_match[] = { + {"GFSH0002" ,0 }, + { }, +}; +MODULE_DEVICE_TABLE (acpi, goldfish_events_acpi_match); +static struct platform_driver events_driver = { .probe = events_probe, .driver = { .name ="goldfish_events" , .of_match_table = goldfish_events_of_match, + .acpi_match_table =ACPI_PTR (goldfish_events_acpi_match), }, };
Dmitry Torokhov
maintainerRe: [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events
Quoted 24 lines · Alan
From: Jason Hu <[email protected]>
Add ACPI binding to the goldfish events driver.
Signed-off-by Jason Hu <[email protected]>Signed-off-by Jin Qian <[email protected]>Signed-off-by Alan <[email protected]>--- drivers/input/keyboard/goldfish_events.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/input/keyboard/goldfish_events.c +1
-0@@ -22,6 +22,7 @@#include <linux/slab.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/acpi.h> enum {REG_READ =0x00 ,
drivers/input/keyboard/goldfish_events.c static const struct of_device_id goldfish_events_of_match[] = { · line 192
Quoted 8 lines
drivers/input/keyboard/goldfish_events.c +5
-0@@ -184,11 +185,18 @@ static const struct of_device_id goldfish_events_of_match[] = { };MODULE_DEVICE_TABLE (of, goldfish_events_of_match); +static const struct acpi_device_id goldfish_events_acpi_match[] = { + {"GFSH0002" ,0 }, + { }, +}; +MODULE_DEVICE_TABLE (acpi, goldfish_events_acpi_match);
I believe this can we guarded by #ifdef CONFIG_ACPI, I'll add it.
drivers/input/keyboard/goldfish_events.c static const struct of_device_id goldfish_events_of_match[] = { · line 202
Quoted 11 lines
drivers/input/keyboard/goldfish_events.c +2
-0+static struct platform_driver events_driver = { .probe = events_probe, .driver = { .name ="goldfish_events" , .of_match_table = goldfish_events_of_match, + .acpi_match_table =ACPI_PTR (goldfish_events_acpi_match), }, };
Thanks.
Signature · 1 line
Dmitry
PATCH 3/3 goldfish: multitouch: no extra EV_SYN
In reply to AlanFrom: Lingfeng Yang <[email protected]>
If we send SYN_REPORT on every single multi-touch event, it breaks the multi-touch.
The multi-touch becomes jerky and you have to click 2-3 times to do things while randomly activating notification bars when not clicking.
If we suppress these SYN_REPORTS, multi-touch will work fine and the events will have a protocol that looks nice.
We need to register Goldfish Events as a multi-touch device by issuing input_mt_init_slots, otherwise input_handle_abs_event in drivers/input/input.c will silently drop all ABS_MT_SLOT events, causing touches of more than one finger to fail.
--- drivers/input/keyboard/goldfish_events.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/input/keyboard/goldfish_events.c +29 -1
@@ -17,6 +17,7 @@#include <linux/interrupt.h> #include <linux/types.h> #include <linux/input.h> +#include <linux/input/mt.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/slab.h>
@@ -24,6 +25,8 @@#include <linux/io.h> #include <linux/acpi.h> +#define GOLDFISH_MAX_FINGERS 5 +enum {REG_READ =0x00 ,REG_SET_PAGE =0x00 ,
@@ -52,7 +55,23 @@ static irqreturn_t events_interrupt(int irq, void *dev_id) value =__raw_readl (edev->addr +REG_READ );input_event (edev->input, type, code, value); -input_sync (edev->input); +/* +* Send an extra (EV_SYN, SYN_REPORT, 0x0) event +* if a key was pressed. Some keyboard device +* drivers may only send the EV_KEY event and +* not EV_SYN. +* Note that sending an extra SYN_REPORT is not +* necessary nor correct protocol with other +* devices such as touchscreens, which will send +* their own SYN_REPORT's when sufficient event +* information has been collected (e.g., for +* touchscreens, when pressure and X/Y coordinates +* have been received). Hence, we will only send +* this extra SYN_REPORT if type == EV_KEY. +*/ +if (type ==EV_KEY ) +input_sync (edev->input); +return IRQ_HANDLED ; }
@@ -154,6 +173,15 @@ static int events_probe(struct platform_device *pdev) input_dev->name = edev->name; input_dev->id.bustype =BUS_HOST ; +/* +* Set the Goldfish Device to be multi-touch. +* If we do not issue input_mt_init_slots, +* the kernel will filter out needed ABS_MT_SLOT +* events when we touch the screen in more than one place, +* preventing multi-touch with more than one finger from working. +* See drivers/input/input.c:input_handle_abs_event. +*/ +input_mt_init_slots (input_dev,GOLDFISH_MAX_FINGERS ,0 );events_import_bits (edev, input_dev->evbit,EV_SYN ,EV_MAX );events_import_bits (edev, input_dev->keybit,EV_KEY ,KEY_MAX );
Dmitry Torokhov
maintainerRe: [PATCH 3/3] goldfish: multitouch: no extra EV_SYN
Quoted 45 lines · Alan
From: Lingfeng Yang <[email protected]>
If we send
SYN_REPORTon every single multi-touch event, it breaks the multi-touch.The multi-touch becomes jerky and you have to click 2-3 times to do things while randomly activating notification bars when not clicking.
If we suppress these
SYN_REPORTS, multi-touch will work fine and the events will have a protocol that looks nice.We need to register Goldfish Events as a multi-touch device by issuing
input_mt_init_slots, otherwiseinput_handle_abs_eventindrivers/input/input.cwill silently drop allABS_MT_SLOTevents, causing touches of more than one finger to fail.Signed-off-by Lingfeng Yang <[email protected]>Signed-off-by Jin Qian <[email protected]>Signed-off-by Alan Cox <[email protected]>--- drivers/input/keyboard/goldfish_events.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)drivers/input/keyboard/goldfish_events.c +3
-0@@ -17,6 +17,7 @@#include <linux/interrupt.h> #include <linux/types.h> #include <linux/input.h> +#include <linux/input/mt.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/slab.h> @@ -24,6 +25,8 @@#include <linux/io.h> #include <linux/acpi.h> +#define GOLDFISH_MAX_FINGERS 5 +enum {REG_READ =0x00 ,REG_SET_PAGE =0x00 ,
drivers/input/keyboard/goldfish_events.c static irqreturn_t events_interrupt(int irq, void *dev_id) · line 62
Quoted 9 lines
drivers/input/keyboard/goldfish_events.c +5
-1@@ -52,7 +55,23 @@ static irqreturn_t events_interrupt(int irq, void *dev_id) value =__raw_readl (edev->addr +REG_READ );input_event (edev->input, type, code, value); -input_sync (edev->input); +/* +* Send an extra (EV_SYN, SYN_REPORT, 0x0) event +* if a key was pressed. Some keyboard device +* drivers may only send the EV_KEY event and +* not EV_SYN.
That would be error in that keyboard driver and should be fixed.
drivers/input/keyboard/goldfish_events.c static irqreturn_t events_interrupt(int irq, void *dev_id) · line 73
Quoted 11 lines
drivers/input/keyboard/goldfish_events.c +11
-0+* Note that sending an extra SYN_REPORT is not +* necessary nor correct protocol with other +* devices such as touchscreens, which will send +* their own SYN_REPORT's when sufficient event +* information has been collected (e.g., for +* touchscreens, when pressure and X/Y coordinates +* have been received). Hence, we will only send +* this extra SYN_REPORT if type == EV_KEY. +*/ +if (type ==EV_KEY ) +input_sync (edev->input);
I'd rather we always rely on the host to send the SYN event.
Quoted 7 lines
drivers/input/keyboard/goldfish_events.c +1
-0+return IRQ_HANDLED ; }@@ -154,6 +173,15 @@ static int events_probe(struct platform_device *pdev) input_dev->name = edev->name;
drivers/input/keyboard/goldfish_events.c static int events_probe(struct platform_device *pdev) · line 184
Quoted 10 lines
drivers/input/keyboard/goldfish_events.c +9
-0input_dev->id.bustype =BUS_HOST ; +/* +* Set the Goldfish Device to be multi-touch. +* If we do not issue input_mt_init_slots, +* the kernel will filter out needed ABS_MT_SLOT +* events when we touch the screen in more than one place, +* preventing multi-touch with more than one finger from working. +* See drivers/input/input.c:input_handle_abs_event. +*/ +input_mt_init_slots (input_dev,GOLDFISH_MAX_FINGERS ,0 );
Can we use data retrieved by events_import_abs_params() to set up correct number of slots? Also we need error handling. And possibly retrieve correct properties to set pass to input_mt_init_slots()...
drivers/input/keyboard/goldfish_events.c static int events_probe(struct platform_device *pdev)
Quoted 4 lines
drivers/input/keyboard/goldfish_events.c +0
-0events_import_bits (edev, input_dev->evbit,EV_SYN ,EV_MAX );events_import_bits (edev, input_dev->keybit,EV_KEY ,KEY_MAX );
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH 3/3] goldfish: multitouch: no extra EV_SYN
Quoted 9 lines
drivers/input/keyboard/goldfish_events.c static irqreturn_t events_interrupt(int irq, void *dev_id) · line 62
Quoted 7 lines
drivers/input/keyboard/goldfish_events.c +5
-1input_event (edev->input, type, code, value); -input_sync (edev->input); +/* +* Send an extra (EV_SYN, SYN_REPORT, 0x0) event +* if a key was pressed. Some keyboard device +* drivers may only send the EV_KEY event and +* not EV_SYN. That would be error in that keyboard driver and should be fixed.
Agreed but it's still the case that current and long standing Goldfish behaviour requires the above.
Quoted 6 lines
Quoted 6 lines
drivers/input/keyboard/goldfish_events.c +6
-0+* Note that sending an extra SYN_REPORT is not +* necessary nor correct protocol with other +* devices such as touchscreens, which will send +* their own SYN_REPORT's when sufficient event +* information has been collected (e.g., for +* touchscreens, when pressure and X/Y coordinates
Quoted 8 lines
drivers/input/keyboard/goldfish_events.c static irqreturn_t events_interrupt(int irq, void *dev_id) · line 73
Quoted 5 lines
drivers/input/keyboard/goldfish_events.c +5
-0+* have been received). Hence, we will only send +* this extra SYN_REPORT if type == EV_KEY. +*/ +if (type ==EV_KEY ) +input_sync (edev->input);I'd rather we always rely on the host to send the SYN event.
That would certainly make sense for the future.
Quoted 7 lines
Quoted 7 lines
drivers/input/keyboard/goldfish_events.c +1
-0+return IRQ_HANDLED ; }@@ -154,6 +173,15 @@ static int events_probe(struct platform_device *pdev)
Quoted 16 lines
drivers/input/keyboard/goldfish_events.c static int events_probe(struct platform_device *pdev) · line 184
Quoted 12 lines
drivers/input/keyboard/goldfish_events.c +6
-0input_dev->name = edev->name; input_dev->id.bustype =BUS_HOST ; +/* +* Set the Goldfish Device to be multi-touch. +* If we do not issue input_mt_init_slots, +* the kernel will filter out needed ABS_MT_SLOT +* events when we touch the screen in more than one place, +* preventing multi-touch with more than one finger from working.
drivers/input/keyboard/goldfish_events.c +3
-0+* See drivers/input/input.c:input_handle_abs_event. +*/ +input_mt_init_slots (input_dev,GOLDFISH_MAX_FINGERS ,0 );Can we use data retrieved by
events_import_abs_params()to set up correct number of slots? Also we need error handling. And possibly retrieve correct properties to set pass toinput_mt_init_slots()...
Again - I agree that makes sense for future versions of Goldfish
Alan
Quoted 7 lines · Alan
From: Greg Hackmann <[email protected]>
Add device tree bindings to the Goldfish virtual platform event driver.
Signed-off-by Greg Hackmann <[email protected]>Signed-off-by Jin Qian <[email protected]>Signed-off-by Alan <[email protected]>
Applied, thank you.
Quoted 52 lines
--- .../devicetree/bindings/goldfish/events.txt | 17 +++++++++++++++++ drivers/input/keyboard/goldfish_events.c | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/goldfish/events.txtDocumentation/devicetree/bindings/goldfish/events.txt new file +17
-0@@ -0,0 +1,17 @@ +Android Goldfish Events Keypad + +Android goldfish events keypad device generated by android emulator. + +Required properties: + +- compatible : should contain "google,goldfish-events-keypad" to match emulator +- reg : <registers mapping> +- interrupts : <interrupt mapping> + +Example: + + goldfish-events@9040000 { + compatible = "google,goldfish-events-keypad"; + reg = <0x9040000 0x1000>; + interrupts = <0x5>; + };drivers/input/keyboard/goldfish_events.c +7
-0@@ -178,10 +178,17 @@ static int events_probe(struct platform_device *pdev)return 0 ; } +static const struct of_device_id goldfish_events_of_match[] = { + { .compatible ="google,goldfish-events-keypad" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, goldfish_events_of_match); +static struct platform_driver events_driver = { .probe = events_probe, .driver = { .name ="goldfish_events" , + .of_match_table = goldfish_events_of_match, }, };
Signature · 1 line
Dmitry