Skip to contentSkip to conversation

input: qt1070: add power management ops

PATCH New Bo Shen 3 participants 4 messages Aug 13, 2013 – Oct 16, 2013

Subsystems (2)
lore
Share & tools
lore

Bo Shen

author
#0 lore raw

PATCH 1/1 input: qt1070: add power management ops

Add power management ops for qt1070, it maybe a wakeup source

---
 drivers/input/keyboard/qt1070.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/input/keyboard/qt1070.c +25 -0
index 42b773b..deefe5a 100644
@@ -243,6 +243,30 @@ static int qt1070_remove(struct i2c_client *client)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int qt1070_suspend(struct device *dev)
+{
+	struct qt1070_data *data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		enable_irq_wake(data->irq);
+
+	return 0;
+}
+
+static int qt1070_resume(struct device *dev)
+{
+	struct qt1070_data *data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		disable_irq_wake(data->irq);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume);
+
 static const struct i2c_device_id qt1070_id[] = {
 	{ "qt1070", 0 },
 	{ },
@@ -253,6 +277,7 @@ static struct i2c_driver qt1070_driver = {
 	.driver	= {
 		.name	= "qt1070",
 		.owner	= THIS_MODULE,
+		.pm	= &qt1070_pm_ops,
 	},
 	.id_table	= qt1070_id,
 	.probe		= qt1070_probe,
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 input: qt1070: add power management ops

On 13/08/2013 09:43, Bo Shen :

Quoted 3 lines

Add power management ops for qt1070, it maybe a wakeup source

Quoted 48 lines
---
  drivers/input/keyboard/qt1070.c |   25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
drivers/input/keyboard/qt1070.c +25 -0
index 42b773b..deefe5a 100644
@@ -243,6 +243,30 @@ static int qt1070_remove(struct i2c_client *client)
  	return 0;
  }
 
+#ifdef CONFIG_PM_SLEEP
+static int qt1070_suspend(struct device *dev)
+{
+	struct qt1070_data *data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		enable_irq_wake(data->irq);
+
+	return 0;
+}
+
+static int qt1070_resume(struct device *dev)
+{
+	struct qt1070_data *data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		disable_irq_wake(data->irq);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume);
+
  static const struct i2c_device_id qt1070_id[] = {
  	{ "qt1070", 0 },
  	{ },
@@ -253,6 +277,7 @@ static struct i2c_driver qt1070_driver = {
  	.driver	= {
  		.name	= "qt1070",
  		.owner	= THIS_MODULE,
+		.pm	= &qt1070_pm_ops,
  	},
  	.id_table	= qt1070_id,
  	.probe		= qt1070_probe,
Signature · 1 line
Nicolas Ferre
author
#2 lore raw

PATCH 1/1 input: qt1070: add power management ops

Hi Dmitry,

Quoted 6 lines · Nicolas Ferre

On 13/08/2013 09:43, Bo Shen :

Quoted 3 lines

Add power management ops for qt1070, it maybe a wakeup source

Would this patch be applied with Nicolas' ACK?

Best Regards,
Bo Shen

Quoted 51 lines
Quoted 49 lines
---
  drivers/input/keyboard/qt1070.c |   25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)
drivers/input/keyboard/qt1070.c +25 -0
index 42b773b..deefe5a 100644
@@ -243,6 +243,30 @@ static int qt1070_remove(struct i2c_client *client)
      return 0;
  }
 
+#ifdef CONFIG_PM_SLEEP
+static int qt1070_suspend(struct device *dev)
+{
+    struct qt1070_data *data = dev_get_drvdata(dev);
+
+    if (device_may_wakeup(dev))
+        enable_irq_wake(data->irq);
+
+    return 0;
+}
+
+static int qt1070_resume(struct device *dev)
+{
+    struct qt1070_data *data = dev_get_drvdata(dev);
+
+    if (device_may_wakeup(dev))
+        disable_irq_wake(data->irq);
+
+    return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume);
+
  static const struct i2c_device_id qt1070_id[] = {
      { "qt1070", 0 },
      { },
@@ -253,6 +277,7 @@ static struct i2c_driver qt1070_driver = {
      .driver    = {
          .name    = "qt1070",
          .owner    = THIS_MODULE,
+        .pm    = &qt1070_pm_ops,
      },
      .id_table    = qt1070_id,
      .probe        = qt1070_probe,
maintainer
#3 lore raw

PATCH 1/1 input: qt1070: add power management ops

Hi Bo,

Quoted 11 lines · Bo Shen

Hi Dmitry,

Quoted 6 lines · Nicolas Ferre

On 13/08/2013 09:43, Bo Shen :

Quoted 3 lines

Add power management ops for qt1070, it maybe a wakeup source

Would this patch be applied with Nicolas' ACK?

This patch is already in mainline:

commit 3719b54bc62318db7dd8ac7c39a09dfb991a208f

Author: Bo Shen <[email protected]>
Date:   Tue Aug 13 09:46:40 2013 -0700

Input: qt1070 - add power management ops

Add power management ops for qt1070, it may be a wakeup source.

Thanks.

Signature · 1 line
Dmitry