cnqf.c (a82ebb3d800d7baf72122e82ab7c9b240d0a8a56) cnqf.c (63b5dbfdb770254c4fdb58d22b62458308685592)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * AMD Platform Management Framework Driver
4 *
5 * Copyright (c) 2022, Advanced Micro Devices, Inc.
6 * All Rights Reserved.
7 *
8 * Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

--- 161 unchanged lines hidden (view full) ---

170 }
171
172 for (i = 0; i < CNQF_TRANSITION_MAX; i++) {
173 config_store.trans_param[src][i].timer += time_lapsed_ms;
174 config_store.trans_param[src][i].total_power += socket_power;
175 config_store.trans_param[src][i].count++;
176
177 tp = &config_store.trans_param[src][i];
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * AMD Platform Management Framework Driver
4 *
5 * Copyright (c) 2022, Advanced Micro Devices, Inc.
6 * All Rights Reserved.
7 *
8 * Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

--- 161 unchanged lines hidden (view full) ---

170 }
171
172 for (i = 0; i < CNQF_TRANSITION_MAX; i++) {
173 config_store.trans_param[src][i].timer += time_lapsed_ms;
174 config_store.trans_param[src][i].total_power += socket_power;
175 config_store.trans_param[src][i].count++;
176
177 tp = &config_store.trans_param[src][i];
178
179#ifdef CONFIG_AMD_PMF_DEBUG
180 dev_dbg(dev->dev, "avg_power: %u mW total_power: %u mW count: %u timer: %u ms\n",
181 avg_power, config_store.trans_param[src][i].total_power,
182 config_store.trans_param[src][i].count,
183 config_store.trans_param[src][i].timer);
184#endif
178 if (tp->timer >= tp->time_constant && tp->count) {
179 avg_power = tp->total_power / tp->count;
180
181 /* Reset the indices */
182 tp->timer = 0;
183 tp->total_power = 0;
184 tp->count = 0;
185

--- 4 unchanged lines hidden (view full) ---

190 tp->priority = false;
191 }
192 }
193 }
194
195 dev_dbg(dev->dev, "[CNQF] Avg power: %u mW socket power: %u mW mode:%s\n",
196 avg_power, socket_power, state_as_str(config_store.current_mode));
197
185 if (tp->timer >= tp->time_constant && tp->count) {
186 avg_power = tp->total_power / tp->count;
187
188 /* Reset the indices */
189 tp->timer = 0;
190 tp->total_power = 0;
191 tp->count = 0;
192

--- 4 unchanged lines hidden (view full) ---

197 tp->priority = false;
198 }
199 }
200 }
201
202 dev_dbg(dev->dev, "[CNQF] Avg power: %u mW socket power: %u mW mode:%s\n",
203 avg_power, socket_power, state_as_str(config_store.current_mode));
204
205#ifdef CONFIG_AMD_PMF_DEBUG
206 dev_dbg(dev->dev, "[CNQF] priority1: %u priority2: %u priority3: %u\n",
207 config_store.trans_param[src][0].priority,
208 config_store.trans_param[src][1].priority,
209 config_store.trans_param[src][2].priority);
210
211 dev_dbg(dev->dev, "[CNQF] priority4: %u priority5: %u priority6: %u\n",
212 config_store.trans_param[src][3].priority,
213 config_store.trans_param[src][4].priority,
214 config_store.trans_param[src][5].priority);
215#endif
216
198 for (j = 0; j < CNQF_TRANSITION_MAX; j++) {
199 /* apply the highest priority */
200 if (config_store.trans_param[src][j].priority) {
201 if (config_store.current_mode !=
202 config_store.trans_param[src][j].target_mode) {
203 config_store.current_mode =
204 config_store.trans_param[src][j].target_mode;
205 dev_dbg(dev->dev, "Moving to Mode :%s\n",

--- 242 unchanged lines hidden ---
217 for (j = 0; j < CNQF_TRANSITION_MAX; j++) {
218 /* apply the highest priority */
219 if (config_store.trans_param[src][j].priority) {
220 if (config_store.current_mode !=
221 config_store.trans_param[src][j].target_mode) {
222 config_store.current_mode =
223 config_store.trans_param[src][j].target_mode;
224 dev_dbg(dev->dev, "Moving to Mode :%s\n",

--- 242 unchanged lines hidden ---