All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Liam Girdwood <lrg-l0cyMroinI0@public.gmane.org>,
	Chris Ball <cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>,
	"ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org"
	<ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org"
	<olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org"
	<alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org>,
	"linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: RE: [PATCH 1/3] irq: If an IRQ is a GPIO, request and configure it
Date: Fri, 2 Sep 2011 17:50:21 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1109021731141.2723@ionos> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF04B327A55C-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>

On Fri, 2 Sep 2011, Stephen Warren wrote:

> Thomas Gleixner wrote at Friday, September 02, 2011 2:37 AM:
> > On Thu, 4 Aug 2011, Stephen Warren wrote:
> > 
> > > Many IRQs are associated with GPIO pins. When the pin is used as an IRQ,
> > > it can't be used as anything else; it should be requested. Enhance the
> > > core interrupt code to call gpio_request() and gpio_direction_input() for
> > > any IRQ that is also a GPIO. This prevents duplication of these calls in
> > > each driver that uses an IRQ.
> > 
> > This is very much the wrong approach. If you think it through then the
> > irq setup code might end up with tons of other subsystem specific
> > setup thingies, e.g. PCI .....
> > 
> > The right thing to do is to add a irq_configure() function pointer to
> > the irq chip and provide a common function for gpios in gpiolib, which
> > is then used by the particular GPIO irq chip implementation.
> 
> Sorry, could you expand on this some more.
> 
> The whole point of these patches is that it's impossible to convert from
> IRQ number to GPIO number.
> 
> Some drivers use just an IRQ, and don't care if it's a GPIO. They work
> fine currently.
> 
> Some drivers use just a GPIO; that's not relevant to these patches.
> 
> Some drivers use something that's both an IRQ and a GPIO. Historically,
> this has worked by passing the IRQ to the driver, and then the driver
> calling irq_to_gpio() to get the GPIO ID. Since irq_to_gpio() is being
> removed, this is no longer possible. The whole point of the removal was
> that it's not possible in general to convert from IRQ to GPIO, so I'm not
> sure exactly what you're proposing irq_configure() or gpiolib do to
> centralize this?

chip->irq_configure() calls a irqchip function if set. So now the code
which implements the irq functionality for GPIO definitely knows how
to map the irq number to the GPIO pin, otherwise it would not be able
to handle the mask/ack/unmask function either.

The drivers which just request an irq are oblivious about that:

request_irq(irq)

	if (chip->irq_configure)
	   chip->irq_configure()
		configure_gpio_pin()

Whether configure_gpio_pin() is a function which is implemented per
GPIO driver or a common function in gpiolib is not relevant for the
irq core code.

Thanks,

	tglx

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Stephen Warren <swarren@nvidia.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>, Chris Ball <cjb@laptop.org>,
	"ccross@android.com" <ccross@android.com>,
	"olof@lixom.net" <olof@lixom.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: RE: [PATCH 1/3] irq: If an IRQ is a GPIO, request and configure it
Date: Fri, 2 Sep 2011 17:50:21 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1109021731141.2723@ionos> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF04B327A55C@HQMAIL01.nvidia.com>

On Fri, 2 Sep 2011, Stephen Warren wrote:

> Thomas Gleixner wrote at Friday, September 02, 2011 2:37 AM:
> > On Thu, 4 Aug 2011, Stephen Warren wrote:
> > 
> > > Many IRQs are associated with GPIO pins. When the pin is used as an IRQ,
> > > it can't be used as anything else; it should be requested. Enhance the
> > > core interrupt code to call gpio_request() and gpio_direction_input() for
> > > any IRQ that is also a GPIO. This prevents duplication of these calls in
> > > each driver that uses an IRQ.
> > 
> > This is very much the wrong approach. If you think it through then the
> > irq setup code might end up with tons of other subsystem specific
> > setup thingies, e.g. PCI .....
> > 
> > The right thing to do is to add a irq_configure() function pointer to
> > the irq chip and provide a common function for gpios in gpiolib, which
> > is then used by the particular GPIO irq chip implementation.
> 
> Sorry, could you expand on this some more.
> 
> The whole point of these patches is that it's impossible to convert from
> IRQ number to GPIO number.
> 
> Some drivers use just an IRQ, and don't care if it's a GPIO. They work
> fine currently.
> 
> Some drivers use just a GPIO; that's not relevant to these patches.
> 
> Some drivers use something that's both an IRQ and a GPIO. Historically,
> this has worked by passing the IRQ to the driver, and then the driver
> calling irq_to_gpio() to get the GPIO ID. Since irq_to_gpio() is being
> removed, this is no longer possible. The whole point of the removal was
> that it's not possible in general to convert from IRQ to GPIO, so I'm not
> sure exactly what you're proposing irq_configure() or gpiolib do to
> centralize this?

chip->irq_configure() calls a irqchip function if set. So now the code
which implements the irq functionality for GPIO definitely knows how
to map the irq number to the GPIO pin, otherwise it would not be able
to handle the mask/ack/unmask function either.

The drivers which just request an irq are oblivious about that:

request_irq(irq)

	if (chip->irq_configure)
	   chip->irq_configure()
		configure_gpio_pin()

Whether configure_gpio_pin() is a function which is implemented per
GPIO driver or a common function in gpiolib is not relevant for the
irq core code.

Thanks,

	tglx

WARNING: multiple messages have this Message-ID (diff)
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] irq: If an IRQ is a GPIO, request and configure it
Date: Fri, 2 Sep 2011 17:50:21 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1109021731141.2723@ionos> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF04B327A55C@HQMAIL01.nvidia.com>

On Fri, 2 Sep 2011, Stephen Warren wrote:

> Thomas Gleixner wrote at Friday, September 02, 2011 2:37 AM:
> > On Thu, 4 Aug 2011, Stephen Warren wrote:
> > 
> > > Many IRQs are associated with GPIO pins. When the pin is used as an IRQ,
> > > it can't be used as anything else; it should be requested. Enhance the
> > > core interrupt code to call gpio_request() and gpio_direction_input() for
> > > any IRQ that is also a GPIO. This prevents duplication of these calls in
> > > each driver that uses an IRQ.
> > 
> > This is very much the wrong approach. If you think it through then the
> > irq setup code might end up with tons of other subsystem specific
> > setup thingies, e.g. PCI .....
> > 
> > The right thing to do is to add a irq_configure() function pointer to
> > the irq chip and provide a common function for gpios in gpiolib, which
> > is then used by the particular GPIO irq chip implementation.
> 
> Sorry, could you expand on this some more.
> 
> The whole point of these patches is that it's impossible to convert from
> IRQ number to GPIO number.
> 
> Some drivers use just an IRQ, and don't care if it's a GPIO. They work
> fine currently.
> 
> Some drivers use just a GPIO; that's not relevant to these patches.
> 
> Some drivers use something that's both an IRQ and a GPIO. Historically,
> this has worked by passing the IRQ to the driver, and then the driver
> calling irq_to_gpio() to get the GPIO ID. Since irq_to_gpio() is being
> removed, this is no longer possible. The whole point of the removal was
> that it's not possible in general to convert from IRQ to GPIO, so I'm not
> sure exactly what you're proposing irq_configure() or gpiolib do to
> centralize this?

chip->irq_configure() calls a irqchip function if set. So now the code
which implements the irq functionality for GPIO definitely knows how
to map the irq number to the GPIO pin, otherwise it would not be able
to handle the mask/ack/unmask function either.

The drivers which just request an irq are oblivious about that:

request_irq(irq)

	if (chip->irq_configure)
	   chip->irq_configure()
		configure_gpio_pin()

Whether configure_gpio_pin() is a function which is implemented per
GPIO driver or a common function in gpiolib is not relevant for the
irq core code.

Thanks,

	tglx

  parent reply	other threads:[~2011-09-02 15:50 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 23:00 [RFC PATCH 0/3] If an IRQ is a GPIO, request and configure it Stephen Warren
2011-08-04 23:00 ` Stephen Warren
2011-08-04 23:00 ` Stephen Warren
     [not found] ` <1312498820-2275-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-04 23:00   ` [PATCH 1/3] irq: " Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-05  0:01     ` Mark Brown
2011-08-05  0:01       ` Mark Brown
2011-08-05  0:01       ` Mark Brown
     [not found]       ` <20110805000148.GB13321-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-08-05  3:53         ` Stephen Warren
2011-08-05  3:53           ` Stephen Warren
2011-08-05  3:53           ` Stephen Warren
2011-08-05  5:35           ` Mark Brown
2011-08-05  5:35             ` Mark Brown
2011-08-05  5:35             ` Mark Brown
     [not found]             ` <20110805053510.GA16956-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-08-05  8:06               ` Ben Dooks
2011-08-05  8:06                 ` Ben Dooks
2011-08-05  8:06                 ` Ben Dooks
2011-08-05  8:29                 ` Mark Brown
2011-08-05  8:29                   ` Mark Brown
2011-08-05  8:29                   ` Mark Brown
2011-08-05 15:29             ` Stephen Warren
2011-08-05 15:29               ` Stephen Warren
2011-08-05 15:29               ` Stephen Warren
2011-08-05 16:15               ` Mark Brown
2011-08-05 16:15                 ` Mark Brown
2011-08-05 16:15                 ` Mark Brown
2011-08-05  1:54     ` Rob Herring
2011-08-05  1:54       ` Rob Herring
2011-08-05  4:05       ` Stephen Warren
2011-08-05  4:05         ` Stephen Warren
2011-08-05  4:05         ` Stephen Warren
2011-08-05  7:58     ` Ben Dooks
2011-08-05  7:58       ` Ben Dooks
2011-09-02  8:36     ` Thomas Gleixner
2011-09-02  8:36       ` Thomas Gleixner
2011-09-02 15:24       ` Stephen Warren
2011-09-02 15:24         ` Stephen Warren
2011-09-02 15:24         ` Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF04B327A55C-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-09-02 15:34           ` Stephen Warren
2011-09-02 15:34             ` Stephen Warren
2011-09-02 15:34             ` Stephen Warren
2011-09-02 15:50           ` Thomas Gleixner [this message]
2011-09-02 15:50             ` Thomas Gleixner
2011-09-02 15:50             ` Thomas Gleixner
2011-08-04 23:00   ` [PATCH 2/3] mmc: tegra: Don't gpio_request GPIOs used as IRQs Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-04 23:00   ` [PATCH 3/3] ASoC: jack_add_gpios: " Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-04 23:00     ` Stephen Warren
2011-08-05  7:55   ` [RFC PATCH 0/3] If an IRQ is a GPIO, request and configure it Ben Dooks
2011-08-05  7:55     ` Ben Dooks
2011-08-05  7:55     ` Ben Dooks
2011-08-05  9:40 ` Russell King - ARM Linux
2011-08-05  9:40   ` Russell King - ARM Linux
     [not found]   ` <20110805094017.GC20575-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-08-05 10:30     ` Ben Dooks
2011-08-05 10:30       ` Ben Dooks
2011-08-05 10:30       ` Ben Dooks
2011-08-05 20:25       ` Linus Walleij
2011-08-05 20:25         ` Linus Walleij
2011-08-05 15:43   ` Stephen Warren
2011-08-05 15:43     ` Stephen Warren
2011-08-05 15:43     ` Stephen Warren
2011-08-05 19:15     ` Russell King - ARM Linux
2011-08-05 19:15       ` Russell King - ARM Linux
2011-08-05 19:15       ` Russell King - ARM Linux
2011-08-05 19:33       ` Stephen Warren
2011-08-05 19:33         ` Stephen Warren
2011-08-05 19:33         ` Stephen Warren
2011-08-05 21:40         ` Russell King - ARM Linux
2011-08-05 21:40           ` Russell King - ARM Linux
2011-08-05 21:40           ` Russell King - ARM Linux

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=alpine.LFD.2.02.1109021731141.2723@ionos \
    --to=tglx-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lrg-l0cyMroinI0@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@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 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.