From patchwork Fri Oct 16 14:14:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin Cooper X-Patchwork-Id: 7415791 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 F0DA79F36A for ; Fri, 16 Oct 2015 14:16:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E5DA20A56 for ; Fri, 16 Oct 2015 14:16:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B75020734 for ; Fri, 16 Oct 2015 14:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932444AbbJPOOd (ORCPT ); Fri, 16 Oct 2015 10:14:33 -0400 Received: from mail-oi0-f48.google.com ([209.85.218.48]:32981 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932235AbbJPOOc (ORCPT ); Fri, 16 Oct 2015 10:14:32 -0400 Received: by oiad129 with SMTP id d129so2582491oia.0; Fri, 16 Oct 2015 07:14:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bA2O1Ejkku0oe8SYHw9WyAQEfgYZtaTB5ZrkOJ873Z4=; b=Mx6rlUNGhADCwL3xzRlr6hzFK5Z9kwDBPCya4yweZ5TyUqHupoRaa9MR0J2yvr3icD //cVpBX4wGugTSluzn0J1j4RrADNj/FseZDCXVcWxh7u+HYeIEWVx0JcSTaB7mLcCXsi mo82iORLBrv2YxyKCx8/WgsvhZX0qGuMa1vhyeVwKHEFWAS/XVW0Si7sMRn6xVinnXGg 00C7ukz776j1bcdmRAoe/7mNiumAlmaPt+vDIk5D4v+YyPuJdvDaKN9miZRMSO5NnfhW ajDqq+8dqCLu2ujEXV31sIspUv3CvNijv4+LWv9sUOc0+pnNrnQLJT/xNMCDdpcutLck LOrg== X-Received: by 10.202.94.133 with SMTP id s127mr9555140oib.92.1445004872061; Fri, 16 Oct 2015 07:14:32 -0700 (PDT) Received: from localhost.localdomain (pool-71-97-41-79.dllstx.fios.verizon.net. [71.97.41.79]) by smtp.gmail.com with ESMTPSA id p3sm8457074oei.9.2015.10.16.07.14.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Oct 2015 07:14:31 -0700 (PDT) From: Franklin S Cooper Jr To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, maxime.ripard@free-electrons.com, LW@KARO-electronics.de, jg1.han@samsung.com, asaf.vertz@tandemg.com Cc: Franklin S Cooper Jr Subject: [PATCH 1/4] Input: edt-ft5x06 - Use max support points to determine how much to read Date: Fri, 16 Oct 2015 09:14:26 -0500 Message-Id: <1445004869-31986-2-git-send-email-fcooper@ti.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1445004869-31986-1-git-send-email-fcooper@ti.com> References: <1445004869-31986-1-git-send-email-fcooper@ti.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Calculate the amount of data that needs to be read for the specified max number of support points. If the maximum number of support points changes then the amount that is read from the touch screen controller should reflect this. Signed-off-by: Franklin S Cooper Jr --- Changes since RFC: Added crclen variable Simplified datalen algorithm drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index a8640c7..e5b0b5d 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -168,9 +168,9 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) struct edt_ft5x06_ts_data *tsdata = dev_id; struct device *dev = &tsdata->client->dev; u8 cmd; - u8 rdbuf[29]; + u8 rdbuf[31]; int i, type, x, y, id; - int offset, tplen, datalen; + int offset, tplen, datalen, crclen; int error; switch (tsdata->version) { @@ -178,14 +178,18 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) cmd = 0xf9; /* tell the controller to send touch data */ offset = 5; /* where the actual touch data starts */ tplen = 4; /* data comes in so called frames */ - datalen = 26; /* how much bytes to listen for */ + crclen = 1; /* length of the crc data */ + + /* how many bytes to listen for */ + datalen = tplen * MAX_SUPPORT_POINTS + offset + crclen; break; case M09: cmd = 0x02; offset = 1; tplen = 6; - datalen = 29; + crclen = 0; + datalen = tplen * MAX_SUPPORT_POINTS + offset + crclen; break; default: