From patchwork Mon Oct 24 11:32:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462627wru; Mon, 24 Oct 2022 06:46:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nh5jolTHdOcpaSKUXmp+QLHjizOdEtXpuEYs60t1SbeIfR8o3IthXBn2SYXOBvJVVJmFX X-Received: by 2002:a17:907:75e9:b0:7a4:31c:ae0d with SMTP id jz9-20020a17090775e900b007a4031cae0dmr7693837ejc.79.1666619177716; Mon, 24 Oct 2022 06:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619177; cv=none; d=google.com; s=arc-20160816; b=I7TiTiaRSWRcwyKYSo2S4aPbc/y6wsFp1NHZjJWAXgRybCz2AWgh8r76KivAoxR0TI bNeq+bMS2TE5ufaFwpDPmyyNCVQMcaKwgmb86rw6x09tYqiwKpav5ik1VptPIVUY9CFf zCBPD6EXmmzGDUbPGyaWwFWXodjNi6I6T3fZNeNe4cAmzBbhBIlB5OR63/K5QHXpxjgt HhWEGNv47y/zEn7HhHPxN9CYmegtENmI1Suay9DTPsFisUocLUYKnsYLNqgiO11dIqQJ S64+6i3ktpDd3PbpQtOk7qAhEhBX+aQT69bJDFbJV+3g23YOQfHIWD3gnXstlouAf9/X Z+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ut/ykMHpnjtV+JHjUSSdABWWx+60AFNoMBIIm5q4HT8=; b=EAPK9v7qxnmmvb1oe/Z30yFs247NabZCTTzZLqCUck1vjwi1GFlx4k+va1GvB6YdJu z0a22AmGkDGrKdyvwDsOH1PNQ52uCaM+EJxFo1Dw+rhB7+iRCER0tgzqOQ1DCCNr1n+f Fi8cXi1yEBpMdgcdJCB/bFQT5PsFDdicEKW9sKLYnklRNYCfqnYE/SUFOxcsJJnKWLc1 U/5yvB4pu4kKagPcDN0IJkhppDwgeAU2v51VaGR/1VX9e/lVEPrU81xRXEZ8Kxb/+F/W 35GZqm6xyftIJIP+OvSGAPVvOsGkMs3KgNKq7AYMq2/GAwijQsNEYU2YOniUdTEmJ+gA XG5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+VZh+4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020aa7d51a000000b00461a7962c26si3616210edq.527.2022.10.24.06.45.53; Mon, 24 Oct 2022 06:46:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+VZh+4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236475AbiJXNoR (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236926AbiJXNlj (ORCPT ); Mon, 24 Oct 2022 09:41:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 015AC7CE1F; Mon, 24 Oct 2022 05:39:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1B8B612E7; Mon, 24 Oct 2022 12:30:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1505C433C1; Mon, 24 Oct 2022 12:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614631; bh=o3vtTwlB4jCOZ2PyHCmxu2zJ9FHZxZzmrmeAx8nin9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+VZh+4awW8ieTbOPH0617svpX/bJT0q+Cn6DX0qzSVCbt3g7nCQvKIm+VMJ/cCyB h+p37F1Yb9g9aR+ZvnXFHd+omKKfyDemqpbYeAM338GPAzAg0YrgTg37ngnQ5ZAJVW dqPkiqegploHJP/q9td/ukP7LK6lntHm0FFaOOvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jameson Thies , Prashant Malani , Benson Leung , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.10 334/390] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Mon, 24 Oct 2022 13:32:11 +0200 Message-Id: <20221024113037.220491883@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576871117902556?= X-GMAIL-MSGID: =?utf-8?q?1747576871117902556?= From: Jameson Thies [ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ] cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended. Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event. Signed-off-by: Jameson Thies Reviewed-by: Prashant Malani Reviewed-by: Benson Leung Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220913204954.2931042-1-jthies@google.com Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index c4de8c4db193..5a622666a075 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -332,10 +332,16 @@ EXPORT_SYMBOL(cros_ec_suspend); static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { + bool wake_event; + while (ec_dev->mkbp_event_supported && - cros_ec_get_next_event(ec_dev, NULL, NULL) > 0) + cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) { blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); + + if (wake_event && device_may_wakeup(ec_dev->dev)) + pm_wakeup_event(ec_dev->dev, 0); + } } /**