From patchwork Sat Dec 23 03:25:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David E. Box" X-Patchwork-Id: 182909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1468121dyi; Fri, 22 Dec 2023 19:27:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjDB7MoL69QnJK4nXPXQ0OdLOubKJZ3pg6R1oRacuv2/aGfI35/ivbypYrS5y1ddP4Yz6x X-Received: by 2002:a50:d55a:0:b0:54c:5e18:50e6 with SMTP id f26-20020a50d55a000000b0054c5e1850e6mr1180272edj.42.1703302079542; Fri, 22 Dec 2023 19:27:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703302079; cv=none; d=google.com; s=arc-20160816; b=UXU/bB4jjmPvJHo0EwZmeSrsEXmx+joOI0FmCJLmEHuflab/7bBVxfNUkjrhHwFc1y zLyRnacoY5JYB8NeUjsVhFL18nLB3uEhwPGQYZp762oV/5J5y2D3XH3Z3KqgZRUD9Ta1 +p67AP0PPPiRnR9Alw1mCglIMrCBmKAUufIiwOaKrlrkMh01cszEW5g6JgRwXepnICDp 3eLAfKHjPx/q7FReQWVqbnktKzT9ryHQwgfy54iLylgoHqHXT9/s32DYkrhzC/Wl1tVU URl6V1KhdzuqIxMTD/TolvOWWw8oHae9UIElSQksJcah05u1dnifdNb2yHoaRS9nRjfT lV7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=HcCn4aeXp4wyxYi2ITZxR7YHHHDDkglEQ7SbYywoxZM=; fh=yyAGbTikx/RHwePVMTF7XiY858Fr2O1Lml8NjpI1ECE=; b=ygopNTJwCnGjOCn12Q/4+5e1ku/w6/90Za5VUEDEsxENLglNfzCrafxRXNg5FX5m4l V21QsAVMpYAkXH5ML98+ALjqN1dmoSjcqWrI0a5JFaETI07IXbyi9Wn2iOsndDKb4Hbx VIh18bvlqLh49Y1uEcCE8Hhu6kLyIkn/txqVdIqF00h9k46cadciZMnHSEYdaD2GP9zF cymrd01V5Mp5URO5532WsKTUY/KyUs1jrTzwqCO/NurL/fVbYUaK1bDyTOuxtRSVBZaO v32qwrPHRg7nL4lg2xdnuBeq8EEu4IyqcaNBAMD4lj0ETRvNJCZvz+MFCfei18k9cQWe LUig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Et1q5zCF; spf=pass (google.com: domain of linux-kernel+bounces-10266-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10266-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dc19-20020a056402311300b005547dbb74desi440835edb.226.2023.12.22.19.27.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 19:27:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10266-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Et1q5zCF; spf=pass (google.com: domain of linux-kernel+bounces-10266-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10266-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0670B1F24588 for ; Sat, 23 Dec 2023 03:27:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E616EAF6; Sat, 23 Dec 2023 03:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Et1q5zCF" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5461B79F2; Sat, 23 Dec 2023 03:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703301956; x=1734837956; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ejKM6Nv6PFWughHe2wl2ebjlYx53nsbMF+dHQa95DuA=; b=Et1q5zCFBn422eTLZeiIeSFsavJl0RRJlwRJiniYisjn9xdeYSQB48xu hnqKTH6EYFG4s5p688p/gVxDmhyoMzzTjq9R2qPcJLXOa3fRugQXevnKJ y97I4/E1/gc1P4daZpT3RfAhEvX7tuxvzcVlI3BIT2wK37nEpgI6toUXK 0canW1Cnbm81de6a0Q97UH+TSIUgWj4Yx4oA7HUtb7QYt4s9JphQhD/Q1 FKieVxNnOjjw/S4PmY7a9qP9wrnYyEsz7jSr2mm775hTmGOu6dat1pA6w EJiYUfXHIY2zBB03dE7muW6V7iCAIlIRc+vNAP8DvxRgQLO3u/EWDjV+8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="395922871" X-IronPort-AV: E=Sophos;i="6.04,298,1695711600"; d="scan'208";a="395922871" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 19:25:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="1024436818" X-IronPort-AV: E=Sophos;i="6.04,298,1695711600"; d="scan'208";a="1024436818" Received: from linux.intel.com ([10.54.29.200]) by fmsmga006.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 19:25:52 -0800 Received: from debox1-desk4.intel.com (unknown [10.209.86.110]) by linux.intel.com (Postfix) with ESMTP id B6F88580DB9; Fri, 22 Dec 2023 19:25:51 -0800 (PST) From: "David E. Box" To: david.e.box@linux.intel.com, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, rajvi.jingar@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] platform/x86/intel/pmc: Add suspend callback Date: Fri, 22 Dec 2023 19:25:43 -0800 Message-Id: <20231223032548.1680738-4-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231223032548.1680738-1-david.e.box@linux.intel.com> References: <20231223032548.1680738-1-david.e.box@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786041681825745470 X-GMAIL-MSGID: 1786041681825745470 Add a suspend callback to struct pmc for performing platform specific tasks before device suspend. This is needed in order to perform GBE LTR ignore on certain platforms at suspend-time instead of at probe-time and replace the GBE LTR ignore removal that was done in order to fix a bug introduced by commit 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and core_configure()"). Fixes: 804951203aa5 ("platform/x86:intel/pmc: Combine core_init() and core_configure()") Signed-off-by: David E. Box --- drivers/platform/x86/intel/pmc/core.c | 3 +++ drivers/platform/x86/intel/pmc/core.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c index cdaab728e942..31905003bb05 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1430,6 +1430,9 @@ static __maybe_unused int pmc_core_suspend(struct device *dev) struct pmc_dev *pmcdev = dev_get_drvdata(dev); struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; + if (pmcdev->suspend) + pmcdev->suspend(pmcdev); + /* Check if the syspend will actually use S0ix */ if (pm_suspend_via_firmware()) return 0; diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h index 2891d8d04fad..ce9b9efc9790 100644 --- a/drivers/platform/x86/intel/pmc/core.h +++ b/drivers/platform/x86/intel/pmc/core.h @@ -389,6 +389,7 @@ struct pmc { * @s0ix_counter: S0ix residency (step adjusted) * @num_lpm_modes: Count of enabled modes * @lpm_en_modes: Array of enabled modes from lowest to highest priority + * @suspend: Function to perform platform specific suspend * @resume: Function to perform platform specific resume * * pmc_dev contains info about power management controller device. @@ -406,6 +407,7 @@ struct pmc_dev { u64 s0ix_counter; int num_lpm_modes; int lpm_en_modes[LPM_MAX_NUM_MODES]; + void (*suspend)(struct pmc_dev *pmcdev); int (*resume)(struct pmc_dev *pmcdev); bool has_die_c6;