Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2086061ybz; Sun, 26 Apr 2020 10:49:47 -0700 (PDT) X-Google-Smtp-Source: APiQypJ8R4JhyNEmBcKSVq4hxvYm1wGrbCoYQjYJrrxz3t9ugzum3FnGwf/G62IdRtu2YKQx7DsV X-Received: by 2002:aa7:c2ce:: with SMTP id m14mr16745499edp.305.1587923387519; Sun, 26 Apr 2020 10:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587923387; cv=none; d=google.com; s=arc-20160816; b=CRWcmC2zeiye+llxIFwnfR4HUw7kDeMKCUn99a4Ob8Se1R6HgkrGsGOfGGSF5BtjcH O3tE508bR6IvkZEe/0MwKWNXP9zUWzvr0t8jybVZOrVMBiYr/L52iHXioG2WFSN0K1ef biyR2eV/duOp5tP4sN0eavcx5atoH3KTi5tz3DZzJA7w7tIusVbYiFwi5n8YCTq5Lmuz oapXewcn0xC+aOo0EqzXfD4NTpER+VQfZRagjgbF1UM6IW84UHbnGipJicoBtJMK5XhN w3Df4s6RAz2wfWOq8hKrfLgnK0Ki3lAbD+2TmqeEm+qYZHbV6U4u2zi8lKUmivEsSHxa OBHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:content-transfer-encoding :mime-version:subject:from:references:in-reply-to:message-id:date :dkim-signature; bh=kfMUjlk2jbUVoGkXEhVMUmO97/r8xl11wkgz6Gv4UtY=; b=aQFvVecwwkmWJno8T5XSYsN2fnyaDqyXdJqUoiHyM/4OhdM1M55eHFinxUUEgVdxZd Z1VvJatz+whThqkc3ECVkIKRJ8JZotauREkMcgG7Xr5Lh1Kw+jT4S9kZdirPXbuQNpyN uhOwRrs9bATn+3e50tApBeVtvvZZz9pbfCq1Hah8np1XrRIEtbe4Db+Mas7DuxDQKh1k W0wr5tep7h0hpaVmMxVEa4sOEhTM2HYf7R8nccT1z2xl+99IjyDHXtzssnjvP0s/E8rN jtrC7gWH88ZtmoaV3gTpkB6Vht7t8eskbtWctQ83LfqzUPZrDV3kXIB627RnNlRezBJk Eb0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=ODjkETVK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pj7si7091648ejb.221.2020.04.26.10.49.23; Sun, 26 Apr 2020 10:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=ODjkETVK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbgDZRr7 (ORCPT + 99 others); Sun, 26 Apr 2020 13:47:59 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:23393 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbgDZRr4 (ORCPT ); Sun, 26 Apr 2020 13:47:56 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 499Fk15LRzzsC; Sun, 26 Apr 2020 19:47:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1587923273; bh=vWuSkPyIwzrqHPidjivky+WANlVA7VFvzOKZcXuXK7g=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=ODjkETVKXe6d20pzthKr1rd/Xjj2sMCgPt1LH6VATg2GhuY6r7SdmxRtpTdMmVU3N xL2Oc45z0h0YRQJnCUW0/WM9BffdDEn2MJ7VKojO+dqP8r7eR/vqrffNvhzQcA8lD9 WerrZJ4ahgOsnfajUyZgXyAqc/rlJUUgUI82gfp5xaf7Y1gVaIe6+WYngu/Y3s4tSg 4WnvUho337aiRiO3w1H54RrOqx3nAMozrqo3vKlxOYqWWoV2bLOMPsH56ZB5Td00Uf LmjVpiAC/BJc7EoU4AO8CftX3s2ya71n8o02AnNZFViGr7Zo/oH+Noxir3fZibRuZX bxyNyChXQ62Rg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.2 at mail Date: Sun, 26 Apr 2020 19:47:52 +0200 Message-Id: <02dc25c5851e50d77bc707a2e1b44caf9d6354eb.1587923061.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH v5 07/10] input: elants: support 0x66 reply opcode for reporting touches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: David Heidelberg , Dmitry Osipenko , Dmitry Torokhov , Henrik Rydberg , James Chen , Johnny Chuang , Rob Herring , Scott Liu Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko eKTF3624 touchscreen firmware uses two variants of the reply opcodes for reporting touch events: one is 0x63 (used by older firmware) and other is 0x66 (used by newer firmware). The 0x66 variant is equal to 0x63 of eKTH3500, while 0x63 needs small adjustment of the touch pressure value. Nexus 7 tablet device has eKTF3624 touchscreen and it uses 0x66 opcode for reporting touch events, let's support it now. Other devices, eg. ASUS TF300T, use 0x63. Note: CMD_HEADER_REK is used for replying to calibration requests, it has the same 0x66 opcode number which eKTF3624 uses for reporting touches. The calibration replies are handled separately from the the rest of the commands in the driver by entering into ELAN_WAIT_RECALIBRATION state and thus this change shouldn't change the old behavior. Signed-off-by: Dmitry Osipenko Tested-by: Michał Mirosław Signed-off-by: Michał Mirosław --- drivers/input/touchscreen/elants_i2c.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 88294bc491e8..7eb74eb832d7 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -61,6 +61,15 @@ #define QUEUE_HEADER_NORMAL 0X63 #define QUEUE_HEADER_WAIT 0x64 +/* + * Depending on firmware version, eKTF3624 touchscreens may utilize one of + * these opcodes for the touch events: 0x63 and 0x66. The 0x63 is used by + * older firmware version and differs from 0x66 such that touch pressure + * value needs to be adjusted. The 0x66 opcode of newer firmware is equal + * to 0x63 of eKTH3500. + */ +#define QUEUE_HEADER_NORMAL2 0x66 + /* Command header definition */ #define CMD_HEADER_WRITE 0x54 #define CMD_HEADER_READ 0x53 @@ -1057,7 +1066,6 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev) switch (ts->buf[FW_HDR_TYPE]) { case CMD_HEADER_HELLO: case CMD_HEADER_RESP: - case CMD_HEADER_REK: break; case QUEUE_HEADER_WAIT: @@ -1077,6 +1085,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev) break; case QUEUE_HEADER_NORMAL: + case QUEUE_HEADER_NORMAL2: report_count = ts->buf[FW_HDR_COUNT]; if (report_count == 0 || report_count > 3) { dev_err(&client->dev, -- 2.20.1