Commit fc902fc1 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

twl4030-gpio: irq and other cleanup

Remove some ARM and OMAP specific stuff from the twl4030 GPIO code,
and some unused/undesirable CPP symbols.  Add minor checkpatch fixes.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 87bee386
...@@ -40,20 +40,25 @@ ...@@ -40,20 +40,25 @@
#include <linux/i2c/twl4030.h> #include <linux/i2c/twl4030.h>
#include <linux/i2c/twl4030-gpio.h> #include <linux/i2c/twl4030-gpio.h>
#include <mach/irqs.h>
#include <asm/mach/irq.h>
#include <mach/gpio.h>
#include <mach/mux.h>
static inline void activate_irq(int irq)
/* REVISIT when these symbols vanish elsewhere, remove them here too */ {
/* #undef TWL4030_GPIO_IRQ_BASE */ #ifdef CONFIG_ARM
/* #undef TWL4030_GPIO_IRQ_END */ /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
* sets on behalf of every irq_chip. Also sets IRQ_NOPROBE.
*/
set_irq_flags(irq, IRQF_VALID);
#else
/* same effect on other architectures */
set_irq_noprobe(irq);
#endif
}
static struct gpio_chip twl_gpiochip; static struct gpio_chip twl_gpiochip;
static int twl4030_gpio_irq_base; static int twl4030_gpio_irq_base;
static int twl4030_gpio_irq_end; static int twl4030_gpio_irq_end;
/* genirq interfaces are not available to modules */
#ifdef MODULE #ifdef MODULE
#define is_module() true #define is_module() true
#else #else
...@@ -530,7 +535,7 @@ static int twl4030_set_gpio_edge_ctrl(int gpio, int edge) ...@@ -530,7 +535,7 @@ static int twl4030_set_gpio_edge_ctrl(int gpio, int edge)
if (ret >= 0) { if (ret >= 0) {
/* clear the previous rising/falling values */ /* clear the previous rising/falling values */
reg = (u8) ret; reg = (u8) ret;
reg &= ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off) reg &= ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off)
| MASK_GPIO_EDR1_GPIOxRISING(c_off)); | MASK_GPIO_EDR1_GPIOxRISING(c_off));
reg |= c_msk; reg |= c_msk;
ret = gpio_twl4030_write(base, reg); ret = gpio_twl4030_write(base, reg);
...@@ -598,7 +603,7 @@ int twl4030_set_gpio_card_detect(int gpio, int enable) ...@@ -598,7 +603,7 @@ int twl4030_set_gpio_card_detect(int gpio, int enable)
ret = gpio_twl4030_write(REG_GPIO_CTRL, reg); ret = gpio_twl4030_write(REG_GPIO_CTRL, reg);
} }
mutex_unlock(&gpio_lock); mutex_unlock(&gpio_lock);
return (ret); return ret;
} }
#endif #endif
...@@ -848,9 +853,9 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev) ...@@ -848,9 +853,9 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
/* install an irq handler for each of the gpio interrupts */ /* install an irq handler for each of the gpio interrupts */
for (irq = twl4030_gpio_irq_base; irq < twl4030_gpio_irq_end; for (irq = twl4030_gpio_irq_base; irq < twl4030_gpio_irq_end;
irq++) { irq++) {
set_irq_chip(irq, &twl4030_gpio_irq_chip); set_irq_chip_and_handler(irq, &twl4030_gpio_irq_chip,
set_irq_handler(irq, do_twl4030_gpio_irq); do_twl4030_gpio_irq);
set_irq_flags(irq, IRQF_VALID); activate_irq(irq);
} }
/* gpio module IRQ */ /* gpio module IRQ */
...@@ -919,13 +924,10 @@ static int __devexit gpio_twl4030_remove(struct platform_device *pdev) ...@@ -919,13 +924,10 @@ static int __devexit gpio_twl4030_remove(struct platform_device *pdev)
/* uninstall the gpio demultiplexing interrupt handler */ /* uninstall the gpio demultiplexing interrupt handler */
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
set_irq_handler(irq, NULL); set_irq_handler(irq, NULL);
set_irq_flags(irq, 0);
/* uninstall the irq handler for each of the gpio interrupts */ /* uninstall the irq handler for each of the gpio interrupts */
for (irq = twl4030_gpio_irq_base; irq < twl4030_gpio_irq_end; irq++) { for (irq = twl4030_gpio_irq_base; irq < twl4030_gpio_irq_end; irq++)
set_irq_handler(irq, NULL); set_irq_handler(irq, NULL);
set_irq_flags(irq, 0);
}
/* stop the gpio unmask kernel thread */ /* stop the gpio unmask kernel thread */
if (gpio_unmask_thread) { if (gpio_unmask_thread) {
......
...@@ -138,17 +138,11 @@ struct twl4030_platform_data { ...@@ -138,17 +138,11 @@ struct twl4030_platform_data {
/* TWL4030 GPIO interrupt definitions */ /* TWL4030 GPIO interrupt definitions */
#define TWL4030_GPIO_MIN 0
#define TWL4030_GPIO_MAX 18 #define TWL4030_GPIO_MAX 18
#define TWL4030_GPIO_MAX_CD 2
#define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n))
#define TWL4030_GPIO_IS_INPUT 1
#define TWL4030_GPIO_IS_OUTPUT 0
#define TWL4030_GPIO_IS_ENABLE 1 #define TWL4030_GPIO_IS_ENABLE 1
#define TWL4030_GPIO_IS_DISABLE 0
#define TWL4030_GPIO_PULL_UP 0 #define TWL4030_GPIO_PULL_UP 0
#define TWL4030_GPIO_PULL_DOWN 1 #define TWL4030_GPIO_PULL_DOWN 1
#define TWL4030_GPIO_PULL_NONE 2
/* Functions to read and write from TWL4030 */ /* Functions to read and write from TWL4030 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment