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: 465902 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1756252jao; Wed, 23 Jun 2021 06:46:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6xBzCD8lB8Zw2fzRFGTgc3SHWizi8EIJ81QCZJmKBLix2VmeSFVsFhxhS8KXD87udsQ7a X-Received: by 2002:a05:6402:51:: with SMTP id f17mr12386453edu.359.1624456006453; Wed, 23 Jun 2021 06:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624456006; cv=none; d=google.com; s=arc-20160816; b=bXS4yW+hQMhIr2KWaHnJJgWchczjBHKRQvxDD8Fbj/1oNZCSnpfgELMcEAbDMVGHCx aIsRxZjSfMY6WdGBD+wqxx9MAqbAUvggvx7OI4qM9BLtcYCdvXtXL1ZF+B8xbaCcQTGv QnwuDAOKljk3AofPj7SHa/LkLEPp4KHzXS8MKB26ahItBlfCr7nHMsrBwpiyuNbqVxMl xvCEV4a6g+TicUYOJE+POx75ZVCHMtF6gEDeb0U8u2E+2SnXeUPH7KzcjBKnMx96r7HJ wGg/i+BOGXebOghB792rXtXerV4zcrKrNhrMDkbM2V91R4aKwbfvmXOeHdujZimkFQCU 5lZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=KN5dhlPjwFWLPcwVK7gO4jILUWWjL5cHiiOIwWbomwc=; b=puciks0bWO3H5hBGWCSznm08Vk3XIIDoGiZYJwG0zi695y3J3dN2eUvpk/+bowiQG1 Alcr28TDUkLfWgNOVqSx96Ld/6yH4gcdT7qNgPAlcgu8UALPLWcFh4NS2utVhY6NzzXi 6Bf0WmD2FdyWc+vG5iX/b0JiMOcY3LFKJkGkgcgEO+nZ5cJz45fEzkeYN8CUcVd6l3RI eLOs5AVGE7vdyh+utWiJ79TfxZxiC7JcqiRE4JEXe+Od/Z6aBijoFJAPvrraaSP6C6Ar PgZJHFORQQ9k11SUI02tc5qNzuRPYjwogOfLh8/WrgrdS4GlR8ykiKQ1wvHOHHufJYX+ tHuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rvxf54Ih; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht7si2510346ejc.379.2021.06.23.06.46.46; Wed, 23 Jun 2021 06:46:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-input-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=@linaro.org header.s=google header.b=rvxf54Ih; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhFWNtB (ORCPT + 1 other); 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-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(-) -- 2.7.4 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: 465901 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1756146jao; Wed, 23 Jun 2021 06:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/Qoki4oZwx2ulpryaf623fr4TbsxvxRfPSyem2MxQPzomrvxgut/YFVh25vVh+bW/EDVJ X-Received: by 2002:a17:907:62a1:: with SMTP id nd33mr64837ejc.303.1624455999742; Wed, 23 Jun 2021 06:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624455999; cv=none; d=google.com; s=arc-20160816; b=okBHlFFlzaCErWiTb9GEm/myDF9V0hOA6DzDb8mh//3VBu0AKgS8Orq2cDqmLvUjHg Mutged1jdGdFDn3wII9KSerTbVdnX0uHuptx5vU0ckkZmuitvVoqV5QVYJTF6TzxGh7S YOx7MkkI0Lsqwcg4kWsV2A3WYbt4ekci8NsnxOCRm59igilHsZ+mpqfl7ZDH90NqiO7W pbL+/DKaxQaDKD2GHUsQBf8vj2I8INmFK0MMq/Qr+KtLMUwIaI4dDu/g4ckVllTlcIDO mDhBTttbTAUlVWzhksAzJEJYHP+y/e7fIxyRhCesVwdJ/M4zXS6ZTjNVE/7eVPoCY3P/ W+4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=imZ3OXeMyZz6bDmbx3FYq7fmRLeLp/Y3Qxck/UIP5zI=; b=lru67mpoJpEJN9Fovb3jJIey5esZ3pPxxslC8CMsWtAzpHojLF9DK7iSoUIfLASazk IyOWYeUPvb7KBJglLYyqEqW3dbTl+b+wlXq9W2MSzCH+Gukm07eUhKo/mBd5hx32Gqlz T94b6JFws/RdLuvOO6gamv0WxQfuu4IWKjepTKe0lyAjFgIutS71n23hKRh2UuaWHRVX D/OZ1sTaEosacDXIP7rJlNJ4qbolnETPT9MP97FQdSfreAAPYBf0mMyNf9VMlX6a12lf iTPHOcBfwFY/zIpQoYdAhWzCcrx+mppKolmsrsuxm5uP9lVOlaxIULMGy5cQVkf3lm82 Aj5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dnS3Y7bn; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht7si2510346ejc.379.2021.06.23.06.46.39; Wed, 23 Jun 2021 06:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-input-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=@linaro.org header.s=google header.b=dnS3Y7bn; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbhFWNsw (ORCPT + 1 other); 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-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(+) -- 2.7.4 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 */