Skip to content

Commit c61b693

Browse files
gkammelaandy-shev
authored andcommitted
platform/x86: intel_pmc_core: Make pmc_core_substate_res_show() generic
Currently pmc_core_substate_res_show() uses array of char pointers i.e., lpm_modes for Tiger Lake directly to iterate through and to get the number of low power modes which is hardcoded and cannot be re-used for future platforms that support sub-states. To maintain readability, make pmc_core_substate_res_show() generic, so that it can re-used for future platforms. Cc: Chen Zhou <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: David E. Box <[email protected]> Signed-off-by: Gayatri Kammela <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 267fc71 commit c61b693

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/platform/x86/intel_pmc_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ static const struct pmc_reg_map tgl_reg_map = {
567567
.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
568568
.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
569569
.ltr_ignore_max = TGL_NUM_IP_IGN_ALLOWED,
570+
.lpm_modes = tgl_lpm_modes,
570571
.lpm_en_offset = TGL_LPM_EN_OFFSET,
571572
.lpm_residency_offset = TGL_LPM_RESIDENCY_OFFSET,
572573
.lpm_sts = tgl_lpm_maps,
@@ -1009,6 +1010,7 @@ DEFINE_SHOW_ATTRIBUTE(pmc_core_ltr);
10091010
static int pmc_core_substate_res_show(struct seq_file *s, void *unused)
10101011
{
10111012
struct pmc_dev *pmcdev = s->private;
1013+
const char **lpm_modes = pmcdev->map->lpm_modes;
10121014
u32 offset = pmcdev->map->lpm_residency_offset;
10131015
u32 lpm_en;
10141016
int index;

drivers/platform/x86/intel_pmc_core.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ enum ppfear_regs {
198198
#define TGL_LPM_STATUS_OFFSET 0x1C3C
199199
#define TGL_LPM_LIVE_STATUS_OFFSET 0x1C5C
200200

201-
const char *lpm_modes[] = {
201+
const char *tgl_lpm_modes[] = {
202202
"S0i2.0",
203203
"S0i2.1",
204204
"S0i2.2",
@@ -255,6 +255,7 @@ struct pmc_reg_map {
255255
const u32 ltr_ignore_max;
256256
const u32 pm_vric1_offset;
257257
/* Low Power Mode registers */
258+
const char **lpm_modes;
258259
const u32 lpm_en_offset;
259260
const u32 lpm_residency_offset;
260261
const u32 lpm_status_offset;

0 commit comments

Comments
 (0)