gpio/tegra: Remove use of irq_to_gpio
Subsystems (4)
PATCH v2 1/4 gpio/tegra: Remove use of irq_to_gpio
irq_to_gpio is being removed. Replace the only use of that API by the ARM Tegra sub-architecture.
---
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(-)
drivers/gpio/gpio-tegra.c +10 -6
@@ -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++) {
Signature · 1 line
1.7.0.4
PATCH v2 2/4 gpio/tegra: Implement gpio_chip.to_irq
--- drivers/gpio/gpio-tegra.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/gpio/gpio-tegra.c +5 -1
@@ -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, };
Signature · 1 line
1.7.0.4
PATCH v2 3/4 arm/tegra: Delete custom gpio_to_irq, and irq_to_gpio
In reply to Stephen WarrenBy 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.
--- arch/arm/mach-tegra/include/mach/gpio.h | 16 ---------------- 1 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/mach-tegra/include/mach/gpio.h +0 -16
@@ -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 */
Signature · 1 line
1.7.0.4
PATCH v2 4/4 arm/tegra: mach/gpio.h: include linux/types.h to fix build
In reply to Stephen WarrenTegra's <mach/gpio.h> uses type bool; we need to include <linux/types.h> to get the definition.
--- arch/arm/mach-tegra/include/mach/gpio.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-tegra/include/mach/gpio.h +1 -1
@@ -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
Signature · 1 line
1.7.0.4
Quoted 11 lines · Stephen Warren
irq_to_gpiois being removed. Replace the only use of that API by the ARM Tegra sub-architecture.Signed-off-by Stephen Warren <[email protected]>---
This series is theirq_to_gpiopatches I posted last week, rebased to ToT, plus removing Tegra's customgpio_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:
Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
Quoted 9 lines · Stephen Warren
Quoted 8 lines
irq_to_gpiois being removed. Replace the only use of that API by the ARM Tegra sub-architecture.Signed-off-by Stephen Warren <[email protected]>---
This series is theirq_to_gpiopatches I posted last week, rebased to ToT, plus removing Tegra's customgpio_to_irq.
Quoted 6 lines
Quoted 3 lines
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 <[email protected]>
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.
Signature · 1 line
nvpublic
Stephen Warren wrote at Friday, August 12, 2011 10:07 AM:
Quoted 14 lines
Colin Cross wrote at Thursday, August 11, 2011 2:54 PM:
Quoted 13 lines · Stephen Warren
Quoted 11 lines
irq_to_gpiois being removed. Replace the only use of that API by the ARM Tegra sub-architecture.Signed-off-by Stephen Warren <[email protected]>---
This series is theirq_to_gpiopatches I posted last week, rebased to ToT, plus removing Tegra's customgpio_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.
Quoted 7 lines
Quoted 2 lines
This whole series looks good to me:
Acked-by Colin Cross <[email protected]>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!
Signature · 1 line
nvpublic