linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: "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>,
	"Benoît Cousson" <bcousson@baylibre.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	"Hans Verkuil" <hans.verkuil@cisco.com>,
	"Mauro Carvalho Chehab" <mchehab@osg.samsung.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Haibo Chen" <haibo.chen@freescale.com>,
	"Andrey Gelman" <andrey.gelman@compulab.co.il>,
	"Igor Grinberg" <grinberg@compulab.co.il>,
	"Aaron Sierra" <asierra@xes-inc.com>,
	"Krzysztof Kozlowski" <k.kozlowski@samsung.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, gta04-owner@goldelico.com,
	linux-input@vger.kernel.org
Subject: [PATCH v2 2/8] drivers:input:tsc2007: send pendown and penup only once like ads7846(+tsc2046) driver does
Date: Fri, 13 Nov 2015 21:35:53 +0100	[thread overview]
Message-ID: <fb7daf0f65e122b62e3149316849a3aeb3c8e5c3.1447446957.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1447446957.git.hns@goldelico.com>
In-Reply-To: <cover.1447446957.git.hns@goldelico.com>

this should reduce unnecessary input events.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/input/touchscreen/tsc2007.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index e0c7173..1a8a79d 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -94,6 +94,7 @@ struct tsc2007 {
 
 	wait_queue_head_t	wait;
 	bool			stopped;
+	bool			pendown;
 
 	int			(*get_pendown_state)(struct device *);
 	void			(*clear_penirq)(void);
@@ -251,7 +252,10 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 			dev_dbg(&ts->client->dev,
 					"shaped point(%4d,%4d), pressure (%4u)\n",
 					tc.x, tc.y, rt);
-			input_report_key(input, BTN_TOUCH, 1);
+			if (!ts->pendown) {
+				input_report_key(input, BTN_TOUCH, 1);
+				ts->pendown = true;
+			}
 			input_report_abs(input, ABS_X, tc.x);
 			input_report_abs(input, ABS_Y, tc.y);
 			input_report_abs(input, ABS_PRESSURE, rt);
@@ -272,9 +276,13 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 
 	dev_dbg(&ts->client->dev, "UP\n");
 
-	input_report_key(input, BTN_TOUCH, 0);
-	input_report_abs(input, ABS_PRESSURE, 0);
-	input_sync(input);
+	if (ts->pendown) {
+		input_report_key(input, BTN_TOUCH, 0);
+		input_report_abs(input, ABS_PRESSURE, 0);
+		input_sync(input);
+
+		ts->pendown = false;
+	}
 
 	if (ts->clear_penirq)
 		ts->clear_penirq();
-- 
2.5.1


  parent reply	other threads:[~2015-11-13 20:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 20:35 [PATCH v2 0/8] drivers: touchscreen: tsc2007 and ads7846/tsc2046 improvements (use common touchscreen bindings, pre-calibration, spi fix and provide iio raw values) H. Nikolaus Schaller
2015-11-13 20:35 ` [PATCH v2 1/8] drivers:input:tsc2007: add new common binding names, pre-calibration, flipping and rotation H. Nikolaus Schaller
2015-11-15  2:14   ` Rob Herring
2015-11-15 11:34     ` H. Nikolaus Schaller
2015-11-13 20:35 ` H. Nikolaus Schaller [this message]
2015-11-13 20:35 ` [PATCH v2 3/8] drivers:input:tsc2007: add iio interface to read external ADC input, temperature and raw conversion values H. Nikolaus Schaller
2015-11-13 20:35 ` [PATCH v2 4/8] DT:omap3+tsc2007: use new common touchscreen bindings H. Nikolaus Schaller
2015-11-13 20:35 ` [PATCH v2 5/8] drivers:input:ads7846(+tsc2046): add new common binding names, pre-calibration and flipping H. Nikolaus Schaller
2015-11-13 22:29   ` Sebastian Reichel
2015-11-13 20:35 ` [PATCH v2 6/8] drivers:input:ads7846(+tsc2046): recognise old binding for coordinate flipping H. Nikolaus Schaller
2015-11-15  2:19   ` Rob Herring
2015-11-15 10:54     ` H. Nikolaus Schaller
2015-11-13 20:35 ` [PATCH v2 7/8] drivers:input:ads7846(+tsc2046): fix spi module table H. Nikolaus Schaller
2015-11-13 20:35 ` [PATCH v2 8/8] DT:omap3+ads7846: use new common touchscreen bindings H. Nikolaus Schaller
2015-11-16 14:37   ` Grazvydas Ignotas
2015-11-16 15:31     ` H. Nikolaus Schaller

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=fb7daf0f65e122b62e3149316849a3aeb3c8e5c3.1447446957.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=andrey.gelman@compulab.co.il \
    --cc=asierra@xes-inc.com \
    --cc=bcousson@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=grinberg@compulab.co.il \
    --cc=gta04-owner@goldelico.com \
    --cc=haibo.chen@freescale.com \
    --cc=hans.verkuil@cisco.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=k.kozlowski@samsung.com \
    --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=mchehab@osg.samsung.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.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 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).