2 * Copyright 2012-15 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
27 * This file defines helper functions provided by the Display Manager to
30 #ifndef __DM_HELPERS__
31 #define __DM_HELPERS__
36 struct dc_dp_mst_stream_allocation_table;
38 enum aux_return_code_type;
39 enum set_config_status;
42 * Allocate memory accessible by the GPU
44 * frame buffer allocations must be aligned to a 4096-byte boundary
46 * Returns virtual address, sets addr to physical address
48 void *dm_helpers_allocate_gpu_mem(
49 struct dc_context *ctx,
50 enum dc_gpu_mem_alloc_type type,
55 * Free the GPU-accessible memory at the virtual address pvMem
57 void dm_helpers_free_gpu_mem(
58 struct dc_context *ctx,
59 enum dc_gpu_mem_alloc_type type,
62 enum dc_edid_status dm_helpers_parse_edid_caps(
64 const struct dc_edid *edid,
65 struct dc_edid_caps *edid_caps);
69 * Update DP branch info
71 void dm_helpers_dp_update_branch_info(
72 struct dc_context *ctx,
73 const struct dc_link *link);
76 * Writes payload allocation table in immediate downstream device.
78 bool dm_helpers_dp_mst_write_payload_allocation_table(
79 struct dc_context *ctx,
80 const struct dc_stream_state *stream,
81 struct dc_dp_mst_stream_allocation_table *proposed_table,
85 * poll pending down reply
87 void dm_helpers_dp_mst_poll_pending_down_reply(
88 struct dc_context *ctx,
89 const struct dc_link *link);
92 * Clear payload allocation table before enable MST DP link.
94 void dm_helpers_dp_mst_clear_payload_allocation_table(
95 struct dc_context *ctx,
96 const struct dc_link *link);
99 * Polls for ACT (allocation change trigger) handled and
101 enum act_return_status dm_helpers_dp_mst_poll_for_allocation_change_trigger(
102 struct dc_context *ctx,
103 const struct dc_stream_state *stream);
105 * Sends ALLOCATE_PAYLOAD message.
107 void dm_helpers_dp_mst_send_payload_allocation(
108 struct dc_context *ctx,
109 const struct dc_stream_state *stream);
112 * Update mst manager relevant variables
114 void dm_helpers_dp_mst_update_mst_mgr_for_deallocation(
115 struct dc_context *ctx,
116 const struct dc_stream_state *stream);
118 bool dm_helpers_dp_mst_start_top_mgr(
119 struct dc_context *ctx,
120 const struct dc_link *link,
123 bool dm_helpers_dp_mst_stop_top_mgr(
124 struct dc_context *ctx,
125 struct dc_link *link);
127 void dm_helpers_dp_mst_update_branch_bandwidth(
128 struct dc_context *ctx,
129 struct dc_link *link);
132 * OS specific aux read callback.
134 bool dm_helpers_dp_read_dpcd(
135 struct dc_context *ctx,
136 const struct dc_link *link,
142 * OS specific aux write callback.
144 bool dm_helpers_dp_write_dpcd(
145 struct dc_context *ctx,
146 const struct dc_link *link,
151 bool dm_helpers_submit_i2c(
152 struct dc_context *ctx,
153 const struct dc_link *link,
154 struct i2c_command *cmd);
156 bool dm_helpers_dp_write_dsc_enable(
157 struct dc_context *ctx,
158 const struct dc_stream_state *stream,
161 bool dm_helpers_is_dp_sink_present(
162 struct dc_link *link);
164 void dm_helpers_mst_enable_stream_features(const struct dc_stream_state *stream);
166 enum dc_edid_status dm_helpers_read_local_edid(
167 struct dc_context *ctx,
168 struct dc_link *link,
169 struct dc_sink *sink);
171 bool dm_helpers_dp_handle_test_pattern_request(
172 struct dc_context *ctx,
173 const struct dc_link *link,
174 union link_test_pattern dpcd_test_pattern,
175 union test_misc dpcd_test_params);
177 void dm_set_dcn_clocks(
178 struct dc_context *ctx,
179 struct dc_clocks *clks);
181 void dm_helpers_enable_periodic_detection(struct dc_context *ctx, bool enable);
183 void dm_set_phyd32clk(struct dc_context *ctx, int freq_khz);
185 bool dm_helpers_dmub_outbox_interrupt_control(struct dc_context *ctx, bool enable);
187 void dm_helpers_smu_timeout(struct dc_context *ctx, unsigned int msg_id, unsigned int param, unsigned int timeout_us);
189 // 0x1 = Result_OK, 0xFE = Result_UnkmownCmd, 0x0 = Status_Busy
190 #define IS_SMU_TIMEOUT(result) \
192 void dm_helpers_init_panel_settings(
193 struct dc_context *ctx,
194 struct dc_panel_config *config,
195 struct dc_sink *sink);
196 void dm_helpers_override_panel_settings(
197 struct dc_context *ctx,
198 struct dc_panel_config *config);
199 int dm_helper_dmub_aux_transfer_sync(
200 struct dc_context *ctx,
201 const struct dc_link *link,
202 struct aux_payload *payload,
203 enum aux_return_code_type *operation_result);
205 int dm_helpers_dmub_set_config_sync(struct dc_context *ctx,
206 const struct dc_link *link,
207 struct set_config_cmd_payload *payload,
208 enum set_config_status *operation_result);
209 enum adaptive_sync_type dm_get_adaptive_sync_support_type(struct dc_link *link);
211 enum dc_edid_status dm_helpers_get_sbios_edid(struct dc_link *link, struct dc_edid *edid);
213 bool dm_helpers_is_fullscreen(struct dc_context *ctx, struct dc_stream_state *stream);
214 bool dm_helpers_is_hdr_on(struct dc_context *ctx, struct dc_stream_state *stream);
216 #endif /* __DM_HELPERS__ */