From nobody Mon Feb 9 05:19:34 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 ECB88C77B7C for ; Fri, 12 May 2023 17:36:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238091AbjELRgR (ORCPT ); Fri, 12 May 2023 13:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238074AbjELRgP (ORCPT ); Fri, 12 May 2023 13:36:15 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A6B91718 for ; Fri, 12 May 2023 10:36:14 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-76c4bb969faso144574739f.3 for ; Fri, 12 May 2023 10:36:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1683912974; x=1686504974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Yv93mD4EqgevAcbmXFwBEuOtcFUngrr1N34sRRE8Vrc=; b=j7G/Qmbnl1GQ4XKXwMPUQWnqEOJTgGl/6VXphk6Aep1ie7bohp2Yd0m0/17ukdnLA4 hEqP86t5/V6sa/V7fBVxzuzBodutbB9tizsiLXOwNIzVrH1Qlc+9trVgXFWLUdA12jH6 PaTs5gL3KFDjTqbz319EEmex/ReXbUNgVIspg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683912974; x=1686504974; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Yv93mD4EqgevAcbmXFwBEuOtcFUngrr1N34sRRE8Vrc=; b=TasNyzPJ4ZHI4om+z5InTm2el0lYANr9wY0BSwAX3ctbRokxlXGmlhEm5U/cqLhYla 3c9jSKLctGBbbCpWoQmTPiKky4NogBU93Cust6iJINn844mvkY/WTTQw9a+gsNbsDcCo k58P0SF/tD4giGNHIyrx498J5SvbpLR03A8TpvM7UqAfLDW0kqt0LqM8yfvlVFarx4U8 FeeGTq7v9OFiOYlpUX/ZQ4r0CjRJ2ydVC6CFSB+xn/Y+vVsr08SLsvNe+cUYzehGWYZY j8g37VpK4wrmQ2vqg8uwyKwSL5b6AgIMcqkNErVN5QwK4jeUJ90yb/2Fyhj7zDboTU38 i7kA== X-Gm-Message-State: AC+VfDxvYCjrnFI/ZNo9RVOiEG5NHyRC7Nlfyh7mfq/9NUJuGAn7p9XH qLd8cBux2Yoz0158G0X2mOr81W6H/FLDsxuOugLREg== X-Google-Smtp-Source: ACHHUZ6w2z4/ld2w4Bdvbl0Jrn/6Di4lmq7Mlj4FsXXe/Na6XKeaYNv5VJi/SQgnD2yUC1oNLk7Nig== X-Received: by 2002:a6b:dd15:0:b0:76c:65df:a118 with SMTP id f21-20020a6bdd15000000b0076c65dfa118mr7954998ioc.6.1683912973867; Fri, 12 May 2023 10:36:13 -0700 (PDT) Received: from timvp-p620-9115096.bld.corp.google.com ([2620:15c:183:200:424a:848:d237:b7d3]) by smtp.gmail.com with ESMTPSA id a2-20020a6b6602000000b0076c750dc780sm1525856ioc.29.2023.05.12.10.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 10:36:13 -0700 (PDT) From: Tim Van Patten To: LKML Cc: lalithkraj@google.com, robbarnes@google.com, rrangel@chromium.org, Tim Van Patten , Tim Van Patten , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev Subject: [PATCH] platform/chrome: cros_ec_lpc: Move host command to prepare/complete Date: Fri, 12 May 2023 11:35:57 -0600 Message-ID: <20230512113556.1.I55189adfdb8d025fc991a0fa820ec09078619b15@changeid> X-Mailer: git-send-email 2.40.1.606.ga4b1b128d6-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Raul E Rangel Signed-off-by: Tim Van Patten --- 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 68bba0fcafab3..93820654a555b 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -543,23 +543,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.40.1.606.ga4b1b128d6-goog