linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@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: Thu, 18 Dec 2014 09:42:14 +0100	[thread overview]
Message-ID: <54929366.7050002@redhat.com> (raw)
In-Reply-To: <1918972.jFlKNuYrbH@dtor-glaptop>

Hi,

On 17-12-14 18:32, Dmitry Torokhov wrote:
> 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?

Good question, I guess if we are somehow really slow with processing the interrupt
that this may happen. So I'll do a v3 swapping the 2.

Regards,

Hans

      reply	other threads:[~2014-12-18  8:42 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
2014-12-18  8:42         ` Hans de Goede [this message]

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=54929366.7050002@redhat.com \
    --to=hdegoede-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@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;
as well as URLs for NNTP newsgroup(s).