Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-07-22 Thread Linus Walleij
On Fri, Jun 7, 2013 at 10:50 PM, Tony Lindgren t...@atomide.com wrote:

 +static irqreturn_t pcs_omap_handle_irq(int irq, void *data)
 +{
 +   struct pcs_omap *pcso = data;
 +   struct list_head *pos;
 +   unsigned int wakeirq;
 +
 +   list_for_each(pos, pcso-wakeirqs) {
 +   struct pcs_reg *pcsoi;
 +   u16 val;
 +
 +   pcsoi = list_entry(pos, struct pcs_reg, node);
 +   wakeirq = pcsoi-irq;
 +   val = pcsoi-read(pcsoi-reg);
 +   if ((val  OMAP_WAKEUP_EVENT_MASK) == OMAP_WAKEUP_EVENT_MASK)
 +   generic_handle_irq(wakeirq);
 +   }
 +
 +   if (pcso-reconfigure_io_chain)
 +   pcso-reconfigure_io_chain();
 +
 +   return IRQ_HANDLED;
 +}

I fail to see why this is OMAP-specific.

I would prefer that this gets handled directly in the pinctrl core or
atleast in pinctrl-single in a generic way - latent IRQs is a generic
problem.

And I would also like it to work the other way around: when
irq_set_wake() is called from the irqchip it percolates down
to the pinctrl core and sets up a cross reference like this, for the pin,
so when an IRQ like this occurs, it will be routed up if and only
if it has been flagged as a wakeup from the irqchip layer.

The cross reference can be stored in struct pin_desc.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-07-22 Thread Linus Walleij
On Fri, Jun 7, 2013 at 10:50 PM, Tony Lindgren t...@atomide.com wrote:

 For wake-up events from deeper idle modes we need to check the
 configured padconf registers for the wake-up bit and then call
 the related interrupt handler.

 Done in collaboration with Roger Quadros rog...@ti.com.

 Cc: Haojian Zhuang haojian.zhu...@gmail.com
 Cc: Peter Ujfalusi peter.ujfal...@ti.com
 Cc: devicetree-disc...@lists.ozlabs.org
 Signed-off-by: Roger Quadros rog...@ti.com
 Signed-off-by: Tony Lindgren t...@atomide.com
(...)
 +   pcsoi-gpio = r-gpio;

This gpio member appear to be used nowhere, which is probably
related to what I was saying about custom GPIO interfaces doing
pinconf, but I could be wrong...

 +/*
 + * Note that omap2430 has 8-bit padconf registers and uses
 + * the plain pinctrl-single binding.
 + */
 +static const struct of_device_id pcs_omap_of_match[] = {
 +   { .compatible = ti,omap3-padconf, },
 +   { .compatible = ti,omap4-padconf, },
 +   { .compatible = ti,omap5-padconf, },
 +   {}
 +};

Goes into some binding document?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-12 Thread Tony Lindgren
* Roger Quadros rog...@ti.com [130611 05:57]:
 On 06/10/2013 06:21 PM, Tony Lindgren wrote:
  * Quadros, Roger rog...@ti.com [130610 03:09]:
  +
  +static int __init pcs_omap_init(void)
  +{
  +   platform_driver_register(pcs_omap_soc_driver);
  +   platform_driver_register(pcs_omap_driver);
  +
  +   return 0;
  +}
  +module_init(pcs_omap_init);
 
  It seems this has to be moved to an earlier place (e.g. subsys_initcall)
  else the pinctrl core fails to find the pinctrl device at the device 
  creation
  time and bails out with -EPROBE_DEFER. Also, that device is never
  created again, so -EPROBE_DEFER doesn't seem to work there.
  
  Ah here, found your other comment :)
  
  That's not needed, the real fix is to make twl-core.c and friends to
  be regular module_init. There are already patches queued for that.
 
 OK. I was testing with USB host driver and it seems to be loaded as 
 fs_initcall() which
 is the root of the problem. I will fix up the usb host driver to be loaded as 
 module_init()

