linux/arch/arm/plat-omap
Cory Maccarrone 4318f36b7c omap: gpio: Simultaneously requested rising and falling edge
Some chips, namely any OMAP1 chips using METHOD_MPUIO,
OMAP15xx and OMAP7xx, cannot be setup to respond to on-chip GPIO
interrupts in both rising and falling edge directions -- they can
only respond to one direction or the other, depending on how the
ICR is configured.

Additionally, current code forces rising edge detection if both
flags are specified:

        if (trigger & IRQ_TYPE_EDGE_RISING)
                l |= 1 << gpio;
        else if (trigger & IRQ_TYPE_EDGE_FALLING)
                l &= ~(1 << gpio);
        else
                goto bad;

This change implements a toggle function that will modify the ICR
to flip the direction of interrupt for IRQs that are requested with
both rising and falling flags.  The toggle function is not called
for chips and GPIOs it does not apply to through the use of a flip_mask
that's added on a per-bank basis.  The mask is only set for those
GPIOs where a toggle is necessary.  Edge detection starts out the
same as above with FALLING mode first.

The toggle happens on EACH interrupt; without it, we have the
following sequence of actions on GPIO transition:

  ICR    GPIO               Result
  0x1    0 -> 1 (rising)    Interrupt
  0x1    1 -> 0 (falling)   No interrupt

  (set ICR to 0x0 manually)
  0x0    0 -> 1 (rising)    No interrupt
  0x0    1 -> 0 (falling)   Interrupt

That is, with the ICR set to 1 for a gpio, only rising edge interrupts
are caught, and with it set to 0, only falling edge interrupts are
caught.  If we add in the toggle, we get this:

  ICR    GPIO               Result
  0x1    0 -> 1 (rising)    Interrupt (ICR set to 0x0)
  0x0    1 -> 0 (falling)   Interrupt (ICR set to 0x1)
  0x1    0 -> 1 ...

so, both rising and falling are caught, per the request for both
(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING).

Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2010-01-08 10:29:04 -08:00
..
include/plat mfd: Add support for twl6030 irq framework 2009-12-14 00:25:31 +01:00
Kconfig ARM: OMAP4: PM: Add dummy hooks for OMAP4 dpll api's 2009-12-11 17:00:46 -07:00
Makefile OMAP2/3/4 core: create omap_device layer 2009-09-03 20:14:05 +03:00
clock.c ARM: OMAP4: PM: Add dummy hooks for OMAP4 dpll api's 2009-12-11 17:00:46 -07:00
common.c OMAP4: Fix cpu detection 2009-12-11 16:16:34 -08:00
cpu-omap.c Merge 7xx-iosplit-plat-merge with omap-fixes 2009-11-22 10:08:43 -08:00
debug-devices.c omap: use smc91x_platdata to setup smc91x 2009-12-11 16:16:33 -08:00
debug-leds.c const: constify remaining dev_pm_ops 2009-12-15 08:53:25 -08:00
devices.c omap: arch/arm/plat-omap/devices.c - sort alphabetically 2009-12-11 16:16:36 -08:00
dma.c omap1: DMA: move LCD related code from plat-omap to mach-omap1 2009-12-11 16:16:33 -08:00
dmtimer.c omap: headers: Move remaining headers from include/mach to include/plat 2009-10-20 09:40:47 -07:00
fb.c OMAP: DSS2: omapfb driver 2009-12-09 12:12:44 +02:00
gpio.c omap: gpio: Simultaneously requested rising and falling edge 2010-01-08 10:29:04 -08:00
i2c.c omap: Split i2c platform init for mach-omap1 and mach-omap2 2009-12-11 16:16:32 -08:00
io.c omap: headers: Move remaining headers from include/mach to include/plat 2009-10-20 09:40:47 -07:00
iommu-debug.c omap: headers: Move remaining headers from include/mach to include/plat 2009-10-20 09:40:47 -07:00
iommu.c Merge branch '7xx-iosplit-plat' with omap-fixes 2009-11-10 18:10:34 -08:00
iopgtable.h omap iommu: tlb and pagetable primitives 2009-05-05 14:52:39 +03:00
iovmm.c arch/arm/plat-omap: Drop an unnecessary NULL test 2009-11-22 10:24:32 -08:00
mailbox.c omap: mailbox: OMAP4 Mailbox-driver Patch to support tasklet implementation 2009-11-22 10:24:33 -08:00
mcbsp.c omap: McBSP: Fix possible port lockout 2010-01-08 10:29:04 -08:00
mux.c omap: mux: Add new style pin multiplexing code for omap3 2009-12-11 16:16:32 -08:00
ocpi.c [ARM] Convert asm/io.h to linux/io.h 2008-09-06 12:10:45 +01:00
omap-pm-noop.c omap: headers: Move remaining headers from include/mach to include/plat 2009-10-20 09:40:47 -07:00
omap_device.c OMAP: omap_device: track latency in nanoseconds 2009-12-11 17:00:44 -07:00
sram.c OMAP4: Fix SRAM base and size 2009-12-11 16:16:35 -08:00
usb.c omap1: Add omap7xx USB support 2009-12-11 16:16:34 -08:00