84 lines
2.6 KiB
Diff
84 lines
2.6 KiB
Diff
|
From 82305cf0e95a8c711cbcb9f74193c5a2fe62f6fa Mon Sep 17 00:00:00 2001
|
||
|
From: Jitendra Lanka <jlanka@nvidia.com>
|
||
|
Date: Wed, 22 Mar 2023 11:39:56 -0400
|
||
|
Subject: [PATCH backport 6.1.42 82/85] UBUNTU: SAUCE: mlxbf-ptm: add atx
|
||
|
debugfs nodes
|
||
|
|
||
|
BugLink: https://bugs.launchpad.net/bugs/2011738
|
||
|
|
||
|
Add additional debugfs nodes that provide ATX status and
|
||
|
power profile data.
|
||
|
|
||
|
Signed-off-by: Jitendra Lanka <jlanka@nvidia.com>
|
||
|
Acked-by: Tim Gardner <tim.gardner@canonical.com>
|
||
|
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
||
|
Signed-off-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>
|
||
|
---
|
||
|
drivers/platform/mellanox/mlxbf-ptm.c | 36 +++++++++++++++++++++++++++
|
||
|
1 file changed, 36 insertions(+)
|
||
|
|
||
|
diff --git a/drivers/platform/mellanox/mlxbf-ptm.c b/drivers/platform/mellanox/mlxbf-ptm.c
|
||
|
index aeb68dc42e32..a2845aa57c5b 100644
|
||
|
--- a/drivers/platform/mellanox/mlxbf-ptm.c
|
||
|
+++ b/drivers/platform/mellanox/mlxbf-ptm.c
|
||
|
@@ -23,6 +23,9 @@
|
||
|
#define MLNX_PTM_GET_MAX_TEMP 0x82000108
|
||
|
#define MLNX_PTM_GET_PWR_EVT_CNT 0x82000109
|
||
|
#define MLNX_PTM_GET_TEMP_EVT_CNT 0x8200010A
|
||
|
+#define MLNX_PTM_GET_POWER_ENVELOPE 0x8200010B
|
||
|
+#define MLNX_PTM_GET_ATX_PWR_STATE 0x8200010C
|
||
|
+#define MLNX_PTM_GET_CUR_PPROFILE 0x8200010D
|
||
|
|
||
|
#define MLNX_POWER_ERROR 300
|
||
|
|
||
|
@@ -142,6 +145,33 @@ static int error_status_show(void *data, u64 *val)
|
||
|
DEFINE_SIMPLE_ATTRIBUTE(error_status_fops,
|
||
|
error_status_show, NULL, "%llu\n");
|
||
|
|
||
|
+static int power_envelope_show(void *data, u64 *val)
|
||
|
+{
|
||
|
+ *val = smc_call0(MLNX_PTM_GET_POWER_ENVELOPE);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+DEFINE_SIMPLE_ATTRIBUTE(power_envelope_fops,
|
||
|
+ power_envelope_show, NULL, "%llu\n");
|
||
|
+
|
||
|
+static int atx_status_show(void *data, u64 *val)
|
||
|
+{
|
||
|
+ *val = smc_call0(MLNX_PTM_GET_ATX_PWR_STATE);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+DEFINE_SIMPLE_ATTRIBUTE(atx_status_fops,
|
||
|
+ atx_status_show, NULL, "%lld\n");
|
||
|
+
|
||
|
+static int current_pprofile_show(void *data, u64 *val)
|
||
|
+{
|
||
|
+ *val = smc_call0(MLNX_PTM_GET_CUR_PPROFILE);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+DEFINE_SIMPLE_ATTRIBUTE(current_pprofile_fops,
|
||
|
+ current_pprofile_show, NULL, "%llu\n");
|
||
|
+
|
||
|
|
||
|
static int __init mlxbf_ptm_init(void)
|
||
|
{
|
||
|
@@ -176,6 +206,12 @@ static int __init mlxbf_ptm_init(void)
|
||
|
NULL, &tthrottling_state_fops);
|
||
|
debugfs_create_file("error_state", 0444, status,
|
||
|
NULL, &error_status_fops);
|
||
|
+ debugfs_create_file("power_envelope", 0444, status,
|
||
|
+ NULL, &power_envelope_fops);
|
||
|
+ debugfs_create_file("atx_power_available", 0444, status,
|
||
|
+ NULL, &atx_status_fops);
|
||
|
+ debugfs_create_file("active_power_profile", 0444, status,
|
||
|
+ NULL, ¤t_pprofile_fops);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
--
|
||
|
2.20.1
|
||
|
|