10078c924SWenjing Liu /* 20078c924SWenjing Liu * Copyright 2022 Advanced Micro Devices, Inc. 30078c924SWenjing Liu * 40078c924SWenjing Liu * Permission is hereby granted, free of charge, to any person obtaining a 50078c924SWenjing Liu * copy of this software and associated documentation files (the "Software"), 60078c924SWenjing Liu * to deal in the Software without restriction, including without limitation 70078c924SWenjing Liu * the rights to use, copy, modify, merge, publish, distribute, sublicense, 80078c924SWenjing Liu * and/or sell copies of the Software, and to permit persons to whom the 90078c924SWenjing Liu * Software is furnished to do so, subject to the following conditions: 100078c924SWenjing Liu * 110078c924SWenjing Liu * The above copyright notice and this permission notice shall be included in 120078c924SWenjing Liu * all copies or substantial portions of the Software. 130078c924SWenjing Liu * 140078c924SWenjing Liu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 150078c924SWenjing Liu * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 160078c924SWenjing Liu * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 170078c924SWenjing Liu * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 180078c924SWenjing Liu * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 190078c924SWenjing Liu * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 200078c924SWenjing Liu * OTHER DEALINGS IN THE SOFTWARE. 210078c924SWenjing Liu * 220078c924SWenjing Liu * Authors: AMD 230078c924SWenjing Liu * 240078c924SWenjing Liu */ 250078c924SWenjing Liu 260078c924SWenjing Liu #ifndef __DC_LINK_EDP_PANEL_CONTROL_H__ 270078c924SWenjing Liu #define __DC_LINK_EDP_PANEL_CONTROL_H__ 280078c924SWenjing Liu #include "link.h" 290078c924SWenjing Liu 300078c924SWenjing Liu enum dp_panel_mode dp_get_panel_mode(struct dc_link *link); 310078c924SWenjing Liu void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode); 320078c924SWenjing Liu bool set_default_brightness_aux(struct dc_link *link); 33202a3816SWenjing Liu void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd); 34202a3816SWenjing Liu int edp_get_backlight_level(const struct dc_link *link); 35202a3816SWenjing Liu bool edp_get_backlight_level_nits(struct dc_link *link, 36202a3816SWenjing Liu uint32_t *backlight_millinits_avg, 37202a3816SWenjing Liu uint32_t *backlight_millinits_peak); 38202a3816SWenjing Liu bool edp_set_backlight_level(const struct dc_link *link, 39202a3816SWenjing Liu uint32_t backlight_pwm_u16_16, 40202a3816SWenjing Liu uint32_t frame_ramp); 41202a3816SWenjing Liu bool edp_set_backlight_level_nits(struct dc_link *link, 42202a3816SWenjing Liu bool isHDR, 43202a3816SWenjing Liu uint32_t backlight_millinits, 44202a3816SWenjing Liu uint32_t transition_time_in_ms); 45202a3816SWenjing Liu int edp_get_target_backlight_pwm(const struct dc_link *link); 46202a3816SWenjing Liu bool edp_get_psr_state(const struct dc_link *link, enum dc_psr_state *state); 47202a3816SWenjing Liu bool edp_set_psr_allow_active(struct dc_link *link, const bool *allow_active, 48202a3816SWenjing Liu bool wait, bool force_static, const unsigned int *power_opts); 49202a3816SWenjing Liu bool edp_setup_psr(struct dc_link *link, 50202a3816SWenjing Liu const struct dc_stream_state *stream, struct psr_config *psr_config, 51202a3816SWenjing Liu struct psr_context *psr_context); 5298ce7d32SWenjing Liu bool edp_set_sink_vtotal_in_psr_active(const struct dc_link *link, 5398ce7d32SWenjing Liu uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su); 5498ce7d32SWenjing Liu void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency); 55c7ddc0a8SBhawanpreet Lakha bool edp_set_replay_allow_active(struct dc_link *dc_link, const bool *enable, 56c7ddc0a8SBhawanpreet Lakha bool wait, bool force_static, const unsigned int *power_opts); 57c7ddc0a8SBhawanpreet Lakha bool edp_setup_replay(struct dc_link *link, 58c7ddc0a8SBhawanpreet Lakha const struct dc_stream_state *stream); 59c7ddc0a8SBhawanpreet Lakha bool edp_set_coasting_vtotal(struct dc_link *link, uint16_t coasting_vtotal); 60c7ddc0a8SBhawanpreet Lakha bool edp_replay_residency(const struct dc_link *link, 61c7ddc0a8SBhawanpreet Lakha unsigned int *residency, const bool is_start, const bool is_alpm); 62c7ddc0a8SBhawanpreet Lakha bool edp_get_replay_state(const struct dc_link *link, uint64_t *state); 63202a3816SWenjing Liu bool edp_wait_for_t12(struct dc_link *link); 6498ce7d32SWenjing Liu bool edp_is_ilr_optimization_required(struct dc_link *link, 6598ce7d32SWenjing Liu struct dc_crtc_timing *crtc_timing); 66*5e03e4a4SSherry Wang bool edp_is_ilr_optimization_enabled(struct dc_link *link); 67*5e03e4a4SSherry Wang enum dc_link_rate get_max_link_rate_from_ilr_table(struct dc_link *link); 6898ce7d32SWenjing Liu bool edp_backlight_enable_aux(struct dc_link *link, bool enable); 6998ce7d32SWenjing Liu void edp_add_delay_for_T9(struct dc_link *link); 7098ce7d32SWenjing Liu bool edp_receiver_ready_T9(struct dc_link *link); 7198ce7d32SWenjing Liu bool edp_receiver_ready_T7(struct dc_link *link); 7298ce7d32SWenjing Liu bool edp_power_alpm_dpcd_enable(struct dc_link *link, bool enable); 73a8728dbbSIan Chen void edp_set_panel_power(struct dc_link *link, bool powerOn); 740078c924SWenjing Liu #endif /* __DC_LINK_EDP_POWER_CONTROL_H__ */ 75