1 /*
2 * Copyright 2023 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 /* FILE POLICY AND INTENDED USAGE:
27 * This file provides single entrance to link functionality declared in dc
28 * public headers. The file is intended to be used as a thin translation layer
29 * that directly calls link internal functions without adding new functional
30 * behavior.
31 *
32 * When exporting a new link related dc function, add function declaration in
33 * dc.h with detail interface documentation, then add function implementation
34 * in this file which calls link functions.
35 */
36 #include "link.h"
37
dc_link_detect(struct dc_link * link,enum dc_detect_reason reason)38 bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
39 {
40 return link_detect(link, reason);
41 }
42
dc_link_detect_connection_type(struct dc_link * link,enum dc_connection_type * type)43 bool dc_link_detect_connection_type(struct dc_link *link,
44 enum dc_connection_type *type)
45 {
46 return link_detect_connection_type(link, type);
47 }
48
dc_link_get_status(const struct dc_link * link)49 const struct dc_link_status *dc_link_get_status(const struct dc_link *link)
50 {
51 return link_get_status(link);
52 }
53 #ifdef CONFIG_DRM_AMD_DC_HDCP
54
55 /* return true if the connected receiver supports the hdcp version */
dc_link_is_hdcp14(struct dc_link * link,enum signal_type signal)56 bool dc_link_is_hdcp14(struct dc_link *link, enum signal_type signal)
57 {
58 return link_is_hdcp14(link, signal);
59 }
60
dc_link_is_hdcp22(struct dc_link * link,enum signal_type signal)61 bool dc_link_is_hdcp22(struct dc_link *link, enum signal_type signal)
62 {
63 return link_is_hdcp22(link, signal);
64 }
65 #endif
66
dc_link_clear_dprx_states(struct dc_link * link)67 void dc_link_clear_dprx_states(struct dc_link *link)
68 {
69 link_clear_dprx_states(link);
70 }
71
dc_link_reset_cur_dp_mst_topology(struct dc_link * link)72 bool dc_link_reset_cur_dp_mst_topology(struct dc_link *link)
73 {
74 return link_reset_cur_dp_mst_topology(link);
75 }
76
dc_link_bandwidth_kbps(const struct dc_link * link,const struct dc_link_settings * link_settings)77 uint32_t dc_link_bandwidth_kbps(
78 const struct dc_link *link,
79 const struct dc_link_settings *link_settings)
80 {
81 return dp_link_bandwidth_kbps(link, link_settings);
82 }
83
dc_bandwidth_in_kbps_from_timing(const struct dc_crtc_timing * timing)84 uint32_t dc_bandwidth_in_kbps_from_timing(
85 const struct dc_crtc_timing *timing)
86 {
87 return link_timing_bandwidth_kbps(timing);
88 }
89
dc_get_cur_link_res_map(const struct dc * dc,uint32_t * map)90 void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map)
91 {
92 link_get_cur_res_map(dc, map);
93 }
94
dc_restore_link_res_map(const struct dc * dc,uint32_t * map)95 void dc_restore_link_res_map(const struct dc *dc, uint32_t *map)
96 {
97 link_restore_res_map(dc, map);
98 }
99
dc_link_update_dsc_config(struct pipe_ctx * pipe_ctx)100 bool dc_link_update_dsc_config(struct pipe_ctx *pipe_ctx)
101 {
102 return link_update_dsc_config(pipe_ctx);
103 }
104