All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vignesh R <vigneshr@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Benoit Cousson <bcousson@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Russell King <linux@arm.linux.org.uk>
Cc: Roger Quadros <rogerq@ti.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	Frodo Lai <frodo.lai@gmail.com>, Jingoo Han <jg1.han@samsung.com>,
	<linux-omap@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-input@vger.kernel.org>,
	Vignesh R <vigneshr@ti.com>
Subject: [PATCH v3 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt
Date: Thu, 23 Jul 2015 20:24:05 +0530	[thread overview]
Message-ID: <1437663246-16049-2-git-send-email-vigneshr@ti.com> (raw)
In-Reply-To: <1437663246-16049-1-git-send-email-vigneshr@ti.com>

On am437x-gp-evm, pixcir touchscreen can wake the system from low power
state by generating wake-up interrupt via pinctrl and IO daisy chain.
Add support for optional wakeup interrupt source by regsitering to
automated wake IRQ framework introduced by commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling").
This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up")

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v3:
 * handle error code returned by of_irq_get_byname()

v2:
 * use of_irq_get_byname()
 * remove enable/disable_wake_irq()

 drivers/input/touchscreen/pixcir_i2c_ts.c | 22 ++++++++++++++++++----
 include/linux/input/pixcir_ts.h           |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 8f3e243a62bf..3a4ab358bf52 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -29,6 +29,8 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 
 #define PIXCIR_MAX_SLOTS       5 /* Max fingers supported by driver */
 
@@ -364,8 +366,6 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev)
 				goto unlock;
 			}
 		}
-
-		enable_irq_wake(client->irq);
 	} else if (input->users) {
 		ret = pixcir_stop(ts);
 	}
@@ -386,8 +386,6 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(&client->dev)) {
-		disable_irq_wake(client->irq);
-
 		if (!input->users) {
 			ret = pixcir_stop(ts);
 			if (ret) {
@@ -445,6 +443,13 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
 	dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
 		pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
 
+	pdata->wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
+	if (pdata->wakeirq < 0 && pdata->wakeirq != -ENODATA &&
+	    pdata->wakeirq != -EINVAL) {
+		dev_err(dev, "Failed to get wakeirq\n");
+		return ERR_PTR(pdata->wakeirq);
+	}
+
 	return pdata;
 }
 #else
@@ -564,11 +569,20 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, tsdata);
 	device_init_wakeup(&client->dev, 1);
 
+	/* Register wakeirq */
+	error = (pdata->wakeirq > 0) ?
+		dev_pm_set_dedicated_wake_irq(dev, pdata->wakeirq) :
+		dev_pm_set_wake_irq(dev, client->irq);
+	if (error)
+		dev_info(dev, "unable to setup wakeirq %d\n",
+			 error);
+
 	return 0;
 }
 
 static int pixcir_i2c_ts_remove(struct i2c_client *client)
 {
+	dev_pm_clear_wake_irq(&client->dev);
 	device_init_wakeup(&client->dev, 0);
 
 	return 0;
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 7bae83b7c396..da573de5a5ee 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -58,6 +58,7 @@ struct pixcir_ts_platform_data {
 	int x_max;
 	int y_max;
 	int gpio_attb;		/* GPIO connected to ATTB line */
+	int wakeirq;
 	struct pixcir_i2c_chip_data chip;
 };
 
-- 
2.4.5


WARNING: multiple messages have this Message-ID (diff)
From: Vignesh R <vigneshr@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Benoit Cousson <bcousson@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Russell King <linux@arm.linux.org.uk>
Cc: Roger Quadros <rogerq@ti.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	Frodo Lai <frodo.lai@gmail.com>, Jingoo Han <jg1.han@samsung.com>,
	linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	Vignesh R <vigneshr@ti.com>
Subject: [PATCH v3 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt
Date: Thu, 23 Jul 2015 20:24:05 +0530	[thread overview]
Message-ID: <1437663246-16049-2-git-send-email-vigneshr@ti.com> (raw)
In-Reply-To: <1437663246-16049-1-git-send-email-vigneshr@ti.com>

On am437x-gp-evm, pixcir touchscreen can wake the system from low power
state by generating wake-up interrupt via pinctrl and IO daisy chain.
Add support for optional wakeup interrupt source by regsitering to
automated wake IRQ framework introduced by commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling").
This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up")

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v3:
 * handle error code returned by of_irq_get_byname()

v2:
 * use of_irq_get_byname()
 * remove enable/disable_wake_irq()

 drivers/input/touchscreen/pixcir_i2c_ts.c | 22 ++++++++++++++++++----
 include/linux/input/pixcir_ts.h           |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 8f3e243a62bf..3a4ab358bf52 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -29,6 +29,8 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 
 #define PIXCIR_MAX_SLOTS       5 /* Max fingers supported by driver */
 
@@ -364,8 +366,6 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev)
 				goto unlock;
 			}
 		}
-
-		enable_irq_wake(client->irq);
 	} else if (input->users) {
 		ret = pixcir_stop(ts);
 	}
@@ -386,8 +386,6 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(&client->dev)) {
-		disable_irq_wake(client->irq);
-
 		if (!input->users) {
 			ret = pixcir_stop(ts);
 			if (ret) {
@@ -445,6 +443,13 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
 	dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
 		pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
 
+	pdata->wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
+	if (pdata->wakeirq < 0 && pdata->wakeirq != -ENODATA &&
+	    pdata->wakeirq != -EINVAL) {
+		dev_err(dev, "Failed to get wakeirq\n");
+		return ERR_PTR(pdata->wakeirq);
+	}
+
 	return pdata;
 }
 #else
@@ -564,11 +569,20 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, tsdata);
 	device_init_wakeup(&client->dev, 1);
 
+	/* Register wakeirq */
+	error = (pdata->wakeirq > 0) ?
+		dev_pm_set_dedicated_wake_irq(dev, pdata->wakeirq) :
+		dev_pm_set_wake_irq(dev, client->irq);
+	if (error)
+		dev_info(dev, "unable to setup wakeirq %d\n",
+			 error);
+
 	return 0;
 }
 
 static int pixcir_i2c_ts_remove(struct i2c_client *client)
 {
+	dev_pm_clear_wake_irq(&client->dev);
 	device_init_wakeup(&client->dev, 0);
 
 	return 0;
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 7bae83b7c396..da573de5a5ee 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -58,6 +58,7 @@ struct pixcir_ts_platform_data {
 	int x_max;
 	int y_max;
 	int gpio_attb;		/* GPIO connected to ATTB line */
+	int wakeirq;
 	struct pixcir_i2c_chip_data chip;
 };
 
-- 
2.4.5

WARNING: multiple messages have this Message-ID (diff)
From: vigneshr@ti.com (Vignesh R)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt
Date: Thu, 23 Jul 2015 20:24:05 +0530	[thread overview]
Message-ID: <1437663246-16049-2-git-send-email-vigneshr@ti.com> (raw)
In-Reply-To: <1437663246-16049-1-git-send-email-vigneshr@ti.com>

On am437x-gp-evm, pixcir touchscreen can wake the system from low power
state by generating wake-up interrupt via pinctrl and IO daisy chain.
Add support for optional wakeup interrupt source by regsitering to
automated wake IRQ framework introduced by commit 4990d4fe327b ("PM /
Wakeirq: Add automated device wake IRQ handling").
This is similar in approach to commit 2a0b965cfb6e ("serial: omap: Add
support for optional wake-up")

Signed-off-by: Vignesh R <vigneshr@ti.com>
---

v3:
 * handle error code returned by of_irq_get_byname()

v2:
 * use of_irq_get_byname()
 * remove enable/disable_wake_irq()

 drivers/input/touchscreen/pixcir_i2c_ts.c | 22 ++++++++++++++++++----
 include/linux/input/pixcir_ts.h           |  1 +
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 8f3e243a62bf..3a4ab358bf52 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -29,6 +29,8 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
+#include <linux/pm_wakeirq.h>
 
 #define PIXCIR_MAX_SLOTS       5 /* Max fingers supported by driver */
 
@@ -364,8 +366,6 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev)
 				goto unlock;
 			}
 		}
-
-		enable_irq_wake(client->irq);
 	} else if (input->users) {
 		ret = pixcir_stop(ts);
 	}
@@ -386,8 +386,6 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev)
 	mutex_lock(&input->mutex);
 
 	if (device_may_wakeup(&client->dev)) {
-		disable_irq_wake(client->irq);
-
 		if (!input->users) {
 			ret = pixcir_stop(ts);
 			if (ret) {
@@ -445,6 +443,13 @@ static struct pixcir_ts_platform_data *pixcir_parse_dt(struct device *dev)
 	dev_dbg(dev, "%s: x %d, y %d, gpio %d\n", __func__,
 		pdata->x_max + 1, pdata->y_max + 1, pdata->gpio_attb);
 
+	pdata->wakeirq = of_irq_get_byname(dev->of_node, "wakeup");
+	if (pdata->wakeirq < 0 && pdata->wakeirq != -ENODATA &&
+	    pdata->wakeirq != -EINVAL) {
+		dev_err(dev, "Failed to get wakeirq\n");
+		return ERR_PTR(pdata->wakeirq);
+	}
+
 	return pdata;
 }
 #else
@@ -564,11 +569,20 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, tsdata);
 	device_init_wakeup(&client->dev, 1);
 
+	/* Register wakeirq */
+	error = (pdata->wakeirq > 0) ?
+		dev_pm_set_dedicated_wake_irq(dev, pdata->wakeirq) :
+		dev_pm_set_wake_irq(dev, client->irq);
+	if (error)
+		dev_info(dev, "unable to setup wakeirq %d\n",
+			 error);
+
 	return 0;
 }
 
 static int pixcir_i2c_ts_remove(struct i2c_client *client)
 {
+	dev_pm_clear_wake_irq(&client->dev);
 	device_init_wakeup(&client->dev, 0);
 
 	return 0;
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 7bae83b7c396..da573de5a5ee 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -58,6 +58,7 @@ struct pixcir_ts_platform_data {
 	int x_max;
 	int y_max;
 	int gpio_attb;		/* GPIO connected to ATTB line */
+	int wakeirq;
 	struct pixcir_i2c_chip_data chip;
 };
 
-- 
2.4.5

  reply	other threads:[~2015-07-23 14:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 14:54 [PATCH v3 0/2] pixcir_i2c_ts: Add optional wakeup irq support Vignesh R
2015-07-23 14:54 ` Vignesh R
2015-07-23 14:54 ` Vignesh R
2015-07-23 14:54 ` Vignesh R [this message]
2015-07-23 14:54   ` [PATCH v3 1/2] input: touchscreen: pixcir_i2c_ts: Add support for optional wakeup interrupt Vignesh R
2015-07-23 14:54   ` Vignesh R
2015-07-27 10:49   ` Roger Quadros
2015-07-27 10:49     ` Roger Quadros
2015-07-27 10:49     ` Roger Quadros
2015-07-27 11:19     ` Vignesh R
2015-07-27 11:19       ` Vignesh R
2015-07-27 11:19       ` Vignesh R
2015-07-27 21:20       ` Dmitry Torokhov
2015-07-27 21:20         ` Dmitry Torokhov
2015-07-28  9:04         ` Roger Quadros
2015-07-28  9:04           ` Roger Quadros
2015-07-28  9:04           ` Roger Quadros
2015-07-23 14:54 ` [PATCH v3 2/2] ARM: dts: am437x-gp-evm: Add wakeup interrupt source for pixcir_i2c_tsc Vignesh R
2015-07-23 14:54   ` Vignesh R
2015-07-23 14:54   ` Vignesh R

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437663246-16049-2-git-send-email-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=frodo.lai@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jg1.han@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@ti.com \
    --cc=rydberg@bitmath.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.