1 /*
2  * Copyright 2012-15 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 /**
27  * This file defines helper functions provided by the Display Manager to
28  * Display Core.
29  */
30 #ifndef __DM_HELPERS__
31 #define __DM_HELPERS__
32 
33 #include "dc_types.h"
34 #include "dc.h"
35 
36 struct dp_mst_stream_allocation_table;
37 
38 enum dc_edid_status dm_helpers_parse_edid_caps(
39 	struct dc_context *ctx,
40 	const struct dc_edid *edid,
41 	struct dc_edid_caps *edid_caps);
42 
43 /*
44  * Writes payload allocation table in immediate downstream device.
45  */
46 bool dm_helpers_dp_mst_write_payload_allocation_table(
47 		struct dc_context *ctx,
48 		const struct dc_stream_state *stream,
49 		struct dp_mst_stream_allocation_table *proposed_table,
50 		bool enable);
51 
52 /*
53  * Clear payload allocation table before enable MST DP link.
54  */
55 void dm_helpers_dp_mst_clear_payload_allocation_table(
56 	struct dc_context *ctx,
57 	const struct dc_link *link);
58 
59 /*
60  * Polls for ACT (allocation change trigger) handled and
61  */
62 bool dm_helpers_dp_mst_poll_for_allocation_change_trigger(
63 		struct dc_context *ctx,
64 		const struct dc_stream_state *stream);
65 /*
66  * Sends ALLOCATE_PAYLOAD message.
67  */
68 bool dm_helpers_dp_mst_send_payload_allocation(
69 		struct dc_context *ctx,
70 		const struct dc_stream_state *stream,
71 		bool enable);
72 
73 bool dm_helpers_dp_mst_start_top_mgr(
74 		struct dc_context *ctx,
75 		const struct dc_link *link,
76 		bool boot);
77 
78 void dm_helpers_dp_mst_stop_top_mgr(
79 		struct dc_context *ctx,
80 		const struct dc_link *link);
81 /**
82  * OS specific aux read callback.
83  */
84 bool dm_helpers_dp_read_dpcd(
85 		struct dc_context *ctx,
86 		const struct dc_link *link,
87 		uint32_t address,
88 		uint8_t *data,
89 		uint32_t size);
90 
91 /**
92  * OS specific aux write callback.
93  */
94 bool dm_helpers_dp_write_dpcd(
95 		struct dc_context *ctx,
96 		const struct dc_link *link,
97 		uint32_t address,
98 		const uint8_t *data,
99 		uint32_t size);
100 
101 bool dm_helpers_submit_i2c(
102 		struct dc_context *ctx,
103 		const struct dc_link *link,
104 		struct i2c_command *cmd);
105 
106 enum dc_edid_status dm_helpers_read_local_edid(
107 		struct dc_context *ctx,
108 		struct dc_link *link,
109 		struct dc_sink *sink);
110 
111 void dm_set_dcn_clocks(
112 		struct dc_context *ctx,
113 		struct dc_clocks *clks);
114 
115 #endif /* __DM_HELPERS__ */
116