summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/amd/pmc/mp1_stb.c
diff options
context:
space:
mode:
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>2024-11-08 12:38:16 +0530
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-12-02 19:31:42 +0200
commit2851f4f8ed4e130d864c5478c6da933a4427ae52 (patch)
tree4a7c23554dc4fc8026e4aba9a71832c6e5345c8b /drivers/platform/x86/amd/pmc/mp1_stb.c
parent00a8d002432fbb955f48445857b2f5be6e93ccc3 (diff)
platform/x86/amd/pmc: Define enum for S2D/PMC msg_port and add helper function
To distinguish between the PMC message port and the S2D (Spill to DRAM) message port, replace the use of 0 and 1 with an enum. To avoid printing the S2D or PMC port multiple times in debug print, add new routine to retrieve the message port information, which can be used to print the right msg_port getting used. Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Link: https://lore.kernel.org/r/20241108070822.3912689-5-Shyam-sundar.S-k@amd.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/amd/pmc/mp1_stb.c')
-rw-r--r--drivers/platform/x86/amd/pmc/mp1_stb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c
index 5c03ac92558f..9ee629db9af9 100644
--- a/drivers/platform/x86/amd/pmc/mp1_stb.c
+++ b/drivers/platform/x86/amd/pmc/mp1_stb.c
@@ -155,7 +155,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
dev_err(dev->dev, "error writing to STB: %d\n", ret);
/* Spill to DRAM num_samples uses separate SMU message port */
- dev->msg_port = 1;
+ dev->msg_port = MSG_PORT_S2D;
ret = amd_pmc_send_cmd(dev, 0, &val, STB_FORCE_FLUSH_DATA, 1);
if (ret)
@@ -172,7 +172,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
/* Get the num_samples to calculate the last push location */
ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true);
/* Clear msg_port for other SMU operation */
- dev->msg_port = 0;
+ dev->msg_port = MSG_PORT_PMC;
if (ret) {
dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret);
return ret;
@@ -267,7 +267,7 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev)
}
/* Spill to DRAM feature uses separate SMU message port */
- dev->msg_port = 1;
+ dev->msg_port = MSG_PORT_S2D;
amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true);
if (size != S2D_TELEMETRY_BYTES_MAX)
@@ -285,7 +285,7 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev)
stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low);
/* Clear msg_port for other SMU operation */
- dev->msg_port = 0;
+ dev->msg_port = MSG_PORT_PMC;
dev->stb_virt_addr = devm_ioremap(dev->dev, stb_phys_addr, dev->dram_size);
if (!dev->stb_virt_addr)