* [PATCH 1/3] input: goldfish_events: add devicetree bindings
@ 2016-02-26 18:49 Alan
2016-02-26 18:49 ` [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events Alan
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alan @ 2016-02-26 18:49 UTC (permalink / raw)
To: dmitry.torokhov, linux-input
From: Greg Hackmann <ghackmann@google.com>
Add device tree bindings to the Goldfish virtual platform event driver.
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan <alan@linux.intel.com>
---
.../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
diff --git a/Documentation/devicetree/bindings/goldfish/events.txt b/Documentation/devicetree/bindings/goldfish/events.txt
new file mode 100644
index 0000000..c270066
--- /dev/null
+++ b/Documentation/devicetree/bindings/goldfish/events.txt
@@ -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>;
+ };
diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
index 907e4e2..b11d218 100644
--- a/drivers/input/keyboard/goldfish_events.c
+++ b/drivers/input/keyboard/goldfish_events.c
@@ -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,
},
};
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events
2016-02-26 18:49 [PATCH 1/3] input: goldfish_events: add devicetree bindings Alan
@ 2016-02-26 18:49 ` Alan
2016-02-26 20:06 ` Dmitry Torokhov
2016-02-26 18:50 ` [PATCH 3/3] goldfish: multitouch: no extra EV_SYN Alan
2016-02-26 20:05 ` [PATCH 1/3] input: goldfish_events: add devicetree bindings Dmitry Torokhov
2 siblings, 1 reply; 7+ messages in thread
From: Alan @ 2016-02-26 18:49 UTC (permalink / raw)
To: dmitry.torokhov, linux-input
From: Jason Hu <jia-cheng.hu@intel.com>
Add ACPI binding to the goldfish events driver.
Signed-off-by: Jason Hu <jia-cheng.hu@intel.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan <alan@linux.intel.com>
---
drivers/input/keyboard/goldfish_events.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
index b11d218..c7e308a 100644
--- a/drivers/input/keyboard/goldfish_events.c
+++ b/drivers/input/keyboard/goldfish_events.c
@@ -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),
},
};
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] goldfish: multitouch: no extra EV_SYN
2016-02-26 18:49 [PATCH 1/3] input: goldfish_events: add devicetree bindings Alan
2016-02-26 18:49 ` [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events Alan
@ 2016-02-26 18:50 ` Alan
2016-02-26 19:57 ` Dmitry Torokhov
2016-02-26 20:05 ` [PATCH 1/3] input: goldfish_events: add devicetree bindings Dmitry Torokhov
2 siblings, 1 reply; 7+ messages in thread
From: Alan @ 2016-02-26 18:50 UTC (permalink / raw)
To: dmitry.torokhov, linux-input
From: Lingfeng Yang <lfy@google.com>
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.
Signed-off-by: Lingfeng Yang <lfy@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/input/keyboard/goldfish_events.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
index c7e308a..c0d77b7 100644
--- a/drivers/input/keyboard/goldfish_events.c
+++ b/drivers/input/keyboard/goldfish_events.c
@@ -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);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] goldfish: multitouch: no extra EV_SYN
2016-02-26 18:50 ` [PATCH 3/3] goldfish: multitouch: no extra EV_SYN Alan
@ 2016-02-26 19:57 ` Dmitry Torokhov
2016-03-01 23:27 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2016-02-26 19:57 UTC (permalink / raw)
To: Alan; +Cc: linux-input
On Fri, Feb 26, 2016 at 06:50:21PM +0000, Alan wrote:
> From: Lingfeng Yang <lfy@google.com>
>
> 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.
>
> Signed-off-by: Lingfeng Yang <lfy@google.com>
> Signed-off-by: Jin Qian <jinqian@android.com>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
> drivers/input/keyboard/goldfish_events.c | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
> index c7e308a..c0d77b7 100644
> --- a/drivers/input/keyboard/goldfish_events.c
> +++ b/drivers/input/keyboard/goldfish_events.c
> @@ -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.
That would be error in that keyboard driver and should be fixed.
> + * 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.
> +
> 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);
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()...
>
> events_import_bits(edev, input_dev->evbit, EV_SYN, EV_MAX);
> events_import_bits(edev, input_dev->keybit, EV_KEY, KEY_MAX);
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] input: goldfish_events: add devicetree bindings
2016-02-26 18:49 [PATCH 1/3] input: goldfish_events: add devicetree bindings Alan
2016-02-26 18:49 ` [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events Alan
2016-02-26 18:50 ` [PATCH 3/3] goldfish: multitouch: no extra EV_SYN Alan
@ 2016-02-26 20:05 ` Dmitry Torokhov
2 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2016-02-26 20:05 UTC (permalink / raw)
To: Alan; +Cc: linux-input
On Fri, Feb 26, 2016 at 06:49:34PM +0000, Alan wrote:
> From: Greg Hackmann <ghackmann@google.com>
>
> Add device tree bindings to the Goldfish virtual platform event driver.
>
> Signed-off-by: Greg Hackmann <ghackmann@google.com>
> Signed-off-by: Jin Qian <jinqian@android.com>
> Signed-off-by: Alan <alan@linux.intel.com>
Applied, thank you.
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/goldfish/events.txt b/Documentation/devicetree/bindings/goldfish/events.txt
> new file mode 100644
> index 0000000..c270066
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/goldfish/events.txt
> @@ -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>;
> + };
> diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
> index 907e4e2..b11d218 100644
> --- a/drivers/input/keyboard/goldfish_events.c
> +++ b/drivers/input/keyboard/goldfish_events.c
> @@ -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,
> },
> };
>
>
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events
2016-02-26 18:49 ` [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events Alan
@ 2016-02-26 20:06 ` Dmitry Torokhov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2016-02-26 20:06 UTC (permalink / raw)
To: Alan; +Cc: linux-input
On Fri, Feb 26, 2016 at 06:49:56PM +0000, Alan wrote:
> From: Jason Hu <jia-cheng.hu@intel.com>
>
> Add ACPI binding to the goldfish events driver.
>
> Signed-off-by: Jason Hu <jia-cheng.hu@intel.com>
> Signed-off-by: Jin Qian <jinqian@android.com>
> Signed-off-by: Alan <alan@linux.intel.com>
> ---
> drivers/input/keyboard/goldfish_events.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/input/keyboard/goldfish_events.c b/drivers/input/keyboard/goldfish_events.c
> index b11d218..c7e308a 100644
> --- a/drivers/input/keyboard/goldfish_events.c
> +++ b/drivers/input/keyboard/goldfish_events.c
> @@ -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);
I believe this can we guarded by #ifdef CONFIG_ACPI, I'll add it.
> +
> 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.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] goldfish: multitouch: no extra EV_SYN
2016-02-26 19:57 ` Dmitry Torokhov
@ 2016-03-01 23:27 ` Alan Cox
0 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2016-03-01 23:27 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, jinqian
> > 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.
Agreed but it's still the case that current and long standing Goldfish
behaviour requires the above.
> > + * 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.
That would certainly make sense for the future.
> > +
> > 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);
>
> 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()...
Again - I agree that makes sense for future versions of Goldfish
Alan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-01 23:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-26 18:49 [PATCH 1/3] input: goldfish_events: add devicetree bindings Alan
2016-02-26 18:49 ` [PATCH 2/3] goldfish: Enable ACPI-based enumeration for goldfish events Alan
2016-02-26 20:06 ` Dmitry Torokhov
2016-02-26 18:50 ` [PATCH 3/3] goldfish: multitouch: no extra EV_SYN Alan
2016-02-26 19:57 ` Dmitry Torokhov
2016-03-01 23:27 ` Alan Cox
2016-02-26 20:05 ` [PATCH 1/3] input: goldfish_events: add devicetree bindings Dmitry Torokhov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.