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_DP_CAPABILITY_H__ |
27 | #define __DC_LINK_DP_CAPABILITY_H__ |
28 | |
29 | #include "link.h" |
30 | |
31 | bool detect_dp_sink_caps(struct dc_link *link); |
32 | |
33 | void detect_edp_sink_caps(struct dc_link *link); |
34 | |
35 | struct dc_link_settings dp_get_max_link_cap(struct dc_link *link); |
36 | |
37 | bool dp_get_max_link_enc_cap(const struct dc_link *link, |
38 | struct dc_link_settings *max_link_enc_cap); |
39 | |
40 | const struct dc_link_settings *dp_get_verified_link_cap( |
41 | const struct dc_link *link); |
42 | |
43 | enum dp_link_encoding link_dp_get_encoding_format( |
44 | const struct dc_link_settings *link_settings); |
45 | |
46 | enum dc_status dp_retrieve_lttpr_cap(struct dc_link *link); |
47 | |
48 | /* Convert PHY repeater count read from DPCD uint8_t. */ |
49 | uint8_t dp_parse_lttpr_repeater_count(uint8_t lttpr_repeater_count); |
50 | |
51 | bool dp_is_sink_present(struct dc_link *link); |
52 | |
53 | bool dp_is_lttpr_present(struct dc_link *link); |
54 | |
55 | bool dp_is_fec_supported(const struct dc_link *link); |
56 | |
57 | bool is_dp_active_dongle(const struct dc_link *link); |
58 | |
59 | bool is_dp_branch_device(const struct dc_link *link); |
60 | |
61 | void dpcd_write_cable_id_to_dprx(struct dc_link *link); |
62 | |
63 | bool dp_should_enable_fec(const struct dc_link *link); |
64 | |
65 | bool dp_is_128b_132b_signal(struct pipe_ctx *pipe_ctx); |
66 | |
67 | /* Initialize output parameter lt_settings. */ |
68 | void dp_decide_training_settings( |
69 | struct dc_link *link, |
70 | const struct dc_link_settings *link_setting, |
71 | struct link_training_settings *lt_settings); |
72 | |
73 | bool link_decide_link_settings( |
74 | struct dc_stream_state *stream, |
75 | struct dc_link_settings *link_setting); |
76 | |
77 | bool edp_decide_link_settings(struct dc_link *link, |
78 | struct dc_link_settings *link_setting, uint32_t req_bw); |
79 | |
80 | bool decide_edp_link_settings_with_dsc(struct dc_link *link, |
81 | struct dc_link_settings *link_setting, |
82 | uint32_t req_bw, |
83 | enum dc_link_rate max_link_rate); |
84 | |
85 | enum dp_link_encoding mst_decide_link_encoding_format(const struct dc_link *link); |
86 | |
87 | void dpcd_set_source_specific_data(struct dc_link *link); |
88 | |
89 | /*query dpcd for version and mst cap addresses*/ |
90 | bool read_is_mst_supported(struct dc_link *link); |
91 | |
92 | bool decide_fallback_link_setting( |
93 | struct dc_link *link, |
94 | struct dc_link_settings *max, |
95 | struct dc_link_settings *cur, |
96 | enum link_training_result training_result); |
97 | |
98 | bool dp_verify_link_cap_with_retries( |
99 | struct dc_link *link, |
100 | struct dc_link_settings *known_limit_link_setting, |
101 | int attempts); |
102 | |
103 | uint32_t link_bw_kbps_from_raw_frl_link_rate_data(uint8_t bw); |
104 | |
105 | bool dp_overwrite_extended_receiver_cap(struct dc_link *link); |
106 | |
107 | #endif /* __DC_LINK_DP_CAPABILITY_H__ */ |
108 | |