* [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio
@ 2011-08-11 20:43 Stephen Warren
2011-08-11 20:43 ` [PATCH v2 2/4] gpio/tegra: Implement gpio_chip.to_irq Stephen Warren
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-11 20:43 UTC (permalink / raw)
To: Grant Likely, Russell King, Colin Cross, Erik Gilling,
Olof Johansson
Cc: linux-tegra, linux-arm-kernel, linux-kernel, Stephen Warren
irq_to_gpio is being removed. Replace the only use of that API by
the ARM Tegra sub-architecture.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
This series is the irq_to_gpio patches I posted last week, rebased to ToT,
plus removing Tegra's custom gpio_to_irq.
This series was tested against next-20110811 on Harmony, by playing audio
and plugging/unplugging headphones. Headphone detection relies on using a
GPIO as an IRQ, and hence on gpio_to_irq.
drivers/gpio/gpio-tegra.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 747eb40..ecade29 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -331,6 +331,7 @@ static struct lock_class_key gpio_lock_class;
static int __init tegra_gpio_init(void)
{
struct tegra_gpio_bank *bank;
+ int gpio;
int i;
int j;
@@ -352,14 +353,17 @@ static int __init tegra_gpio_init(void)
gpiochip_add(&tegra_gpio_chip);
- for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) {
- bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))];
+ for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
+ int irq = TEGRA_GPIO_TO_IRQ(gpio);
+ /* No validity check; all Tegra GPIOs are valid IRQs */
- irq_set_lockdep_class(i, &gpio_lock_class);
- irq_set_chip_data(i, bank);
- irq_set_chip_and_handler(i, &tegra_gpio_irq_chip,
+ bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
+
+ irq_set_lockdep_class(irq, &gpio_lock_class);
+ irq_set_chip_data(irq, bank);
+ irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
handle_simple_irq);
- set_irq_flags(i, IRQF_VALID);
+ set_irq_flags(irq, IRQF_VALID);
}
for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/4] gpio/tegra: Implement gpio_chip.to_irq
2011-08-11 20:43 [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Stephen Warren
@ 2011-08-11 20:43 ` Stephen Warren
2011-08-11 20:43 ` [PATCH v2 3/4] arm/tegra: Delete custom gpio_to_irq, and irq_to_gpio Stephen Warren
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-11 20:43 UTC (permalink / raw)
To: Grant Likely, Russell King, Colin Cross, Erik Gilling,
Olof Johansson
Cc: linux-tegra, linux-arm-kernel, linux-kernel, Stephen Warren
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
drivers/gpio/gpio-tegra.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index ecade29..df64536 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -134,7 +134,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
return 0;
}
-
+static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
+{
+ return TEGRA_GPIO_TO_IRQ(offset);
+}
static struct gpio_chip tegra_gpio_chip = {
.label = "tegra-gpio",
@@ -142,6 +145,7 @@ static struct gpio_chip tegra_gpio_chip = {
.get = tegra_gpio_get,
.direction_output = tegra_gpio_direction_output,
.set = tegra_gpio_set,
+ .to_irq = tegra_gpio_to_irq,
.base = 0,
.ngpio = TEGRA_NR_GPIOS,
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 3/4] arm/tegra: Delete custom gpio_to_irq, and irq_to_gpio
2011-08-11 20:43 [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Stephen Warren
2011-08-11 20:43 ` [PATCH v2 2/4] gpio/tegra: Implement gpio_chip.to_irq Stephen Warren
@ 2011-08-11 20:43 ` Stephen Warren
2011-08-11 20:43 ` [PATCH v2 4/4] arm/tegra: mach/gpio.h: include linux/types.h to fix build Stephen Warren
2011-08-11 20:54 ` [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Colin Cross
3 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-11 20:43 UTC (permalink / raw)
To: Grant Likely, Russell King, Colin Cross, Erik Gilling,
Olof Johansson
Cc: linux-tegra, linux-arm-kernel, linux-kernel, Stephen Warren
By not definining a custom gpio_to_irq, the default gpiolib version is
used, allowing platform consolidation.
irq_to_gpio is deprecated and in the process of being removed. Make that
happen now for ARM Tegra.
This also partially fixes the Tegra build; it was broken because gpio.h
referred to EINVAL, which wasn't always defined when <mach/gpio.h> was
included.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/include/mach/gpio.h | 16 ----------------
1 files changed, 0 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index e353805..284a19e 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -26,22 +26,6 @@
#define TEGRA_NR_GPIOS INT_GPIO_NR
#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
-#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
- if (gpio < TEGRA_NR_GPIOS)
- return INT_GPIO_BASE + gpio;
- return -EINVAL;
-}
-#define gpio_to_irq gpio_to_irq
-
-static inline int irq_to_gpio(unsigned int irq)
-{
- if ((irq >= INT_GPIO_BASE) && (irq < INT_GPIO_BASE + INT_GPIO_NR))
- return irq - INT_GPIO_BASE;
- return -EINVAL;
-}
struct tegra_gpio_table {
int gpio; /* GPIO number */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 4/4] arm/tegra: mach/gpio.h: include linux/types.h to fix build
2011-08-11 20:43 [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Stephen Warren
2011-08-11 20:43 ` [PATCH v2 2/4] gpio/tegra: Implement gpio_chip.to_irq Stephen Warren
2011-08-11 20:43 ` [PATCH v2 3/4] arm/tegra: Delete custom gpio_to_irq, and irq_to_gpio Stephen Warren
@ 2011-08-11 20:43 ` Stephen Warren
2011-08-11 20:54 ` [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Colin Cross
3 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-11 20:43 UTC (permalink / raw)
To: Grant Likely, Russell King, Colin Cross, Erik Gilling,
Olof Johansson
Cc: linux-tegra, linux-arm-kernel, linux-kernel, Stephen Warren
Tegra's <mach/gpio.h> uses type bool; we need to include <linux/types.h>
to get the definition.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/include/mach/gpio.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index 284a19e..7910d26 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -20,7 +20,7 @@
#ifndef __MACH_TEGRA_GPIO_H
#define __MACH_TEGRA_GPIO_H
-#include <linux/init.h>
+#include <linux/types.h>
#include <mach/irqs.h>
#define TEGRA_NR_GPIOS INT_GPIO_NR
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio
2011-08-11 20:43 [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Stephen Warren
` (2 preceding siblings ...)
2011-08-11 20:43 ` [PATCH v2 4/4] arm/tegra: mach/gpio.h: include linux/types.h to fix build Stephen Warren
@ 2011-08-11 20:54 ` Colin Cross
2011-08-12 16:07 ` Stephen Warren
3 siblings, 1 reply; 7+ messages in thread
From: Colin Cross @ 2011-08-11 20:54 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely, Russell King, Erik Gilling, Olof Johansson,
linux-tegra, linux-arm-kernel, linux-kernel
On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> irq_to_gpio is being removed. Replace the only use of that API by
> the ARM Tegra sub-architecture.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> plus removing Tegra's custom gpio_to_irq.
>
> This series was tested against next-20110811 on Harmony, by playing audio
> and plugging/unplugging headphones. Headphone detection relies on using a
> GPIO as an IRQ, and hence on gpio_to_irq.
This whole series looks good to me:
Acked-by: Colin Cross <ccross@android.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* RE: [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio
2011-08-11 20:54 ` [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Colin Cross
@ 2011-08-12 16:07 ` Stephen Warren
2011-08-22 23:44 ` Stephen Warren
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Warren @ 2011-08-12 16:07 UTC (permalink / raw)
To: Grant Likely, Russell King
Cc: Erik Gilling, Olof Johansson, linux-tegra@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Colin Cross
Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
> On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> > irq_to_gpio is being removed. Replace the only use of that API by
> > the ARM Tegra sub-architecture.
> >
> > Signed-off-by: Stephen Warren <swarren@nvidia.com>
> > ---
> > This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> > plus removing Tegra's custom gpio_to_irq.
> >
> > This series was tested against next-20110811 on Harmony, by playing audio
> > and plugging/unplugging headphones. Headphone detection relies on using a
> > GPIO as an IRQ, and hence on gpio_to_irq.
>
> This whole series looks good to me:
> Acked-by: Colin Cross <ccross@android.com>
Grant, Does this series look OK to you? Russell asked me to add it to the
ARM patch system once you'd Ack'd it.
Thanks.
--
nvpublic
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio
2011-08-12 16:07 ` Stephen Warren
@ 2011-08-22 23:44 ` Stephen Warren
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2011-08-22 23:44 UTC (permalink / raw)
To: Russell King, Grant Likely
Cc: Erik Gilling, Olof Johansson, linux-tegra@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Colin Cross
Stephen Warren wrote at Friday, August 12, 2011 10:07 AM:
> Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
> > On Thu, Aug 11, 2011 at 1:43 PM, Stephen Warren <swarren@nvidia.com> wrote:
> > > irq_to_gpio is being removed. Replace the only use of that API by
> > > the ARM Tegra sub-architecture.
> > >
> > > Signed-off-by: Stephen Warren <swarren@nvidia.com>
> > > ---
> > > This series is the irq_to_gpio patches I posted last week, rebased to ToT,
> > > plus removing Tegra's custom gpio_to_irq.
> > >
> > > This series was tested against next-20110811 on Harmony, by playing audio
> > > and plugging/unplugging headphones. Headphone detection relies on using a
> > > GPIO as an IRQ, and hence on gpio_to_irq.
> >
> > This whole series looks good to me:
> > Acked-by: Colin Cross <ccross@android.com>
>
> Grant, Does this series look OK to you? Russell asked me to add it to the
> ARM patch system once you'd Ack'd it.
>
> Thanks.
Russell, I've uploaded these to the ARM patch system as 7052..7055.
Note that I didn't wait for Grant's Ack, since Colin Ack'd them, and
Grant said in another thread that he's being very liberal in allowing
GPIO rework changes; I hope this is OK!
--
nvpublic
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-08-22 23:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 20:43 [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Stephen Warren
2011-08-11 20:43 ` [PATCH v2 2/4] gpio/tegra: Implement gpio_chip.to_irq Stephen Warren
2011-08-11 20:43 ` [PATCH v2 3/4] arm/tegra: Delete custom gpio_to_irq, and irq_to_gpio Stephen Warren
2011-08-11 20:43 ` [PATCH v2 4/4] arm/tegra: mach/gpio.h: include linux/types.h to fix build Stephen Warren
2011-08-11 20:54 ` [PATCH v2 1/4] gpio/tegra: Remove use of irq_to_gpio Colin Cross
2011-08-12 16:07 ` Stephen Warren
2011-08-22 23:44 ` Stephen Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox