Add Arrow Lake U/H support
Subsystems (2)
Xi Pardee
maintainerv6 cover Add Arrow Lake U/H support
This patch series contains six patches to add Arrow Lake U/H support in intel_pmc_core driver.
The first five patches are preparation patches. The third patch creates a generic init function for all platforms. The fourth patch replaces the init functions with pmc_dev_info structures in X86_MATCH_VFM() of core.c file. In order to support platform specific init actions, the patch also adds a init function field in the pmc_dev_info structure. The fifth patch moves architecture specific action from core.c to init() function in spt.c.
v6->v5:
- Move arch specific action from core.c to init() function of spt.c
- Remove core init functions from header and change them to static functions within each file.
v5->v4:
- Replace DMU with full name.
- Rename func field to pci_func.
- Remove arch_specific callback function and replace generic_core_init completely with arch specific init functions when needed to allow more flexibility.
v4->v3:
- Remove all per architecture init functions and replace with pmc_dev_info structures in x86_cpu_id structure in core.c.
- Remove fixup field and add arch_specific field in pmc_dev_info structure.
- Move ssram init comment to be function comment.
- Remove ssram field in pmc_dev_info structure.
- Captilize PMC
- Remove PMC_IDX_SOC
v3->v2:
- Create a generic init function for all platforms
v2->v1:
- Create an info structure for platform variation information
- Make generic init function to static in tgl.c
- Fix typo
Xi Pardee (6):
platform/x86:intel/pmc: Make tgl_core_generic_init() static platform/x86/intel/pmc: Remove duplicate enum platform/x86:intel/pmc: Create generic_core_init() for all platforms platform/x86/intel/pmc: Remove simple init functions platform/x86:intel/pmc: Move arch specific action to init function platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core
driver
drivers/platform/x86/intel/pmc/adl.c | 22 ++--- drivers/platform/x86/intel/pmc/arl.c | 79 ++++++++++-------- drivers/platform/x86/intel/pmc/cnp.c | 21 ++--- drivers/platform/x86/intel/pmc/core.c | 114 +++++++++++++++++--------- drivers/platform/x86/intel/pmc/core.h | 46 ++++++++--- drivers/platform/x86/intel/pmc/icl.c | 18 +--- drivers/platform/x86/intel/pmc/lnl.c | 25 ++---- drivers/platform/x86/intel/pmc/mtl.c | 45 +++------- drivers/platform/x86/intel/pmc/spt.c | 33 +++++--- drivers/platform/x86/intel/pmc/tgl.c | 39 ++++----- 10 files changed, 228 insertions(+), 214 deletions(-)
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v6 1/6 platform/x86:intel/pmc: Make tgl_core_generic_init() static
Make tgl_core_generic_init() a static function as the function has no callers outside of tgl.c. Remove the prototype in core.h and reorder the code in tgl.c.
--- drivers/platform/x86/intel/pmc/core.h | 1 - drivers/platform/x86/intel/pmc/tgl.c | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-)
drivers/platform/x86/intel/pmc/core.h +0 -1
@@ -597,7 +597,6 @@ int cnp_core_init(struct pmc_dev *pmcdev);int icl_core_init (struct pmc_dev *pmcdev);int tgl_core_init (struct pmc_dev *pmcdev);int tgl_l_core_init (struct pmc_dev *pmcdev); -int tgl_core_generic_init (struct pmc_dev *pmcdev,int pch_tp);int adl_core_init (struct pmc_dev *pmcdev);int mtl_core_init (struct pmc_dev *pmcdev);int arl_core_init (struct pmc_dev *pmcdev);
drivers/platform/x86/intel/pmc/tgl.c +11 -11
@@ -285,17 +285,7 @@ void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev)ACPI_FREE (out_obj); } -int tgl_l_core_init (struct pmc_dev *pmcdev) -{ -return tgl_core_generic_init (pmcdev,PCH_LP ); -} - -int tgl_core_init (struct pmc_dev *pmcdev) -{ -return tgl_core_generic_init (pmcdev,PCH_H ); -} - -int tgl_core_generic_init (struct pmc_dev *pmcdev,int pch_tp) +static int tgl_core_generic_init (struct pmc_dev *pmcdev,int pch_tp) {struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];int ret;
@@ -317,3 +307,13 @@ int tgl_core_generic_init(struct pmc_dev *pmcdev, int pch_tp)return 0 ; } + +int tgl_l_core_init (struct pmc_dev *pmcdev) +{ +return tgl_core_generic_init (pmcdev,PCH_LP ); +} + +int tgl_core_init (struct pmc_dev *pmcdev) +{ +return tgl_core_generic_init (pmcdev,PCH_H ); +}
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v6 2/6 platform/x86/intel/pmc: Remove duplicate enum
In reply to Xi PardeeRemove duplicate enum PMC_IDX_SOC. PMC_IDX_SOC has the same value as PMC_IDX_MAIN. Replace it with PMC_IDX_MAIN to avoid confusion.
--- drivers/platform/x86/intel/pmc/arl.c | 2 +- drivers/platform/x86/intel/pmc/core.h | 1 - drivers/platform/x86/intel/pmc/lnl.c | 2 +- drivers/platform/x86/intel/pmc/mtl.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/platform/x86/intel/pmc/arl.c +1 -1
@@ -693,7 +693,7 @@ static int arl_resume(struct pmc_dev *pmcdev)int arl_core_init (struct pmc_dev *pmcdev) { -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC ]; +struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];int ret;int func =0 ;bool ssram_init = true;
drivers/platform/x86/intel/pmc/core.h +0 -1
@@ -430,7 +430,6 @@ struct pmc_dev {enum pmc_index {PMC_IDX_MAIN , -PMC_IDX_SOC =PMC_IDX_MAIN ,PMC_IDX_IOE ,PMC_IDX_PCH ,PMC_IDX_MAX
drivers/platform/x86/intel/pmc/lnl.c +1 -1
@@ -553,7 +553,7 @@ static int lnl_resume(struct pmc_dev *pmcdev)int lnl_core_init (struct pmc_dev *pmcdev) {int ret; -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC ]; +struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];lnl_d3_fixup ();
drivers/platform/x86/intel/pmc/mtl.c +1 -1
@@ -992,7 +992,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 ]; +struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ];int ret;int func =2 ;bool ssram_init = true;
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v6 3/6 platform/x86:intel/pmc: Create generic_core_init() for all platforms
In reply to Xi PardeeCreate a generic_core_init() function for all architectures to reduce duplicate code in each architecture file. Create an info structure to catch the variations between each architecture and pass it to the generic init function.
Convert all architectures to call the generic core init function.
--- drivers/platform/x86/intel/pmc/adl.c | 21 +++++-------- drivers/platform/x86/intel/pmc/arl.c | 43 +++++++-------------------- drivers/platform/x86/intel/pmc/cnp.c | 21 +++++-------- drivers/platform/x86/intel/pmc/core.c | 42 ++++++++++++++++++++++++++ drivers/platform/x86/intel/pmc/core.h | 22 ++++++++++++++ drivers/platform/x86/intel/pmc/icl.c | 17 ++++------- drivers/platform/x86/intel/pmc/lnl.c | 22 +++++--------- drivers/platform/x86/intel/pmc/mtl.c | 42 +++++++------------------- drivers/platform/x86/intel/pmc/spt.c | 17 ++++------- drivers/platform/x86/intel/pmc/tgl.c | 31 +++++++++---------- 10 files changed, 131 insertions(+), 147 deletions(-)
drivers/platform/x86/intel/pmc/adl.c +7 -14
@@ -311,20 +311,13 @@ const struct pmc_reg_map adl_reg_map = { .pson_residency_counter_step = TGL_PSON_RES_COUNTER_STEP, }; +static struct pmc_dev_info adl_pmc_dev = { + .map = &adl_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, +}; +int adl_core_init (struct pmc_dev *pmcdev) { -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ]; -int ret; - - pmcdev->suspend = cnl_suspend; - pmcdev->resume = cnl_resume; - - pmc->map = &adl_reg_map; - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - -pmc_core_get_low_power_modes (pmcdev); - -return 0 ; +return generic_core_init (pmcdev, &adl_pmc_dev); }
drivers/platform/x86/intel/pmc/arl.c +10 -33
50 lines not on this page · raw message
drivers/platform/x86/intel/pmc/cnp.c +7 -14
@@ -274,20 +274,13 @@ int cnl_resume(struct pmc_dev *pmcdev)return pmc_core_resume_common (pmcdev); } +static struct pmc_dev_info cnp_pmc_dev = { + .map = &cnp_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, +}; +int cnp_core_init (struct pmc_dev *pmcdev) { -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ]; -int ret; - - pmcdev->suspend = cnl_suspend; - pmcdev->resume = cnl_resume; - - pmc->map = &cnp_reg_map; - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - -pmc_core_get_low_power_modes (pmcdev); - -return 0 ; +return generic_core_init (pmcdev, &cnp_pmc_dev); }
drivers/platform/x86/intel/pmc/core.c +42 -0
48 lines not on this page · raw message
drivers/platform/x86/intel/pmc/core.h +22 -0
@@ -435,6 +435,27 @@ enum pmc_index { PMC_IDX_MAX }; +/** +* struct pmc_dev_info - Structure to keep PMC device info +* @pci_func: Function number of the primary PMC +* @dmu_guid: Die Management Unit GUID +* @regmap_list: Pointer to a list of pmc_info structure that could be +* available for the platform. When set, this field implies +* SSRAM support. +* @map: Pointer to a pmc_reg_map struct that contains platform +* specific attributes of the primary PMC +* @suspend: Function to perform platform specific suspend +* @resume: Function to perform platform specific resume +*/ +struct pmc_dev_info { +u8 pci_func; +u32 dmu_guid; +struct pmc_info *regmap_list; +const struct pmc_reg_map *map; +void (*suspend)(struct pmc_dev *pmcdev); +int (*resume)(struct pmc_dev *pmcdev); +}; +extern const struct pmc_bit_map msr_map[];extern const struct pmc_bit_map spt_pll_map[];extern const struct pmc_bit_map spt_mphy_map[];
@@ -591,6 +612,7 @@ extern void pmc_core_set_device_d3(unsigned int device);extern int pmc_core_ssram_init (struct pmc_dev *pmcdev,int func); +int generic_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info);int spt_core_init (struct pmc_dev *pmcdev);int cnp_core_init (struct pmc_dev *pmcdev);int icl_core_init (struct pmc_dev *pmcdev);
drivers/platform/x86/intel/pmc/icl.c +5 -12
@@ -50,18 +50,11 @@ const struct pmc_reg_map icl_reg_map = { .etr3_offset = ETR3_OFFSET, }; +static struct pmc_dev_info icl_pmc_dev = { + .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; - - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - -pmc_core_get_low_power_modes (pmcdev); - -return ret; +return generic_core_init (pmcdev, &icl_pmc_dev); }
drivers/platform/x86/intel/pmc/lnl.c +7 -15
@@ -550,22 +550,14 @@ static int lnl_resume(struct pmc_dev *pmcdev)return cnl_resume (pmcdev); } +static struct pmc_dev_info lnl_pmc_dev = { + .map = &lnl_socm_reg_map, + .suspend = cnl_suspend, + .resume = lnl_resume, +}; +int lnl_core_init (struct pmc_dev *pmcdev) { -int ret; -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ]; -lnl_d3_fixup (); - - pmcdev->suspend = cnl_suspend; - pmcdev->resume = lnl_resume; - - pmc->map = &lnl_socm_reg_map; - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - -pmc_core_get_low_power_modes (pmcdev); - -return 0 ; +return generic_core_init (pmcdev, &lnl_pmc_dev); }
drivers/platform/x86/intel/pmc/mtl.c +10 -32
49 lines not on this page · raw message
drivers/platform/x86/intel/pmc/spt.c +5 -12
@@ -134,18 +134,11 @@ const struct pmc_reg_map spt_reg_map = { .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; +static struct pmc_dev_info spt_pmc_dev = { + .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; - - ret =get_primary_reg_base (pmc); -if (ret) -return ret; - -pmc_core_get_low_power_modes (pmcdev); - -return ret; +return generic_core_init (pmcdev, &spt_pmc_dev); }
drivers/platform/x86/intel/pmc/tgl.c +16 -15
@@ -285,35 +285,36 @@ void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev)ACPI_FREE (out_obj); } -static int tgl_core_generic_init (struct pmc_dev *pmcdev,int pch_tp) -{ -struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN ]; -int ret; +static struct pmc_dev_info tgl_l_pmc_dev = { + .map = &tgl_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, +}; -if (pch_tp ==PCH_H ) - pmc->map = &tgl_h_reg_map; -else - pmc->map = &tgl_reg_map; +static struct pmc_dev_info tgl_pmc_dev = { + .map = &tgl_h_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, +}; - pmcdev->suspend = cnl_suspend; - pmcdev->resume = cnl_resume; +static int tgl_core_generic_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +int ret; - ret =get_primary_reg_base (pmc); + ret =generic_core_init (pmcdev, pmc_dev_info);if (ret)return ret; -pmc_core_get_low_power_modes (pmcdev);pmc_core_get_tgl_lpm_reqs (pmcdev->pdev); -return 0 ; }int tgl_l_core_init (struct pmc_dev *pmcdev) { -return tgl_core_generic_init (pmcdev,PCH_LP ); +return tgl_core_generic_init (pmcdev, &tgl_l_pmc_dev); }int tgl_core_init (struct pmc_dev *pmcdev) { -return tgl_core_generic_init (pmcdev,PCH_H ); +return tgl_core_generic_init (pmcdev, &tgl_pmc_dev); }
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v6 4/6 platform/x86/intel/pmc: Remove simple init functions
In reply to Xi PardeeRemove simple init functions to avoid duplicate code. Store init function performing architecture specific action in the corresponding pmc_dev_info structure. Replace init function with pmc_dev_info structure in X86_MATCH_VFM() of core.c.
--- drivers/platform/x86/intel/pmc/adl.c | 7 +-- drivers/platform/x86/intel/pmc/arl.c | 15 ++++--- drivers/platform/x86/intel/pmc/cnp.c | 6 +-- drivers/platform/x86/intel/pmc/core.c | 61 +++++++++++++++------------ drivers/platform/x86/intel/pmc/core.h | 21 +++++---- drivers/platform/x86/intel/pmc/icl.c | 7 +-- drivers/platform/x86/intel/pmc/lnl.c | 15 ++++--- drivers/platform/x86/intel/pmc/mtl.c | 15 ++++--- drivers/platform/x86/intel/pmc/spt.c | 7 +-- drivers/platform/x86/intel/pmc/tgl.c | 34 ++++++--------- 10 files changed, 86 insertions(+), 102 deletions(-)
drivers/platform/x86/intel/pmc/adl.c +1 -6
@@ -311,13 +311,8 @@ const struct pmc_reg_map adl_reg_map = { .pson_residency_counter_step = TGL_PSON_RES_COUNTER_STEP, }; -static struct pmc_dev_info adl_pmc_dev = { +struct pmc_dev_info adl_pmc_dev = { .map = &adl_reg_map, .suspend = cnl_suspend, .resume = cnl_resume, }; - -int adl_core_init (struct pmc_dev *pmcdev) -{ -return generic_core_init (pmcdev, &adl_pmc_dev); -}
drivers/platform/x86/intel/pmc/arl.c +8 -7
@@ -691,17 +691,18 @@ static int arl_resume(struct pmc_dev *pmcdev)return cnl_resume (pmcdev); } -static struct pmc_dev_info arl_pmc_dev = { +static int arl_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +arl_d3_fixup (); +return generic_core_init (pmcdev, pmc_dev_info); +} + +struct pmc_dev_info arl_pmc_dev = { .pci_func =0 , .dmu_guid =ARL_PMT_DMU_GUID , .regmap_list = arl_pmc_info_list, .map = &arl_socs_reg_map, .suspend = cnl_suspend, .resume = arl_resume, + .init = arl_core_init, }; - -int arl_core_init (struct pmc_dev *pmcdev) -{ -arl_d3_fixup (); -return generic_core_init (pmcdev, &arl_pmc_dev); -}
drivers/platform/x86/intel/pmc/cnp.c +1 -5
@@ -274,13 +274,9 @@ int cnl_resume(struct pmc_dev *pmcdev)return pmc_core_resume_common (pmcdev); } -static struct pmc_dev_info cnp_pmc_dev = { +struct pmc_dev_info cnp_pmc_dev = { .map = &cnp_reg_map, .suspend = cnl_suspend, .resume = cnl_resume, }; -int cnp_core_init (struct pmc_dev *pmcdev) -{ -return generic_core_init (pmcdev, &cnp_pmc_dev); -}
drivers/platform/x86/intel/pmc/core.c +33 -28
87 lines not on this page · raw message
drivers/platform/x86/intel/pmc/core.h +12 -9
@@ -446,6 +446,7 @@ enum pmc_index {* specific attributes of the primary PMC * @suspend: Function to perform platform specific suspend * @resume: Function to perform platform specific resume +* @init: Function to perform platform specific init action */ struct pmc_dev_info {u8 pci_func;
@@ -454,6 +455,7 @@ struct pmc_dev_info {const struct pmc_reg_map *map;void (*suspend)(struct pmc_dev *pmcdev);int (*resume)(struct pmc_dev *pmcdev); +int (*init)(struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info); };extern const struct pmc_bit_map msr_map[];
@@ -613,15 +615,16 @@ extern void pmc_core_set_device_d3(unsigned int device);extern int pmc_core_ssram_init (struct pmc_dev *pmcdev,int func);int generic_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info); -int spt_core_init (struct pmc_dev *pmcdev); -int cnp_core_init (struct pmc_dev *pmcdev); -int icl_core_init (struct pmc_dev *pmcdev); -int tgl_core_init (struct pmc_dev *pmcdev); -int tgl_l_core_init (struct pmc_dev *pmcdev); -int adl_core_init (struct pmc_dev *pmcdev); -int mtl_core_init (struct pmc_dev *pmcdev); -int arl_core_init (struct pmc_dev *pmcdev); -int lnl_core_init (struct pmc_dev *pmcdev); + +extern struct pmc_dev_info spt_pmc_dev; +extern struct pmc_dev_info cnp_pmc_dev; +extern struct pmc_dev_info icl_pmc_dev; +extern struct pmc_dev_info tgl_l_pmc_dev; +extern struct pmc_dev_info tgl_pmc_dev; +extern struct pmc_dev_info adl_pmc_dev; +extern struct pmc_dev_info mtl_pmc_dev; +extern struct pmc_dev_info arl_pmc_dev; +extern struct pmc_dev_info lnl_pmc_dev;void cnl_suspend (struct pmc_dev *pmcdev);int cnl_resume (struct pmc_dev *pmcdev);
drivers/platform/x86/intel/pmc/icl.c +1 -6
@@ -50,11 +50,6 @@ const struct pmc_reg_map icl_reg_map = { .etr3_offset = ETR3_OFFSET, }; -static struct pmc_dev_info icl_pmc_dev = { +struct pmc_dev_info icl_pmc_dev = { .map = &icl_reg_map, }; - -int icl_core_init (struct pmc_dev *pmcdev) -{ -return generic_core_init (pmcdev, &icl_pmc_dev); -}
drivers/platform/x86/intel/pmc/lnl.c +8 -7
@@ -550,14 +550,15 @@ static int lnl_resume(struct pmc_dev *pmcdev)return cnl_resume (pmcdev); } -static struct pmc_dev_info lnl_pmc_dev = { +static int lnl_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +lnl_d3_fixup (); +return generic_core_init (pmcdev, pmc_dev_info); +} + +struct pmc_dev_info lnl_pmc_dev = { .map = &lnl_socm_reg_map, .suspend = cnl_suspend, .resume = lnl_resume, + .init = lnl_core_init, }; - -int lnl_core_init (struct pmc_dev *pmcdev) -{ -lnl_d3_fixup (); -return generic_core_init (pmcdev, &lnl_pmc_dev); -}
drivers/platform/x86/intel/pmc/mtl.c +8 -7
@@ -990,17 +990,18 @@ static int mtl_resume(struct pmc_dev *pmcdev)return cnl_resume (pmcdev); } -static struct pmc_dev_info mtl_pmc_dev = { +static int mtl_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +mtl_d3_fixup (); +return generic_core_init (pmcdev, pmc_dev_info); +} + +struct pmc_dev_info mtl_pmc_dev = { .pci_func =2 , .dmu_guid =MTL_PMT_DMU_GUID , .regmap_list = mtl_pmc_info_list, .map = &mtl_socm_reg_map, .suspend = cnl_suspend, .resume = mtl_resume, + .init = mtl_core_init, }; - -int mtl_core_init (struct pmc_dev *pmcdev) -{ -mtl_d3_fixup (); -return generic_core_init (pmcdev, &mtl_pmc_dev); -}
drivers/platform/x86/intel/pmc/spt.c +1 -6
@@ -134,11 +134,6 @@ const struct pmc_reg_map spt_reg_map = { .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; -static struct pmc_dev_info spt_pmc_dev = { +struct pmc_dev_info spt_pmc_dev = { .map = &spt_reg_map, }; - -int spt_core_init (struct pmc_dev *pmcdev) -{ -return generic_core_init (pmcdev, &spt_pmc_dev); -}
drivers/platform/x86/intel/pmc/tgl.c +13 -21
@@ -285,19 +285,7 @@ void pmc_core_get_tgl_lpm_reqs(struct platform_device *pdev)ACPI_FREE (out_obj); } -static struct pmc_dev_info tgl_l_pmc_dev = { - .map = &tgl_reg_map, - .suspend = cnl_suspend, - .resume = cnl_resume, -}; - -static struct pmc_dev_info tgl_pmc_dev = { - .map = &tgl_h_reg_map, - .suspend = cnl_suspend, - .resume = cnl_resume, -}; - -static int tgl_core_generic_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +static int tgl_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) {int ret;
@@ -309,12 +297,16 @@ static int tgl_core_generic_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmreturn 0 ; } -int tgl_l_core_init (struct pmc_dev *pmcdev) -{ -return tgl_core_generic_init (pmcdev, &tgl_l_pmc_dev); -} +struct pmc_dev_info tgl_l_pmc_dev = { + .map = &tgl_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, + .init = tgl_core_init, +}; -int tgl_core_init (struct pmc_dev *pmcdev) -{ -return tgl_core_generic_init (pmcdev, &tgl_pmc_dev); -} +struct pmc_dev_info tgl_pmc_dev = { + .map = &tgl_h_reg_map, + .suspend = cnl_suspend, + .resume = cnl_resume, + .init = tgl_core_init, +};
Signature · 1 line
2.43.0
Xi Pardee
maintainerPATCH v6 5/6 platform/x86:intel/pmc: Move arch specific action to init function
In reply to Xi PardeeMove arch specific action from core.c to the init() function of spt.c.
--- drivers/platform/x86/intel/pmc/core.c | 13 ------------- drivers/platform/x86/intel/pmc/spt.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-)
drivers/platform/x86/intel/pmc/core.c +0 -13
@@ -1416,11 +1416,6 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {MODULE_DEVICE_TABLE (x86cpu, intel_pmc_core_ids); -static const struct pci_device_id pmc_pci_ids[] = { - {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, - { } -}; -/* * This quirk can be used on those platforms where * the platform BIOS enforces 24Mhz crystal to shutdown
@@ -1531,14 +1526,6 @@ static int pmc_core_probe(struct platform_device *pdev)if (!pmcdev->pkgc_res_cnt)return -ENOMEM ; -/* -* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here -* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap -* in this case. -*/ -if (pmc_dev_info == &spt_pmc_dev && !pci_dev_present (pmc_pci_ids)) - pmc_dev_info = &cnp_pmc_dev; -mutex_init (&pmcdev->lock);if (pmc_dev_info->init)
drivers/platform/x86/intel/pmc/spt.c +21 -0
@@ -8,6 +8,8 @@* */ +#include <linux/pci.h> +#include "core.h" const struct pmc_bit_map spt_pll_map[] = {
@@ -134,6 +136,25 @@ const struct pmc_reg_map spt_reg_map = { .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; +static const struct pci_device_id pmc_pci_ids[] = { + {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, + { } +}; + +static int spt_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +/* +* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here +* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap +* in this case. +*/ +if (!pci_dev_present (pmc_pci_ids)) +return generic_core_init (pmcdev, &cnp_pmc_dev); + +return generic_core_init (pmcdev, pmc_dev_info); +} +struct pmc_dev_info spt_pmc_dev = { .map = &spt_reg_map, + .init = spt_core_init, };
Signature · 1 line
2.43.0
Re: [PATCH v6 5/6] platform/x86:intel/pmc: Move arch specific action to init function
Quoted 69 lines · Xi Pardee
Move arch specific action from
core.cto theinit()function ofspt.c.Signed-off-by Xi Pardee <[email protected]>--- drivers/platform/x86/intel/pmc/core.c | 13 ------------- drivers/platform/x86/intel/pmc/spt.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-)drivers/platform/x86/intel/pmc/core.c +0
-13@@ -1416,11 +1416,6 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {MODULE_DEVICE_TABLE (x86cpu, intel_pmc_core_ids); -static const struct pci_device_id pmc_pci_ids[] = { - {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, - { } -}; -/* * This quirk can be used on those platforms where * the platform BIOS enforces 24Mhz crystal to shutdown @@ -1531,14 +1526,6 @@ static int pmc_core_probe(struct platform_device *pdev)if (!pmcdev->pkgc_res_cnt)return -ENOMEM ; -/* -* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here -* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap -* in this case. -*/ -if (pmc_dev_info == &spt_pmc_dev && !pci_dev_present (pmc_pci_ids)) - pmc_dev_info = &cnp_pmc_dev; -mutex_init (&pmcdev->lock);if (pmc_dev_info->init)drivers/platform/x86/intel/pmc/spt.c +14
-0@@ -8,6 +8,8 @@* */ +#include <linux/pci.h> +#include "core.h" const struct pmc_bit_map spt_pll_map[] = {@@ -134,6 +136,25 @@ const struct pmc_reg_map spt_reg_map = { .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; +static const struct pci_device_id pmc_pci_ids[] = { + {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, + { } +}; + +static int spt_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +/* +* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here +* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap +* in this case. +*/
drivers/platform/x86/intel/pmc/spt.c const struct pmc_reg_map spt_reg_map = { · line 160
Quoted 10 lines
drivers/platform/x86/intel/pmc/spt.c +7
-0+if (!pci_dev_present (pmc_pci_ids)) +return generic_core_init (pmcdev, &cnp_pmc_dev); + +return generic_core_init (pmcdev, pmc_dev_info); +} +struct pmc_dev_info spt_pmc_dev = { .map = &spt_reg_map, + .init = spt_core_init, };
Hi,
I've applied all but this patch into the review-ilpo-next branch.
This change is good otherwise but I'd prefer the pmc_pci_ids be named better such that it actually relates to why it exists :-). So please respin this patch.
Signature · 1 line
i.
Xi Pardee
maintainerRe: [PATCH v6 5/6] platform/x86:intel/pmc: Move arch specific action to init function
Quoted 83 lines · Ilpo Järvinen
Quoted 69 lines · Xi Pardee
Move arch specific action from
core.cto theinit()function ofspt.c.Signed-off-by Xi Pardee <[email protected]>--- drivers/platform/x86/intel/pmc/core.c | 13 ------------- drivers/platform/x86/intel/pmc/spt.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-)drivers/platform/x86/intel/pmc/core.c +0
-13@@ -1416,11 +1416,6 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {MODULE_DEVICE_TABLE (x86cpu, intel_pmc_core_ids); -static const struct pci_device_id pmc_pci_ids[] = { - {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, - { } -}; -/* * This quirk can be used on those platforms where * the platform BIOS enforces 24Mhz crystal to shutdown @@ -1531,14 +1526,6 @@ static int pmc_core_probe(struct platform_device *pdev)if (!pmcdev->pkgc_res_cnt)return -ENOMEM ; -/* -* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here -* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap -* in this case. -*/ -if (pmc_dev_info == &spt_pmc_dev && !pci_dev_present (pmc_pci_ids)) - pmc_dev_info = &cnp_pmc_dev; -mutex_init (&pmcdev->lock);if (pmc_dev_info->init)drivers/platform/x86/intel/pmc/spt.c +14
-0@@ -8,6 +8,8 @@* */ +#include <linux/pci.h> +#include "core.h" const struct pmc_bit_map spt_pll_map[] = {@@ -134,6 +136,25 @@ const struct pmc_reg_map spt_reg_map = { .pm_vric1_offset = SPT_PMC_VRIC1_OFFSET, }; +static const struct pci_device_id pmc_pci_ids[] = { + {PCI_VDEVICE (INTEL ,SPT_PMC_PCI_DEVICE_ID ) }, + { } +}; + +static int spt_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +/* +* Coffee Lake has CPU ID of Kaby Lake and Cannon Lake PCH. So here +* Sunrisepoint PCH regmap can't be used. Use Cannon Lake PCH regmap +* in this case. +*/ drivers/platform/x86/intel/pmc/spt.c const struct pmc_reg_map spt_reg_map = { · line 160
Quoted 10 lines
drivers/platform/x86/intel/pmc/spt.c +7
-0+if (!pci_dev_present (pmc_pci_ids)) +return generic_core_init (pmcdev, &cnp_pmc_dev); + +return generic_core_init (pmcdev, pmc_dev_info); +} +struct pmc_dev_info spt_pmc_dev = { .map = &spt_reg_map, + .init = spt_core_init, };Hi,
Quoted 5 lines
I've applied all but this patch into the review-ilpo-next branch.
This change is good otherwise but I'd prefer the
pmc_pci_idsbe named better such that it actually relates to why it exists :-). So please respin this patch.
Hi,
Thanks! I will change the name in next version.
Xi
Xi Pardee
maintainerPATCH v6 6/6 platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core driver
In reply to Xi PardeeAdd Arrow Lake U and Arrow Lake H support in intel_pmc_core driver.
--- drivers/platform/x86/intel/pmc/arl.c | 37 +++++++++++++++++++++++++++ drivers/platform/x86/intel/pmc/core.c | 2 ++ drivers/platform/x86/intel/pmc/core.h | 1 + 3 files changed, 40 insertions(+)
drivers/platform/x86/intel/pmc/arl.c +37 -0
@@ -16,6 +16,7 @@#define IOEP_LPM_REQ_GUID 0x5077612#define SOCS_LPM_REQ_GUID 0x8478657#define PCHS_LPM_REQ_GUID 0x9684572 +#define SOCM_LPM_REQ_GUID 0x2625030static const u8 ARL_LPM_REG_INDEX [] = {0 ,4 ,5 ,6 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,20 };
@@ -650,6 +651,7 @@ const struct pmc_reg_map arl_pchs_reg_map = { .etr3_offset = ETR3_OFFSET, }; +#define PMC_DEVID_SOCM 0x777f#define PMC_DEVID_SOCS 0xae7f#define PMC_DEVID_IOEP 0x7ecf#define PMC_DEVID_PCHS 0x7f27
@@ -669,11 +671,17 @@ static struct pmc_info arl_pmc_info_list[] = { .devid = PMC_DEVID_PCHS, .map = &arl_pchs_reg_map, }, + { + .guid = SOCM_LPM_REQ_GUID, + .devid = PMC_DEVID_SOCM, + .map = &mtl_socm_reg_map, + }, {} };#define ARL_NPU_PCI_DEV 0xad1d#define ARL_GNA_PCI_DEV 0xae4c +#define ARL_H_GNA_PCI_DEV 0x774c/* * Set power state of select devices that do not have drivers to D3 * so that they do not block Package C entry.
@@ -684,6 +692,12 @@ static void arl_d3_fixup(void)pmc_core_set_device_d3 (ARL_GNA_PCI_DEV ); } +static void arl_h_d3_fixup (void ) +{ +pmc_core_set_device_d3 (ARL_NPU_PCI_DEV ); +pmc_core_set_device_d3 (ARL_H_GNA_PCI_DEV ); +} +static int arl_resume (struct pmc_dev *pmcdev) {arl_d3_fixup ();
@@ -691,12 +705,25 @@ static int arl_resume(struct pmc_dev *pmcdev)return cnl_resume (pmcdev); } +static int arl_h_resume (struct pmc_dev *pmcdev) +{ +arl_h_d3_fixup (); + +return cnl_resume (pmcdev); +} +static int arl_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) {arl_d3_fixup ();return generic_core_init (pmcdev, pmc_dev_info); } +static int arl_h_core_init (struct pmc_dev *pmcdev,struct pmc_dev_info *pmc_dev_info) +{ +arl_h_d3_fixup (); +return generic_core_init (pmcdev, pmc_dev_info); +} +struct pmc_dev_info arl_pmc_dev = { .pci_func =0 , .dmu_guid =ARL_PMT_DMU_GUID ,
@@ -706,3 +733,13 @@ struct pmc_dev_info arl_pmc_dev = { .resume = arl_resume, .init = arl_core_init, }; + +struct pmc_dev_info arl_h_pmc_dev = { + .pci_func =2 , + .dmu_guid =ARL_PMT_DMU_GUID , + .regmap_list = arl_pmc_info_list, + .map = &mtl_socm_reg_map, + .suspend = cnl_suspend, + .resume = arl_h_resume, + .init = arl_h_core_init, +};
drivers/platform/x86/intel/pmc/core.c +2 -0
@@ -1410,6 +1410,8 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {X86_MATCH_VFM (INTEL_RAPTORLAKE_S , &adl_pmc_dev),X86_MATCH_VFM (INTEL_METEORLAKE_L , &mtl_pmc_dev),X86_MATCH_VFM (INTEL_ARROWLAKE , &arl_pmc_dev), +X86_MATCH_VFM (INTEL_ARROWLAKE_H , &arl_h_pmc_dev), +X86_MATCH_VFM (INTEL_ARROWLAKE_U , &arl_h_pmc_dev), X86_MATCH_VFM(INTEL_LUNARLAKE_M, &lnl_pmc_dev), {} };
drivers/platform/x86/intel/pmc/core.h +1 -0
@@ -624,6 +624,7 @@ extern struct pmc_dev_info tgl_pmc_dev;extern struct pmc_dev_info adl_pmc_dev;extern struct pmc_dev_info mtl_pmc_dev;extern struct pmc_dev_info arl_pmc_dev; +extern struct pmc_dev_info arl_h_pmc_dev;extern struct pmc_dev_info lnl_pmc_dev;void cnl_suspend (struct pmc_dev *pmcdev);
Signature · 1 line
2.43.0