#include <linux/i2c/twl4030.h>
#include <linux/i2c/twl4030-gpio.h>
-#include <mach/irqs.h>
-#include <asm/mach/irq.h>
-#include <mach/gpio.h>
-#include <mach/mux.h>
-
-/* REVISIT when these symbols vanish elsewhere, remove them here too */
-/* #undef TWL4030_GPIO_IRQ_BASE */
-/* #undef TWL4030_GPIO_IRQ_END */
+static inline void activate_irq(int irq)
+{
+#ifdef CONFIG_ARM
+ /* 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 int twl4030_gpio_irq_base;
static int twl4030_gpio_irq_end;
+/* genirq interfaces are not available to modules */
#ifdef MODULE
#define is_module() true
#else
if (ret >= 0) {
/* clear the previous rising/falling values */
reg = (u8) ret;
- reg &= ~( MASK_GPIO_EDR1_GPIOxFALLING(c_off)
+ reg &= ~(MASK_GPIO_EDR1_GPIOxFALLING(c_off)
| MASK_GPIO_EDR1_GPIOxRISING(c_off));
reg |= c_msk;
ret = gpio_twl4030_write(base, reg);
ret = gpio_twl4030_write(REG_GPIO_CTRL, reg);
}
mutex_unlock(&gpio_lock);
- return (ret);
+ return ret;
}
#endif
/* install an irq handler for each of the gpio interrupts */
for (irq = twl4030_gpio_irq_base; irq < twl4030_gpio_irq_end;
irq++) {
- set_irq_chip(irq, &twl4030_gpio_irq_chip);
- set_irq_handler(irq, do_twl4030_gpio_irq);
- set_irq_flags(irq, IRQF_VALID);
+ set_irq_chip_and_handler(irq, &twl4030_gpio_irq_chip,
+ do_twl4030_gpio_irq);
+ activate_irq(irq);
}
/* gpio module IRQ */
/* uninstall the gpio demultiplexing interrupt handler */
irq = platform_get_irq(pdev, 0);
set_irq_handler(irq, NULL);
- set_irq_flags(irq, 0);
/* 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_flags(irq, 0);
- }
/* stop the gpio unmask kernel thread */
if (gpio_unmask_thread) {
/* TWL4030 GPIO interrupt definitions */
-#define TWL4030_GPIO_MIN 0
#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_IS_INPUT 1
-#define TWL4030_GPIO_IS_OUTPUT 0
#define TWL4030_GPIO_IS_ENABLE 1
-#define TWL4030_GPIO_IS_DISABLE 0
#define TWL4030_GPIO_PULL_UP 0
#define TWL4030_GPIO_PULL_DOWN 1
-#define TWL4030_GPIO_PULL_NONE 2
/* Functions to read and write from TWL4030 */