OK good to hear.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-11 Thread Roger Quadros
On 06/10/2013 06:21 PM, Tony Lindgren wrote:
 * Quadros, Roger rog...@ti.com [130610 03:09]:
 +
 +static int __init pcs_omap_init(void)
 +{
 +   platform_driver_register(pcs_omap_soc_driver);
 +   platform_driver_register(pcs_omap_driver);
 +
 +   return 0;
 +}
 +module_init(pcs_omap_init);

 It seems this has to be moved to an earlier place (e.g. subsys_initcall)
 else the pinctrl core fails to find the pinctrl device at the device creation
 time and bails out with -EPROBE_DEFER. Also, that device is never
 created again, so -EPROBE_DEFER doesn't seem to work there.
 
 Ah here, found your other comment :)
 
 That's not needed, the real fix is to make twl-core.c and friends to
 be regular module_init. There are already patches queued for that.

OK. I was testing with USB host driver and it seems to be loaded as 
fs_initcall() which
is the root of the problem. I will fix up the usb host driver to be loaded as 
module_init()

cheers,
-roger
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-10 Thread Quadros, Roger


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. 
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


From: Tony Lindgren [t...@atomide.com]
Sent: Friday, June 07, 2013 11:50 PM
To: linus.wall...@linaro.org
Cc: devicetree-disc...@lists.ozlabs.org; Haojian Zhuang; Ujfalusi, Peter; 
linux-omap@vger.kernel.org; linux-arm-ker...@lists.infradead.org; Quadros, Roger
Subject: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up 
events

For wake-up events from deeper idle modes we need to check the
configured padconf registers for the wake-up bit and then call
the related interrupt handler.

Done in collaboration with Roger Quadros rog...@ti.com.

Cc: Haojian Zhuang haojian.zhu...@gmail.com
Cc: Peter Ujfalusi peter.ujfal...@ti.com
Cc: devicetree-disc...@lists.ozlabs.org
Signed-off-by: Roger Quadros rog...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/pinctrl/Makefile  |3
 drivers/pinctrl/pinctrl-single-omap.c |  287 +
 include/linux/platform_data/pinctrl-single-omap.h |4
 3 files changed, 293 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/pinctrl-single-omap.c
 create mode 100644 include/linux/platform_data/pinctrl-single-omap.h

diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 9bdaeb8..abf7f01 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -30,7 +30,8 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
 obj-$(CONFIG_PINCTRL_STN8815)  += pinctrl-nomadik-stn8815.o
 obj-$(CONFIG_PINCTRL_DB8500)   += pinctrl-nomadik-db8500.o
 obj-$(CONFIG_PINCTRL_DB8540)   += pinctrl-nomadik-db8540.o
-obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o
+pcs-$(CONFIG_ARCH_OMAP2PLUS)   += pinctrl-single-omap.o
+obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o $(pcs-y)
 obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o
 obj-$(CONFIG_PINCTRL_SUNXI)+= pinctrl-sunxi.o
 obj-$(CONFIG_PINCTRL_TEGRA)+= pinctrl-tegra.o
