linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: Dmitry Torokhov
	<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Trilok Soni <soni.trilok-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	Arve Hj?nnev?g <arve-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	kernel list
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Brian Swetland <swetland-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Morton <akpm-3NddpPZAyC0@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Joonyoung Shim
	<jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	t.fujak-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>,
	Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Daniel Ribeiro <drwyrm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: Threaded interrupts for synaptic touchscreen in HTC dream
Date: Wed, 22 Jul 2009 13:18:00 +0100	[thread overview]
Message-ID: <20090722121800.GD21171@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <alpine.LFD.2.00.0907221022190.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On Wed, Jul 22, 2009 at 12:44:01PM +0200, Thomas Gleixner wrote:
> On Tue, 21 Jul 2009, Mark Brown wrote:

> > I'll need to have a more detailed look at that but it's not immediately
> > clear to me how a driver (or even machine) should use that code - it
> > looks more like it's intended to be called from within the IRQ
> > infrastructure than from random driver code.

> All it needs is to set handle_level_oneshot_irq for the interrupt line
> of your I2C or whatever devices. 

>    set_irq_handler(irq, handle_level_oneshot_irq);

Yeah, I know - the issue I was having was that the use of set_irq_handler()
seemed rather rude for driver code.  Grepping around I see that there
are actually a small number of drivers using it already but at first
glance most of them appear to be implementing interrupt controllers.  It
was setting off alarm bells about abstraction layer violation like
set_irq_type() does.

> > Nothing if the above works, though I guess more documentation wouldn't
> > hurt (and possibly a more friendly wrapper).  From the name and

> Wrapper for what ? 

Something to package up the set_irq_handler() and request_threaded_irq()
(possibly a flag for request_threaded_irq()).  This is such a common
thing and request_threaded_irq() looks so much like it should Just Work
that I'd expect it'll help usability a lot to have a single function
which says "this is the idiomatic way to implement this".

> The irq thread finds out which interrupt(s) are active in the
> device. So it raises the interrupt handlers for those from the thread
> which will wake up the relevant interrupt threads for those
> devices. Once all the thread handlers have finished you return from
> the main thread and the interrupt line gets unmasked again.

Yes, this bit of it isn't too much of a problem, it's what's going on in
all the non-genirq infrastructures, but...

> The driver which controls the interrupt device has to expose the
> demultiplexed interrupts via its own irq_chip implementation. Of
> course the chip functions like mask/ack/unmask cannot run in atomic
> context as they require bus access again.

...as you say this is the tricky bit.

