From patchwork Fri Jan 13 01:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Previn X-Patchwork-Id: 13099643 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 696AFC54EBE for ; Fri, 13 Jan 2023 01:19:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F25B110E972; Fri, 13 Jan 2023 01:18:54 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E35F10E1C4; Fri, 13 Jan 2023 01:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673572732; x=1705108732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RwXBgafC0Ino9kWhUa/Yd/vWrZ+2jKNEm9FIOAIGPHc=; b=DtXe6FLnWhoIDYxHRrWPdxAL20fYEHZtoW6XfRlwEgR6rOpLAPJp2ScU P5JCi+ebeEKUGeY9L12Oe2Xq+fg6a8NAK1JVryhJCJ9qQHv3EMBxSGdD9 rBZP8prIP1WLC1DIC47k+ATPfLtFD4XDhwG8YSB9741NHNhiV8kyR/Y0E yP82BAtdidYGBOVr2friB9YI7TLh3uGUw5fBwlpWrBV7Z6Gp4ILxiqz4C U2LKA8yvZ9RlHtkbZmelaIbEq627/Xev8LeY6U3V0oUVBjlEWcB/qb8xt S7ItHHCi2fYSgZLIKwLch+oVQ48jrmwpNSy2tP64MzWTuQ35D6WKTnG+S A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="323941571" X-IronPort-AV: E=Sophos;i="5.97,212,1669104000"; d="scan'208";a="323941571" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 17:18:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="746761017" X-IronPort-AV: E=Sophos;i="5.97,212,1669104000"; d="scan'208";a="746761017" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2023 17:18:51 -0800 From: Alan Previn To: intel-gfx@lists.freedesktop.org Subject: [PATCH v5 1/6] mei: mei-me: resume device in prepare Date: Thu, 12 Jan 2023 17:18:45 -0800 Message-Id: <20230113011850.1463965-2-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113011850.1463965-1-alan.previn.teres.alexis@intel.com> References: <20230113011850.1463965-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alan Previn , Vivi@freedesktop.org, Greg Kroah-Hartman , Rodrigo , Alexander Usyskin , dri-devel@lists.freedesktop.org, Daniele Ceraolo Spurio , Juston Li , Tomas Winkler Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Alexander Usyskin Asynchronous runtime resume is not possible while the system is suspending. The power management subsystem resumes the device only in the suspend phase, not in the prepare phase. Force resume device in prepare to allow drivers on mei bus to communicate in their prepare callbacks. Signed-off-by: Alexander Usyskin Signed-off-by: Alan Previn Reviewed-by: Tomas Winkler --- drivers/misc/mei/pci-me.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c index 704cd0caa172..9f6ff06a94fd 100644 --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c @@ -340,6 +340,12 @@ static void mei_me_remove(struct pci_dev *pdev) } #ifdef CONFIG_PM_SLEEP +static int mei_me_pci_prepare(struct device *device) +{ + pm_runtime_resume(device); + return 0; +} + static int mei_me_pci_suspend(struct device *device) { struct pci_dev *pdev = to_pci_dev(device); @@ -396,7 +402,17 @@ static int mei_me_pci_resume(struct device *device) return 0; } -#endif /* CONFIG_PM_SLEEP */ + +static void mei_me_pci_complete(struct device *device) +{ + pm_runtime_suspend(device); +} +#else /* CONFIG_PM_SLEEP */ + +#define mei_me_pci_prepare NULL +#define mei_me_pci_complete NULL + +#endif /* !CONFIG_PM_SLEEP */ #ifdef CONFIG_PM static int mei_me_pm_runtime_idle(struct device *device) @@ -499,6 +515,8 @@ static inline void mei_me_unset_pm_domain(struct mei_device *dev) } static const struct dev_pm_ops mei_me_pm_ops = { + .prepare = mei_me_pci_prepare, + .complete = mei_me_pci_complete, SET_SYSTEM_SLEEP_PM_OPS(mei_me_pci_suspend, mei_me_pci_resume) SET_RUNTIME_PM_OPS(