Commit 2e35e3aa authored by Xi Pardee's avatar Xi Pardee Committed by Hans de Goede

platform/x86:intel/pmc: Call pmc_get_low_power_modes from platform init

In order to setup a table of low power mode requirements for Meteor Lake,
pmc_core_get_low_power_modes() will need to be run from platform init code
so that the enabled modes are known, allowing the use of the
pmc_for_each_mode helper. Make the function global and call it from the
platform init code.
Signed-off-by: default avatarXi Pardee <xi.pardee@intel.com>
Signed-off-by: default avatarDavid E. Box <david.e.box@linux.intel.com>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20231129222132.2331261-12-david.e.box@linux.intel.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 416eeb2e
...@@ -319,6 +319,8 @@ int adl_core_init(struct pmc_dev *pmcdev) ...@@ -319,6 +319,8 @@ int adl_core_init(struct pmc_dev *pmcdev)
if (ret) if (ret)
return ret; return ret;
pmc_core_get_low_power_modes(pmcdev);
/* Due to a hardware limitation, the GBE LTR blocks PC10 /* Due to a hardware limitation, the GBE LTR blocks PC10
* when a cable is attached. Tell the PMC to ignore it. * when a cable is attached. Tell the PMC to ignore it.
*/ */
......
...@@ -214,6 +214,8 @@ int cnp_core_init(struct pmc_dev *pmcdev) ...@@ -214,6 +214,8 @@ int cnp_core_init(struct pmc_dev *pmcdev)
if (ret) if (ret)
return ret; return ret;
pmc_core_get_low_power_modes(pmcdev);
/* Due to a hardware limitation, the GBE LTR blocks PC10 /* Due to a hardware limitation, the GBE LTR blocks PC10
* when a cable is attached. Tell the PMC to ignore it. * when a cable is attached. Tell the PMC to ignore it.
*/ */
......
...@@ -966,9 +966,8 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order) ...@@ -966,9 +966,8 @@ static bool pmc_core_pri_verify(u32 lpm_pri, u8 *mode_order)
return true; 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]; struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI; u8 pri_order[LPM_MAX_NUM_MODES] = LPM_DEFAULT_PRI;
u8 mode_order[LPM_MAX_NUM_MODES]; u8 mode_order[LPM_MAX_NUM_MODES];
...@@ -1000,7 +999,8 @@ static void pmc_core_get_low_power_modes(struct platform_device *pdev) ...@@ -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++) for (mode = 0; mode < LPM_MAX_NUM_MODES; mode++)
pri_order[mode_order[mode]] = mode; pri_order[mode_order[mode]] = mode;
else 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, * Loop through all modes from lowest to highest priority,
...@@ -1250,7 +1250,6 @@ static int pmc_core_probe(struct platform_device *pdev) ...@@ -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); 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_do_dmi_quirks(primary_pmc);
pmc_core_dbgfs_register(pmcdev); pmc_core_dbgfs_register(pmcdev);
......
...@@ -490,6 +490,7 @@ extern int pmc_core_send_ltr_ignore(struct pmc_dev *pmcdev, u32 value); ...@@ -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 pmc_core_resume_common(struct pmc_dev *pmcdev);
int get_primary_reg_base(struct pmc *pmc); 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); extern void pmc_core_ssram_init(struct pmc_dev *pmcdev);
......
...@@ -53,7 +53,15 @@ const struct pmc_reg_map icl_reg_map = { ...@@ -53,7 +53,15 @@ const struct pmc_reg_map icl_reg_map = {
int icl_core_init(struct pmc_dev *pmcdev) int icl_core_init(struct pmc_dev *pmcdev)
{ {
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
int ret;
pmc->map = &icl_reg_map; 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;
} }
...@@ -985,7 +985,7 @@ static int mtl_resume(struct pmc_dev *pmcdev) ...@@ -985,7 +985,7 @@ static int mtl_resume(struct pmc_dev *pmcdev)
int mtl_core_init(struct pmc_dev *pmcdev) int mtl_core_init(struct pmc_dev *pmcdev)
{ {
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC]; struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC];
int ret = 0; int ret;
mtl_d3_fixup(); mtl_d3_fixup();
...@@ -1002,6 +1002,8 @@ int mtl_core_init(struct pmc_dev *pmcdev) ...@@ -1002,6 +1002,8 @@ int mtl_core_init(struct pmc_dev *pmcdev)
return ret; return ret;
} }
pmc_core_get_low_power_modes(pmcdev);
/* Due to a hardware limitation, the GBE LTR blocks PC10 /* Due to a hardware limitation, the GBE LTR blocks PC10
* when a cable is attached. Tell the PMC to ignore it. * when a cable is attached. Tell the PMC to ignore it.
*/ */
......
...@@ -137,7 +137,15 @@ const struct pmc_reg_map spt_reg_map = { ...@@ -137,7 +137,15 @@ const struct pmc_reg_map spt_reg_map = {
int spt_core_init(struct pmc_dev *pmcdev) int spt_core_init(struct pmc_dev *pmcdev)
{ {
struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN]; struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
int ret;
pmc->map = &spt_reg_map; 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;
} }
...@@ -263,6 +263,7 @@ int tgl_core_init(struct pmc_dev *pmcdev) ...@@ -263,6 +263,7 @@ int tgl_core_init(struct pmc_dev *pmcdev)
if (ret) if (ret)
return ret; return ret;
pmc_core_get_low_power_modes(pmcdev);
pmc_core_get_tgl_lpm_reqs(pmcdev->pdev); pmc_core_get_tgl_lpm_reqs(pmcdev->pdev);
/* Due to a hardware limitation, the GBE LTR blocks PC10 /* Due to a hardware limitation, the GBE LTR blocks PC10
* when a cable is attached. Tell the PMC to ignore it. * when a cable is attached. Tell the PMC to ignore it.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment