Skip to content

Commit fb57551

Browse files
rjingarjwrdegoede
authored andcommitted
platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix
For platforms with Alder Lake PCH (Alder Lake S and Raptor Lake S) the slp_s0_residency attribute has been reporting the wrong value. Unlike other platforms, ADL PCH does not have a counter for the time that the SLP_S0 signal was asserted. Instead, firmware uses the aggregate of the Low Power Mode (LPM) substate counters as the S0ix value. Since the LPM counters run at a different frequency, this lead to misreporting of the S0ix time. Add a check for Alder Lake PCH and adjust the frequency accordingly when display slp_s0_residency. Fixes: bbab311 ("platform/x86/intel: pmc/core: Add Alderlake support to pmc core driver") Signed-off-by: Rajvi Jingar <[email protected]> Signed-off-by: David E. Box <[email protected]> Reviewed-by: Rajneesh Bhardwaj <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent acd0acb commit fb57551

File tree

1 file changed

+12
-1
lines changed
  • drivers/platform/x86/intel/pmc

1 file changed

+12
-1
lines changed

drivers/platform/x86/intel/pmc/core.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,18 @@ static inline void pmc_core_reg_write(struct pmc_dev *pmcdev, int reg_offset,
6666

6767
static inline u64 pmc_core_adjust_slp_s0_step(struct pmc_dev *pmcdev, u32 value)
6868
{
69-
return (u64)value * pmcdev->map->slp_s0_res_counter_step;
69+
/*
70+
* ADL PCH does not have the SLP_S0 counter and LPM Residency counters are
71+
* used as a workaround which uses 30.5 usec tick. All other client
72+
* programs have the legacy SLP_S0 residency counter that is using the 122
73+
* usec tick.
74+
*/
75+
const int lpm_adj_x2 = pmcdev->map->lpm_res_counter_step_x2;
76+
77+
if (pmcdev->map == &adl_reg_map)
78+
return (u64)value * GET_X2_COUNTER((u64)lpm_adj_x2);
79+
else
80+
return (u64)value * pmcdev->map->slp_s0_res_counter_step;
7081
}
7182

7283
static int set_etr3(struct pmc_dev *pmcdev)

0 commit comments

Comments
 (0)