S:    Supported
  F:    Documentation/hwmon/wm83??
  F:    arch/arm/mach-s3c64xx/mach-crag6410*
 +F:    drivers/clk/clk-wm83*.c
  F:    drivers/leds/leds-wm83*.c
+ F:    drivers/gpio/gpio-*wm*.c
  F:    drivers/hwmon/wm83??-hwmon.c
  F:    drivers/input/misc/wm831x-on.c
  F:    drivers/input/touchscreen/wm831x-ts.c
 
                edge = GPIO_INT_FALL_EDGE;
                break;
        case IRQ_TYPE_EDGE_BOTH:
-               val = gpio_get_value(gpio);
-               if (val) {
-                       edge = GPIO_INT_LOW_LEV;
-                       pr_debug("mxc: set GPIO %d to low trigger\n", gpio);
+               if (GPIO_EDGE_SEL >= 0) {
+                       edge = GPIO_INT_BOTH_EDGES;
                } else {
-                       edge = GPIO_INT_HIGH_LEV;
-                       pr_debug("mxc: set GPIO %d to high trigger\n", gpio);
+                       val = gpio_get_value(gpio);
+                       if (val) {
+                               edge = GPIO_INT_LOW_LEV;
+                               pr_debug("mxc: set GPIO %d to low trigger\n", gpio);
+                       } else {
+                               edge = GPIO_INT_HIGH_LEV;
+                               pr_debug("mxc: set GPIO %d to high trigger\n", gpio);
+                       }
 -                      port->both_edges |= 1 << (gpio & 31);
++                      port->both_edges |= 1 << gpio_idx;
                }
-               port->both_edges |= 1 << gpio_idx;
                break;
        case IRQ_TYPE_LEVEL_LOW:
                edge = GPIO_INT_LOW_LEV;
                return -EINVAL;
        }
  
-       reg += GPIO_ICR1 + ((gpio_idx & 0x10) >> 2); /* ICR1 or ICR2 */
-       bit = gpio_idx & 0xf;
-       val = readl(reg) & ~(0x3 << (bit << 1));
-       writel(val | (edge << (bit << 1)), reg);
+       if (GPIO_EDGE_SEL >= 0) {
+               val = readl(port->base + GPIO_EDGE_SEL);
+               if (edge == GPIO_INT_BOTH_EDGES)
 -                      writel(val | (1 << (gpio & 0x1f)),
++                      writel(val | (1 << gpio_idx),
+                               port->base + GPIO_EDGE_SEL);
+               else
 -                      writel(val & ~(1 << (gpio & 0x1f)),
++                      writel(val & ~(1 << gpio_idx),
+                               port->base + GPIO_EDGE_SEL);
+       }
+ 
+       if (edge != GPIO_INT_BOTH_EDGES) {
 -              reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */
 -              bit = gpio & 0xf;
++              reg += GPIO_ICR1 + ((gpio_idx & 0x10) >> 2); /* lower or upper register */
++              bit = gpio_idx & 0xf;
+               val = readl(reg) & ~(0x3 << (bit << 1));
+               writel(val | (edge << (bit << 1)), reg);
+       }
+ 
 -      writel(1 << (gpio & 0x1f), port->base + GPIO_ISR);
 +      writel(1 << gpio_idx, port->base + GPIO_ISR);
  
        return 0;
  }