From patchwork Tue Jul 21 08:48:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1332864 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 4B9sgz25Cfz9sRW; Tue, 21 Jul 2020 18:48:31 +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 1jxnwp-000671-Gv; Tue, 21 Jul 2020 08:48:27 +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 1jxnwm-00065W-1P for kernel-team@lists.ubuntu.com; Tue, 21 Jul 2020 08:48:24 +0000 Received: from mail-pg1-f200.google.com ([209.85.215.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jxnwl-0001ER-LY for kernel-team@lists.ubuntu.com; Tue, 21 Jul 2020 08:48:23 +0000 Received: by mail-pg1-f200.google.com with SMTP id y28so14707115pge.23 for ; Tue, 21 Jul 2020 01:48:23 -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=nbjPbUaDKJv3PNqsYU/mN2x/lxyv//dJZTRm35twTPI=; b=bmjM7X7HarcT3OIogfRKljcJqRPdsIh5Em/Y4M1SUE70DKIL83gJ+Vd+D/LLRBo8gI AFq75EDKjIooYj/bTyl4QMz+44t5n/7IC8iAoIRoXIHq/N7rGhPEd/5Kd7Q978EC8nlq DhWxYHATHbljUU5v6TxHrcnr2Sv5P+5pop+XWG6d/A2serG2xk9B9Bm8bansQHxlZYZ/ i5gpnWk4pUg2ZW15BnYpqm56qKZl0c82rpWpB7H7IGguYqock+k/zDAl67V2SdiKgsTT PKQRXVG9ktH4BoPyyZtW4cBGzI+LLl+1ZvwMkA4+NamieBP1wdkQcRf2a3EyxuWFgksw DwcQ== X-Gm-Message-State: AOAM532QZ70Z20Jw/paCSklyq17JH36t2ilE03+ZUV5GPXk4JnXU5gBR PKkbrRJsjQ1nE5DiUXnrDvnyvrVwVfSzvNS540Q2JlM1YC0RNmhyfNnFkbpfeTc6IlgkMSl4/Xv j+XYC81EJOKx/16TscuUqG+5sJy0MCJXM05+AtUF0OQ== X-Received: by 2002:a17:90b:19d4:: with SMTP id nm20mr3971256pjb.206.1595321302215; Tue, 21 Jul 2020 01:48:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7BQ22DcDjJ0a9eTKoFo4rASt1AqNAqWHwgUM2/BKMeAuUJORZALrqGfV73UlBpYdZghiRvA== X-Received: by 2002:a17:90b:19d4:: with SMTP id nm20mr3971233pjb.206.1595321301836; Tue, 21 Jul 2020 01:48:21 -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 x13sm18936171pfj.122.2020.07.21.01.48.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jul 2020 01:48:21 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2 v2][SRU][OEM-5.6] HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle Date: Tue, 21 Jul 2020 16:48:14 +0800 Message-Id: <20200721084814.31667-3-koba.ko@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200721084814.31667-1-koba.ko@canonical.com> References: <20200721084814.31667-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 linux-next) 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 294c84e136d7..c18ca6a6cb3d 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -931,6 +931,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 }, @@ -945,6 +953,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 @@ -1072,6 +1082,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 */