> Here in deed we need to put some thought into common infrastructure
> as it seems that such excellent hardware designs are becoming more
> popular :(

This isn't a new issue - it's more that you're seeing a greater degree
of mainline activity from embedded systems.  

FWIW the hardware tradeoff here is in a large part down to the fact that
many of these devices are heavily size (and therefore pin count)
constrained, often on both the device and CPU end of things.  Adding
more pins would either mean a bigger device or a device that's more
expensive to manufacture and use.  This pushes to minimal wire, low
speed control interfaces and for the sort of low volume control these
things need there's not much operational problem there.  These things
are *normally* either pushing events that either won't happen very often
(eg, RTC alarm expiry) or shouldn't happen at all (eg, power failures)
and so aren't performance critical.

> After that bus_sync_unlock() is called outside the atomic context. Now
> the chip implementation issues the bus commands, waits for completion
> and unlocks the interrupt controller bus.

I'll try to find time to implement some use of it and give it a spin -
it looks good at first glance but I'll need to convert one of my drivers
to genirq in order to test.  Someone working on a chip that already uses
genirq might get there first.

  parent reply	other threads:[~2009-07-22 12:18 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090714100634.GA4054@elf.ucw.cz>
2009-07-14 10:20 ` Support for synaptic touchscreen in HTC dream Trilok Soni
     [not found]   ` <5d5443650907140320w334864f4uc1ee13ed32fdb874-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-15 13:36     ` Pavel Machek
     [not found]       ` <20090715133627.GA2538-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2009-07-15 17:33         ` Trilok Soni
     [not found]           ` <5d5443650907151033w36008b71pe4b32bcea9489b75-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-21 10:21             ` Pavel Machek
2009-07-21 10:34               ` Trilok Soni
     [not found]                 ` <5d5443650907210334k3f562cebsc665511a161c8639-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-08-08 13:40                   ` Synaptics touchscreen for HTC Dream: check that smbus is available Pavel Machek
     [not found]                     ` <20090808134049.GA13083-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2009-08-17 23:47                       ` Andrew Morton
     [not found]                         ` <20090817164759.43c39f2d.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-08-21 14:23                           ` Pavel Machek
2009-07-21 10:59           ` Threaded interrupts for synaptic touchscreen in HTC dream Pavel Machek
     [not found]             ` <20090721105924.GK4133-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2009-07-21 11:36               ` Mark Brown
     [not found]                 ` <20090721113642.GC13286-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2009-07-21 12:18                   ` Trilok Soni
2009-07-21 12:30                     ` Trilok Soni
2009-07-21 12:49                       ` Mark Brown
     [not found]                         ` <20090721124933.GA5668-HF5t3jzXg/6ND3a5+9QAFujbO/Zr0HzV@public.gmane.org>
2009-07-21 16:04                           ` Dmitry Torokhov
     [not found]                             ` <20090721160436.GD4352-wUGeVx6es1+Q2O5dskk9LyLysJ1jNyTM@public.gmane.org>
2009-07-21 20:30                               ` Thomas Gleixner
2009-07-21 20:58                                 ` Dmitry Torokhov
2009-07-21 21:48                                   ` Thomas Gleixner
     [not found]                                 ` <alpine.LFD.2.00.0907212225030.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-21 22:25                                   ` Mark Brown
     [not found]                                     ` <20090721222547.GA1948-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2009-07-22 10:44                                       ` Thomas Gleixner
     [not found]                                         ` <alpine.LFD.2.00.0907221022190.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 12:18                                           ` Mark Brown [this message]
2009-07-22 12:58                                             ` Thomas Gleixner
     [not found]                                               ` <alpine.LFD.2.00.0907221427380.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 13:30                                                 ` Peter Zijlstra
2009-07-22 14:18                                                   ` Thomas Gleixner
     [not found]                                                     ` <alpine.LFD.2.00.0907221615480.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 14:32                                                       ` Mark Brown
     [not found]                                                         ` <20090722143211.GB29404-HF5t3jzXg/6ND3a5+9QAFujbO/Zr0HzV@public.gmane.org>
2009-07-22 14:52                                                           ` Thomas Gleixner
     [not found]                                                             ` <alpine.LFD.2.00.0907221645240.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 14:56                                                               ` Mark Brown
2009-07-22 15:15                                                                 ` Thomas Gleixner
     [not found]                                                                   ` <alpine.LFD.2.00.0907221715260.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 15:56                                                                     ` Mark Brown
2009-07-22 16:57                                                   ` David Brownell
     [not found]                                                     ` <200907220957.16499.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-07-22 21:04                                                       ` Thomas Gleixner
     [not found]                                                         ` <alpine.LFD.2.00.0907222226270.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 21:57                                                           ` Arve Hjønnevåg
     [not found]                                                             ` <d6200be20907221457r4e2f6d29g57146586fd13776a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-22 22:15                                                               ` David Brownell
2009-07-22 23:30                                                                 ` Arve Hjønnevåg
2009-07-22 22:09                                                         ` David Brownell
2009-07-23  4:43                                                         ` Dmitry Torokhov
2009-07-22 13:31                                                 ` Mark Brown
2009-07-22 17:04                                                   ` David Brownell
2009-07-22 17:08                                                     ` Mark Brown
2009-07-22 16:04                                               ` Dmitry Torokhov
     [not found]                                                 ` <20090722155811.GA2775-wUGeVx6es1+Q2O5dskk9LyLysJ1jNyTM@public.gmane.org>
2009-07-22 16:40                                                   ` Thomas Gleixner
2009-07-22 16:57                                                     ` Mark Brown
     [not found]                                                     ` <alpine.LFD.2.00.0907221830410.2813-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-07-22 17:08                                                       ` Dmitry Torokhov
2009-07-22 17:13                                                       ` David Brownell
2009-07-22 16:51                                               ` David Brownell
2009-07-22 16:39                                 ` David Brownell
     [not found]                                   ` <200907220939.33399.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-07-22 16:43                                     ` Thomas Gleixner
2009-07-22 17:34                                       ` David Brownell
2009-07-22 16:50                                     ` Mark Brown
2009-07-22 17:41                                 ` David Brownell
2009-07-21 20:43                               ` Daniel Ribeiro
2009-07-21 12:30                     ` Mark Brown
2009-07-23 14:55                 ` Pavel Machek
2009-07-15 21:33         ` Support " Arve Hjønnevåg
2009-07-21 10:40           ` Pavel Machek

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=20090722121800.GD21171@rakim.wolfsonmicro.main \
    --to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
    --cc=akpm-3NddpPZAyC0@public.gmane.org \
    --cc=arve-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
    --cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=drwyrm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=soni.trilok-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=swetland-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=t.fujak-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@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).