linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] input: rotary encoder: Add wake up support
@ 2015-02-12 15:40 Sylvain Rochet
       [not found] ` <1423755638-9294-1-git-send-email-sylvain.rochet-ETtyaVkrhkNWk0Htik3J/w@public.gmane.org>
  2015-02-12 15:40 ` [PATCH v3 2/2] input: rotary encoder: Add wake up support Sylvain Rochet
  0 siblings, 2 replies; 7+ messages in thread
From: Sylvain Rochet @ 2015-02-12 15:40 UTC (permalink / raw)
  To: linux-input, Daniel Mack, Johan Hovold, Dmitry Torokhov; +Cc: Sylvain Rochet

Changes since v2:
  * Using false instead of 0 on boolean
  * Splitted DT documentation in separate patch

Changes since v1:
  * Using DT property wakeup-source instead of rotary-encoder,wakeup
  * Renamed int wakeup to bool wakeup_source
  * Patch cleanup (checkpatch.pl)

Sylvain Rochet (2):
  DT: Documentation: input: rotary encoder: Add wakeup-source property
  input: rotary encoder: Add wake up support

 .../devicetree/bindings/input/rotary-encoder.txt   |  1 +
 Documentation/input/rotary-encoder.txt             |  1 +
 drivers/input/misc/rotary_encoder.c                | 37 ++++++++++++++++++++++
 include/linux/rotary_encoder.h                     |  1 +
 4 files changed, 40 insertions(+)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] DT: Documentation: input: rotary encoder: Add wakeup-source property
       [not found] ` <1423755638-9294-1-git-send-email-sylvain.rochet-ETtyaVkrhkNWk0Htik3J/w@public.gmane.org>
@ 2015-02-12 15:40   ` Sylvain Rochet
  2015-06-16 17:28     ` Sylvain Rochet
  0 siblings, 1 reply; 7+ messages in thread
From: Sylvain Rochet @ 2015-02-12 15:40 UTC (permalink / raw)
  To: linux-input-u79uwXL29TY76Z2rM5mHXA, Daniel Mack, Johan Hovold,
	Dmitry Torokhov
  Cc: Sylvain Rochet, devicetree-u79uwXL29TY76Z2rM5mHXA

This patch adds property wakeup-source to GPIO rotary encoders.

Signed-off-by: Sylvain Rochet <sylvain.rochet-ETtyaVkrhkNWk0Htik3J/w@public.gmane.org>
Reviewed-by: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
---
 Documentation/devicetree/bindings/input/rotary-encoder.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
index 3315495..2c643a3 100644
--- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
+++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
@@ -15,6 +15,7 @@ Optional properties:
 - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
   greater than the specified steps or smaller than 0. For absolute axis only.
 - rotary-encoder,half-period: Makes the driver work on half-period mode.
+- wakeup-source: Boolean, rotary encoder can wake-up the system.
 
 See Documentation/input/rotary-encoder.txt for more information.
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] input: rotary encoder: Add wake up support
  2015-02-12 15:40 [PATCH v3 0/2] input: rotary encoder: Add wake up support Sylvain Rochet
       [not found] ` <1423755638-9294-1-git-send-email-sylvain.rochet-ETtyaVkrhkNWk0Htik3J/w@public.gmane.org>
@ 2015-02-12 15:40 ` Sylvain Rochet
  2015-02-13  3:43   ` Johan Hovold
  1 sibling, 1 reply; 7+ messages in thread
From: Sylvain Rochet @ 2015-02-12 15:40 UTC (permalink / raw)
  To: linux-input, Daniel Mack, Johan Hovold, Dmitry Torokhov; +Cc: Sylvain Rochet

This patch adds wake up support for rotary encoders.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
---
 Documentation/input/rotary-encoder.txt |  1 +
 drivers/input/misc/rotary_encoder.c    | 37 ++++++++++++++++++++++++++++++++++
 include/linux/rotary_encoder.h         |  1 +
 3 files changed, 39 insertions(+)

diff --git a/Documentation/input/rotary-encoder.txt b/Documentation/input/rotary-encoder.txt
index 92e68bc..ed158d3 100644
--- a/Documentation/input/rotary-encoder.txt
+++ b/Documentation/input/rotary-encoder.txt
@@ -109,6 +109,7 @@ static struct rotary_encoder_platform_data my_rotary_encoder_info = {
 	.inverted_a	= 0,
 	.inverted_b	= 0,
 	.half_period	= false,
+	.wakeup_source	= false,
 };
 
 static struct platform_device rotary_encoder_device = {
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index f27f81e..d166554 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -26,6 +26,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
+#include <linux/pm.h>
 
 #define DRV_NAME "rotary-encoder"
 
@@ -180,6 +181,8 @@ static struct rotary_encoder_platform_data *rotary_encoder_parse_dt(struct devic
 					"rotary-encoder,rollover", NULL);
 	pdata->half_period = !!of_get_property(np,
 					"rotary-encoder,half-period", NULL);
+	pdata->wakeup_source = !!of_get_property(np,
+					"wakeup-source", NULL);
 
 	return pdata;
 }
