All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@de.bosch.com>
To: linux-input@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Henrik Rydberg <rydberg@bitmath.org>,
	Javier Martinez Canillas <javier@osg.samsung.com>
Cc: Knut Wohlrab <Knut.Wohlrab@de.bosch.com>,
	Oleksij Rempel <linux@rempel-privat.de>
Subject: [PATCH v3 3/4] Input: zforce_ts: Add device tree support for scanning frequency
Date: Wed, 4 May 2016 12:24:40 +0200	[thread overview]
Message-ID: <1462357481-16258-4-git-send-email-dirk.behme@de.bosch.com> (raw)
In-Reply-To: <1462357481-16258-1-git-send-email-dirk.behme@de.bosch.com>

From: Knut Wohlrab <Knut.Wohlrab@de.bosch.com>

Add device tree support for idle and finger scanning frequency.

For usage details see documentation.

Signed-off-by: Knut Wohlrab <Knut.Wohlrab@de.bosch.com>
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
 .../devicetree/bindings/input/touchscreen/zforce_ts.txt   |  4 ++++
 drivers/input/touchscreen/zforce_ts.c                     | 15 ++++++++++++++-
 include/linux/platform_data/zforce_ts.h                   |  2 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
index e3c27c4..d8d57ba 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
@@ -11,6 +11,8 @@ Required properties:
 Optional properties:
 - irq-gpios : interrupt gpio the chip is connected to
 - vdd-supply: Regulator controlling the controller supply
+- scan-idle-hz: idle scanning frequency in Hz (0 - 65535 Hz; default 10 Hz)
+- scan-active-hz: touch scanning frequeny in Hz (0 - 65535 Hz; default 50 Hz)
 
 Example:
 
@@ -28,6 +30,8 @@ Example:
 
 			x-size = <800>;
 			y-size = <600>;
+			scan-idle-hz = <50>;
+			scan-active-hz = <250>;
 		};
 
 		/* ... */
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index c912a0b..2e489fd 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -87,6 +87,9 @@
 
 #define SETCONFIG_DUALTOUCH		(1 << 0)
 
+#define SCAN_FREQ_DEFAULT_IDLE		10
+#define SCAN_FREQ_DEFAULT_FINGER	50
+
 struct zforce_point {
 	int coord_x;
 	int coord_y;
@@ -304,7 +307,9 @@ static int zforce_start(struct zforce_ts *ts)
 		goto error;
 	}
 
-	ret = zforce_scan_frequency(ts, 10, 50, 50);
+	ret = zforce_scan_frequency(ts, pdata->scan_freq_idle,
+				    pdata->scan_freq_finger,
+				    pdata->scan_freq_finger);
 	if (ret) {
 		dev_err(&client->dev, "Unable to set scan frequency, %d\n",
 			ret);
@@ -838,6 +843,14 @@ static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev)
 		return ERR_PTR(-EINVAL);
 	}
 
+	if (of_property_read_u16(np, "scan-idle-hz",
+				 &pdata->scan_freq_idle))
+		pdata->scan_freq_idle = SCAN_FREQ_DEFAULT_IDLE;
+
+	if (of_property_read_u16(np, "scan-active-hz",
+				 &pdata->scan_freq_finger))
+		pdata->scan_freq_finger = SCAN_FREQ_DEFAULT_FINGER;
+
 	return pdata;
 }
 
diff --git a/include/linux/platform_data/zforce_ts.h b/include/linux/platform_data/zforce_ts.h
index 7bdece8..90a1181 100644
--- a/include/linux/platform_data/zforce_ts.h
+++ b/include/linux/platform_data/zforce_ts.h
@@ -18,6 +18,8 @@
 struct zforce_ts_platdata {
 	unsigned int x_max;
 	unsigned int y_max;
+	u16 scan_freq_idle;
+	u16 scan_freq_finger;
 };
 
 #endif /* _LINUX_INPUT_ZFORCE_TS_H */
-- 
1.9.1


  parent reply	other threads:[~2016-05-04 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 10:24 [PATCH v3 0/4] zForce upstreaming Dirk Behme
2016-05-04 10:24 ` [PATCH v3 1/4] Input: zforce_ts: Reinitialize touch controller when BOOT_COMPLETE received Dirk Behme
2016-05-04 10:24 ` [PATCH v3 2/4] Input: zforce_ts: allow open even if initialisation is not completed Dirk Behme
2016-05-04 10:24 ` Dirk Behme [this message]
2016-07-06 19:59   ` [PATCH v3 3/4] Input: zforce_ts: Add device tree support for scanning frequency Dmitry Torokhov
2016-05-04 10:24 ` [PATCH v3 4/4] Input: zforce_ts: Add support for minimum touch size limit Dirk Behme
2016-05-19  5:26 ` [PATCH v3 0/4] zForce upstreaming Dirk Behme
2016-06-10  7:43 ` AW: " FIXED-TERM Rempel Oleksij (CM/ESO3)

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=1462357481-16258-4-git-send-email-dirk.behme@de.bosch.com \
    --to=dirk.behme@de.bosch.com \
    --cc=Knut.Wohlrab@de.bosch.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=javier@osg.samsung.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=rydberg@bitmath.org \
    /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.