ARM: tegra12: allow 1-to-many irq to wake mapping
Peng Du [Thu, 18 Jul 2013 23:55:22 +0000 (16:55 -0700)]
Applying the below change for tegra12x:

  ARM: tegra: allow 1-to-many irq to wake mapping
  commit: cb65afb270232448b9a00c547ce67f06aa7a1e54

Signed-off-by: Peng Du <pdu@nvidia.com>
Change-Id: Id0ea2cc1d351f954fd62de570c425d405f92ce3c
Reviewed-on: http://git-master/r/251040
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

arch/arm/mach-tegra/wakeups-t12x.c

index 9b86536..9b2aa50 100644 (file)
@@ -168,18 +168,20 @@ int tegra_gpio_to_wake(int gpio)
        return -EINVAL;
 }
 
-int tegra_irq_to_wake(int irq)
+void tegra_irq_to_wake(int irq, int *wak_list, int *wak_size)
 {
        int i;
-       int ret = -EINVAL;
 
+       *wak_size = 0;
        for (i = 0; i < ARRAY_SIZE(tegra_wake_event_irq); i++) {
                if (tegra_wake_event_irq[i] == irq) {
                        pr_info("Wake%d for irq=%d\n", i, irq);
-                       ret = i;
-                       goto out;
+                       wak_list[*wak_size] = i;
+                       *wak_size = *wak_size + 1;
                }
        }
+       if (*wak_size)
+               goto out;
 
        /* The gpio set_wake code bubbles the set_wake call up to the irq
         * set_wake code. This insures that the nested irq set_wake call
@@ -194,11 +196,12 @@ int tegra_irq_to_wake(int irq)
 
        if (tegra_gpio_get_bank_int_nr(tegra_gpio_wakes[last_gpio]) == irq) {
                pr_info("gpio bank wake found: wake%d for irq=%d\n", i, irq);
-               ret = last_gpio;
+               wak_list[*wak_size] = last_gpio;
+               *wak_size = 1;
        }
 
 out:
-       return ret;
+       return;
 }
 
 int tegra_wake_to_irq(int wake)