@@ -280,6 +283,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
 		goto exit_free_irq_b;
 	}
 
+	device_init_wakeup(&pdev->dev, pdata->wakeup_source);
+
 	platform_set_drvdata(pdev, encoder);
 
 	return 0;
@@ -306,6 +311,8 @@ static int rotary_encoder_remove(struct platform_device *pdev)
 	struct rotary_encoder *encoder = platform_get_drvdata(pdev);
 	const struct rotary_encoder_platform_data *pdata = encoder->pdata;
 
+	device_init_wakeup(&pdev->dev, false);
+
 	free_irq(encoder->irq_a, encoder);
 	free_irq(encoder->irq_b, encoder);
 	gpio_free(pdata->gpio_a);
@@ -320,11 +327,41 @@ static int rotary_encoder_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int rotary_encoder_suspend(struct device *dev)
+{
+	struct rotary_encoder *encoder = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev)) {
+		enable_irq_wake(encoder->irq_a);
+		enable_irq_wake(encoder->irq_b);
+	}
+
+	return 0;
+}
+
+static int rotary_encoder_resume(struct device *dev)
+{
+	struct rotary_encoder *encoder = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev)) {
+		disable_irq_wake(encoder->irq_a);
+		disable_irq_wake(encoder->irq_b);
+	}
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(rotary_encoder_pm_ops,
+		 rotary_encoder_suspend, rotary_encoder_resume);
+
 static struct platform_driver rotary_encoder_driver = {
 	.probe		= rotary_encoder_probe,
 	.remove		= rotary_encoder_remove,
 	.driver		= {
 		.name	= DRV_NAME,
+		.pm	= &rotary_encoder_pm_ops,
 		.of_match_table = of_match_ptr(rotary_encoder_of_match),
 	}
 };
diff --git a/include/linux/rotary_encoder.h b/include/linux/rotary_encoder.h
index 3f594dc..b33f2d2 100644
--- a/include/linux/rotary_encoder.h
+++ b/include/linux/rotary_encoder.h
@@ -11,6 +11,7 @@ struct rotary_encoder_platform_data {
 	bool relative_axis;
 	bool rollover;
 	bool half_period;
+	bool wakeup_source;
 };
 
 #endif /* __ROTARY_ENCODER_H__ */
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] input: rotary encoder: Add wake up support
  2015-02-12 15:40 ` [PATCH v3 2/2] input: rotary encoder: Add wake up support Sylvain Rochet
@ 2015-02-13  3:43   ` Johan Hovold
  2015-02-13  9:12     ` Sylvain Rochet
  0 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2015-02-13  3:43 UTC (permalink / raw)
  To: Sylvain Rochet; +Cc: linux-input, Daniel Mack, Johan Hovold, Dmitry Torokhov

On Thu, Feb 12, 2015 at 04:40:38PM +0100, Sylvain Rochet wrote:
> This patch adds wake up support for rotary encoders.
> 
> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> Reviewed-by: Johan Hovold <johan@kernel.org>
> ---
>  Documentation/input/rotary-encoder.txt |  1 +
>  drivers/input/misc/rotary_encoder.c    | 37 ++++++++++++++++++++++++++++++++++
>  include/linux/rotary_encoder.h         |  1 +
>  3 files changed, 39 insertions(+)
> 
> diff --git a/Documentation/input/rotary-encoder.txt b/Documentation/input/rotary-encoder.txt
> index 92e68bc..ed158d3 100644
> --- a/Documentation/input/rotary-encoder.txt
> +++ b/Documentation/input/rotary-encoder.txt
> @@ -109,6 +109,7 @@ static struct rotary_encoder_platform_data my_rotary_encoder_info = {
>  	.inverted_a	= 0,
>  	.inverted_b	= 0,
>  	.half_period	= false,
> +	.wakeup_source	= false,
>  };

This should have been part of PATCH 1/2 as well.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] input: rotary encoder: Add wake up support
  2015-02-13  3:43   ` Johan Hovold
@ 2015-02-13  9:12     ` Sylvain Rochet
  2015-02-15  5:53       ` Johan Hovold
  0 siblings, 1 reply; 7+ messages in thread
From: Sylvain Rochet @ 2015-02-13  9:12 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-input, Daniel Mack, Dmitry Torokhov

Hello Johan,

On Fri, Feb 13, 2015 at 11:43:17AM +0800, Johan Hovold wrote:
> On Thu, Feb 12, 2015 at 04:40:38PM +0100, Sylvain Rochet wrote:
> > This patch adds wake up support for rotary encoders.
> > 
> > Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> > Reviewed-by: Johan Hovold <johan@kernel.org>
> > ---
> >  Documentation/input/rotary-encoder.txt |  1 +
> >  drivers/input/misc/rotary_encoder.c    | 37 ++++++++++++++++++++++++++++++++++
> >  include/linux/rotary_encoder.h         |  1 +
> >  3 files changed, 39 insertions(+)
> > 
> > diff --git a/Documentation/input/rotary-encoder.txt b/Documentation/input/rotary-encoder.txt
> > index 92e68bc..ed158d3 100644
> > --- a/Documentation/input/rotary-encoder.txt
> > +++ b/Documentation/input/rotary-encoder.txt
> > @@ -109,6 +109,7 @@ static struct rotary_encoder_platform_data my_rotary_encoder_info = {
> >  	.inverted_a	= 0,
> >  	.inverted_b	= 0,
> >  	.half_period	= false,
> > +	.wakeup_source	= false,
> >  };
> 
> This should have been part of PATCH 1/2 as well.

