]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86/amd/pmf: Replace magic table id with METRICS_TABLE_ID
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Thu, 20 Nov 2025 10:52:10 +0000 (16:22 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 21 Nov 2025 15:18:12 +0000 (17:18 +0200)
Add METRICS_TABLE_ID (7) and use it when requesting the metrics
transfer table instead of the hard-coded literal. This clarifies the
meaning of the argument to amd_pmf_send_cmd() and centralizes the table
ID definition for easier maintenance.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://patch.msgid.link/20251120105210.3945710-4-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmf/core.c
drivers/platform/x86/amd/pmf/pmf.h
drivers/platform/x86/amd/pmf/spc.c

index a659cedc4533790838ffe2370b865093f4111f21..a6a5d416edf9fd963a65ac64441ff5363718166e 100644 (file)
@@ -131,7 +131,7 @@ static void amd_pmf_get_metrics(struct work_struct *work)
 
        /* Transfer table contents */
        memset(dev->buf, 0, sizeof(dev->m_table));
-       amd_pmf_send_cmd(dev, SET_TRANSFER_TABLE, SET_CMD, 7, NULL);
+       amd_pmf_send_cmd(dev, SET_TRANSFER_TABLE, SET_CMD, METRICS_TABLE_ID, NULL);
        memcpy(&dev->m_table, dev->buf, sizeof(dev->m_table));
 
        time_elapsed_ms = ktime_to_ms(ktime_get()) - dev->start_time;
index 4544388d06e892e74d38736d52a2bd50e667338e..f07e9f4c660a80ebc815c9fc2b6c93627a57dee5 100644 (file)
@@ -124,6 +124,8 @@ struct cookie_header {
 #define SET_CMD                false
 #define GET_CMD                true
 
+#define METRICS_TABLE_ID       7
+
 typedef void (*apmf_event_handler_t)(acpi_handle handle, u32 event, void *data);
 
 /* APTS PMF BIOS Interface */
index b10229def18a2347e5d257712fedf64b52e82957..0a37dc6a79500887dd08d807a39e604aecfe7ba7 100644 (file)
@@ -202,7 +202,7 @@ static void amd_pmf_get_smu_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_ta
 {
        /* Get the updated metrics table data */
        memset(dev->buf, 0, dev->mtable_size);
-       amd_pmf_send_cmd(dev, SET_TRANSFER_TABLE, SET_CMD, 7, NULL);
+       amd_pmf_send_cmd(dev, SET_TRANSFER_TABLE, SET_CMD, METRICS_TABLE_ID, NULL);
 
        switch (dev->cpu_id) {
        case AMD_CPU_ID_PS: