From patchwork Wed Jun 23 13:56:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 12339861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B4E5C4743C for ; Wed, 23 Jun 2021 13:46:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4284A61075 for ; Wed, 23 Jun 2021 13:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhFWNtB (ORCPT ); Wed, 23 Jun 2021 09:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbhFWNtB (ORCPT ); Wed, 23 Jun 2021 09:49:01 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEEB7C061574 for ; Wed, 23 Jun 2021 06:46:43 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id nb6so4104144ejc.10 for ; Wed, 23 Jun 2021 06:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=KN5dhlPjwFWLPcwVK7gO4jILUWWjL5cHiiOIwWbomwc=; b=rvxf54IhcT73xGm4yzf22rjo5xRZnXZmM7zRlBuMx/rgrj4JuTRsXh14Vov/WmuMEm m4wf1o/1CcUSrJOk4hNaynHn5n0DQDFJ8Cou2p0ZjtQ90msRJyZES22wXUX27w3ri7To xwOM4p8wAh6Yf4oEmQ5PNJoDosfDUyBfR5kJVOM21zAJLmMFXSTk7kRziHgI2WCHtW4N yEucHA//r2BIo/nuIVZ3wnvbDFn21JeUGyVutVbn2cGpwBIFPH4RdPTCykhd0JSFXvhS p6D/jgqcnjSl7sLdFyiqIgzRiFOkOqn5yMQnwVyexqcMyFusn636MNmdjOK6GBfWbaS0 RY6A== 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; bh=KN5dhlPjwFWLPcwVK7gO4jILUWWjL5cHiiOIwWbomwc=; b=FE3O7MU1iG+xBCfmIP1NxgwoDCOPng3Kb3uY79/BoX2uuVMUNCqGKDu8dYi33MNBuC n1L7hAnYvlWchTE0k7RppSrn80kByCs+5IvfRrJJzp+TXYNEEzQ3CONxhKAJBU33iGev q4Trh1Pj6PfyjkZz2MyNFBtKd9luh9A61MELfX80S7XtbsmnrEhnIjV7MAcMMG4ziC2E tACnk+aMWOSSVQK9fqjKdsSkE7V+wzl1+kNmWAFU6zxQqBq4uBb+k8xX3spVkB2/E0ii mcJN5P17UgcPfyP6l6JrbliZ9Gcnvnr3RUp0DkoMPbiN/syxJ+DphG/B0S6PCnb2EVHQ C9yQ== X-Gm-Message-State: AOAM5327mv1YtaKMBSUUo60MlMgS8/aqWrDKGtO0aq8ytR5xMge+lPoj yQ9EtapRvpD1FHXGkWGtxC+SbH8obwCVKQ== X-Google-Smtp-Source: ABdhPJwWk1Gf8ojBLwUc7erNtfcVw3264i/88bwIHGDi43iUXv9O/4krVt2HRo1eA8ZFYPn4xypkug== X-Received: by 2002:a5d:6882:: with SMTP id h2mr67935wru.243.1624455991856; Wed, 23 Jun 2021 06:46:31 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:78f0:ea41:c81:639b]) by smtp.gmail.com with ESMTPSA id l4sm89546wru.41.2021.06.23.06.46.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jun 2021 06:46:31 -0700 (PDT) From: Loic Poulain To: nick@shmanahar.org, dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, Loic Poulain Subject: [PATCH 1/2] Input: atmel_mxt_ts: Add wake-up support Date: Wed, 23 Jun 2021 15:56:36 +0200 Message-Id: <1624456597-9486-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add capability for the touchscreen to wakeup the host on touch event. Signed-off-by: Loic Poulain --- drivers/input/touchscreen/atmel_mxt_ts.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 05de92c..807f449 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3223,6 +3223,8 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + device_set_wakeup_capable(&client->dev, true); + error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators); if (error) { @@ -3309,8 +3311,12 @@ static int __maybe_unused mxt_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_device_enabled(input_dev)) - mxt_stop(data); + if (input_device_enabled(input_dev)) { + if (device_may_wakeup(dev)) + enable_irq_wake(data->irq); + else + mxt_stop(data); + } mutex_unlock(&input_dev->mutex); @@ -3332,8 +3338,12 @@ static int __maybe_unused mxt_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_device_enabled(input_dev)) - mxt_start(data); + if (input_device_enabled(input_dev)) { + if (device_may_wakeup(dev)) + disable_irq_wake(data->irq); + else + mxt_start(data); + } mutex_unlock(&input_dev->mutex); From patchwork Wed Jun 23 13:56:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 12339859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42653C4743C for ; Wed, 23 Jun 2021 13:46:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E0FD60720 for ; Wed, 23 Jun 2021 13:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbhFWNsw (ORCPT ); Wed, 23 Jun 2021 09:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbhFWNsw (ORCPT ); Wed, 23 Jun 2021 09:48:52 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B47C061574 for ; Wed, 23 Jun 2021 06:46:34 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id l7-20020a05600c1d07b02901b0e2ebd6deso1408229wms.1 for ; Wed, 23 Jun 2021 06:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=imZ3OXeMyZz6bDmbx3FYq7fmRLeLp/Y3Qxck/UIP5zI=; b=dnS3Y7bnMetbd+bmWmHq9IBznx1bwe4/UlbvgQ+VYm8PUmYsr33lvtAQFcQmKmPgaI h8GZXDB3TzEyFmLqeHP3syhb/2IG4NFBfMvKXtv6DkbzroVJk6yaEpAWvF3873nOoB+a rbSyvBQ10PB4+uMz4oYzBxDGeCMP2vt5bEVTbacnerR7Wx3AElWECbGoT+6TkjXrl+He I+SqOy7TR76jbd7lzEkdXcl1UA+yTxxmknUh+vkCa347bhS9mkQ/rGL1fP02Phywetda tILZIMtqaoXYi0/7Gy3P8Wzo+CHzxqVN+0yGUEpv/yrujD14h/J02on7KRKK/pRFN8N3 +f5A== 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; bh=imZ3OXeMyZz6bDmbx3FYq7fmRLeLp/Y3Qxck/UIP5zI=; b=KR9YnEGYXF+9XQjMVbwArblU4unmykB5+pR2ztm6cWSQAfkWNtM7NTiwML6jFaQ0QD CTB1gJtqYJX10kb8rrq8oRGaspc+YIzuCFbo9Ay50WEseVHpzv1yeol2GJFUbMR45HcZ YV22pIYNzgGsdIef3KyPF/8594PwQhGyoFkio3XEH8uMcYqUTWTgh/IbygOViMVAxrqJ w3UPc08x+l0y4nXpYN5tEJxdWGSyzr6yfXCVisbRKekqCw7o4J9MaCmrter8606rMx4C YN/IN+qOEvZV0I3sPmHec27CfXjKSa331GtMPamD+dUuvhQ/UsFW0hbJdI3L5Ycb2ycs WWuA== X-Gm-Message-State: AOAM531BMkZec3k3aw1Suf8nCEZRvmU21qYsZMcpcEdiDfd4BegJ9xv0 05ocCATGbJwa7PfajoYCeIeJBQ== X-Google-Smtp-Source: ABdhPJy3LClhWqPO7KXylIx1pcnjVm6dORYP41P0uibUBchkQugYD0VGxyn78p6UQljLMhhEz02BZQ== X-Received: by 2002:a1c:e907:: with SMTP id q7mr11141341wmc.1.1624455993080; Wed, 23 Jun 2021 06:46:33 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:78f0:ea41:c81:639b]) by smtp.gmail.com with ESMTPSA id l4sm89546wru.41.2021.06.23.06.46.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jun 2021 06:46:32 -0700 (PDT) From: Loic Poulain To: nick@shmanahar.org, dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, Loic Poulain Subject: [PATCH 2/2] Input: atmel_mxt_ts: atmel_mxt_ts: Fix event loss Date: Wed, 23 Jun 2021 15:56:37 +0200 Message-Id: <1624456597-9486-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624456597-9486-1-git-send-email-loic.poulain@linaro.org> References: <1624456597-9486-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org If both touch events and release are part of the same report, userspace will not consider it as a touch-down & touch-up but as a non-action. That can happen on resume when 'buffered' events are dequeued in a row. Make sure that release always causes previous events to be synced before being reported. Signed-off-by: Loic Poulain --- drivers/input/touchscreen/atmel_mxt_ts.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 807f449..e05ec30 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -990,6 +990,13 @@ static void mxt_proc_t100_message(struct mxt_data *data, u8 *message) input_report_abs(input_dev, ABS_MT_DISTANCE, distance); input_report_abs(input_dev, ABS_MT_ORIENTATION, orientation); } else { + /* + * Always sync input before reporting release, to be sure + * previous event(s) are taking into account by user side. + */ + if (data->update_input) + mxt_input_sync(data); + dev_dbg(dev, "[%u] release\n", id); /* close out slot */