From nobody Wed Apr 8 04:27:16 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 1436DC32789 for ; Tue, 23 Aug 2022 17:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232545AbiHWR5X (ORCPT ); Tue, 23 Aug 2022 13:57:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233226AbiHWRzb (ORCPT ); Tue, 23 Aug 2022 13:55:31 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492FCC2EAE for ; Tue, 23 Aug 2022 08:59:20 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-31f5960500bso245866007b3.14 for ; Tue, 23 Aug 2022 08:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc; bh=s208mFKW5mux3x3fFQzuS0oklKHocAknnwXo8nQY6YI=; b=onfDdlrNeXjaHJVDclJvl6kkSSZkwz5ngSB+xHxpci91JPwn/QO5fmV/397a+aKKxp zTPVzXdt1umOXjW8wgznpZ1IlQ4kZgOHnBZiB55z16cURRuftdST3FqI3I+UVo3b11h3 XxkIIXmNoF0oLdrwDceCt/wTQn9UJbLIdHuQgggVxuaVm5+KNac5PQPzdHbFe2CFjx9I hbcEIsznWyLSkDngLXclu2/eSvs7K2b1fH4EzzNEg86OETq+ltNOkV9PIpYilyHRkqL4 1nBZFFUXLC3aJEPGR7WT+kszNxPVrmIjbjrjcAfyeFB3LvUdjBuoo1vlYq60nMCIA7S1 lpQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc; bh=s208mFKW5mux3x3fFQzuS0oklKHocAknnwXo8nQY6YI=; b=1HMeLnUEJ5RI8PNtuAgikkbzWTujWh7v1sxavaxnC4jTlkEYa9vhIj7WYDcFrR+QE9 2CJKJK1MfQHER6MR76uTgQa111TGzN+5PH5nB31IygQKkkzy+EMSKWuRVrAk56wp0v2+ lxDmFYsmAR09KU+N+xOWsbOFxyvyS9RvjvLBDDV+IfcMLc7/3ONXAn5DHQWNnaE4A4Uw ZpiVIkG0yJg0spaWIk5BI9QpH8SdQaLC78J+TIO+D38QyywN7bHB77C4C27dkNF2tHo8 QNx6VcXMTD1IZCrqwhjDGpEo6lwWBLxp1RyKb5pH68GAREszpSSuKR1JifYRW7DM6/UE nYMQ== X-Gm-Message-State: ACgBeo0b1ZZUP4L2K+onySZvvBFF+2ZS9vuCu0glvmXyOpmN0MfDEYPX M6hCE9aK3pwfu4ZTD6UlruFFARcKxA== X-Google-Smtp-Source: AA6agR6lvaz85tu0pzAuiS+DWBgUc/EfOcw88DjqRBJtufUAKYnAyUkyBx9LWajcnsGGF57Q4v0iO+5xwQ== X-Received: from timvp-p620-9115096.bld.corp.google.com ([2620:15c:183:200:2f3b:1daa:d20:c362]) (user=timvp job=sendgmr) by 2002:a5b:d09:0:b0:695:f25c:fa14 with SMTP id y9-20020a5b0d09000000b00695f25cfa14mr3450377ybp.163.1661270359512; Tue, 23 Aug 2022 08:59:19 -0700 (PDT) Date: Tue, 23 Aug 2022 09:59:17 -0600 Message-Id: <20220823095915.v7.1.I55189adfdb8d025fc991a0fa820ec09078619b15@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog Subject: [PATCH v7] platform/chrome: cros_ec_lpc: Move host command to 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 moves the host command that the AP sends and allows the EC to log entry/exit of AP's suspend/resume more accurately. Signed-off-by: Tim Van Patten --- Changes in v7: - Rename "host event" to "host command" in title/description. Changes in v6: - Fully restore fixes from v3. Changes in v5: - Restore fixes from v3. Changes in v4: - Update title and description. 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 7677ab3c0ead..4158bdeee197 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.2.609.g9ff673ca1a-goog