|
10 | 10 |
|
11 | 11 | #include "pmf.h"
|
12 | 12 |
|
| 13 | +static struct amd_pmf_static_slider_granular_v2 config_store_v2; |
13 | 14 | static struct amd_pmf_static_slider_granular config_store;
|
14 | 15 |
|
15 | 16 | #ifdef CONFIG_AMD_PMF_DEBUG
|
| 17 | +static const char *slider_v2_as_str(unsigned int state) |
| 18 | +{ |
| 19 | + switch (state) { |
| 20 | + case POWER_MODE_BEST_PERFORMANCE: |
| 21 | + return "Best Performance"; |
| 22 | + case POWER_MODE_BALANCED: |
| 23 | + return "Balanced"; |
| 24 | + case POWER_MODE_BEST_POWER_EFFICIENCY: |
| 25 | + return "Best Power Efficiency"; |
| 26 | + case POWER_MODE_ENERGY_SAVE: |
| 27 | + return "Energy Save"; |
| 28 | + default: |
| 29 | + return "Unknown Power Mode"; |
| 30 | + } |
| 31 | +} |
| 32 | + |
16 | 33 | static const char *slider_as_str(unsigned int state)
|
17 | 34 | {
|
18 | 35 | switch (state) {
|
@@ -63,10 +80,44 @@ static void amd_pmf_dump_sps_defaults(struct amd_pmf_static_slider_granular *dat
|
63 | 80 |
|
64 | 81 | pr_debug("Static Slider Data - END\n");
|
65 | 82 | }
|
| 83 | + |
| 84 | +static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v2 *data) |
| 85 | +{ |
| 86 | + unsigned int i, j; |
| 87 | + |
| 88 | + pr_debug("Static Slider APTS state index data - BEGIN"); |
| 89 | + pr_debug("size: %u\n", data->size); |
| 90 | + |
| 91 | + for (i = 0; i < POWER_SOURCE_MAX; i++) |
| 92 | + for (j = 0; j < POWER_MODE_V2_MAX; j++) |
| 93 | + pr_debug("%s %s: %u\n", amd_pmf_source_as_str(i), slider_v2_as_str(j), |
| 94 | + data->sps_idx.power_states[i][j]); |
| 95 | + |
| 96 | + pr_debug("Static Slider APTS state index data - END\n"); |
| 97 | +} |
66 | 98 | #else
|
67 | 99 | static void amd_pmf_dump_sps_defaults(struct amd_pmf_static_slider_granular *data) {}
|
| 100 | +static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v2 *data) {} |
68 | 101 | #endif
|
69 | 102 |
|
| 103 | +static void amd_pmf_load_defaults_sps_v2(struct amd_pmf_dev *dev) |
| 104 | +{ |
| 105 | + struct apmf_static_slider_granular_output_v2 output; |
| 106 | + unsigned int i, j; |
| 107 | + |
| 108 | + memset(&config_store_v2, 0, sizeof(config_store_v2)); |
| 109 | + apmf_get_static_slider_granular_v2(dev, &output); |
| 110 | + |
| 111 | + config_store_v2.size = output.size; |
| 112 | + |
| 113 | + for (i = 0; i < POWER_SOURCE_MAX; i++) |
| 114 | + for (j = 0; j < POWER_MODE_V2_MAX; j++) |
| 115 | + config_store_v2.sps_idx.power_states[i][j] = |
| 116 | + output.sps_idx.power_states[i][j]; |
| 117 | + |
| 118 | + amd_pmf_dump_sps_defaults_v2(&config_store_v2); |
| 119 | +} |
| 120 | + |
70 | 121 | static void amd_pmf_load_defaults_sps(struct amd_pmf_dev *dev)
|
71 | 122 | {
|
72 | 123 | struct apmf_static_slider_granular_output output;
|
@@ -256,7 +307,10 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev)
|
256 | 307 | dev->current_profile = PLATFORM_PROFILE_BALANCED;
|
257 | 308 |
|
258 | 309 | if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) {
|
259 |
| - amd_pmf_load_defaults_sps(dev); |
| 310 | + if (dev->pmf_if_version == PMF_IF_V2) |
| 311 | + amd_pmf_load_defaults_sps_v2(dev); |
| 312 | + else |
| 313 | + amd_pmf_load_defaults_sps(dev); |
260 | 314 |
|
261 | 315 | /* update SPS balanced power mode thermals */
|
262 | 316 | amd_pmf_set_sps_power_limits(dev);
|
|
0 commit comments