Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH resend v2] input: Add new sun4i-lradc-keys driver
Date: Wed, 17 Dec 2014 09:32:11 -0800	[thread overview]
Message-ID: <1918972.jFlKNuYrbH@dtor-glaptop> (raw)
In-Reply-To: <1418827411-13265-2-git-send-email-hdegoede@redhat.com>

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

  reply	other threads:[~2014-12-17 17:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 14:43 [PATCH resend v2] input: Add new sun4i-lradc-keys driver Hans de Goede
2014-12-17 14:43 ` Hans de Goede
2014-12-17 17:32   ` Dmitry Torokhov [this message]
2014-12-18  8:42     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1918972.jFlKNuYrbH@dtor-glaptop \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox