From patchwork Sun Jun 23 06:31:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11011603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDB766C5 for ; Sun, 23 Jun 2019 06:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD2B528B2B for ; Sun, 23 Jun 2019 06:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0B8828B3D; Sun, 23 Jun 2019 06:32:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDE5E28B2B for ; Sun, 23 Jun 2019 06:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbfFWGb6 (ORCPT ); Sun, 23 Jun 2019 02:31:58 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40716 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbfFWGb6 (ORCPT ); Sun, 23 Jun 2019 02:31:58 -0400 Received: by mail-pf1-f194.google.com with SMTP id p184so5682087pfp.7; Sat, 22 Jun 2019 23:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fsg8cr6mQhG4dr4Q+MgsY02WFUAFbTzHhAJKafUHVk8=; b=gniVCEkPm4LEUka8nJ29vElgDkZcMqC4EOmP3aeKTmveRGjR0Lutyl4XrMsdhNIDgn hxiWjx5yjx7oiQbzVAo9PHx+79oL4xshXZZF50Cje+2YpaX5ukBw4YNwnUFbgwdm+JkI mIDeuxtANkZxG8KeVGNq7JK8WCUYXqnIFUXCP1jjs1NTt9QrSf/06CRMKWelcp+I+Klq 1BQy7TBONOvHAG6hghzCDY9FGki53333908D2j5WlQBNX1Oq1fZUCRK3AXZEX4aVfuah MmjSTpYsqWPOCLyT019yED2bAKARwHMxUBijVAy/nZbPOAknRbepLGgqVZrVTGPbxkwl EcXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fsg8cr6mQhG4dr4Q+MgsY02WFUAFbTzHhAJKafUHVk8=; b=S5p9R9f411AphC+sQeT1ZqaHF8gvLkPYXhauCUlo6D26S8BP5n5cCtyyg3ZC3EF5n8 gyk6xcBe5aSr/OwMm+hyvP4kLI1cJ/3y3tArEGVLMXoxoRo7V1igSYX+J2q6qIjv+MwH OraUurjyTBRIup8IWPCVyv3vz3KJhgGM1rP1Nwh0j84D5faO0vG+zN6AutujDclMGDoW plXKqQGzI2jyaNkdbeVJjvm2cZU77Xqh3zLrw1HIgvVBmRB+W6FVhHGfKXObSIY0gzxy 0KUy/eXeHm5YtZhPFHaOo7iSZ7A4oIn8/E+rtD/ek0WIm/slNufuruKvWJy0Dvl+tA1k RefQ== X-Gm-Message-State: APjAAAUTTEPJiL15wvlcFR66AzhLSVBjpB82are/tjL7RG5hd1LHxxBw uy3t7mKHD1g9v8h6PS3i54D2Ohan X-Google-Smtp-Source: APXvYqz6h+hZLJW9UhIbHs1/trA9Zst1/9rrU+BmQ7fHvjNz1mNogcFapHDpS4JuL+QeM/wlmqF5Hw== X-Received: by 2002:a17:90a:b387:: with SMTP id e7mr17557873pjr.113.1561271516593; Sat, 22 Jun 2019 23:31:56 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id i14sm10421411pfk.0.2019.06.22.23.31.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 22 Jun 2019 23:31:55 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Andy Shevchenko , Marco Felsch , Benoit Parrot , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] Input: edt-ft5x06 - use get_unaligned_be16() Date: Sat, 22 Jun 2019 23:31:52 -0700 Message-Id: <20190623063153.261546-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of doing conversion by hand, let's use the proper accessors. Signed-off-by: Dmitry Torokhov Reviewed-by: Andy Shevchenko Tested-by: Benoit Parrot --- drivers/input/touchscreen/edt-ft5x06.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index c639ebce914c..ec770226e119 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -27,6 +27,7 @@ #include #include #include +#include #define WORK_REGISTER_THRESHOLD 0x00 #define WORK_REGISTER_REPORT_RATE 0x08 @@ -239,8 +240,8 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) if (tsdata->version == EDT_M06 && type == TOUCH_EVENT_DOWN) continue; - x = ((buf[0] << 8) | buf[1]) & 0x0fff; - y = ((buf[2] << 8) | buf[3]) & 0x0fff; + x = get_unaligned_be16(buf) & 0x0fff; + y = get_unaligned_be16(buf + 2) & 0x0fff; /* The FT5x26 send the y coordinate first */ if (tsdata->version == EV_FT) swap(x, y); From patchwork Sun Jun 23 06:31:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 11011605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 023DC6C5 for ; Sun, 23 Jun 2019 06:32:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E63E228AE3 for ; Sun, 23 Jun 2019 06:32:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA52128B2C; Sun, 23 Jun 2019 06:32:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B134B28AE3 for ; Sun, 23 Jun 2019 06:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725268AbfFWGcA (ORCPT ); Sun, 23 Jun 2019 02:32:00 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45794 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726387AbfFWGb6 (ORCPT ); Sun, 23 Jun 2019 02:31:58 -0400 Received: by mail-pf1-f196.google.com with SMTP id r1so5672882pfq.12; Sat, 22 Jun 2019 23:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g67QRpobtyj7t+gsjQpl42X5lgDmhE+QGppdKoo8L64=; b=XiZXR5WYsJZYzREpoJ10jd6FWIXE+mVaElDrDm/R76BCXkuGtv3VUZUB1p4227KgdK +lEYx1u+oGcr6GqxtGxiBdzJZGXM7kNouzJiJkUIo1PIQKrFmwMULRwRA6OnXr8OI71y FdjCk7sGz7fMfHdOPsT4XKLtNgyuF8YvDMSERtZzy0V3DjQs9q0MvwV7Dqbf0oSz+g6E c8XrptLngwP6XXUL64QxP1+YIwRwiH/6IwU3WyuHTBBFpogwGw2nHbXEHSJxdVC6cCLV 0DdwikooRRmYDzNBaOO+x3MUSuwBVPs0rE9/p4GDU0Lgpzt1U9Ao2TYiK/hNBMf4nLmg +v6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g67QRpobtyj7t+gsjQpl42X5lgDmhE+QGppdKoo8L64=; b=XUDCdZIGGHMVLP6vIFn96H1MfSMRmQeNLDImXbSyHyINqvB7MhqaHwYj57REC+9zja e6IqcAc2R5RbLQ0rGP38f96+Hw4wjP40EmUQGAc0T8AhG0x00YtBH6FOHTspw4qdtgXu LT+T3ObnblhITmbNuvsTDG2jBv+cxdQ1Sik0vTFLuIshkvog565xW9kNQFtM72ZP7/qF ZUkmk6/Ft5Ajl/evgb2K99FblvZQ78v/6RIi+YVcWuqsVD/I0sUiBN+egFjOaAeT0otw rbcPYSrQLIHR1DFIm1VS4WgkLuuR9iPzcey3bdjjIn6cuQrWXDVD7ttz0tn2zCUyVYLW 7yIA== X-Gm-Message-State: APjAAAVlWph60IuR1oPHsdUicBes4eAOuJE0mKE2/bGzU6k7K30jOp9c 4eHnVIVupZGpqw4fjAD3edVtwsLZ X-Google-Smtp-Source: APXvYqxZmIDk18EuG0XPfWV+SPRRs9Nl8bob/rMRYxxEr/4EF8En2O6v71Y0EJglMIH9rv3H1UwPIQ== X-Received: by 2002:a17:90a:37c8:: with SMTP id v66mr17418896pjb.33.1561271517227; Sat, 22 Jun 2019 23:31:57 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id i14sm10421411pfk.0.2019.06.22.23.31.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 22 Jun 2019 23:31:56 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Andy Shevchenko , Marco Felsch , Benoit Parrot , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Input: edt-ft5x06 - simplify event reporting code Date: Sat, 22 Jun 2019 23:31:53 -0700 Message-Id: <20190623063153.261546-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190623063153.261546-1-dmitry.torokhov@gmail.com> References: <20190623063153.261546-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that input_mt_report_slot_state() returns true if slot is active we no longer need a temporary for the slot state. Signed-off-by: Dmitry Torokhov Tested-by: Benoit Parrot --- drivers/input/touchscreen/edt-ft5x06.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index ec770226e119..3cc4341bbdff 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -229,7 +229,6 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) for (i = 0; i < tsdata->max_support_points; i++) { u8 *buf = &rdbuf[i * tplen + offset]; - bool down; type = buf[0] >> 6; /* ignore Reserved events */ @@ -247,16 +246,12 @@ static irqreturn_t edt_ft5x06_ts_isr(int irq, void *dev_id) swap(x, y); id = (buf[2] >> 4) & 0x0f; - down = type != TOUCH_EVENT_UP; input_mt_slot(tsdata->input, id); - input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, down); - - if (!down) - continue; - - touchscreen_report_pos(tsdata->input, &tsdata->prop, x, y, - true); + if (input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, + type != TOUCH_EVENT_UP)) + touchscreen_report_pos(tsdata->input, &tsdata->prop, + x, y, true); } input_mt_report_pointer_emulation(tsdata->input, true);