Oops, this is not what I understand :(, should I resend ?

Sylvain

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] input: rotary encoder: Add wake up support
  2015-02-13  9:12     ` Sylvain Rochet
@ 2015-02-15  5:53       ` Johan Hovold
  0 siblings, 0 replies; 7+ messages in thread
From: Johan Hovold @ 2015-02-15  5:53 UTC (permalink / raw)
  To: Sylvain Rochet; +Cc: Johan Hovold, linux-input, Daniel Mack, Dmitry Torokhov

On Fri, Feb 13, 2015 at 10:12:08AM +0100, Sylvain Rochet wrote:
> Hello Johan,
> 
> On Fri, Feb 13, 2015 at 11:43:17AM +0800, Johan Hovold wrote:
> > On Thu, Feb 12, 2015 at 04:40:38PM +0100, Sylvain Rochet wrote:
> > > This patch adds wake up support for rotary encoders.
> > > 
> > > Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> > > Reviewed-by: Johan Hovold <johan@kernel.org>
> > > ---
> > >  Documentation/input/rotary-encoder.txt |  1 +
> > >  drivers/input/misc/rotary_encoder.c    | 37 ++++++++++++++++++++++++++++++++++
> > >  include/linux/rotary_encoder.h         |  1 +
> > >  3 files changed, 39 insertions(+)
> > > 
> > > diff --git a/Documentation/input/rotary-encoder.txt b/Documentation/input/rotary-encoder.txt
> > > index 92e68bc..ed158d3 100644
> > > --- a/Documentation/input/rotary-encoder.txt
> > > +++ b/Documentation/input/rotary-encoder.txt
> > > @@ -109,6 +109,7 @@ static struct rotary_encoder_platform_data my_rotary_encoder_info = {
> > >  	.inverted_a	= 0,
> > >  	.inverted_b	= 0,
> > >  	.half_period	= false,
> > > +	.wakeup_source	= false,
> > >  };
> > 
> > This should have been part of PATCH 1/2 as well.
> 
> Oops, this is not what I understand :(, should I resend ?

You can wait and see what the device-tree folks says about using
"wakeup-source" as property name first.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] DT: Documentation: input: rotary encoder: Add wakeup-source property
  2015-02-12 15:40   ` [PATCH v3 1/2] DT: Documentation: input: rotary encoder: Add wakeup-source property Sylvain Rochet
@ 2015-06-16 17:28     ` Sylvain Rochet
  0 siblings, 0 replies; 7+ messages in thread
From: Sylvain Rochet @ 2015-06-16 17:28 UTC (permalink / raw)
  To: devicetree; +Cc: linux-input, Daniel Mack, Johan Hovold, Dmitry Torokhov

Hello,

On Thu, Feb 12, 2015 at 04:40:37PM +0100, Sylvain Rochet wrote:
> This patch adds property wakeup-source to GPIO rotary encoders.
> 
> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> Reviewed-by: Johan Hovold <johan@kernel.org>
> Cc: <devicetree@vger.kernel.org>
> ---
>  Documentation/devicetree/bindings/input/rotary-encoder.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/rotary-encoder.txt b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> index 3315495..2c643a3 100644
> --- a/Documentation/devicetree/bindings/input/rotary-encoder.txt
> +++ b/Documentation/devicetree/bindings/input/rotary-encoder.txt
> @@ -15,6 +15,7 @@ Optional properties:
>  - rotary-encoder,rollover: Automatic rollove when the rotary value becomes
>    greater than the specified steps or smaller than 0. For absolute axis only.
>  - rotary-encoder,half-period: Makes the driver work on half-period mode.
> +- wakeup-source: Boolean, rotary encoder can wake-up the system.
>  
>  See Documentation/input/rotary-encoder.txt for more information.

Hello DT guys, it's been a while, may I ping you about this property ?

We wonder if this should be "rotary-encoder,wakeup", "linux,wakeup" or 
"wakeup-source".

Thank you :)

Sylvain

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-06-16 18:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 15:40 [PATCH v3 0/2] input: rotary encoder: Add wake up support Sylvain Rochet
     [not found] ` <1423755638-9294-1-git-send-email-sylvain.rochet-ETtyaVkrhkNWk0Htik3J/w@public.gmane.org>
2015-02-12 15:40   ` [PATCH v3 1/2] DT: Documentation: input: rotary encoder: Add wakeup-source property Sylvain Rochet
2015-06-16 17:28     ` Sylvain Rochet
2015-02-12 15:40 ` [PATCH v3 2/2] input: rotary encoder: Add wake up support Sylvain Rochet
2015-02-13  3:43   ` Johan Hovold
2015-02-13  9:12     ` Sylvain Rochet
2015-02-15  5:53       ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).