Skip to content

Commit c3b4093

Browse files
Shyam Sundar S Kjwrdegoede
authored andcommitted
platform/x86/amd/pmf: Add support update p3t limit
P3T (Peak Package Power Limit) is a metric within the SMU controller that can influence the power limits. Add support from the driver to update P3T limits accordingly. Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Shyam Sundar S K <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent f4627df commit c3b4093

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/platform/x86/amd/pmf/pmf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#define GET_STT_MIN_LIMIT 0x1F
5050
#define GET_STT_LIMIT_APU 0x20
5151
#define GET_STT_LIMIT_HS2 0x21
52+
#define SET_P3T 0x23 /* P3T: Peak Package Power Limit */
5253

5354
/* OS slider update notification */
5455
#define DC_BEST_PERF 0
@@ -72,6 +73,7 @@
7273
#define PMF_POLICY_STT_MIN 6
7374
#define PMF_POLICY_STT_SKINTEMP_APU 7
7475
#define PMF_POLICY_STT_SKINTEMP_HS2 8
76+
#define PMF_POLICY_P3T 38
7577

7678
/* TA macros */
7779
#define PMF_TA_IF_VERSION_MAJOR 1
@@ -481,6 +483,7 @@ struct pmf_action_table {
481483
u32 stt_minlimit; /* in mW */
482484
u32 stt_skintemp_apu; /* in C */
483485
u32 stt_skintemp_hs2; /* in C */
486+
u32 p3t_limit; /* in mW */
484487
};
485488

486489
/* Input conditions */

drivers/platform/x86/amd/pmf/tee-if.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
105105
dev->prev_data->stt_skintemp_hs2 = val;
106106
}
107107
break;
108+
109+
case PMF_POLICY_P3T:
110+
if (dev->prev_data->p3t_limit != val) {
111+
amd_pmf_send_cmd(dev, SET_P3T, false, val, NULL);
112+
dev_dbg(dev->dev, "update P3T: %u\n", val);
113+
dev->prev_data->p3t_limit = val;
114+
}
115+
break;
108116
}
109117
}
110118
}

0 commit comments

Comments
 (0)