diff mbox series

[SRU,J:linux-bluefield,v1,1/1] UBUNTU: SAUCE: mlxbf-ptm: use single SMC for total power

Message ID f39cfad939b565aaa49222d0c237346183ac2725.1718287750.git.jlanka@nvidia.com
State New
Headers show
Series UBUNTU: SAUCE: mlxbf-ptm: use single SMC for total power | expand

Commit Message

Jitendra Lanka June 13, 2024, 3:18 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2069303

update total power reporting to use a single secure
monitor call

Signed-off-by: Jitendra Lanka <jlanka@nvidia.com>
---
 drivers/platform/mellanox/mlxbf-ptm.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/platform/mellanox/mlxbf-ptm.c b/drivers/platform/mellanox/mlxbf-ptm.c
index 26f883bf71f3..ba8167c652a6 100644
--- a/drivers/platform/mellanox/mlxbf-ptm.c
+++ b/drivers/platform/mellanox/mlxbf-ptm.c
@@ -29,8 +29,7 @@ 
 #define MLNX_PTM_GET_DDR_TTHROTTLE      0x8200010E
 #define MLNX_PTM_GET_DDR_TEMP_EVT_CTR   0x8200010F
 #define MLNX_PTM_GET_TEMP_ENVELOPE	0x82000110
-
-#define MLNX_POWER_ERROR		300
+#define MLNX_PTM_GET_TOTAL_POWER	0x82000111
 
 struct dentry *monitors;
 
@@ -117,15 +116,7 @@  DEFINE_SIMPLE_ATTRIBUTE(vr1_power_fops, vr1_power_show, NULL, "%llu\n");
 
 static int total_power_show(void *data, u64 *val)
 {
-	u64 v0, v1;
-
-	v0 = smc_call0(MLNX_PTM_GET_VR0_POWER);
-	if (v0 > MLNX_POWER_ERROR)
-		v0 = 0;
-	v1 = smc_call0(MLNX_PTM_GET_VR1_POWER);
-	if (v1 > MLNX_POWER_ERROR)
-		v1 = 0;
-	*val = (v0 + v1);
+	*val = smc_call0(MLNX_PTM_GET_TOTAL_POWER);
 
 	return 0;
 }