xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/amd/display/dc/dm_helpers.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: dm_helpers.h,v 1.2 2021/12/18 23:45:00 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2012-15 Advanced Micro Devices, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * Authors: AMD
25  *
26  */
27 
28 /**
29  * This file defines helper functions provided by the Display Manager to
30  * Display Core.
31  */
32 #ifndef __DM_HELPERS__
33 #define __DM_HELPERS__
34 
35 #include "dc_types.h"
36 #include "dc.h"
37 
38 struct dp_mst_stream_allocation_table;
39 
40 enum dc_edid_status dm_helpers_parse_edid_caps(
41 	struct dc_context *ctx,
42 	const struct dc_edid *edid,
43 	struct dc_edid_caps *edid_caps);
44 
45 
46 /*
47  * Update DP branch info
48  */
49 void dm_helpers_dp_update_branch_info(
50 		struct dc_context *ctx,
51 		const struct dc_link *link);
52 
53 /*
54  * Writes payload allocation table in immediate downstream device.
55  */
56 bool dm_helpers_dp_mst_write_payload_allocation_table(
57 		struct dc_context *ctx,
58 		const struct dc_stream_state *stream,
59 		struct dp_mst_stream_allocation_table *proposed_table,
60 		bool enable);
61 
62 /*
63  * poll pending down reply
64  */
65 void dm_helpers_dp_mst_poll_pending_down_reply(
66 	struct dc_context *ctx,
67 	const struct dc_link *link);
68 
69 /*
70  * Clear payload allocation table before enable MST DP link.
71  */
72 void dm_helpers_dp_mst_clear_payload_allocation_table(
73 	struct dc_context *ctx,
74 	const struct dc_link *link);
75 
76 /*
77  * Polls for ACT (allocation change trigger) handled and
78  */
79 enum act_return_status dm_helpers_dp_mst_poll_for_allocation_change_trigger(
80 		struct dc_context *ctx,
81 		const struct dc_stream_state *stream);
82 /*
83  * Sends ALLOCATE_PAYLOAD message.
84  */
85 bool dm_helpers_dp_mst_send_payload_allocation(
86 		struct dc_context *ctx,
87 		const struct dc_stream_state *stream,
88 		bool enable);
89 
90 bool dm_helpers_dp_mst_start_top_mgr(
91 		struct dc_context *ctx,
92 		const struct dc_link *link,
93 		bool boot);
94 
95 void dm_helpers_dp_mst_stop_top_mgr(
96 		struct dc_context *ctx,
97 		const struct dc_link *link);
98 /**
99  * OS specific aux read callback.
100  */
101 bool dm_helpers_dp_read_dpcd(
102 		struct dc_context *ctx,
103 		const struct dc_link *link,
104 		uint32_t address,
105 		uint8_t *data,
106 		uint32_t size);
107 
108 /**
109  * OS specific aux write callback.
110  */
111 bool dm_helpers_dp_write_dpcd(
112 		struct dc_context *ctx,
113 		const struct dc_link *link,
114 		uint32_t address,
115 		const uint8_t *data,
116 		uint32_t size);
117 
118 bool dm_helpers_submit_i2c(
119 		struct dc_context *ctx,
120 		const struct dc_link *link,
121 		struct i2c_command *cmd);
122 
123 bool dm_helpers_dp_write_dsc_enable(
124 		struct dc_context *ctx,
125 		const struct dc_stream_state *stream,
126 		bool enable
127 );
128 bool dm_helpers_is_dp_sink_present(
129 		struct dc_link *link);
130 
131 enum dc_edid_status dm_helpers_read_local_edid(
132 		struct dc_context *ctx,
133 		struct dc_link *link,
134 		struct dc_sink *sink);
135 
136 void dm_set_dcn_clocks(
137 		struct dc_context *ctx,
138 		struct dc_clocks *clks);
139 
140 #endif /* __DM_HELPERS__ */
141