From patchwork Thu Sep 17 02:23:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1365776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BsLNs3vVgz9sRf; Thu, 17 Sep 2020 12:23:24 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kIjZu-0001DM-C5; Thu, 17 Sep 2020 02:23:18 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kIjZs-0001DB-QV for kernel-team@lists.ubuntu.com; Thu, 17 Sep 2020 02:23:16 +0000 Received: from mail-pg1-f199.google.com ([209.85.215.199]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kIjZs-00030T-FD for kernel-team@lists.ubuntu.com; Thu, 17 Sep 2020 02:23:16 +0000 Received: by mail-pg1-f199.google.com with SMTP id q21so508646pgj.4 for ; Wed, 16 Sep 2020 19:23:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XkcpszKwM6Ds0b1qI7BGVY/hd2cenTtojf8gSe4Dv3E=; b=Ai/B+/DrvOqV5UoxyGz0FJKcgFHvMnp8ERGYuUSPHU5ax5QoPFWjnMzX71oigl6eTK A+ph65gMVPdAXEG9r7AzXz5nAiRiPtPcXwLj179BTdb5/gT3ebU/sxIjymOcibp0IWfw x4ZVOZzr2KvI3HA5u1hMAHago1V6lDBWygdC+Yg2YU0SPeDvM978/XhCcegy5NwFuRCY jy5+ExRXeIxwWEchZS1RPL8QCxG4wvL5xJXRj7kq+UxDKCidcnTCUuZJOA+F395J+Rfb 76ksmCAEOJO3MJcamq0mTMFq+Vxyvq2SX6i3WOrh6+ibn7DikKuJh6hb12fmvXxkXQjl DcVQ== X-Gm-Message-State: AOAM531KCZq7L002MnPgHLCuVi9ROo7cvSXSpzGBK2RoY8hHfgLLxhzL 2gSpHNrI9kkTRKSm3FMRCaw88vfBZf0Y3d4rSrEANWPD0/8PVlxjCXSoqoQNlNPjGb9IXJU9Prt Qx9U0c2KzSX0ygH+h/DL5hgW6GgPwuYOv/e15WQk4pA== X-Received: by 2002:a17:902:5992:b029:d1:e5e7:be7b with SMTP id p18-20020a1709025992b02900d1e5e7be7bmr8454712pli.85.1600309394936; Wed, 16 Sep 2020 19:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGcFyMziCzPFSYsulbkRLFADxC7aErNDMwN0tCh1sRFcGQg7jHJFSAFkK5TrW1YpH9twrvNQ== X-Received: by 2002:a17:902:5992:b029:d1:e5e7:be7b with SMTP id p18-20020a1709025992b02900d1e5e7be7bmr8454705pli.85.1600309394673; Wed, 16 Sep 2020 19:23:14 -0700 (PDT) Received: from canonical.com (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id w203sm18282925pfc.97.2020.09.16.19.23.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Sep 2020 19:23:14 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][G] HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle Date: Thu, 17 Sep 2020 10:23:09 +0800 Message-Id: <20200917022309.30240-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200917022309.30240-1-koba.ko@canonical.com> References: <20200917022309.30240-1-koba.ko@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kai-Heng Feng BugLink: https://bugs.launchpad.net/bugs/1888331 Many laptops can be woken up from Suspend-to-Idle by touchpad. This is also the default behavior on other OSes. However, if touchpad and touchscreen contact to each other when lid is closed, wakeup events can be triggered inadventertly. So let's disable the wakeup by default, but enable the wakeup capability so users can enable it at their own discretion. Signed-off-by: Kai-Heng Feng Reviewed-by: Hans de Goede Signed-off-by: Jiri Kosina (cherry picked from commit 52c978955c6475603c41aecba8fad587add9facd) Signed-off-by: Koba Ko --- drivers/hid/i2c-hid/i2c-hid-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index dbd04492825d..87ff93bf76ba 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -935,6 +935,14 @@ static void i2c_hid_acpi_fix_up_power(struct device *dev) acpi_device_fix_up_power(adev); } +static void i2c_hid_acpi_enable_wakeup(struct device *dev) +{ + if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) { + device_set_wakeup_capable(dev, true); + device_set_wakeup_enable(dev, false); + } +} + static const struct acpi_device_id i2c_hid_acpi_match[] = { {"ACPI0C50", 0 }, {"PNP0C50", 0 }, @@ -949,6 +957,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client, } static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {} + +static inline void i2c_hid_acpi_enable_wakeup(struct device *dev) {} #endif #ifdef CONFIG_OF @@ -1076,6 +1086,8 @@ static int i2c_hid_probe(struct i2c_client *client, i2c_hid_acpi_fix_up_power(&client->dev); + i2c_hid_acpi_enable_wakeup(&client->dev); + device_enable_async_suspend(&client->dev); /* Make sure there is something at this address */