1 /*
2  * Copyright 2022 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #ifndef __DC_LINK_EDP_PANEL_CONTROL_H__
27 #define __DC_LINK_EDP_PANEL_CONTROL_H__
28 #include "link.h"
29 
30 enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
31 void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);
32 bool set_default_brightness_aux(struct dc_link *link);
33 void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd);
34 int edp_get_backlight_level(const struct dc_link *link);
35 bool edp_get_backlight_level_nits(struct dc_link *link,
36 		uint32_t *backlight_millinits_avg,
37 		uint32_t *backlight_millinits_peak);
38 bool edp_set_backlight_level(const struct dc_link *link,
39 		uint32_t backlight_pwm_u16_16,
40 		uint32_t frame_ramp);
41 bool edp_set_backlight_level_nits(struct dc_link *link,
42 		bool isHDR,
43 		uint32_t backlight_millinits,
44 		uint32_t transition_time_in_ms);
45 int edp_get_target_backlight_pwm(const struct dc_link *link);
46 bool edp_get_psr_state(const struct dc_link *link, enum dc_psr_state *state);
47 bool edp_set_psr_allow_active(struct dc_link *link, const bool *allow_active,
48 		bool wait, bool force_static, const unsigned int *power_opts);
49 bool edp_setup_psr(struct dc_link *link,
50 		const struct dc_stream_state *stream, struct psr_config *psr_config,
51 		struct psr_context *psr_context);
52 bool edp_set_sink_vtotal_in_psr_active(const struct dc_link *link,
53        uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su);
54 void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency);
55 bool edp_set_replay_allow_active(struct dc_link *dc_link, const bool *enable,
56 	bool wait, bool force_static, const unsigned int *power_opts);
57 bool edp_setup_replay(struct dc_link *link,
58 		const struct dc_stream_state *stream);
59 bool edp_set_coasting_vtotal(struct dc_link *link, uint16_t coasting_vtotal);
60 bool edp_replay_residency(const struct dc_link *link,
61 	unsigned int *residency, const bool is_start, const bool is_alpm);
62 bool edp_get_replay_state(const struct dc_link *link, uint64_t *state);
63 bool edp_wait_for_t12(struct dc_link *link);
64 bool edp_is_ilr_optimization_required(struct dc_link *link,
65        struct dc_crtc_timing *crtc_timing);
66 bool edp_is_ilr_optimization_enabled(struct dc_link *link);
67 enum dc_link_rate get_max_link_rate_from_ilr_table(struct dc_link *link);
68 bool edp_backlight_enable_aux(struct dc_link *link, bool enable);
69 void edp_add_delay_for_T9(struct dc_link *link);
70 bool edp_receiver_ready_T9(struct dc_link *link);
71 bool edp_receiver_ready_T7(struct dc_link *link);
72 bool edp_power_alpm_dpcd_enable(struct dc_link *link, bool enable);
73 void edp_set_panel_power(struct dc_link *link, bool powerOn);
74 #endif /* __DC_LINK_EDP_POWER_CONTROL_H__ */
75