Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp67155rwi; Sun, 9 Oct 2022 18:38:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WxFgGq3tFmUXq4sec9uvNt0nDEMNOYHOT+KPcOKMNUxMtedZ4XSew99NcuJz9/CtlW3ci X-Received: by 2002:a62:52d8:0:b0:562:3c8d:d427 with SMTP id g207-20020a6252d8000000b005623c8dd427mr17253014pfb.44.1665365897272; Sun, 09 Oct 2022 18:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665365897; cv=none; d=google.com; s=arc-20160816; b=1EWH2aZtX0CqiPIvWc/KiVe+ldBotc0cwtdA10+cfTPYKOpBQUUViYK5b1gee4kGKR dlCaQaYqRR47BGqXOatKNUuFO6OaGCcH61Al8K2eEG01xMpaDG04cc2ccozlG6te6XKr GuCypaJoP1T3u0Owc+4Df2VLoZvaM7y1cDKUNC73Lfv9CM43EYDxhddwOIAm2xLoHbo+ mlSrHu5rR9gl8BTGZA6OFGli6n5cCb7E/7Run32b/E+w7TS9cWDy4/oAamhQqhBfcyXD S1Qsi7oGBXLwf+nDmAdDUc1TQxRhdx5N4fZBcrqlXrn4ghPxSYRePqfWxAaqrEgD2QJ6 MwDA== 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=ut/ykMHpnjtV+JHjUSSdABWWx+60AFNoMBIIm5q4HT8=; b=VCLGBQBfqhDUWaS/tnvzg+vq0uz9TPKVp5SECTwhj7MCw+TFN8ugyF0Lfh7wJHapMG FHEKjK08eBzyk12pYlVZt6tg+Q/X6yR8I2DI6euRz4e7je0bwH8zMZez0cImjm1Z5qkY NNGYNz33jl+rLse22PU0cpnagnd7Lrfr9RkNyKdfcTuYLaNtyU8G6GVO+AaswXeuoXUB bVdly0kwDycnsfawTkUwmrC8FCIb6JZkFAcIcCQLLpdtG3JYvqXG140fg3ywHq+HFvbO AoXfk8AVcbr4ijCdqNtFs9Pu4yhmDjcz5bZiiNkTwfZEpAspdvPgz4JDnhB6fLVTus7t NRRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kRJ0EDRt; 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 t189-20020a625fc6000000b0054246220a40si10951429pfb.158.2022.10.09.18.38.06; Sun, 09 Oct 2022 18:38: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=@kernel.org header.s=k20201202 header.b=kRJ0EDRt; 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 S231681AbiJJA0p (ORCPT + 99 others); Sun, 9 Oct 2022 20:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbiJJAWk (ORCPT ); Sun, 9 Oct 2022 20:22:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 726591571B; Sun, 9 Oct 2022 16:56:39 -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 sin.source.kernel.org (Postfix) with ESMTPS id CAA63CE0F9B; Sun, 9 Oct 2022 23:56:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CB8FC433B5; Sun, 9 Oct 2022 23:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665359796; bh=o3vtTwlB4jCOZ2PyHCmxu2zJ9FHZxZzmrmeAx8nin9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRJ0EDRteZiRSvcjvIY2JDR4OtJzK+opAJGwPRsAwd+xKlcVtYaKK7BF8/rZOsqno rGmdsuC3Q/xCWcSos0tJYuVhCbWeEDCLq9nkz7JXBKumTwOv9PSnk2jeB9df6HnQK6 3kGmDM1i6xz8VPnLyDCyL36DvOuD7Yx4O0vte/06HmW3PH2pxd0l2lKMWVfulfi2kJ uJ40a3wCCRR0BUO9oxvMGusNYXjInAqHcbAhZOlbi0mA6dW6Qy6ba2iWMSYUOL/8gs 1CSBswG3p87RaG580BDHQ53xgzPzMC+yW2078+yJAtvdbBvsSTn3YfsF0YynfR1Hcm Fkx7JTyZJBOww== 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.10 13/22] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Sun, 9 Oct 2022 19:55:31 -0400 Message-Id: <20221009235540.1231640-13-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221009235540.1231640-1-sashal@kernel.org> References: <20221009235540.1231640-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 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); + } } /** -- 2.35.1