From patchwork Mon Oct 24 11:33:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp481297wru; Mon, 24 Oct 2022 07:22:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kjFu75giN5d2OPNFhRmfH6sjsSsX9olmmo8f1RMch4E6vKvljmcTgJmX5vEHjboRIxvNg X-Received: by 2002:a17:907:628f:b0:72f:58fc:3815 with SMTP id nd15-20020a170907628f00b0072f58fc3815mr28069615ejc.719.1666621372392; Mon, 24 Oct 2022 07:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621372; cv=none; d=google.com; s=arc-20160816; b=KM7G7kY1DfHbv4oT2YMavcMtCebOHTEQ4gfj3byLLiQ9CCGebl8ZXAAJ/itPbk8/k0 jXGBp4zSKUM0zmqLbQCFFOxzE8v7nurJg80tzQ6Lnjfe8QpZkGV1SdiHlCyrG5HFdmfa F6TX7GZzJseNhpXcbH+M+2KDoX54BWE+iaHTgfVovaagaLNz7x/x1pSTcpiGPD1y+OG8 dOM2Iw0BImotl4j5ik6/SIYZpFRXTGZLr39Oo4BNHQN+Bs/CahTvhHwsGf2Rc3x2Aba8 a/xhXnSoImx3NzizfP46itZ/3EhKq4nRD+allAx9lYWToGzs7XXS8Nckr5AKesoFf87u vpQg== 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=KIrY/uw0Lz4x9OrPmbANdtC1jqoT+tnkFXb32S98qtw=; b=Dp0Dp6L89NoYGFdHCoSYKCH/sClg1/00opoAEDUS56uSL+smHfvM0G9zbktqBKDDwR jAgHantS/CMZ7qIukpluHoyBY+FNZIlWG75845Laa1Ifemaj+VappVQt7QOdmphNrWyH RYgj27BRnCmOo6k96wlFqyNH7DobRf0xyGuWfd+pTnewg56YwIW++98pv6bZiQGR5CDm y491kA2HCGXS61nmEHOcSNqIDYkgHKHGgPcu1SXBRCCdy9K0AItRHgryssdDHzNpe7Wc h3a0ThIyAJiQ/eRJYcv5Nr07n5+VWeJBQ7crqAVjS5Ocsx/kfnyqDGTDhfn2u48zEHpT TwgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1cad15jt; 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 go10-20020a1709070d8a00b0078d4c9d77adsi34908118ejc.94.2022.10.24.07.22.28; Mon, 24 Oct 2022 07:22:52 -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=1cad15jt; 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 S234572AbiJXORY (ORCPT + 99 others); Mon, 24 Oct 2022 10:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbiJXOOl (ORCPT ); Mon, 24 Oct 2022 10:14:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3FD65F6; Mon, 24 Oct 2022 05:54:38 -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 11CCE612E7; Mon, 24 Oct 2022 12:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25EAAC433C1; Mon, 24 Oct 2022 12:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615976; bh=JG4zpURXQKIe8yvupxxFcpZJr66Oes7UwY5ObWUaDP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1cad15jthqgT1mzoFUnOFrrBqY4hhjOvoUqUSiEGJw3g3BI1eYzN8737qEavEliBP Y3pXSCnRZqZPU8I/XKdB6f1tLoiKMoAosWIP2ffbgald5YVOVo8+N27kX5oCx/aDy8 nBq+uDOFkQYXxx6ZUplZpJeLTSlqxGNCp+y0EJ5Q= 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.15 454/530] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Mon, 24 Oct 2022 13:33:18 +0200 Message-Id: <20221024113105.591144748@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747579172095179650?= X-GMAIL-MSGID: =?utf-8?q?1747579172095179650?= 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 4f0390b10cd3..9664e13ded59 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -353,10 +353,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); + } } /**