linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linux-sh list <linux-sh@vger.kernel.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Magnus Damm <magnus.damm@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [Update][PATCH 4/5] PM / input / touchscreen: Make st1232 use device PM QoS constraints
Date: Fri, 16 Dec 2011 00:13:35 +0000	[thread overview]
Message-ID: <201112160113.36166.rjw@sisk.pl> (raw)
In-Reply-To: <201112160110.09124.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the st1232 driver use dev_pm_qos_add_ancestor_request() to
add a device PM QoS latency constraint for the controller it
depends on, so that the controller won't go into an overly deep
low-power state when the touchscreen has to be particularly
responsive (e.g. when the user moves his or her finger on it).

This change is based on a prototype patch from Guennadi Liakhovetski.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/input/touchscreen/st1232.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Index: linux/drivers/input/touchscreen/st1232.c
=================================--- linux.orig/drivers/input/touchscreen/st1232.c
+++ linux/drivers/input/touchscreen/st1232.c
@@ -23,6 +23,7 @@
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/pm_qos.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 
@@ -46,6 +47,7 @@ struct st1232_ts_data {
 	struct i2c_client *client;
 	struct input_dev *input_dev;
 	struct st1232_ts_finger finger[MAX_FINGERS];
+	struct dev_pm_qos_request low_latency_req;
 };
 
 static int st1232_ts_read_data(struct st1232_ts_data *ts)
@@ -118,8 +120,17 @@ static irqreturn_t st1232_ts_irq_handler
 	}
 
 	/* SYN_MT_REPORT only if no contact */
-	if (!count)
+	if (!count) {
 		input_mt_sync(input_dev);
+		if (ts->low_latency_req.dev) {
+			dev_pm_qos_remove_request(&ts->low_latency_req);
+			ts->low_latency_req.dev = NULL;
+		}
+	} else if (!ts->low_latency_req.dev) {
+		/* First contact, request 100 us latency. */
+		dev_pm_qos_add_ancestor_request(&ts->client->dev,
+						&ts->low_latency_req, 100);
+	}
 
 	/* SYN_REPORT */
 	input_sync(input_dev);


  parent reply	other threads:[~2011-12-16  0:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 23:42 [RFC][PATCH 0/4] PM / shmobile: Use PM QoS latency constraints in touchscreen driver Rafael J. Wysocki
2011-12-09 23:43 ` [RFC][PATCH 1/4] PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume Rafael J. Wysocki
2011-12-09 23:44 ` [RFC][PATCH 2/4] PM / shmobile: Remove the stay_on flag from SH7372's PM domains Rafael J. Wysocki
2011-12-09 23:45 ` [RFC][PATCH 3/4] PM / QoS: Introduce dev_pm_qos_add_ancestor_request() Rafael J. Wysocki
2011-12-09 23:46 ` [RFC][PATCH 4/4] PM / input / touchscreen: Make st1232 use device PM QoS constraints Rafael J. Wysocki
2011-12-12 14:34   ` [RFC][PATCH 4/4] PM / input / touchscreen: Make st1232 use device Guennadi Liakhovetski
2011-12-16  0:10 ` [Update][PATCH 0/5] PM / shmobile: Use PM QoS latency constraints in touchscreen driver on SH7372 Rafael J. Wysocki
2011-12-16  0:11   ` [Update][PATCH 1/5] PM / shmobile: Don't include SH7372's INTCS in syscore suspend/resume Rafael J. Wysocki
2011-12-16  0:12   ` [Update][PATCH 2/5] PM / shmobile: Remove the stay_on flag from SH7372's PM domains Rafael J. Wysocki
2011-12-16  0:12   ` [Update][PATCH 3/5] PM / QoS: Introduce dev_pm_qos_add_ancestor_request() Rafael J. Wysocki
2011-12-16  0:13   ` Rafael J. Wysocki [this message]
2011-12-16  0:16   ` [Update][PATCH 5/5] PM / shmobile: Allow the A4R domain to be turned off at run time Rafael J. Wysocki

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=201112160113.36166.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.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 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).