]> git.ipfire.org Git - thirdparty/kernel/stable.git/blob - drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
KVM: Harden copying of userspace-array against overflow
[thirdparty/kernel/stable.git] / drivers / gpu / drm / amd / display / dc / link / protocols / link_edp_panel_control.h
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 bool set_cached_brightness_aux(struct dc_link *link);
34 void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd);
35 int edp_get_backlight_level(const struct dc_link *link);
36 bool edp_get_backlight_level_nits(struct dc_link *link,
37 uint32_t *backlight_millinits_avg,
38 uint32_t *backlight_millinits_peak);
39 bool edp_set_backlight_level(const struct dc_link *link,
40 uint32_t backlight_pwm_u16_16,
41 uint32_t frame_ramp);
42 bool edp_set_backlight_level_nits(struct dc_link *link,
43 bool isHDR,
44 uint32_t backlight_millinits,
45 uint32_t transition_time_in_ms);
46 int edp_get_target_backlight_pwm(const struct dc_link *link);
47 bool edp_get_psr_state(const struct dc_link *link, enum dc_psr_state *state);
48 bool edp_set_psr_allow_active(struct dc_link *link, const bool *allow_active,
49 bool wait, bool force_static, const unsigned int *power_opts);
50 bool edp_setup_psr(struct dc_link *link,
51 const struct dc_stream_state *stream, struct psr_config *psr_config,
52 struct psr_context *psr_context);
53 bool edp_set_sink_vtotal_in_psr_active(const struct dc_link *link,
54 uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su);
55 void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency);
56 bool edp_set_replay_allow_active(struct dc_link *dc_link, const bool *enable,
57 bool wait, bool force_static, const unsigned int *power_opts);
58 bool edp_setup_replay(struct dc_link *link,
59 const struct dc_stream_state *stream);
60 bool edp_set_coasting_vtotal(struct dc_link *link, uint16_t coasting_vtotal);
61 bool edp_replay_residency(const struct dc_link *link,
62 unsigned int *residency, const bool is_start, const bool is_alpm);
63 bool edp_get_replay_state(const struct dc_link *link, uint64_t *state);
64 bool edp_wait_for_t12(struct dc_link *link);
65 bool edp_is_ilr_optimization_required(struct dc_link *link,
66 struct dc_crtc_timing *crtc_timing);
67 bool edp_is_ilr_optimization_enabled(struct dc_link *link);
68 enum dc_link_rate get_max_link_rate_from_ilr_table(struct dc_link *link);
69 bool edp_backlight_enable_aux(struct dc_link *link, bool enable);
70 void edp_add_delay_for_T9(struct dc_link *link);
71 bool edp_receiver_ready_T9(struct dc_link *link);
72 bool edp_receiver_ready_T7(struct dc_link *link);
73 bool edp_power_alpm_dpcd_enable(struct dc_link *link, bool enable);
74 void edp_set_panel_power(struct dc_link *link, bool powerOn);
75 #endif /* __DC_LINK_EDP_POWER_CONTROL_H__ */