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 dp_mst_stream_allocation_table;
38 enum aux_return_code_type;
41 * Allocate memory accessible by the GPU
43 * frame buffer allocations must be aligned to a 4096-byte boundary
45 * Returns virtual address, sets addr to physical address
47 void *dm_helpers_allocate_gpu_mem(
48 struct dc_context *ctx,
49 enum dc_gpu_mem_alloc_type type,
54 * Free the GPU-accessible memory at the virtual address pvMem
56 void dm_helpers_free_gpu_mem(
57 struct dc_context *ctx,
58 enum dc_gpu_mem_alloc_type type,
61 enum dc_edid_status dm_helpers_parse_edid_caps(
62 struct dc_context *ctx,
63 const struct dc_edid *edid,
64 struct dc_edid_caps *edid_caps);
68 * Update DP branch info
70 void dm_helpers_dp_update_branch_info(
71 struct dc_context *ctx,
72 const struct dc_link *link);
75 * Writes payload allocation table in immediate downstream device.
77 bool dm_helpers_dp_mst_write_payload_allocation_table(
78 struct dc_context *ctx,
79 const struct dc_stream_state *stream,
80 struct dp_mst_stream_allocation_table *proposed_table,
84 * poll pending down reply
86 void dm_helpers_dp_mst_poll_pending_down_reply(
87 struct dc_context *ctx,
88 const struct dc_link *link);
91 * Clear payload allocation table before enable MST DP link.
93 void dm_helpers_dp_mst_clear_payload_allocation_table(
94 struct dc_context *ctx,
95 const struct dc_link *link);
98 * Polls for ACT (allocation change trigger) handled and
100 enum act_return_status dm_helpers_dp_mst_poll_for_allocation_change_trigger(
101 struct dc_context *ctx,
102 const struct dc_stream_state *stream);
104 * Sends ALLOCATE_PAYLOAD message.
106 bool dm_helpers_dp_mst_send_payload_allocation(
107 struct dc_context *ctx,
108 const struct dc_stream_state *stream,
111 bool dm_helpers_dp_mst_start_top_mgr(
112 struct dc_context *ctx,
113 const struct dc_link *link,
116 void dm_helpers_dp_mst_stop_top_mgr(
117 struct dc_context *ctx,
118 struct dc_link *link);
120 * OS specific aux read callback.
122 bool dm_helpers_dp_read_dpcd(
123 struct dc_context *ctx,
124 const struct dc_link *link,
130 * OS specific aux write callback.
132 bool dm_helpers_dp_write_dpcd(
133 struct dc_context *ctx,
134 const struct dc_link *link,
139 bool dm_helpers_submit_i2c(
140 struct dc_context *ctx,
141 const struct dc_link *link,
142 struct i2c_command *cmd);
144 bool dm_helpers_dp_write_dsc_enable(
145 struct dc_context *ctx,
146 const struct dc_stream_state *stream,
149 bool dm_helpers_is_dp_sink_present(
150 struct dc_link *link);
152 void dm_helpers_mst_enable_stream_features(const struct dc_stream_state *stream);
154 enum dc_edid_status dm_helpers_read_local_edid(
155 struct dc_context *ctx,
156 struct dc_link *link,
157 struct dc_sink *sink);
159 void dm_set_dcn_clocks(
160 struct dc_context *ctx,
161 struct dc_clocks *clks);
163 bool dm_helpers_dmub_outbox_interrupt_control(struct dc_context *ctx, bool enable);
165 void dm_helpers_smu_timeout(struct dc_context *ctx, unsigned int msg_id, unsigned int param, unsigned int timeout_us);
167 // 0x1 = Result_OK, 0xFE = Result_UnkmownCmd
168 #define IS_SMU_TIMEOUT(result) \
169 (!(result == 0x1 || result == 0xFE))
171 int dm_helper_dmub_aux_transfer_sync(
172 struct dc_context *ctx,
173 const struct dc_link *link,
174 struct aux_payload *payload,
175 enum aux_return_code_type *operation_result);
176 #endif /* __DM_HELPERS__ */