linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Anisse Astier <anisse@astier.eu>
Cc: linux-input@vger.kernel.org, linux-acpi@vger.kernel.org,
	Len Brown <lenb@kernel.org>,
	Carlos Corbacho <carlos@strangeworlds.co.uk>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [RFC PATCH 1/2] Input: add msi-wmi driver to support hotkeys in MSI Windtop AE1900-WT
Date: Fri, 4 Dec 2009 16:20:47 +0100	[thread overview]
Message-ID: <200912041620.48791.trenn@suse.de> (raw)
In-Reply-To: <20091204145102.3c6f1669@destiny.ordissimo>

On Friday 04 December 2009 14:51:02 Anisse Astier wrote:
> On Fri, 4 Dec 2009 11:55:53 +0100, Thomas Renninger <trenn@suse.de> wrote :
> 
> > > 
> > > > +#define dprintk(msg...)	do {			\
> > > Isn't reimplementing some kind of dprintk a little outdated with
> > > DYNAMIC_PRINTK now in kernel?
> > Eh, DYNAMIC_PRINTK?
> > grep DYNAMIC_PRINTK include/linux/ -r
> > is empty...
> 
> My mistake, the option name is actually DYNAMIC_DEBUG, and is named "Enable
> dynamic printk() support" in Kernel Hacking config.
> cf Documentation/dynamic-debug-howto.txt
Good catch.

> > > > +			cur = ktime_get_real();
> > > > +			/* Ignore event if the same event happened in a 50 ms
> > > > +			   timeframe -> Key press may result in 10-20 GPEs */
> > > > +			if (ktime_to_us(ktime_sub(cur, key->last_pressed))
> > > > +			    < 1000 * 50) {
> > > 
...
> I see no problem with the above. It just works fine, whether you use
> get_jiffies or a ktime.
> 
> The thing Dmitry was proposing to do in his review to my patch, is to use a 
> kernel timer (struct timer_list, mod_timer, etc.), and change the algorithm.
> Instead  of having as a reference the first interrupt of (or bounce), you use
> the last one:
> Every time an interrupt is fired, you call mod_timer() to the kick the timer
> further in time(say 20ms). Once you didn't have any interrupt for this given
> period of time, it means your button is stabilized, and the timer will fire 
> your report_input function.

I see these disadvantages:
  - It would be more complicated code
  - You have one extra irq (the one fired by your aimed timer which finally
    does the work)
  - You react after the timeout (+50ms delay).
The latter two are not sever.

The advantage is:
  - If you get constant irqs over the 30ms/50ms timeout, you would still
    only switch once.

But in this HW case, it really should be save with a 50ms timeout and I'd vote
to take the ktime or get_jiffies approach.

> You can see how it's done in drivers/input/keybourd/gpio_keys.c
> 
> > 
> > Beside that (backlight) switching takes some time, but this should not
> > be due to above "debouncing".
> Yep, I noticed that as well.
> I verified, backlight behave the same in Windows. Slow switch, and just 6
> levels.
Thanks!

I'd prefer if Len could take on top patches, I don't want to touch this
again any time soon if not necessary.

    Thomas

  reply	other threads:[~2009-12-04 15:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 18:26 [RFC PATCH 1/2] Input: add msi-wmi driver to support hotkeys in MSI Windtop AE1900-WT Anisse Astier
2009-12-02 18:28 ` [RFC PATCH 2/2] Input: msi-wmi - switch to using sparse keymap library Anisse Astier
2009-12-02 18:48   ` Dmitry Torokhov
2009-12-03  3:11 ` [RFC PATCH 1/2] Input: add msi-wmi driver to support hotkeys in MSI Windtop AE1900-WT Dmitry Torokhov
2009-12-03  9:08   ` Anisse Astier
2009-12-03  9:34     ` Dmitry Torokhov
2009-12-03 16:49 ` Thomas Renninger
2009-12-04 10:15   ` Anisse Astier
2009-12-04 10:55     ` Thomas Renninger
2009-12-04 13:51       ` Anisse Astier
2009-12-04 15:20         ` Thomas Renninger [this message]
2009-12-04 15:35           ` Anisse Astier

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=200912041620.48791.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=anisse@astier.eu \
    --cc=carlos@strangeworlds.co.uk \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@vger.kernel.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).