diff mbox series

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

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

Commit Message

Jitendra Lanka Sept. 6, 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.

---
 drivers/platform/mellanox/mlxbf-ptm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Bartlomiej Zolnierkiewicz Sept. 14, 2023, 2:57 p.m. UTC | #1
Hi Jitendra,

On Wed, Sep 6, 2023 at 5:19 PM Jitendra Lanka <jlanka@nvidia.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2034594
>
> Add a new read-only debugfs node called temp_envelope
> that gets the current temperature envelope.

Please add your Signed-off-by: line to the commit description.

--
Best regards,
Bartlomiej

> ---
>  drivers/platform/mellanox/mlxbf-ptm.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> 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,
> --
> 2.30.1
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,