From nobody Fri Apr 10 15:47:33 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 19422C28D13 for ; Mon, 22 Aug 2022 17:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236973AbiHVR2r (ORCPT ); Mon, 22 Aug 2022 13:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbiHVR2p (ORCPT ); Mon, 22 Aug 2022 13:28:45 -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 21FD1326C3 for ; Mon, 22 Aug 2022 10:28:44 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-337ed9110c2so155076887b3.15 for ; Mon, 22 Aug 2022 10:28:44 -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=yzjS+LywkTWL8WvWDA7N7t+zpqj6zc8ZGGsibUAWoXc=; b=HvLX6cWQF1notA4Yggh9p9vMeoaGyxWp/t/sue/w1EOhy3i1JIiuey4oxPZFoTXNkp P0xEOo5gccH+H9j24WUunpcJJ5nNsVe6U4DNlAGPE0q+NLNbItfpCnDKap4y590e6+I0 DsREykmxLQzMWVi0O7PwTnp3DA05QKKE7r800Ei8eVr5Ku7wtgbvi1cWeHOwiOpzuGMW yK9vxeBzvWjVYDcWtWecyxrytUGB4q4rohMIum5MXXtJ+fkmC//pGsypRGYAIK2WKAVr DcQCTcMGzB6qMvz+QbE5y+SaivL0FXuiTyYe9IlNd2FR3urGrf1k936KA8QaPa9Y3yZY YbFQ== 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=yzjS+LywkTWL8WvWDA7N7t+zpqj6zc8ZGGsibUAWoXc=; b=Nk6/FJDagpUlbmjvOuLwCj6oAXgrR57j/2HmsIho6m03koCWf+deKv/THBk+0s/g8N IM4fATn4WUweJ6c68z0F0yMn9SB3guzgd8ISo4r3THSEkbgNqCV57W3Rt7uPo9KEElEb PSYBqrJh9Kf2RriuiUUKNLJhaxIs5Pgbc7pgxGZkHjYPcFNOCZva5B4qBcsUPP7Zv/fX cqNFc/lquaxq337EIusCokpYaV8AYjCImcSK0MLsX2+bquZKaRcs/No4f/DwnCzYJeKi YgagmBYZrWA+ILpdr/mWW4AbHNT4Yug9ogWnFQQnKdazLWfnnPTgOVEc3oNDkQ8BvkcB 8msg== X-Gm-Message-State: ACgBeo1LwDFd+k+uYO5499kjYLqejJLloLTdoLxu50TAbXiT52wzSIBY YKzh1eygFVk41cbkn3XbM3ajqxVD6A== X-Google-Smtp-Source: AA6agR5pKK4GPpIqDTf9/ajoMTVtP1y9QH/7kTtaiFafgYADIP+eyPoY+AVJfw7OFW9JT34FZvouDUfvwA== X-Received: from timvp-p620-9115096.bld.corp.google.com ([2620:15c:183:200:762:7c61:946f:731]) (user=timvp job=sendgmr) by 2002:a81:7c2:0:b0:335:90cb:1962 with SMTP id 185-20020a8107c2000000b0033590cb1962mr21509762ywh.173.1661189323446; Mon, 22 Aug 2022 10:28:43 -0700 (PDT) Date: Mon, 22 Aug 2022 11:28:40 -0600 Message-Id: <20220822112832.v6.1.I55189adfdb8d025fc991a0fa820ec09078619b15@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog Subject: [PATCH v6] platform/chrome: cros_ec_lpc: Move host event 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 event 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 --- 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