From patchwork Tue Aug 11 18:45:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Welling X-Patchwork-Id: 6994261 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5779CC05AC for ; Tue, 11 Aug 2015 18:45:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E618205F7 for ; Tue, 11 Aug 2015 18:45:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7436820656 for ; Tue, 11 Aug 2015 18:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752241AbbHKSpQ (ORCPT ); Tue, 11 Aug 2015 14:45:16 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:33016 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbbHKSpP (ORCPT ); Tue, 11 Aug 2015 14:45:15 -0400 Received: by iods203 with SMTP id s203so14825359iod.0; Tue, 11 Aug 2015 11:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=IKS2a2KM3q78YCP1I3h2tqgixEtvW6ln6ZtYbhvpEIc=; b=rrtQQjIXWJ7aQNJYpGrmEJ6euh4qjwsuOLgdxvO/LC7iX80yvn62enbrefx72YECfO kooXapITjP8qxvN4e2zZhRHXeaiHbZccDm2So8Rs4elQjCRVdaTpKMRrN1451K+RXop8 khQT3lWPRJkthO97rdhzewWI/+oU7XgDK3L6Hp9VFqVd69VodmVj+ggRtkq/VyRmd15U fn47592p9yOnPRmBtl8DmgrukAVu8IaAf6yWmWM14q8qFj4WnmCf7jH9Ph0xRHFzXil2 zxfsqFBT1wP0SJpdcc/AnNLYn3mu59QEPzpmMHffwzY0cFMOJQAillN/Xqg3bapbt3J5 PYnQ== X-Received: by 10.107.16.223 with SMTP id 92mr29552956ioq.14.1439318714245; Tue, 11 Aug 2015 11:45:14 -0700 (PDT) Received: from deathstar.hitronhub.home (173-22-240-187.client.mchsi.com. [173.22.240.187]) by smtp.gmail.com with ESMTPSA id u4sm8685011igz.8.2015.08.11.11.45.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Aug 2015 11:45:13 -0700 (PDT) From: Michael Welling To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Vignesh R , Jonathan Cameron , Brad Griffis , Wolfram Sang Cc: Michael Welling Subject: [PATCH] input: ti_am335x_tsc: Add open delay parameter Date: Tue, 11 Aug 2015 13:45:05 -0500 Message-Id: <1439318705-18601-1-git-send-email-mwelling@ieee.org> X-Mailer: git-send-email 2.1.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.0 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 Adds a device tree parameter to set the open delay on the touchscreen conversion steps. Increasing this parameter helps the touch accuracy on some screens. Signed-off-by: Michael Welling --- .../bindings/input/touchscreen/ti-tsc-adc.txt | 5 +++++ drivers/input/touchscreen/ti_am335x_tsc.c | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt index b1163bf..cb11fda 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt @@ -41,6 +41,11 @@ Optional properties: charge step, so this does in fact function as a hardware knob for adjusting the amount of "settling time". + ti,open-delay: Open delay applied to all touchscreen conversion steps. + The value corresponds to the number of ADC clock + cycles to wait after applying the step configuration + registers and before sending the start of ADC + conversion. Maximum value is 0x3FFFF. - child "adc" ti,chan-step-opendelay: List of open delays for each channel of diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 191a1b8..37a9729 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -54,6 +54,7 @@ struct titsc { u32 inp_xp, inp_xn, inp_yp, inp_yn; u32 step_mask; u32 charge_delay; + u32 open_delay; }; static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) @@ -148,7 +149,7 @@ static void titsc_step_config(struct titsc *ts_dev) end_step = first_step + tsc_steps; for (i = end_step - ts_dev->coordinate_readouts; i < end_step; i++) { titsc_writel(ts_dev, REG_STEPCONFIG(i), config); - titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); + titsc_writel(ts_dev, REG_STEPDELAY(i), ts_dev->open_delay); } config = 0; @@ -172,7 +173,7 @@ static void titsc_step_config(struct titsc *ts_dev) end_step = first_step + ts_dev->coordinate_readouts; for (i = first_step; i < end_step; i++) { titsc_writel(ts_dev, REG_STEPCONFIG(i), config); - titsc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); + titsc_writel(ts_dev, REG_STEPDELAY(i), ts_dev->open_delay); } /* Make CHARGECONFIG same as IDLECONFIG */ @@ -188,13 +189,13 @@ static void titsc_step_config(struct titsc *ts_dev) STEPCONFIG_INP(ts_dev->inp_xp); titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config); titsc_writel(ts_dev, REG_STEPDELAY(end_step), - STEPCONFIG_OPENDLY); + ts_dev->open_delay); end_step++; config |= STEPCONFIG_INP(ts_dev->inp_yn); titsc_writel(ts_dev, REG_STEPCONFIG(end_step), config); titsc_writel(ts_dev, REG_STEPDELAY(end_step), - STEPCONFIG_OPENDLY); + ts_dev->open_delay); /* The steps end ... end - readouts * 2 + 2 and bit 0 for TS_Charge */ stepenable = 1; @@ -392,6 +393,15 @@ static int titsc_parse_dt(struct platform_device *pdev, dev_warn(&pdev->dev, "ti,charge-delay not specified\n"); } + err = of_property_read_u32(node, "ti,open-delay", + &ts_dev->open_delay); + /* + * If ti,open-delay value is not specified, then use + * STEPCONFIG_OPENDLY as the default value. + */ + if (err < 0) + ts_dev->open_delay = STEPCONFIG_OPENDLY; + return of_property_read_u32_array(node, "ti,wire-config", ts_dev->config_inp, ARRAY_SIZE(ts_dev->config_inp)); }