From nobody Fri Dec 19 18:41:57 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37C70C433FE for ; Sat, 22 Oct 2022 08:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234485AbiJVIik (ORCPT ); Sat, 22 Oct 2022 04:38:40 -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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/cr= os_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); =20 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); + } } =20 /** --=20 2.35.1