Skip to contentSkip to conversation

drm/amd/pm: denote S to the deep sleep clock

PATCH In review Kenneth Feng 3 participants 3 messages Feb 8, 2024

Subsystems (3)
lore
Share & tools
lore

Kenneth Feng

author maintainer
#0 lore raw

PATCH 1/1 drm/amd/pm: denote S to the deep sleep clock

denote S to the deep sleep clock for the clock output on smu v13.0.0/v13.0.7/v13.0.10

---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 27 +++++++++++++------
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 27 +++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +19 -8
index 2e7518f4ae1a..fd33646970a4 100644
@@ -109,6 +109,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
 
 #define LINK_SPEED_MAX					3
+#define SMU_13_0_0_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1269,20 +1270,30 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
 			 *   - level 0 -> min clock freq
 			 *   - level 1 -> max clock freq
 			 * And the current clock frequency can be any value between them.
-			 * So, if the current clock frequency is not at level 0 or level 1,
-			 * we will fake it as three dpm levels:
+			 * So, if the current clock frequency is lower than level 0,
+			 * we will denote it to S:
+			 *   - level S -> current actual clock freq
 			 *   - level 0 -> min clock freq
-			 *   - level 1 -> current actual clock freq
-			 *   - level 2 -> max clock freq
+			 *   - level 1 -> max clock freq
 			 */
 			if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-			     (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+			     (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+				 (curr_freq < SMU_13_0_0_DSCLK_THRESHOLD)) {
+				size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+						curr_freq);
 				size += sysfs_emit_at(buf, size, "0: %uMhz\n",
 						single_dpm_table->dpm_levels[0].value);
-				size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-						curr_freq);
-				size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+				size += sysfs_emit_at(buf, size, "1: %uMhz\n",
 						single_dpm_table->dpm_levels[1].value);
+			} else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+						(single_dpm_table->dpm_levels[1].value != curr_freq)) {
+				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+						single_dpm_table->dpm_levels[0].value,
+						single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+				size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+				size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+						single_dpm_table->dpm_levels[1].value,
+						single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
 			} else {
 				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
 						single_dpm_table->dpm_levels[0].value,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +19 -8
index 0ffdb58af74e..2ecebad7a9cb 100644
@@ -85,6 +85,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
 
 #define LINK_SPEED_MAX					3
+#define SMU_13_0_7_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1258,20 +1259,30 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
 			 *   - level 0 -> min clock freq
 			 *   - level 1 -> max clock freq
 			 * And the current clock frequency can be any value between them.
-			 * So, if the current clock frequency is not at level 0 or level 1,
-			 * we will fake it as three dpm levels:
+			 * So, if the current clock frequency is lower than level 0,
+			 * we will denote it to S:
+			 *   - level S -> current actual clock freq
 			 *   - level 0 -> min clock freq
-			 *   - level 1 -> current actual clock freq
-			 *   - level 2 -> max clock freq
+			 *   - level 1 -> max clock freq
 			 */
 			if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-			     (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+			     (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+				 (curr_freq < SMU_13_0_7_DSCLK_THRESHOLD)) {
+				size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+						curr_freq);
 				size += sysfs_emit_at(buf, size, "0: %uMhz\n",
 						single_dpm_table->dpm_levels[0].value);
-				size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-						curr_freq);
-				size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+				size += sysfs_emit_at(buf, size, "1: %uMhz\n",
 						single_dpm_table->dpm_levels[1].value);
+			} else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+						(single_dpm_table->dpm_levels[1].value != curr_freq)) {
+				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+						single_dpm_table->dpm_levels[0].value,
+						single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+				size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+				size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+						single_dpm_table->dpm_levels[1].value,
+						single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
 			} else {
 				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
 						single_dpm_table->dpm_levels[0].value,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 49 lines · Kenneth Feng

denote S to the deep sleep clock for the clock output on smu v13.0.0/v13.0.7/v13.0.10

---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 27 +++++++++++++------
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 27 +++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +12 -8
index 2e7518f4ae1a..fd33646970a4 100644
@@ -109,6 +109,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
 
 #define LINK_SPEED_MAX					3
+#define SMU_13_0_0_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1269,20 +1270,30 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
 			 *   - level 0 -> min clock freq
 			 *   - level 1 -> max clock freq
 			 * And the current clock frequency can be any value between them.
-			 * So, if the current clock frequency is not at level 0 or level 1,
-			 * we will fake it as three dpm levels:
+			 * So, if the current clock frequency is lower than level 0,
+			 * we will denote it to S:
+			 *   - level S -> current actual clock freq
 			 *   - level 0 -> min clock freq
-			 *   - level 1 -> current actual clock freq
-			 *   - level 2 -> max clock freq
+			 *   - level 1 -> max clock freq
 			 */
 			if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-			     (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+			     (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+				 (curr_freq < SMU_13_0_0_DSCLK_THRESHOLD)) {
+				size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+						curr_freq);
 				size += sysfs_emit_at(buf, size, "0: %uMhz\n",
 						single_dpm_table->dpm_levels[0].value);
-				size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-						curr_freq);
-				size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+				size += sysfs_emit_at(buf, size, "1: %uMhz\n",
 						single_dpm_table->dpm_levels[1].value);
+			} else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+						(single_dpm_table->dpm_levels[1].value != curr_freq)) {

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c static int smu_v13_0_0_print_clk_levels(struct smu_context *smu, · line 1299

Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +7 -0
+				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+						single_dpm_table->dpm_levels[0].value,
+						single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+				size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+				size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+						single_dpm_table->dpm_levels[1].value,
+						single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
 			} else {
 				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
 						single_dpm_table->dpm_levels[0].value,

'S' notation is used for any clock, not just GFXCLK. The 'else' part here also needs modification.

Thanks,
Lijo

Quoted 51 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +19 -8
index 0ffdb58af74e..2ecebad7a9cb 100644
@@ -85,6 +85,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM			10
 
 #define LINK_SPEED_MAX					3
+#define SMU_13_0_7_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = {
 	MSG_MAP(TestMessage,			PPSMC_MSG_TestMessage,                 1),
@@ -1258,20 +1259,30 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
 			 *   - level 0 -> min clock freq
 			 *   - level 1 -> max clock freq
 			 * And the current clock frequency can be any value between them.
-			 * So, if the current clock frequency is not at level 0 or level 1,
-			 * we will fake it as three dpm levels:
+			 * So, if the current clock frequency is lower than level 0,
+			 * we will denote it to S:
+			 *   - level S -> current actual clock freq
 			 *   - level 0 -> min clock freq
-			 *   - level 1 -> current actual clock freq
-			 *   - level 2 -> max clock freq
+			 *   - level 1 -> max clock freq
 			 */
 			if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-			     (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+			     (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+				 (curr_freq < SMU_13_0_7_DSCLK_THRESHOLD)) {
+				size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+						curr_freq);
 				size += sysfs_emit_at(buf, size, "0: %uMhz\n",
 						single_dpm_table->dpm_levels[0].value);
-				size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-						curr_freq);
-				size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+				size += sysfs_emit_at(buf, size, "1: %uMhz\n",
 						single_dpm_table->dpm_levels[1].value);
+			} else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+						(single_dpm_table->dpm_levels[1].value != curr_freq)) {
+				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+						single_dpm_table->dpm_levels[0].value,
+						single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+				size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+				size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+						single_dpm_table->dpm_levels[1].value,
+						single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
 			} else {
 				size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
 						single_dpm_table->dpm_levels[0].value,
#2 lore raw
In reply to Kenneth Feng
Quoted 3 lines · Kenneth Feng

denote S to the deep sleep clock for the clock output on smu v13.0.0/v13.0.7/v13.0.10

Would be nice to fix up smu 11 as well at some point.

Alex

Quoted 111 lines
---
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  | 27 +++++++++++++------
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  | 27 +++++++++++++------
 2 files changed, 38 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +19 -8
index 2e7518f4ae1a..fd33646970a4 100644
@@ -109,6 +109,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM                  10
 
 #define LINK_SPEED_MAX                                 3
+#define SMU_13_0_0_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] = {
        MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,                 1),
