platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "David E. Box" <david.e.box@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	platform-driver-x86@vger.kernel.org,
	rajvi.jingar@linux.intel.com
Subject: Re: [PATCH 05/11] platform/x86:intel/pmc: Move get_low_power_modes function
Date: Tue, 26 Sep 2023 18:56:54 +0300 (EEST)	[thread overview]
Message-ID: <a790e9e7-2748-5d2f-a035-20ef42ca87a2@linux.intel.com> (raw)
In-Reply-To: <20230922213032.1770590-6-david.e.box@linux.intel.com>

On Fri, 22 Sep 2023, David E. Box wrote:

> From: Xi Pardee <xi.pardee@intel.com>
> 
> Some platforms will have a need to retrieve the low power modes as part of
> their driver initialization. As such, make the function global and call it
> from the platform specific init code.

What is the real justification for this change, I don't think it's clearly 
stated above?

-- 
 i.

> Signed-off-by: Xi Pardee <xi.pardee@intel.com>
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
>  drivers/platform/x86/intel/pmc/adl.c  |  2 ++
>  drivers/platform/x86/intel/pmc/cnp.c  |  2 ++
>  drivers/platform/x86/intel/pmc/core.c |  7 +++----
>  drivers/platform/x86/intel/pmc/core.h |  1 +
>  drivers/platform/x86/intel/pmc/icl.c  | 10 +++++++++-
>  drivers/platform/x86/intel/pmc/mtl.c  |  4 +++-
>  drivers/platform/x86/intel/pmc/spt.c  | 10 +++++++++-
>  drivers/platform/x86/intel/pmc/tgl.c  |  1 +
>  8 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/pmc/adl.c b/drivers/platform/x86/intel/pmc/adl.c
> index 5006008e01be..64c492391ede 100644
> --- a/drivers/platform/x86/intel/pmc/adl.c
> +++ b/drivers/platform/x86/intel/pmc/adl.c
> @@ -319,6 +319,8 @@ int adl_core_init(struct pmc_dev *pmcdev)
>  	if (ret)
>  		return ret;
>  
> +	pmc_core_get_low_power_modes(pmcdev);
> +
>  	/* Due to a hardware limitation, the GBE LTR blocks PC10
>  	 * when a cable is attached. Tell the PMC to ignore it.
>  	 */
> diff --git a/drivers/platform/x86/intel/pmc/cnp.c b/drivers/platform/x86/intel/pmc/cnp.c
> index 420aaa1d7c76..59298f184d0e 100644
> --- a/drivers/platform/x86/intel/pmc/cnp.c
> +++ b/drivers/platform/x86/intel/pmc/cnp.c
> @@ -214,6 +214,8 @@ int cnp_core_init(struct pmc_dev *pmcdev)
>  	if (ret)
>  		return ret;
>  
> +	pmc_core_get_low_power_modes(pmcdev);
> +
>  	/* Due to a hardware limitation, the GBE LTR blocks PC10
>  	 * when a cable is attached. Tell the PMC to ignore it.
>  	 */
> diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/intel/pmc/core.c
> index 5a36b3f77bc5..e58c8cc286a3 100644
> --- a/drivers/platform/x86/intel/pmc/core.c
> +++ b/drivers/platform/x86/intel/pmc/core.c
> @@ -966,9 +966,8 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order)
>  	return true;
>  }
>  
> -static void pmc_core_get_low_power_modes(struct platform_device *pdev)
> +void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev)
>  {
> -	struct pmc_dev *pmcdev = platform_get_drvdata(pdev);
>  	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
>  	u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI;
>  	u8 mode_order[LPM_MAX_NUM_MODES];
> @@ -1000,7 +999,8 @@ static void pmc_core_get_low_power_modes(struct platform_device *pdev)
>  		for (mode = 0; mode < LPM_MAX_NUM_MODES; mode++)
>  			pri_order[mode_order[mode]] = mode;
>  	else
> -		dev_warn(&pdev->dev, "Assuming a default substate order for this platform\n");
> +		dev_warn(&pmcdev->pdev->dev,
> +			 "Assuming a default substate order for this platform\n");
>  
>  	/*
>  	 * Loop through all modes from lowest to highest priority,
> @@ -1250,7 +1250,6 @@ static int pmc_core_probe(struct platform_device *pdev)
>  	}
>  
>  	pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(primary_pmc);
> -	pmc_core_get_low_power_modes(pdev);
>  	pmc_core_do_dmi_quirks(primary_pmc);
>  
>  	pmc_core_dbgfs_register(pmcdev);
> diff --git a/drivers/platform/x86/intel/pmc/core.h b/drivers/platform/x86/intel/pmc/core.h
> index 0729f593c6a7..ccf24e0f5e50 100644
> --- a/drivers/platform/x86/intel/pmc/core.h
> +++ b/drivers/platform/x86/intel/pmc/core.h
> @@ -490,6 +490,7 @@ extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value);
>  
>  int pmc_core_resume_common(struct pmc_dev *pmcdev);
>  int get_primary_reg_base(struct pmc *pmc);
> +extern void pmc_core_get_low_power_modes(struct pmc_dev *pmcdev);
>  
>  extern void pmc_core_ssram_init(struct pmc_dev *pmcdev);
>  
> diff --git a/drivers/platform/x86/intel/pmc/icl.c b/drivers/platform/x86/intel/pmc/icl.c
> index d08e3174230d..71b0fd6cb7d8 100644
> --- a/drivers/platform/x86/intel/pmc/icl.c
> +++ b/drivers/platform/x86/intel/pmc/icl.c
> @@ -53,7 +53,15 @@ const struct pmc_reg_map icl_reg_map = {
>  int icl_core_init(struct pmc_dev *pmcdev)
>  {
>  	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
> +	int ret;
>  
>  	pmc->map = &icl_reg_map;
> -	return get_primary_reg_base(pmc);
> +
> +	ret = get_primary_reg_base(pmc);
> +	if (ret)
> +		return ret;
> +
> +	pmc_core_get_low_power_modes(pmcdev);
> +
> +	return ret;
>  }
> diff --git a/drivers/platform/x86/intel/pmc/mtl.c b/drivers/platform/x86/intel/pmc/mtl.c
> index 2204bc666980..c3b5f4fe01d1 100644
> --- a/drivers/platform/x86/intel/pmc/mtl.c
> +++ b/drivers/platform/x86/intel/pmc/mtl.c
> @@ -985,7 +985,7 @@ static int mtl_resume(struct pmc_dev *pmcdev)
>  int mtl_core_init(struct pmc_dev *pmcdev)
>  {
>  	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC];
> -	int ret = 0;
> +	int ret;
>  
>  	mtl_d3_fixup();
>  
> @@ -1002,6 +1002,8 @@ int mtl_core_init(struct pmc_dev *pmcdev)
>  			return ret;
>  	}
>  
> +	pmc_core_get_low_power_modes(pmcdev);
> +
>  	/* Due to a hardware limitation, the GBE LTR blocks PC10
>  	 * when a cable is attached. Tell the PMC to ignore it.
>  	 */
> diff --git a/drivers/platform/x86/intel/pmc/spt.c b/drivers/platform/x86/intel/pmc/spt.c
> index 4b6f5cbda16c..ab993a69e33e 100644
> --- a/drivers/platform/x86/intel/pmc/spt.c
> +++ b/drivers/platform/x86/intel/pmc/spt.c
> @@ -137,7 +137,15 @@ const struct pmc_reg_map spt_reg_map = {
>  int spt_core_init(struct pmc_dev *pmcdev)
>  {
>  	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
> +	int ret;
>  
>  	pmc->map = &spt_reg_map;
> -	return get_primary_reg_base(pmc);
> +
> +	ret = get_primary_reg_base(pmc);
> +	if (ret)
> +		return ret;
> +
> +	pmc_core_get_low_power_modes(pmcdev);
> +
> +	return ret;
>  }
> diff --git a/drivers/platform/x86/intel/pmc/tgl.c b/drivers/platform/x86/intel/pmc/tgl.c
> index 2449940102db..d5f1d2223c5a 100644
> --- a/drivers/platform/x86/intel/pmc/tgl.c
> +++ b/drivers/platform/x86/intel/pmc/tgl.c
> @@ -263,6 +263,7 @@ int tgl_core_init(struct pmc_dev *pmcdev)
>  	if (ret)
>  		return ret;
>  
> +	pmc_core_get_low_power_modes(pmcdev);
>  	pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
>  	/* Due to a hardware limitation, the GBE LTR blocks PC10
>  	 * when a cable is attached. Tell the PMC to ignore it.
> 

  reply	other threads:[~2023-09-26 15:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 21:30 [PATCH 00/11] intel_pmc: Add telemetry API to read counters David E. Box
2023-09-22 21:30 ` [PATCH 01/11] platform/x86/intel/vsec: Add intel_vsec_register David E. Box
2023-09-26 14:17   ` Ilpo Järvinen
2023-09-26 23:51     ` David E. Box
2023-09-22 21:30 ` [PATCH 02/11] platform/x86/intel/vsec: Add base address field David E. Box
2023-09-26 14:39   ` Ilpo Järvinen
2023-09-22 21:30 ` [PATCH 03/11] platform/x86/intel/pmt: Add header to struct intel_pmt_entry David E. Box
2023-09-26 14:43   ` Ilpo Järvinen
2023-09-22 21:30 ` [PATCH 04/11] platform/x86/intel/pmt: telemetry: Export API to read telemetry David E. Box
2023-09-26 15:40   ` Ilpo Järvinen
2023-09-26 23:59     ` David E. Box
2023-09-22 21:30 ` [PATCH 05/11] platform/x86:intel/pmc: Move get_low_power_modes function David E. Box
2023-09-26 15:56   ` Ilpo Järvinen [this message]
2023-09-27  0:16     ` David E. Box
2023-09-22 21:30 ` [PATCH 06/11] platform/x86/intel/pmc: Split pmc_core_ssram_get_pmc() David E. Box
2023-09-22 21:30 ` [PATCH 07/11] platform/x86/intel/pmc: Find and register PMC telemetry entries David E. Box
2023-09-22 21:30 ` [PATCH 08/11] platform/x86/intel/pmc: Display LPM requirements for multiple PMCs David E. Box
2023-09-22 21:30 ` [PATCH 09/11] platform/x86/intel/pmc: Retrieve LPM information using Intel PMT David E. Box
2023-09-26 16:07   ` Ilpo Järvinen
2023-09-22 21:30 ` [PATCH 10/11] platform/x86/intel/pmc: Read low power mode requirements for MTL-M and MTL-P David E. Box
2023-09-26 16:03   ` Ilpo Järvinen
2023-09-27  0:20     ` David E. Box
2023-09-22 21:30 ` [PATCH 11/11] platform/x86/intel/pmc: Add debug attribute for Die C6 counter David E. Box
2023-09-26 16:11   ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a790e9e7-2748-5d2f-a035-20ef42ca87a2@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=david.e.box@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rajvi.jingar@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).