From patchwork Sat Oct 22 07:28:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107585wrr; Sat, 22 Oct 2022 01:41:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w5kcImSBgfxdFydEdwBYYHpZzgIH+s1dTuMlR3T4PzBvjc6tpM8sg80ti+CxVHkWss/XT X-Received: by 2002:a05:6402:1944:b0:457:fed7:5c30 with SMTP id f4-20020a056402194400b00457fed75c30mr20575558edz.278.1666428084298; Sat, 22 Oct 2022 01:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428084; cv=none; d=google.com; s=arc-20160816; b=Tx8izLbsGUCCif/NYk5h0TA2aGPtsoRKGPc+Aa5c5UaNgmzmmAWlHUyHGHR1fAB2Ap 41hix448FSofk0+L7PXDfo06MWz0PtnDEp5i8ZZnhVEhrlRe7gcOYQenFsf6+RRgf0MU 72YPuljti5Fu4GVdi/sTL4zYzONMrvKaa/qCB6To4he8h6wtapCIirZhX03DuisgpkLp hs+jGHQpEwj2S8DfHkMWEK+267gBRXiHjL2P6ctRXUxlj7XsnYQgmz6rqTBnKGefv/xp 8nWAVax1lvONwIFFTS1q8ocDVpwto1DURayIbMwfGizenqs+oWUD8aflck/IWcy07fkm zfGw== 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=3AUJ4H+i8u/hCrOJRuq7xfaqW+0zQXMaMmcggqucrr4=; b=SnwnYs5/5qicZ6QVjEd8i9G5DyorpTppq65oYN++WZ3miuPrmpfo5tLrTys97b4FRH JZL/A/0w1nSYdllEGm79v4rNzGSjsqMPTr8uZjpBgTWCvdVrbc1Ro4Z1EqvzYgvcyqVR ziXB/2zP9Y2lt4R83qoNKbk3LtfSoMDrrJijaw4Whsa6cDecNhW0hfAeGTLAsiaYbeDb tLi4ENDp/Vo3mDQC6N8irE4woQRHKq9ZRNpCGmZhOjbMEYGpS7bHNTNnFA9J2RLcAOYo H/cCBe0Wy9Vl3qbURzCxtN6lSpe0NVnSYvaNBpiLBgvmqq5BKdLjfervqDw1i8+7JuZ0 7dGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ix7Az4aD; 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 y17-20020a50ce11000000b0045cda8e8383si20640106edi.542.2022.10.22.01.40.54; Sat, 22 Oct 2022 01:41:24 -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=Ix7Az4aD; 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 S234483AbiJVIih (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234232AbiJVIec (ORCPT ); Sat, 22 Oct 2022 04:34:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFDF2E717D; Sat, 22 Oct 2022 01:04:00 -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 D044D60B95; Sat, 22 Oct 2022 08:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C13C433C1; Sat, 22 Oct 2022 08:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425779; bh=M38r/E9gOiSMNUxlhb0oTig0PM5+yEimJHqsvloDPrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ix7Az4aDiudhGBK8nY4RQuAEOjh6fIyO4LsME94sNq60mpcmT6LUX6uv+k7tBHT9n O98Jfbl3oeJxQzJ4oO5JmAcDWdr+5ZkXA7GG5iNWqx4Y0xZf0ATRqUpGis5bRPil1i pRmiW2uNCvgA1m7c+NUZ0sRvtz/92pGp96LojFl4= 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.19 613/717] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Sat, 22 Oct 2022 09:28:12 +0200 Message-Id: <20221022072525.573383019@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376494866552298?= X-GMAIL-MSGID: =?utf-8?q?1747376494866552298?= 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 00381490dd3e..4b0934ef7714 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -352,10 +352,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); + } } /**