diff mbox series

[SRU,J:linux-bluefield,v2,1/1] UBUNTU: SAUCE: mlxbf-ptm: add thermal envelope debugfs node

Message ID 11fd5a5195a5cd343fa04f89016bb2a26671485c.1694704121.git.jlanka@nvidia.com
State New
Headers show
Series UBUNTU: SAUCE: mlxbf-ptm: add thermal envelope debugfs node | expand

Commit Message

Jitendra Lanka Sept. 14, 2023, 3:18 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2034594

Add a new read-only debugfs node called temp_envelope
that gets the current temperature envelope.

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

Patch

diff --git a/drivers/platform/mellanox/mlxbf-ptm.c b/drivers/platform/mellanox/mlxbf-ptm.c
index 59ac99695825..26f883bf71f3 100644
--- a/drivers/platform/mellanox/mlxbf-ptm.c
+++ b/drivers/platform/mellanox/mlxbf-ptm.c
@@ -28,6 +28,7 @@ 
 #define MLNX_PTM_GET_CUR_PPROFILE       0x8200010D
 #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
 
@@ -156,6 +157,15 @@  static int power_envelope_show(void *data, u64 *val)
 DEFINE_SIMPLE_ATTRIBUTE(power_envelope_fops,
 			power_envelope_show, NULL, "%llu\n");
 
+static int temp_envelope_show(void *data, u64 *val)
+{
+	*val = smc_call0(MLNX_PTM_GET_TEMP_ENVELOPE);
+
+	return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(temp_envelope_fops,
+			temp_envelope_show, NULL, "%llu\n");
+
 static int atx_status_show(void *data, u64 *val)
 {
 	*val = smc_call0(MLNX_PTM_GET_ATX_PWR_STATE);
@@ -227,6 +237,8 @@  static int __init mlxbf_ptm_init(void)
 			    NULL, &error_status_fops);
 	debugfs_create_file("power_envelope", 0444, status,
 			    NULL, &power_envelope_fops);
+	debugfs_create_file("temp_envelope", 0444, status,
+			    NULL, &temp_envelope_fops);
 	debugfs_create_file("atx_power_available", 0444, status,
 			    NULL, &atx_status_fops);
 	debugfs_create_file("active_power_profile", 0444, status,