From patchwork Wed May 4 10:24:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9012071 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 3FA2F9FC33 for ; Wed, 4 May 2016 10:25:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45BA62037F for ; Wed, 4 May 2016 10:25:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DF5A20394 for ; Wed, 4 May 2016 10:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757557AbcEDKYw (ORCPT ); Wed, 4 May 2016 06:24:52 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:42115 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757403AbcEDKYr (ORCPT ); Wed, 4 May 2016 06:24:47 -0400 Received: from vsmta12.fe.internet.bosch.com (unknown [10.4.98.52]) by imta24.fe.bosch.de (Postfix) with ESMTP id E2D61D80219 for ; Wed, 4 May 2016 12:24:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1462357485; bh=ouBWHh5srlogj/Sk3yWmNfyMJAskJgSoTHPUkeXkeks=; l=10; h=From:From:Reply-To:Sender; b=wxp4qTP2YKbfAdVh4RWCfI4UI6H9kwh4JBdSBjSbcjggoKDGN5NVxkQ1zk5fTFWeQ 1muphc6tZZk+2F1CvTTTAfPzSJRM9ayyHq8mSGkIeg6emGerPXF5YvLtxURBRC1u5p lIbLvXVsa2cS3A6NgGfbAS8uk0h8ZWbvT8c3RtGI= Received: from SI-HUB1001.de.bosch.com (vsgw22.fe.internet.bosch.com [10.4.98.11]) by vsmta12.fe.internet.bosch.com (Postfix) with ESMTP id 9C75F1B80640 for ; Wed, 4 May 2016 12:24:45 +0200 (CEST) Received: from hi-z5661.hi.de.bosch.com (10.34.211.95) by SI-HUB1001.de.bosch.com (10.4.103.108) 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 15D4341864; Wed, 4 May 2016 12:24:44 +0200 (CEST) From: Dirk Behme To: , Dmitry Torokhov , Henrik Rydberg , Javier Martinez Canillas CC: Knut Wohlrab , Oleksij Rempel Subject: [PATCH v3 4/4] Input: zforce_ts: Add support for minimum touch size limit Date: Wed, 4 May 2016 12:24:41 +0200 Message-ID: <1462357481-16258-5-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: r4i5/tdWdiDX+jWaHZ/d599F5Swf4pRNh+w9Wz/xXDqfAI47JnxBxC1Q kH0sYj3GPyIj4R5J2uvl5mxB4fbIrB1YpEPWJiyzhrs6JAEL1u4sO7y/k5+VebC5w3HgF8UiVon uiLTPfidH6gxXpncC8X8q+Rr3CkIc0f9apaWMaFIbmaDSnOqZfo7vhl9PIBCwCqIJhrrDy290Pi IFfRms6Ej9OIj3yO7NMHPQXWpPyoCPaFHMfVTC4BRFJJyf5BJe3QfwsVk0UbtuRXh7bFKB7ifps pY0EeF24Wd4JYNxMlxYKJ+wC9m/Dj4P/WVpiJvdPpCuffGH9zI= 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 The minimum touch size can be set to support more reliable touch detection under difficult conditions (e.g. dust on touch panel surface). For usage details see documentation. Signed-off-by: Knut Wohlrab Signed-off-by: Oleksij Rempel --- .../bindings/input/touchscreen/zforce_ts.txt | 2 ++ drivers/input/touchscreen/zforce_ts.c | 29 ++++++++++++++++++++++ include/linux/platform_data/zforce_ts.h | 1 + 3 files changed, 32 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt index d8d57ba..fed13a1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt @@ -13,6 +13,7 @@ Optional properties: - 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) +- touch-size-min-mm: minimum touch size limit in mm (0 - 255 mm; 0 = no limit (default)) Example: @@ -32,6 +33,7 @@ Example: y-size = <600>; scan-idle-hz = <50>; scan-active-hz = <250>; + touch-size-min-mm = <5>; }; /* ... */ diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 2e489fd..90bd9d9 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -54,6 +54,7 @@ #define COMMAND_SETCONFIG 0x03 #define COMMAND_DATAREQUEST 0x04 #define COMMAND_SCANFREQ 0x08 +#define COMMAND_TOUCH_SIZE 0x09 #define COMMAND_STATUS 0X1e /* @@ -65,6 +66,7 @@ #define RESPONSE_RESOLUTION 0x02 #define RESPONSE_SETCONFIG 0x03 #define RESPONSE_SCANFREQ 0x08 +#define RESPONSE_TOUCH_SIZE 0x09 #define RESPONSE_STATUS 0X1e /* @@ -276,6 +278,21 @@ static int zforce_scan_frequency(struct zforce_ts *ts, u16 idle, u16 finger, return zforce_send_wait(ts, &buf[0], ARRAY_SIZE(buf)); } +static int zforce_touch_size_limit(struct zforce_ts *ts, u8 limit) +{ + struct i2c_client *client = ts->client; + u8 buf[] = { FRAME_START, 5, COMMAND_TOUCH_SIZE, + 0, 0, /* maximum size limit off */ + 1, limit }; /* set minimum size limit */ + + if (!limit) + return 0; + + dev_dbg(&client->dev, "set min. touch size limit to %d mm\n", limit); + + return zforce_send_wait(ts, &buf[0], ARRAY_SIZE(buf)); +} + static int zforce_setconfig(struct zforce_ts *ts, char b1) { struct i2c_client *client = ts->client; @@ -316,6 +333,13 @@ static int zforce_start(struct zforce_ts *ts) goto error; } + ret = zforce_touch_size_limit(ts, pdata->touch_size_min); + if (ret) { + dev_err(&client->dev, "Unable to set min. touch size, %d\n", + ret); + goto error; + } + ret = zforce_setconfig(ts, SETCONFIG_DUALTOUCH); if (ret) { dev_err(&client->dev, "Unable to set config\n"); @@ -577,6 +601,7 @@ static irqreturn_t zforce_irq_thread(int irq, void *dev_id) case RESPONSE_SETCONFIG: case RESPONSE_RESOLUTION: case RESPONSE_SCANFREQ: + case RESPONSE_TOUCH_SIZE: zforce_complete(ts, payload[RESPONSE_ID], payload[RESPONSE_DATA]); break; @@ -851,6 +876,10 @@ static struct zforce_ts_platdata *zforce_parse_dt(struct device *dev) &pdata->scan_freq_finger)) pdata->scan_freq_finger = SCAN_FREQ_DEFAULT_FINGER; + if (of_property_read_u8(np, "touch-size-min-mm", + &pdata->touch_size_min)) + pdata->touch_size_min = 0; + return pdata; } diff --git a/include/linux/platform_data/zforce_ts.h b/include/linux/platform_data/zforce_ts.h index 90a1181..75e1a49 100644 --- a/include/linux/platform_data/zforce_ts.h +++ b/include/linux/platform_data/zforce_ts.h @@ -20,6 +20,7 @@ struct zforce_ts_platdata { unsigned int y_max; u16 scan_freq_idle; u16 scan_freq_finger; + u8 touch_size_min; }; #endif /* _LINUX_INPUT_ZFORCE_TS_H */