Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp973177rwi; Wed, 19 Oct 2022 05:21:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ozJrgMHmoxgQ05zOKJsYtcMOSjiUrtx9eYXkyu5Ef1muXFZcsF+UjAtoUPJPubr+a7FBE X-Received: by 2002:a65:6bcb:0:b0:44c:3e11:a7ac with SMTP id e11-20020a656bcb000000b0044c3e11a7acmr7184068pgw.274.1666182075211; Wed, 19 Oct 2022 05:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666182075; cv=none; d=google.com; s=arc-20160816; b=uFhfTIM/F512r1hFYtsJkvEyshDzVHYIIo4R8de5IkRSC9nz1bAuoFuuPinZ2MAXRg Fk8gpi/6YK/Ih25CH4eivNAZ1jYyCRKSiRwCQVjA0nDV5rZjHspeQtWHviLS6J/fkvan 7NOBXh7Ghjo6dLsRBpFUjNsJEqVF56YApkn60GBfGAixNR9DcUYztQJqbNZogAHFEbEB x2yud3FTPrmzCkTM6TyBbKulOJ/ZQtkr0geVP7lKrYbliuKXT0+4V7ejZXCqYrOefZPY du+WGY1DeQGh+kTSP+Go2lUmV2XyvMkYEwutBy2L4cVqyCVV5XdBYl63AIZIILRVQwjc Z6hg== 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=Ks9c5fal2HIeLdJjd/0p+pyxwCfKlQSG+Ai82b6dNXM=; b=APQqpvRC0RGCkGOCnGu+gRPgt3z8hQpht6uWNCbfka4jVQYgCITlqK5w7PnkmQQWH8 PU/4k0ZRiDGD3uDinsbNLUFahz+8GFBYfx+RwLANB/TzumlYupCdnDrjpxZh/is8askD owYpOaxHogZSZJ3NRTd4vhWp06W/NSuNI7Wadc8p/A/5m9QqV7Wxp++NYe74eWWQvafJ Xlu/5oCEdsxenqHyLCLkKNSuoEWKWFUiZPPEObNn3saKoiks9Vb7wPU1XL6cj66Ksjn2 U3rnLDz246z/4Oi5SHy5OoXfJRoksXIcklL94w758VzAObG+YP7BjUWXfD5980TRoKBY PsEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0AhZtaOZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056a000a8700b0052f60f7e0a1si19777044pfl.5.2022.10.19.05.21.03; Wed, 19 Oct 2022 05:21:15 -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=0AhZtaOZ; 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 S230372AbiJSL4A (ORCPT + 99 others); Wed, 19 Oct 2022 07:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbiJSLyy (ORCPT ); Wed, 19 Oct 2022 07:54:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FE4817FD41; Wed, 19 Oct 2022 04:34: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 sin.source.kernel.org (Postfix) with ESMTPS id 0A7E7CE21C7; Wed, 19 Oct 2022 09:12:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EAF7C433C1; Wed, 19 Oct 2022 09:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170774; bh=+bDLyobCzXL7wDQw/U6oi4YdNCx8flKdh8jVS9hCnO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0AhZtaOZgiXDbyxotjBIjOSk/NhYE8NPVZeClqTz1SgeBHFjf9xx1agNhD4YaktcC y9649sOuHHpVsvgsA/r7Jz4idWSRcQafBJIZm+sZXytlkPtjQAO+GW7WfO/xYko8nU QbzFbr27saY6Ec+A+qTO2Qi3qlRCr2EmUutjZw84= 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 6.0 747/862] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Wed, 19 Oct 2022 10:33:54 +0200 Message-Id: <20221019083322.941916152@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 8aace50d446d..110df0fd4b00 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -349,10 +349,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