Thread (2 messages) 2 messages, 2 authors, 2014-12-18

[PATCH resend v2] input: Add new sun4i-lradc-keys driver

From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
Date: 2014-12-17 17:32:11
Also in: linux-devicetree, linux-input

Possibly related (same subject, not in this thread)

On Wednesday, December 17, 2014 03:43:31 PM Hans de Goede wrote:
+       /*
+        * lradc supports only one keypress at a time, release does not give
+        * any info as to which key was released, so we cache the keycode.
+        */
+       if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) {
+               val = readl(lradc->base + LRADC_DATA0) & 0x3f;
+               voltage = val * lradc->vref / 63;
+
+               for (i = 0; i < lradc->chan0_map_count; i++) {
+                       diff = abs(lradc->chan0_map[i].voltage - voltage);
+                       if (diff < closest) {
+                               closest = diff;
+                               keycode = lradc->chan0_map[i].keycode;
+                       }
+               }
+
+               lradc->chan0_keycode = keycode;
+               input_report_key(lradc->input, lradc->chan0_keycode, 1);
+       }
+
+       if (ints & CHAN0_KEYUP_IRQ) {
+               input_report_key(lradc->input, lradc->chan0_keycode, 0);
+               lradc->chan0_keycode = 0;
+       }
Can release and press be reported simultaneously? Should we process release 
first?

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help