Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2146501pxk; Sat, 19 Sep 2020 14:43:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys6eXuT1pf962cHLNJW72lnZ4ncoQcCqrdc5yd3MorqP4S7AktQexgP9095YdzK596qHcM X-Received: by 2002:a17:906:a207:: with SMTP id r7mr43577395ejy.32.1600551801039; Sat, 19 Sep 2020 14:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600551801; cv=none; d=google.com; s=arc-20160816; b=muQa4qz1swPYHPBZS0gamejjZbWqwdoPzVs49tLI4RIs2uBo5ebf52uY1bEW5f8rH8 rtCzgd1j1H43gYVeV5Fl19DSJCZ5z2Hqh+yFBKiuc7zUKevxkVRmjkSXjPy/sgqXnMJF +DoaCEXFXb4VV0Dds2aAlSmjylvSZ/heQdPgqibL3UT3PaBsbG3iyVhS01nwg92cU0cJ VQDlURHzIdO7BbcC6IxulC6DIwBplTQlkdTp0hl5poB2qjmYcz7zHD8UtoUO8sPHFrj0 Y2cQ605XfJFF1G3rJFzkD+nlZ/I2R+B8YQcnLSEyyURmPptLOXDZmFOjgS/gf7wyNrQH ukxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :subject:from:references:in-reply-to:message-id:date:dkim-signature; bh=AGAOKSc1/6KxFoeU74u1vgV+8R8A61dyoWK1xkmevQU=; b=RG+Q73d9u19JmcrlZNKrKLB2sC3XWsWMxWzQJH0HNJg14RDqlE7N6YKwdhPd3ou2l0 GscGv6X0mQoafms6HN96JKMH3xBW1IMxcjcH3W68p68RXzAV/XZ5fdD2T9xasz4ytraY CKmD9GCIN1OznMNU2ynQOJ+JHP4vi09iDkHjYJ58JwL8NGyThmxva9RHHnH/ySx208qN 8idhldL6T5VCCkpIV/Ez7MNmqA6oJJAfTSkApibM5/G6XyFBj6Vw6dGdRnH/fg+ULn5H b/EmD9lZTEQaMErEOAr1wCQVAVsBnZs6qEddyQDEZYSKrlWf1KCQK0UsvlbF40NX62qu y+1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=d7FHNT4Y; 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 v2si4932998ejw.741.2020.09.19.14.42.41; Sat, 19 Sep 2020 14:43:21 -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=d7FHNT4Y; 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 S1726751AbgISVla (ORCPT + 99 others); Sat, 19 Sep 2020 17:41:30 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:10378 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbgISVl0 (ORCPT ); Sat, 19 Sep 2020 17:41:26 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4Bv4034TfFzht; Sat, 19 Sep 2020 23:41:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1600551683; bh=nLwavT2NA5+jIA2IuW6zD/l5oswZ/ngNahOWEbWGrOQ=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=d7FHNT4YLCDqqarkSYbb/7qXMEzkll8472+0ydkYbLHj6WfiFnQAR/OYB/9UFK+RE VBLLmXx0QgD3r2qXNztQD2bb/T1MtFZ5wOZePbSUmVDAqu1tgPF7T7b4rL8wQIVgQq fTRXh2BP1pH8xSuqyvFdorPnYUM1a7evQEyaK5KoC+Z9rhyVhVX0sb42vJRp6bHcNI mF+v1j9ky44r5Pi6WJBHWI/FtZKRN5uN7BjTKDzcoVtRO8uWPlvK+jU81V4HrsAAuY qJ3csQNfVhJLwoIAeZM6EsxAwPHIyoozYzxiB/mPzMgY79KImK+KNygie7m7z1JWU9 Q9b1RFwIuM4gg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.4 at mail Date: Sat, 19 Sep 2020 23:41:22 +0200 Message-Id: <38cd8d9682e1cc1daae9fb69785f8d2ead08f1ba.1600551334.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH v7 4/4] 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: Dmitry Torokhov , Dmitry Osipenko , Henrik Rydberg , James Chen , Johnny Chuang , Scott Liu , "Gustavo A. R. Silva" , Harry Cutts , Peter Hutterer Cc: linux-input@vger.kernel.org, linux-kernel@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 c24d8cdc4251..1cbda6f20d07 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 @@ -1052,7 +1061,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: @@ -1072,6 +1080,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