From patchwork Wed May 4 10:24:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9012061 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 163019F39D for ; Wed, 4 May 2016 10:25:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D00220390 for ; Wed, 4 May 2016 10:25:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 331042037F for ; Wed, 4 May 2016 10:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757556AbcEDKYv (ORCPT ); Wed, 4 May 2016 06:24:51 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:42118 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757425AbcEDKYr (ORCPT ); Wed, 4 May 2016 06:24:47 -0400 Received: from vsmta13.fe.internet.bosch.com (unknown [10.4.98.53]) by imta24.fe.bosch.de (Postfix) with ESMTP id 0F283D80204 for ; Wed, 4 May 2016 12:24:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462357486; bh=ouBWHh5srlogj/Sk3yWmNfyMJAskJgSoTHPUkeXkeks=; l=10; h=From:From:Reply-To:Sender; b=W6cyf3ZVQA5GnQ0gjWGpQnfAqyU9BI0dHJA1FoIVsHwDtJy0+qljYBx+MlLKsM4RI C4ilhCY97RRkxCQsRNBT3DusxpQ6T8zGd9J3PhoDxLrWd7B5Zzt1Z2W6HNk0BwxLuQ DilyFd40uyYe0KM3a5SqUVQDD/fmhg6R/RMu475g= Received: from FE-HUB1001.de.bosch.com (vsgw23.fe.internet.bosch.com [10.4.98.23]) by vsmta13.fe.internet.bosch.com (Postfix) with ESMTP id C3DC72E40611 for ; Wed, 4 May 2016 12:24:45 +0200 (CEST) Received: from hi-z5661.hi.de.bosch.com (10.34.211.95) by FE-HUB1001.de.bosch.com (10.4.103.109) with Microsoft SMTP Server id 14.3.195.1; Wed, 4 May 2016 12:24:44 +0200 Received: from hi-z5661.hi.de.bosch.com (localhost [127.0.0.1]) by hi-z5661.hi.de.bosch.com (Postfix) with ESMTP id EDB5742A18; Wed, 4 May 2016 12:24:43 +0200 (CEST) From: Dirk Behme To: , Dmitry Torokhov , Henrik Rydberg , Javier Martinez Canillas CC: Knut Wohlrab , Oleksij Rempel Subject: [PATCH v3 3/4] Input: zforce_ts: Add device tree support for scanning frequency Date: Wed, 4 May 2016 12:24:40 +0200 Message-ID: <1462357481-16258-4-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1462357481-16258-1-git-send-email-dirk.behme@de.bosch.com> References: <1462357481-16258-1-git-send-email-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22300.006 X-TMASE-MatchedRID: PNYZc1qdHqKLwgJA7qJvFBWCVBr+Ay98FuNF4lJG6xtq1Zuz1uJuCGb6 PphVtfZgepIB3PZlMP0lzcrQrfCbLpw1Vo16+J2x6/xAZojbl7d6zDxGcFEbCq0uk08Xe+CsoLe GyPisKp12oqDCZT4qtIZnaPgXWZLwLVayL7k7olzcWo5Vvs8MQu3+iQEtoSj4d0CDQF9Yh06jxY yRBa/qJcFwgTvxipFajoczmuoPCq3aeuoT+YGkE5dhIYtLJrlHaLMB4x63PsU1/LcZQdhV7Jee3 NVihT0rXiVRBBx+LmLgtLrbED8lFoWvI2+uhdjZYYXJV0MyVqSj8b7iT1+xr2Y1nzFQPMLzHwIx WwrKkFl+4e/MUJHjLyOKu9iBLoTUlExlQIQeRG0= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Knut Wohlrab Add device tree support for idle and finger scanning frequency. For usage details see documentation. Signed-off-by: Knut Wohlrab Signed-off-by: Oleksij Rempel --- .../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 */