@@ -1269,20 +1270,30 @@ static int smu_v13_0_0_print_clk_levels(struct smu_context *smu,
                         *   - level 0 -> min clock freq
                         *   - level 1 -> max clock freq
                         * And the current clock frequency can be any value between them.
-                        * So, if the current clock frequency is not at level 0 or level 1,
-                        * we will fake it as three dpm levels:
+                        * So, if the current clock frequency is lower than level 0,
+                        * we will denote it to S:
+                        *   - level S -> current actual clock freq
                         *   - level 0 -> min clock freq
-                        *   - level 1 -> current actual clock freq
-                        *   - level 2 -> max clock freq
+                        *   - level 1 -> max clock freq
                         */
                        if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-                            (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+                            (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+                                (curr_freq < SMU_13_0_0_DSCLK_THRESHOLD)) {
+                               size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+                                               curr_freq);
                                size += sysfs_emit_at(buf, size, "0: %uMhz\n",
                                                single_dpm_table->dpm_levels[0].value);
-                               size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-                                               curr_freq);
-                               size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+                               size += sysfs_emit_at(buf, size, "1: %uMhz\n",
                                                single_dpm_table->dpm_levels[1].value);
+                       } else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+                                               (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+                               size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+                                               single_dpm_table->dpm_levels[0].value,
+                                               single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+                               size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+                               size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+                                               single_dpm_table->dpm_levels[1].value,
+                                               single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
                        } else {
                                size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
                                                single_dpm_table->dpm_levels[0].value,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +19 -9
index 0ffdb58af74e..2ecebad7a9cb 100644
@@ -85,6 +85,7 @@
 #define PP_OD_FEATURE_FAN_MINIMUM_PWM                  10
 
 #define LINK_SPEED_MAX                                 3
+#define SMU_13_0_7_DSCLK_THRESHOLD 100
 
 static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = {
        MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,                 1),
@@ -1258,20 +1259,30 @@ static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
                         *   - level 0 -> min clock freq
                         *   - level 1 -> max clock freq
                         * And the current clock frequency can be any value between them.
-                        * So, if the current clock frequency is not at level 0 or level 1,
-                        * we will fake it as three dpm levels:
+                        * So, if the current clock frequency is lower than level 0,
+                        * we will denote it to S:
+                        *   - level S -> current actual clock freq
                         *   - level 0 -> min clock freq
-                        *   - level 1 -> current actual clock freq
-                        *   - level 2 -> max clock freq
+                        *   - level 1 -> max clock freq
                         */
                        if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
-                            (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+                            (single_dpm_table->dpm_levels[1].value != curr_freq) &&
+                                (curr_freq < SMU_13_0_7_DSCLK_THRESHOLD)) {
+                               size += sysfs_emit_at(buf, size, "S: %uMhz *\n",
+                                               curr_freq);
                                size += sysfs_emit_at(buf, size, "0: %uMhz\n",
                                                single_dpm_table->dpm_levels[0].value);
-                               size += sysfs_emit_at(buf, size, "1: %uMhz *\n",
-                                               curr_freq);
-                               size += sysfs_emit_at(buf, size, "2: %uMhz\n",
+                               size += sysfs_emit_at(buf, size, "1: %uMhz\n",
                                                single_dpm_table->dpm_levels[1].value);
+                       } else if ((single_dpm_table->dpm_levels[0].value != curr_freq) &&
+                                               (single_dpm_table->dpm_levels[1].value != curr_freq)) {
+                               size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
+                                               single_dpm_table->dpm_levels[0].value,
+                                               single_dpm_table->dpm_levels[0].value == curr_freq ? "*" : "");
+                               size += sysfs_emit_at(buf, size, "1: %uMhz *\n", curr_freq);
+                               size += sysfs_emit_at(buf, size, "2: %uMhz %s\n",
+                                               single_dpm_table->dpm_levels[1].value,
+                                               single_dpm_table->dpm_levels[1].value == curr_freq ? "*" : "");
                        } else {
                                size += sysfs_emit_at(buf, size, "0: %uMhz %s\n",
                                                single_dpm_table->dpm_levels[0].value,
--

2.34.1