pmf.h (22ee98cb696e95b05a188756d479d382d93559ef) | pmf.h (9732f9c7b4a0c18820cbf9c74f7c8abde60f2834) |
---|---|
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> --- 8 unchanged lines hidden (view full) --- 17/* APMF Functions */ 18#define APMF_FUNC_VERIFY_INTERFACE 0 19#define APMF_FUNC_GET_SYS_PARAMS 1 20#define APMF_FUNC_SBIOS_REQUESTS 2 21#define APMF_FUNC_SBIOS_HEARTBEAT 4 22#define APMF_FUNC_AUTO_MODE 5 23#define APMF_FUNC_SET_FAN_IDX 7 24#define APMF_FUNC_STATIC_SLIDER_GRANULAR 9 | 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> --- 8 unchanged lines hidden (view full) --- 17/* APMF Functions */ 18#define APMF_FUNC_VERIFY_INTERFACE 0 19#define APMF_FUNC_GET_SYS_PARAMS 1 20#define APMF_FUNC_SBIOS_REQUESTS 2 21#define APMF_FUNC_SBIOS_HEARTBEAT 4 22#define APMF_FUNC_AUTO_MODE 5 23#define APMF_FUNC_SET_FAN_IDX 7 24#define APMF_FUNC_STATIC_SLIDER_GRANULAR 9 |
25#define APMF_FUNC_DYN_SLIDER_AC 11 26#define APMF_FUNC_DYN_SLIDER_DC 12 |
|
25 26/* Message Definitions */ 27#define SET_SPL 0x03 /* SPL: Sustained Power Limit */ 28#define SET_SPPT 0x05 /* SPPT: Slow Package Power Tracking */ 29#define SET_FPPT 0x07 /* FPPT: Fast Package Power Tracking */ 30#define GET_SPL 0x0B 31#define GET_SPPT 0x0D 32#define GET_FPPT 0x0F --- 127 unchanged lines hidden (view full) --- 160 struct delayed_work heart_beat; 161 struct smu_pmf_metrics m_table; 162 struct delayed_work work_buffer; 163 ktime_t start_time; 164 int socket_power_history[AVG_SAMPLE_SIZE]; 165 int socket_power_history_idx; 166 bool amt_enabled; 167 struct mutex update_mutex; /* protects race between ACPI handler and metrics thread */ | 27 28/* Message Definitions */ 29#define SET_SPL 0x03 /* SPL: Sustained Power Limit */ 30#define SET_SPPT 0x05 /* SPPT: Slow Package Power Tracking */ 31#define SET_FPPT 0x07 /* FPPT: Fast Package Power Tracking */ 32#define GET_SPL 0x0B 33#define GET_SPPT 0x0D 34#define GET_FPPT 0x0F --- 127 unchanged lines hidden (view full) --- 162 struct delayed_work heart_beat; 163 struct smu_pmf_metrics m_table; 164 struct delayed_work work_buffer; 165 ktime_t start_time; 166 int socket_power_history[AVG_SAMPLE_SIZE]; 167 int socket_power_history_idx; 168 bool amt_enabled; 169 struct mutex update_mutex; /* protects race between ACPI handler and metrics thread */ |
170 bool cnqf_enabled; 171 bool cnqf_supported; |
|
168}; 169 170struct apmf_sps_prop_granular { 171 u32 fppt; 172 u32 sppt; 173 u32 sppt_apu_only; 174 u32 spl; 175 u32 stt_min; --- 113 unchanged lines hidden (view full) --- 289 u32 spl_quiet; 290 u32 sppt_apu_only_quiet; 291 /* Fan ID */ 292 u32 fan_id_perf; 293 u32 fan_id_balanced; 294 u32 fan_id_quiet; 295} __packed; 296 | 172}; 173 174struct apmf_sps_prop_granular { 175 u32 fppt; 176 u32 sppt; 177 u32 sppt_apu_only; 178 u32 spl; 179 u32 stt_min; --- 113 unchanged lines hidden (view full) --- 293 u32 spl_quiet; 294 u32 sppt_apu_only_quiet; 295 /* Fan ID */ 296 u32 fan_id_perf; 297 u32 fan_id_balanced; 298 u32 fan_id_quiet; 299} __packed; 300 |
301/* CnQF Layer */ 302enum cnqf_trans_priority { 303 CNQF_TRANSITION_TO_TURBO, /* Any other mode to Turbo Mode */ 304 CNQF_TRANSITION_FROM_BALANCE_TO_PERFORMANCE, /* quiet/balance to Performance Mode */ 305 CNQF_TRANSITION_FROM_QUIET_TO_BALANCE, /* Quiet Mode to Balance Mode */ 306 CNQF_TRANSITION_TO_QUIET, /* Any other mode to Quiet Mode */ 307 CNQF_TRANSITION_FROM_PERFORMANCE_TO_BALANCE, /* Performance/Turbo to Balance Mode */ 308 CNQF_TRANSITION_FROM_TURBO_TO_PERFORMANCE, /* Turbo mode to Performance Mode */ 309 CNQF_TRANSITION_MAX, 310}; 311 312enum cnqf_mode { 313 CNQF_MODE_QUIET, 314 CNQF_MODE_BALANCE, 315 CNQF_MODE_PERFORMANCE, 316 CNQF_MODE_TURBO, 317 CNQF_MODE_MAX, 318}; 319 320enum apmf_cnqf_pos { 321 APMF_CNQF_TURBO, 322 APMF_CNQF_PERFORMANCE, 323 APMF_CNQF_BALANCE, 324 APMF_CNQF_QUIET, 325 APMF_CNQF_MAX, 326}; 327 328struct cnqf_mode_settings { 329 struct power_table_control power_control; 330 struct fan_table_control fan_control; 331 u32 power_floor; 332}; 333 334struct cnqf_tran_params { 335 u32 time_constant; /* minimum time required to switch to next mode */ 336 u32 power_threshold; 337 u32 timer; /* elapsed time. if timer > timethreshold, it will move to next mode */ 338 u32 total_power; 339 u32 count; 340 bool priority; 341 bool shifting_up; 342 enum cnqf_mode target_mode; 343}; 344 345struct cnqf_config { 346 struct cnqf_tran_params trans_param[POWER_SOURCE_MAX][CNQF_TRANSITION_MAX]; 347 struct cnqf_mode_settings mode_set[POWER_SOURCE_MAX][CNQF_MODE_MAX]; 348 struct power_table_control defaults; 349 enum cnqf_mode current_mode; 350 u32 power_src; 351 u32 avg_power; 352}; 353 354struct apmf_cnqf_power_set { 355 u32 pfloor; 356 u32 fppt; 357 u32 sppt; 358 u32 sppt_apu_only; 359 u32 spl; 360 u32 stt_min_limit; 361 u8 stt_skintemp[STT_TEMP_COUNT]; 362 u32 fan_id; 363} __packed; 364 365struct apmf_dyn_slider_output { 366 u16 size; 367 u16 flags; 368 u32 t_perf_to_turbo; 369 u32 t_balanced_to_perf; 370 u32 t_quiet_to_balanced; 371 u32 t_balanced_to_quiet; 372 u32 t_perf_to_balanced; 373 u32 t_turbo_to_perf; 374 struct apmf_cnqf_power_set ps[APMF_CNQF_MAX]; 375} __packed; 376 |
|
297/* Core Layer */ 298int apmf_acpi_init(struct amd_pmf_dev *pmf_dev); 299void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev); 300int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index); 301int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32 *data); 302int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev); 303int amd_pmf_get_power_source(void); | 377/* Core Layer */ 378int apmf_acpi_init(struct amd_pmf_dev *pmf_dev); 379void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev); 380int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index); 381int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32 *data); 382int amd_pmf_init_metrics_table(struct amd_pmf_dev *dev); 383int amd_pmf_get_power_source(void); |
304int apmf_install_handler(struct amd_pmf_dev *pmf_dev); | |
305 306/* SPS Layer */ 307int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf); 308void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, 309 struct amd_pmf_static_slider_granular *table); 310int amd_pmf_init_sps(struct amd_pmf_dev *dev); 311void amd_pmf_deinit_sps(struct amd_pmf_dev *dev); 312int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, --- 7 unchanged lines hidden (view full) --- 320void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev); 321void amd_pmf_deinit_auto_mode(struct amd_pmf_dev *dev); 322void amd_pmf_trans_automode(struct amd_pmf_dev *dev, int socket_power, ktime_t time_elapsed_ms); 323int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_req *req); 324 325void amd_pmf_update_2_cql(struct amd_pmf_dev *dev, bool is_cql_event); 326int amd_pmf_reset_amt(struct amd_pmf_dev *dev); 327void amd_pmf_handle_amt(struct amd_pmf_dev *dev); | 384 385/* SPS Layer */ 386int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf); 387void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, 388 struct amd_pmf_static_slider_granular *table); 389int amd_pmf_init_sps(struct amd_pmf_dev *dev); 390void amd_pmf_deinit_sps(struct amd_pmf_dev *dev); 391int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, --- 7 unchanged lines hidden (view full) --- 399void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev); 400void amd_pmf_deinit_auto_mode(struct amd_pmf_dev *dev); 401void amd_pmf_trans_automode(struct amd_pmf_dev *dev, int socket_power, ktime_t time_elapsed_ms); 402int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_req *req); 403 404void amd_pmf_update_2_cql(struct amd_pmf_dev *dev, bool is_cql_event); 405int amd_pmf_reset_amt(struct amd_pmf_dev *dev); 406void amd_pmf_handle_amt(struct amd_pmf_dev *dev); |
407 408/* CnQF Layer */ 409int apmf_get_dyn_slider_def_ac(struct amd_pmf_dev *pdev, struct apmf_dyn_slider_output *data); 410int apmf_get_dyn_slider_def_dc(struct amd_pmf_dev *pdev, struct apmf_dyn_slider_output *data); 411int amd_pmf_init_cnqf(struct amd_pmf_dev *dev); 412void amd_pmf_deinit_cnqf(struct amd_pmf_dev *dev); 413int amd_pmf_trans_cnqf(struct amd_pmf_dev *dev, int socket_power, ktime_t time_lapsed_ms); 414extern const struct attribute_group cnqf_feature_attribute_group; 415 |
|
328#endif /* PMF_H */ | 416#endif /* PMF_H */ |