Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp63898rwi; Sun, 9 Oct 2022 18:34:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7f2bawyuXkycajT1c/1H0ppICTTd1N68CDfJUAs1tNxjoIIM5litA/bSWC8DQxiqujxgea X-Received: by 2002:a05:6a00:1f10:b0:562:b9e1:55e9 with SMTP id be16-20020a056a001f1000b00562b9e155e9mr15369561pfb.60.1665365640880; Sun, 09 Oct 2022 18:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665365640; cv=none; d=google.com; s=arc-20160816; b=fReNiEbJ2RO4ierHzDzGFTPGXZreKPAAL6gADZqBQSyCwEx1/rJVD05RtcD0LTxsfG EjNjStfr85t7Y1AH33LVJkJDBTLhdy5+aYfJyk/T4m7bdAxTUOW16ZcS9QaqlOUcnf14 /D/tQS02sWylsZigv6prGENdMde5xxHqkqnET+HJnABtINvskCLiCxbICir/WFIhOhhM GRawkyuYRWvTcle86X6xK6dB4qJ48LkwzopUMrGO7wZv1wdacincUq8lSSxoPci4C54y ZTtd5oOcsJOWHfv6cyyknJmAS0kyZOfhfyuOyGNPfB1W7IeA+SWWhmxQPJEy2mSZbUYB sAUQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KIrY/uw0Lz4x9OrPmbANdtC1jqoT+tnkFXb32S98qtw=; b=uZNlU+wBMx4Or49y4cSJEO04o8Sm/8Vz4vH2orDmJ82iFfrIoBQ3xovTCbvygP6Okz se6mbA605YopJ/A+qyiqaWy3Pfw1h6sLjxaeikWaTwBDPHJT2pCymIU6r9A6EBTiclad ITFSBezUTgT9tS6QfHRJmbR82uEQ5Dx9KugiQS6Ts0a1AnJggwFBnP3n8pJlNkewf262 vTIfvBzI3ii+LNVw11zpu/2ulyBuGfs/G3k5pn3nURn5N6Z39i6hgJp6U5tv6qsz/PdX QEZo3LOV5Fe059P90QDmDAVpFKdd7ne3to5pShPbEtOhHzfUsEFVMOrWh1jDPFrcjXwB uVgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D3uLByha; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a170902e89200b0017f93a4e32dsi11668141plg.0.2022.10.09.18.33.49; Sun, 09 Oct 2022 18:34:00 -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=@kernel.org header.s=k20201202 header.b=D3uLByha; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232786AbiJJAWl (ORCPT + 99 others); Sun, 9 Oct 2022 20:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232290AbiJJAU7 (ORCPT ); Sun, 9 Oct 2022 20:20:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07EE3264A8; Sun, 9 Oct 2022 16:55:07 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7ABA3B80DF9; Sun, 9 Oct 2022 23:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EE05C43148; Sun, 9 Oct 2022 23:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665359705; bh=JG4zpURXQKIe8yvupxxFcpZJr66Oes7UwY5ObWUaDP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D3uLByhaG7elr72Rw2TDhfznqCKuwsQ03+jx2lSxv9iOm58nLYOEqVrajwd/MZGoI Oj87YvVpfw2YspoUFP+PjVcoMSlDLtiEVoU+SUoSC6XGHDD/bKmoKDkdlFyzISDT+H 3P2ac/7v6BfX7LhaviCAwIHsBW5L5TKSlayZRdSs/VuxOZuDFWazcbe9o7wuEHYsPW KXqXRvGw39jYheclZd5KZXtdWGNT6lIQLn4B3eh1Sj4Xi2W9Yr5IL0MfgNTXn4oIoT CZKV8HuJk1GQxOuuwzLs+NCHpbWcshUSoBEVgFuvpSu1McVWb07yvxdF4L0jWJ7T1F nxFnHj7qszOxg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jameson Thies , Prashant Malani , Benson Leung , Tzung-Bi Shih , Sasha Levin , chrome-platform@lists.linux.dev Subject: [PATCH AUTOSEL 5.15 15/25] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Sun, 9 Oct 2022 19:54:15 -0400 Message-Id: <20221009235426.1231313-15-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009235426.1231313-1-sashal@kernel.org> References: <20221009235426.1231313-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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); + } } /** -- 2.35.1