From nobody Sun Apr 12 00:57:12 2026 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 0FB5EC00140 for ; Tue, 2 Aug 2022 17:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232983AbiHBRk0 (ORCPT ); Tue, 2 Aug 2022 13:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbiHBRkV (ORCPT ); Tue, 2 Aug 2022 13:40:21 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCBA610EA for ; Tue, 2 Aug 2022 10:40:17 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-31f5960500bso122626457b3.14 for ; Tue, 02 Aug 2022 10:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=ONVk+IwfQtxkQMEE1txHxraIYz5uS1JfsA6nTBwgy+I=; b=VPi1EX9sV3DI3/6YfkpEke2lO5PZ2alhRTtje8l5A7fsDOKzH3zs6lpGJSy3VD1Kwc gSTmLomYI5iNuo+5Dqa+wxPnj84hVgh40XecRcNFbjGl/DcJomF4EL5SW2MQzR0HRS3o 0GRMM0y9FmEbHuaDTRci/3TrTZRz5Qkwp9ZLY0htMy51YggPCh+k6riQG7qBynu6Ljt7 txyB+cVI8TajmI/Z4yiE37p1A9Wz+9JSgHW4g3VQLlfsiVZGY4znC33U/QUu/zKe1xeK dX9bi2BWvBTIC+gFLiM97+BKol+uHfNy3wfz3NdjPaTTpLfjFQs7vf9UrHszGXJQ4/5N zgpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=ONVk+IwfQtxkQMEE1txHxraIYz5uS1JfsA6nTBwgy+I=; b=If1wRt0ywiCrXmUHC9X3/NXZsMYovK6oV82SQbCYxchfb6sDqZs2D8XuwzHcQUFWFG /qMvGZyk1LUCteBauPbf6xT5olRcKqO7Sntnhlj/U5JdjIusxFUnuILGU1Uh2B/pwLwx /wqkXJ9GJa2xz7BUm5b5ezN7+pf93fVQ/A8wqNRQyT4KnhdkYwYfkM3roXomzOZE1RmC xy8enpZV0/beGh/0C1BfS9KainrRWqpnhbpCtgja186cAq/JOYXP7aXB5h4gX4tGVfmf Yj4NRm+tNTI7uXa6dojz1ASGsy/m+BK079/tBheuEuPGqadVOllOx788pRHZzCjrw0+y lXkw== X-Gm-Message-State: ACgBeo0Y7W/gH4kx6PJ616dnausVgnxXn++LSI5Ojd0Jky+3FskCRj0r nT2bxhUcXWE0XFz7poSwKJ1REJXglA== X-Google-Smtp-Source: AA6agR6G2fc61/vdfjDY2CqjeZK0f37dBSOoZhf6/RxQc1A4UreeeeNwIkSFEV8AcCr2cuFO5qqUDWYlZw== X-Received: from timvp.bld.corp.google.com ([2620:15c:183:200:61dc:f28d:ccc1:638a]) (user=timvp job=sendgmr) by 2002:a05:6902:1404:b0:64e:1ec0:cec with SMTP id z4-20020a056902140400b0064e1ec00cecmr15406103ybu.588.1659462017098; Tue, 02 Aug 2022 10:40:17 -0700 (PDT) Date: Tue, 2 Aug 2022 11:40:08 -0600 Message-Id: <20220802113957.v3.1.I2c8c550183162e7594309b66d19af696b8d84552@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog Subject: [PATCH v3] platform/chrome: cros_ec: Send host event for prepare/complete From: Tim Van Patten To: rrangel@chromium.org, robbarnes@google.com Cc: Tim Van Patten , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update cros_ec_lpc_pm_ops to call cros_ec_lpc_prepare() during PM .prepare() and cros_ec_lpc_complete() during .complete(). This allows the EC to log entry/exit of AP's suspend/resume more accurately. Signed-off-by: Tim Van Patten --- Changes in v3: - Update cros_ec_lpc_suspend() to cros_ec_lpc_prepare() - Update cros_ec_lpc_resume() to cros_ec_lpc_complete() Changes in v2: - Include cros_ec_resume() return value in dev_info() output. - Guard setting .prepare/.complete with #ifdef CONFIG_PM_SLEEP. drivers/platform/chrome/cros_ec_lpc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrom= e/cros_ec_lpc.c index 7677ab3c0ead9..4158bdeee197b 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -530,23 +530,31 @@ static const struct dmi_system_id cros_ec_lpc_dmi_tab= le[] __initconst =3D { MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); =20 #ifdef CONFIG_PM_SLEEP -static int cros_ec_lpc_suspend(struct device *dev) +static int cros_ec_lpc_prepare(struct device *dev) { struct cros_ec_device *ec_dev =3D dev_get_drvdata(dev); =20 + dev_info(dev, "Prepare EC suspend\n"); + return cros_ec_suspend(ec_dev); } =20 -static int cros_ec_lpc_resume(struct device *dev) +static void cros_ec_lpc_complete(struct device *dev) { struct cros_ec_device *ec_dev =3D dev_get_drvdata(dev); + int ret; + + ret =3D cros_ec_resume(ec_dev); =20 - return cros_ec_resume(ec_dev); + dev_info(dev, "EC resume completed: ret =3D %d\n", ret); } #endif =20 static const struct dev_pm_ops cros_ec_lpc_pm_ops =3D { - SET_LATE_SYSTEM_SLEEP_PM_OPS(cros_ec_lpc_suspend, cros_ec_lpc_resume) +#ifdef CONFIG_PM_SLEEP + .prepare =3D cros_ec_lpc_prepare, + .complete =3D cros_ec_lpc_complete +#endif }; =20 static struct platform_driver cros_ec_lpc_driver =3D { --=20 2.37.1.455.g008518b4e5-goog