All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Jon Smirl <jonsmirl@gmail.com>
Cc: "David Härdeman" <david@hardeman.nu>,
	linux-input@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [RFC2] Teach drivers/media/IR/ir-raw-event.c to use durations
Date: Thu, 08 Apr 2010 10:06:53 -0300	[thread overview]
Message-ID: <4BBDD4ED.5040007@infradead.org> (raw)
In-Reply-To: <r2l9e4733911004080541s58fd4e70o215800426290a09a@mail.gmail.com>

Jon Smirl wrote:
> On Thu, Apr 8, 2010 at 1:10 AM, Mauro Carvalho Chehab
> <mchehab@infradead.org> wrote:
>> David Härdeman wrote:
>>> drivers/media/IR/ir-raw-event.c is currently written with the assumption
>>> that all "raw" hardware will generate events only on state change (i.e.
>>> when a pulse or space starts).
>>>
>>> However, some hardware (like mceusb, probably the most popular IR receiver
>>> out there) only generates duration data (and that data is buffered so using
>>> any kind of timing on the data is futile).
>>>
>>> Furthermore, using signed int's to represent pulse/space durations in ms
>>> is a well-known approach to anyone with experience in writing ir decoders.
>>>
>>> This patch (which has been tested this time) is still a RFC on my proposed
>>> interface changes.
>>>
>>> Changes since last version:
>>>
>>> o RC5x and NECx support no longer added in patch (separate patches to follow)
>>>
>>> o The use of a kfifo has been left given feedback from Jon, Andy, Mauro
>> Ok.
>>
>>> o The RX decoding is now handled via a workqueue (I can break that up into a
>>>   separate patch later, but I think it helps the discussion to have it in for
>>>   now), with inspiration from Andy's code.
>> I'm in doubt about that. the workqueue is called just after an event. this means
>> that, just after every IRQ trigger (assuming the worse case), the workqueue will
>> be called.
>>
>> On the previous code, it is drivers responsibility to call the function that
>> de-queue. On saa7134, I've scheduled it to wake after 15 ms. So, instead of
>> 32 wakeups, just one is done, and the additional delay introduced by it is not
>> enough to disturb the user.
> 
> The wakeup is variable when the default thread is used. My quad core
> desktop wakes up on every pulse. My embedded system wakes up about
> every 15 pulses. The embedded system called schedule_work() fifteen
> times from the IRQ, but the kernel collapsed them into a single
> wakeup. I'd stick with the default thread and let the kernel get
> around to processing IR whenever it has some time.

Makes sense.

> A workqueue has to be used at some point in the system. The input
> subsystem calls that send messages to user space can't be called from
> interrupt context.  I believe in handing off to the workqueue as soon
> as possible for IR signals.

I'm ok on using a workqueue for it.
> 
> Keep this code in the core to simplify writing the drivers. My GPIO
> timer driver example is very simple.
> 
> If you're worried about performance, none of this code matters. What
> is more important is localizing memory accesses to avoid processor
> cache misses. A cache miss can equal 1000 divides.

Agreed.


-- 

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Jon Smirl <jonsmirl@gmail.com>
Cc: "David Härdeman" <david@hardeman.nu>,
	linux-input@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [RFC2] Teach drivers/media/IR/ir-raw-event.c to use durations
Date: Thu, 08 Apr 2010 10:06:53 -0300	[thread overview]
Message-ID: <4BBDD4ED.5040007@infradead.org> (raw)
In-Reply-To: <r2l9e4733911004080541s58fd4e70o215800426290a09a@mail.gmail.com>

Jon Smirl wrote:
> On Thu, Apr 8, 2010 at 1:10 AM, Mauro Carvalho Chehab
> <mchehab@infradead.org> wrote:
>> David Härdeman wrote:
>>> drivers/media/IR/ir-raw-event.c is currently written with the assumption
>>> that all "raw" hardware will generate events only on state change (i.e.
>>> when a pulse or space starts).
>>>
>>> However, some hardware (like mceusb, probably the most popular IR receiver
>>> out there) only generates duration data (and that data is buffered so using
>>> any kind of timing on the data is futile).
>>>
>>> Furthermore, using signed int's to represent pulse/space durations in ms
>>> is a well-known approach to anyone with experience in writing ir decoders.
>>>
>>> This patch (which has been tested this time) is still a RFC on my proposed
>>> interface changes.
>>>
>>> Changes since last version:
>>>
>>> o RC5x and NECx support no longer added in patch (separate patches to follow)
>>>
>>> o The use of a kfifo has been left given feedback from Jon, Andy, Mauro
>> Ok.
>>
>>> o The RX decoding is now handled via a workqueue (I can break that up into a
>>>   separate patch later, but I think it helps the discussion to have it in for
>>>   now), with inspiration from Andy's code.
>> I'm in doubt about that. the workqueue is called just after an event. this means
>> that, just after every IRQ trigger (assuming the worse case), the workqueue will
>> be called.
>>
>> On the previous code, it is drivers responsibility to call the function that
>> de-queue. On saa7134, I've scheduled it to wake after 15 ms. So, instead of
>> 32 wakeups, just one is done, and the additional delay introduced by it is not
>> enough to disturb the user.
> 
> The wakeup is variable when the default thread is used. My quad core
> desktop wakes up on every pulse. My embedded system wakes up about
> every 15 pulses. The embedded system called schedule_work() fifteen
> times from the IRQ, but the kernel collapsed them into a single
> wakeup. I'd stick with the default thread and let the kernel get
> around to processing IR whenever it has some time.

Makes sense.

> A workqueue has to be used at some point in the system. The input
> subsystem calls that send messages to user space can't be called from
> interrupt context.  I believe in handing off to the workqueue as soon
> as possible for IR signals.

I'm ok on using a workqueue for it.
> 
> Keep this code in the core to simplify writing the drivers. My GPIO
> timer driver example is very simple.
> 
> If you're worried about performance, none of this code matters. What
> is more important is localizing memory accesses to avoid processor
> cache misses. A cache miss can equal 1000 divides.

Agreed.


-- 

Cheers,
Mauro

  reply	other threads:[~2010-04-08 13:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 20:18 [RFC2] Teach drivers/media/IR/ir-raw-event.c to use durations David Härdeman
2010-04-07 20:18 ` David Härdeman
2010-04-07 21:01 ` Jon Smirl
2010-04-08  0:18 ` Jon Smirl
2010-04-08  0:44 ` Andy Walls
2010-04-08  5:10 ` Mauro Carvalho Chehab
2010-04-08  5:10   ` Mauro Carvalho Chehab
2010-04-08 11:23   ` David Härdeman
2010-04-08 11:50     ` Mauro Carvalho Chehab
2010-04-08 12:43       ` David Härdeman
2010-04-08 12:43         ` David Härdeman
2010-04-08 13:07         ` Mauro Carvalho Chehab
2010-04-08 12:41   ` Jon Smirl
2010-04-08 12:41     ` Jon Smirl
2010-04-08 13:06     ` Mauro Carvalho Chehab [this message]
2010-04-08 13:06       ` Mauro Carvalho Chehab
2010-04-08 15:53       ` David Härdeman
2010-04-08 15:53         ` David Härdeman
2010-04-08 17:04         ` Mauro Carvalho Chehab

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=4BBDD4ED.5040007@infradead.org \
    --to=mchehab@infradead.org \
    --cc=david@hardeman.nu \
    --cc=jonsmirl@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-media@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.