From patchwork Fri May 12 17:35:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Van Patten X-Patchwork-Id: 13239566 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D14DB200A5 for ; Fri, 12 May 2023 17:36:14 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-76c7517612dso77065739f.0 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=A86iEbpldYzrDsGaFZXNiGL11/nIw2HPeTJ1tV5WBB7RynLbt+lMrkQrFJ0yZ6ZfSL AY0Cz0COgNPdWz1Q8Jo09fSVoTOKun/yBPTy1xJfnIahI0vRfk51Fx2q6yG5Tz3NbGIR NGesp27ecZTEDa7XZcjPjXY0EjLesyNMGQMYxLwuVJAHoME6qAHGFT1xY52L1WUeA6RR GsvX7/AARnGZi6LMxpwFAdYoIAdM9vLQrGd8XKtE6/5cpmspqU5CR3KwoSpimQV6ML9t BMq4gakMV5zDXRtosgs9Smt+SsqvBay41HtxSC/DQMrfcBhrLvjJfT2HAzRoYeaTgsOr TPNg== X-Gm-Message-State: AC+VfDy+fssPvV8+hux92k3UM6OJTASbVvnHdHMWIgD1fYnDJ94iDk7j prDZPT7nF18I+SbIDBXpAwHbVQ== 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 Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/chrome/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_table[] __initconst = { MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); #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 = dev_get_drvdata(dev); + dev_info(dev, "Prepare EC suspend\n"); + return cros_ec_suspend(ec_dev); } -static int cros_ec_lpc_resume(struct device *dev) +static void cros_ec_lpc_complete(struct device *dev) { struct cros_ec_device *ec_dev = dev_get_drvdata(dev); + int ret; + + ret = cros_ec_resume(ec_dev); - return cros_ec_resume(ec_dev); + dev_info(dev, "EC resume completed: ret = %d\n", ret); } #endif static const struct dev_pm_ops cros_ec_lpc_pm_ops = { - SET_LATE_SYSTEM_SLEEP_PM_OPS(cros_ec_lpc_suspend, cros_ec_lpc_resume) +#ifdef CONFIG_PM_SLEEP + .prepare = cros_ec_lpc_prepare, + .complete = cros_ec_lpc_complete +#endif }; static struct platform_driver cros_ec_lpc_driver = {