diff --git a/drivers/pinctrl/pinctrl-single-omap.c 
b/drivers/pinctrl/pinctrl-single-omap.c
new file mode 100644
index 000..680cf81
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-single-omap.c
@@ -0,0 +1,287 @@
+/*
+ * pinctrl-single-omap - omap specific wake-up irq handler
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
snip

+
+static int __init pcs_omap_init(void)
+{
+   platform_driver_register(pcs_omap_soc_driver);
+   platform_driver_register(pcs_omap_driver);
+
+   return 0;
+}
+module_init(pcs_omap_init);

It seems this has to be moved to an earlier place (e.g. subsys_initcall)
else the pinctrl core fails to find the pinctrl device at the device creation
time and bails out with -EPROBE_DEFER. Also, that device is never
created again, so -EPROBE_DEFER doesn't seem to work there.

The code i'm talking about is in dt_to_map_one_config()
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/pinctrl/devicetree.c#n109

+
+static void __exit pcs_omap_exit(void)
+{
+   platform_driver_unregister(pcs_omap_driver);
+   platform_driver_unregister(pcs_omap_soc_driver);
+}
+module_exit(pcs_omap_exit);
+
+MODULE_ALIAS(platform: pinctrl-single-omap);
+MODULE_AUTHOR(Texas Instruments Inc.);
+MODULE_DESCRIPTION(pinctrl-single-omap driver);
+MODULE_LICENSE(GPL v2);
diff --git a/include/linux/platform_data/pinctrl-single-omap.h 
b/include/linux/platform_data/pinctrl-single-omap.h
new file mode 100644
index 000..bd92efc
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-single-omap.h
@@ -0,0 +1,4 @@
+struct pcs_omap_pdata {
+   int irq;
+   void (*reconfigure_io_chain)(void);
+};


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-10 Thread Tony Lindgren
* Quadros, Roger rog...@ti.com [130610 03:09]:
 +
 +static int __init pcs_omap_init(void)
 +{
 +   platform_driver_register(pcs_omap_soc_driver);
 +   platform_driver_register(pcs_omap_driver);
 +
 +   return 0;
 +}
 +module_init(pcs_omap_init);
 
 It seems this has to be moved to an earlier place (e.g. subsys_initcall)
 else the pinctrl core fails to find the pinctrl device at the device creation
 time and bails out with -EPROBE_DEFER. Also, that device is never
 created again, so -EPROBE_DEFER doesn't seem to work there.

Ah here, found your other comment :)

That's not needed, the real fix is to make twl-core.c and friends to
be regular module_init. There are already patches queued for that.
 
Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-08 Thread Tony Lindgren
For wake-up events from deeper idle modes we need to check the
configured padconf registers for the wake-up bit and then call
the related interrupt handler.

Done in collaboration with Roger Quadros rog...@ti.com.

Cc: Haojian Zhuang haojian.zhu...@gmail.com
Cc: Peter Ujfalusi peter.ujfal...@ti.com
Cc: devicetree-disc...@lists.ozlabs.org
Signed-off-by: Roger Quadros rog...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com

---

Here's a version of against current Linux next to as also the
Makefile entry for sirf had changed.

diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 3b26e3c..d4c2214 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -31,7 +31,8 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
 obj-$(CONFIG_PINCTRL_STN8815)  += pinctrl-nomadik-stn8815.o
 obj-$(CONFIG_PINCTRL_DB8500)   += pinctrl-nomadik-db8500.o
 obj-$(CONFIG_PINCTRL_DB8540)   += pinctrl-nomadik-db8540.o
-obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o
+pcs-$(CONFIG_ARCH_OMAP2PLUS)   += pinctrl-single-omap.o
+obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o $(pcs-y)
 obj-$(CONFIG_PINCTRL_SIRF) += sirf/
 obj-$(CONFIG_PINCTRL_SUNXI)+= pinctrl-sunxi.o
 obj-$(CONFIG_PINCTRL_TEGRA)+= pinctrl-tegra.o
diff --git a/drivers/pinctrl/pinctrl-single-omap.c 
b/drivers/pinctrl/pinctrl-single-omap.c
new file mode 100644
index 000..680cf81
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-single-omap.c
@@ -0,0 +1,287 @@
+/*
+ * pinctrl-single-omap - omap specific wake-up irq handler
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/err.h
+#include linux/interrupt.h
+#include linux/io.h
+#include linux/irq.h
+#include linux/list.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_platform.h
+#include linux/platform_device.h
+#include linux/platform_data/pinctrl-single-omap.h
+#include linux/pm_runtime.h
+
+#include pinctrl-single.h
+
+#define OMAP_WAKEUP_EN (1  14)
+#define OMAP_WAKEUP_EVENT  (1  15)
+#define OMAP_WAKEUP_EVENT_MASK (OMAP_WAKEUP_EN | OMAP_WAKEUP_EVENT)
+
+struct pcs_omap {
+   unsigned int irq;
+   struct device *dev;
+   struct list_head wakeirqs;
+   struct pcs_soc soc;
+   void (*reconfigure_io_chain)(void);
+   struct mutex mutex;
+};
+
+static int pcs_omap_reg_init(const struct pcs_soc *soc, struct pcs_reg *r)
+{
+   struct pcs_omap *pcso = container_of(soc, struct pcs_omap, soc);
+   struct list_head *pos;
+   struct pcs_reg *pcsoi;
+   int res = 0;
+
+   if (!(r-val  OMAP_WAKEUP_EN))
+   return 0;
+
+   if (r-irq = 0)
+   return 0;
+
+   mutex_lock(pcso-mutex);
+   list_for_each(pos, pcso-wakeirqs) {
+   pcsoi = list_entry(pos, struct pcs_reg, node);
+   if (r-reg == pcsoi-reg) {
+   pcsoi-read = r-read;
+   pcsoi-write = r-write;
+   pcsoi-reg = r-reg;
+   pcsoi-val = r-val;
+   pcsoi-irq = r-irq;
+   pcsoi-gpio = r-gpio;
+   res++;
+   goto out;
+   }
+   }
+   pcsoi = devm_kzalloc(pcso-dev, sizeof(*r), GFP_KERNEL);
+   if (!pcsoi) {
+   mutex_unlock(pcso-mutex);
+   res = -ENOMEM;
+   goto out;
+   }
+   *pcsoi = *r;
+   list_add_tail(pcsoi-node, pcso-wakeirqs);
+
+out:
+   mutex_unlock(pcso-mutex);
+
+   if (res  pcso-reconfigure_io_chain)
+   pcso-reconfigure_io_chain();
+
+   return res  0 ? 0 : res;
+}
+
+static int pcs_update_list(const struct pcs_soc *soc, struct pcs_reg *r)
+{
+   struct pcs_omap *pcso = container_of(soc, struct pcs_omap, soc);
+   struct list_head *pos;
+   int changed = 0;
+
+   if (!r-irq)
+   return 0;
+
+   mutex_lock(pcso-mutex);
+   list_for_each(pos, pcso-wakeirqs) {
+   struct pcs_reg *pcsoi;
+
+   pcsoi = list_entry(pos, struct pcs_reg, node);
+   if ((r-reg == pcsoi-reg) 
+   (r-val != pcsoi-val)) {
+   pcsoi-val = r-val;
+   changed++;
+   }
+   }
+   mutex_unlock(pcso-mutex);
+
+   if (pcso-reconfigure_io_chain  changed)
+   pcso-reconfigure_io_chain();
+
+   return 0;
+}
+
+static int pcs_omap_enable(const struct pcs_soc 

Re: [PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-08 Thread Haojian Zhuang
On Sat, Jun 8, 2013 at 4:50 AM, Tony Lindgren t...@atomide.com wrote:
 For wake-up events from deeper idle modes we need to check the
 configured padconf registers for the wake-up bit and then call
 the related interrupt handler.

 Done in collaboration with Roger Quadros rog...@ti.com.

 Cc: Haojian Zhuang haojian.zhu...@gmail.com
 Cc: Peter Ujfalusi peter.ujfal...@ti.com
 Cc: devicetree-disc...@lists.ozlabs.org
 Signed-off-by: Roger Quadros rog...@ti.com
 Signed-off-by: Tony Lindgren t...@atomide.com
 ---
  drivers/pinctrl/Makefile  |3
  drivers/pinctrl/pinctrl-single-omap.c |  287 
 +
  include/linux/platform_data/pinctrl-single-omap.h |4
  3 files changed, 293 insertions(+), 1 deletion(-)
  create mode 100644 drivers/pinctrl/pinctrl-single-omap.c
  create mode 100644 include/linux/platform_data/pinctrl-single-omap.h


The hardware behavior likes PXA3xx.

Acked-by: Haojian Zhuang haojian.zhu...@gmail.com

Regards
Haojian
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] pinctrl: single: omap: Add SoC specific module for wake-up events

2013-06-07 Thread Tony Lindgren
For wake-up events from deeper idle modes we need to check the
configured padconf registers for the wake-up bit and then call
the related interrupt handler.

Done in collaboration with Roger Quadros rog...@ti.com.

Cc: Haojian Zhuang haojian.zhu...@gmail.com
Cc: Peter Ujfalusi peter.ujfal...@ti.com
Cc: devicetree-disc...@lists.ozlabs.org
Signed-off-by: Roger Quadros rog...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 drivers/pinctrl/Makefile  |3 
 drivers/pinctrl/pinctrl-single-omap.c |  287 +
 include/linux/platform_data/pinctrl-single-omap.h |4 
 3 files changed, 293 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/pinctrl-single-omap.c
 create mode 100644 include/linux/platform_data/pinctrl-single-omap.h

diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 9bdaeb8..abf7f01 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -30,7 +30,8 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
 obj-$(CONFIG_PINCTRL_STN8815)  += pinctrl-nomadik-stn8815.o
 obj-$(CONFIG_PINCTRL_DB8500)   += pinctrl-nomadik-db8500.o
 obj-$(CONFIG_PINCTRL_DB8540)   += pinctrl-nomadik-db8540.o
-obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o
+pcs-$(CONFIG_ARCH_OMAP2PLUS)   += pinctrl-single-omap.o
+obj-$(CONFIG_PINCTRL_SINGLE)   += pinctrl-single.o $(pcs-y)
 obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o
 obj-$(CONFIG_PINCTRL_SUNXI)+= pinctrl-sunxi.o
 obj-$(CONFIG_PINCTRL_TEGRA)+= pinctrl-tegra.o
diff --git a/drivers/pinctrl/pinctrl-single-omap.c 
b/drivers/pinctrl/pinctrl-single-omap.c
new file mode 100644
index 000..680cf81
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-single-omap.c
@@ -0,0 +1,287 @@
+/*
+ * pinctrl-single-omap - omap specific wake-up irq handler
+ *
+ * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/err.h
+#include linux/interrupt.h
+#include linux/io.h
+#include linux/irq.h
+#include linux/list.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_platform.h
+#include linux/platform_device.h
+#include linux/platform_data/pinctrl-single-omap.h
+#include linux/pm_runtime.h
+
+#include pinctrl-single.h
+
+#define OMAP_WAKEUP_EN (1  14)
+#define OMAP_WAKEUP_EVENT  (1  15)
+#define OMAP_WAKEUP_EVENT_MASK (OMAP_WAKEUP_EN | OMAP_WAKEUP_EVENT)
+
+struct pcs_omap {
+   unsigned int irq;
+   struct device *dev;
+   struct list_head wakeirqs;
+   struct pcs_soc soc;
+   void (*reconfigure_io_chain)(void);
+   struct mutex mutex;
+};
+
+static int pcs_omap_reg_init(const struct pcs_soc *soc, struct pcs_reg *r)
+{
+   struct pcs_omap *pcso = container_of(soc, struct pcs_omap, soc);
+   struct list_head *pos;
+   struct pcs_reg *pcsoi;
+   int res = 0;
+
+   if (!(r-val  OMAP_WAKEUP_EN))
+   return 0;
+
+   if (r-irq = 0)
+   return 0;
+
+   mutex_lock(pcso-mutex);
+   list_for_each(pos, pcso-wakeirqs) {
+   pcsoi = list_entry(pos, struct pcs_reg, node);
+   if (r-reg == pcsoi-reg) {
+   pcsoi-read = r-read;
+   pcsoi-write = r-write;
+   pcsoi-reg = r-reg;
+   pcsoi-val = r-val;
+   pcsoi-irq = r-irq;
+   pcsoi-gpio = r-gpio;
+   res++;
+   goto out;
+   }
+   }
+   pcsoi = devm_kzalloc(pcso-dev, sizeof(*r), GFP_KERNEL);
+   if (!pcsoi) {
+   mutex_unlock(pcso-mutex);
+   res = -ENOMEM;
+   goto out;
+   }
+   *pcsoi = *r;
+   list_add_tail(pcsoi-node, pcso-wakeirqs);
+
+out:
+   mutex_unlock(pcso-mutex);
+
+   if (res  pcso-reconfigure_io_chain)
+   pcso-reconfigure_io_chain();
+
+   return res  0 ? 0 : res;
+}
+
+static int pcs_update_list(const struct pcs_soc *soc, struct pcs_reg *r)
+{
+   struct pcs_omap *pcso = container_of(soc, struct pcs_omap, soc);
+   struct list_head *pos;
+   int changed = 0;
+
+   if (!r-irq)
+   return 0;
+
+   mutex_lock(pcso-mutex);
+   list_for_each(pos, pcso-wakeirqs) {
+   struct pcs_reg *pcsoi;
+
+   pcsoi = list_entry(pos, struct pcs_reg, node);
+   if ((r-reg == pcsoi-reg) 
+   (r-val != pcsoi-val)) {
+