1bbf854dcSDavid Francis /* Copyright 2018 Advanced Micro Devices, Inc. 2bbf854dcSDavid Francis * 3bbf854dcSDavid Francis * Permission is hereby granted, free of charge, to any person obtaining a 4bbf854dcSDavid Francis * copy of this software and associated documentation files (the "Software"), 5bbf854dcSDavid Francis * to deal in the Software without restriction, including without limitation 6bbf854dcSDavid Francis * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7bbf854dcSDavid Francis * and/or sell copies of the Software, and to permit persons to whom the 8bbf854dcSDavid Francis * Software is furnished to do so, subject to the following conditions: 9bbf854dcSDavid Francis * 10bbf854dcSDavid Francis * The above copyright notice and this permission notice shall be included in 11bbf854dcSDavid Francis * all copies or substantial portions of the Software. 12bbf854dcSDavid Francis * 13bbf854dcSDavid Francis * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14bbf854dcSDavid Francis * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15bbf854dcSDavid Francis * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16bbf854dcSDavid Francis * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 17bbf854dcSDavid Francis * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18bbf854dcSDavid Francis * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19bbf854dcSDavid Francis * OTHER DEALINGS IN THE SOFTWARE. 20bbf854dcSDavid Francis * 21bbf854dcSDavid Francis * Authors: AMD 22bbf854dcSDavid Francis * 23bbf854dcSDavid Francis */ 24bbf854dcSDavid Francis 25bbf854dcSDavid Francis #ifndef MODULES_POWER_POWER_HELPERS_H_ 26bbf854dcSDavid Francis #define MODULES_POWER_POWER_HELPERS_H_ 27bbf854dcSDavid Francis 28bbf854dcSDavid Francis #include "dc/inc/hw/dmcu.h" 298d26334dSWyatt Wood #include "dc/inc/hw/abm.h" 3065e7a174SDavid Zhang #include "dc/inc/core_types.h" 31bbf854dcSDavid Francis 3233c8256bSYongqiang Sun struct resource_pool; 3333c8256bSYongqiang Sun 34bbf854dcSDavid Francis 35bbf854dcSDavid Francis enum abm_defines { 36bbf854dcSDavid Francis abm_defines_max_level = 4, 37bbf854dcSDavid Francis abm_defines_max_config = 4, 38bbf854dcSDavid Francis }; 39bbf854dcSDavid Francis 40bbf854dcSDavid Francis struct dmcu_iram_parameters { 41bbf854dcSDavid Francis unsigned int *backlight_lut_array; 42bbf854dcSDavid Francis unsigned int backlight_lut_array_size; 43e8e91f93SRizvi bool backlight_ramping_override; 44bbf854dcSDavid Francis unsigned int backlight_ramping_reduction; 45bbf854dcSDavid Francis unsigned int backlight_ramping_start; 462ad0cdf9SAnthony Koo unsigned int min_abm_backlight; 47bbf854dcSDavid Francis unsigned int set; 48bbf854dcSDavid Francis }; 49bbf854dcSDavid Francis 50bbf854dcSDavid Francis bool dmcu_load_iram(struct dmcu *dmcu, 51bbf854dcSDavid Francis struct dmcu_iram_parameters params); 5233c8256bSYongqiang Sun bool dmub_init_abm_config(struct resource_pool *res_pool, 536e568e43SJake Wang struct dmcu_iram_parameters params, 546e568e43SJake Wang unsigned int inst); 55bbf854dcSDavid Francis 56dede1feaSBhawanpreet Lakha void init_replay_config(struct dc_link *link, struct replay_config *pr_config); 57e379787cSTom Chung void set_replay_coasting_vtotal(struct dc_link *link, 58e379787cSTom Chung enum replay_coasting_vtotal_type type, 598e054b0fSChunTao Tso uint32_t vtotal); 60*57a0d65bSChunTao Tso void set_replay_defer_update_coasting_vtotal(struct dc_link *link, 61*57a0d65bSChunTao Tso enum replay_coasting_vtotal_type type, 62*57a0d65bSChunTao Tso uint32_t vtotal); 63*57a0d65bSChunTao Tso void update_replay_coasting_vtotal_from_defer(struct dc_link *link, 64*57a0d65bSChunTao Tso enum replay_coasting_vtotal_type type); 65f37f7979SChunTao Tso void set_replay_ips_full_screen_video_src_vtotal(struct dc_link *link, uint16_t vtotal); 66e379787cSTom Chung void calculate_replay_link_off_frame_count(struct dc_link *link, 67e379787cSTom Chung uint16_t vtotal, uint16_t htotal); 68dede1feaSBhawanpreet Lakha 699dd94101SDavid Zhang bool is_psr_su_specific_panel(struct dc_link *link); 7065e7a174SDavid Zhang void mod_power_calc_psr_configs(struct psr_config *psr_config, 7165e7a174SDavid Zhang struct dc_link *link, 7265e7a174SDavid Zhang const struct dc_stream_state *stream); 7365e7a174SDavid Zhang bool mod_power_only_edp(const struct dc_state *context, 7465e7a174SDavid Zhang const struct dc_stream_state *stream); 75c84ff24aSRobin Chen bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link, 7613b90cf9SHamza Mahfooz struct dc_stream_state *stream, 7713b90cf9SHamza Mahfooz struct psr_config *config); 785e9252d8SJosip Pavic 795e9252d8SJosip Pavic bool fill_custom_backlight_caps(unsigned int config_no, 805e9252d8SJosip Pavic struct dm_acpi_atif_backlight_caps *caps); 81bbf854dcSDavid Francis #endif /* MODULES_POWER_POWER_HELPERS_H_ */ 82