public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

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

  parent 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
     [not found] ` <1418827411-13265-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-12-17 14:43   ` Hans de Goede
     [not found]     ` <1418827411-13265-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.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