Rev 6336 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6336 | Rev 6936 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright © 2014 Red Hat. |
2 | * Copyright © 2014 Red Hat. |
3 | * |
3 | * |
4 | * Permission to use, copy, modify, distribute, and sell this software and its |
4 | * Permission to use, copy, modify, distribute, and sell this software and its |
5 | * documentation for any purpose is hereby granted without fee, provided that |
5 | * documentation for any purpose is hereby granted without fee, provided that |
6 | * the above copyright notice appear in all copies and that both that copyright |
6 | * the above copyright notice appear in all copies and that both that copyright |
7 | * notice and this permission notice appear in supporting documentation, and |
7 | * notice and this permission notice appear in supporting documentation, and |
8 | * that the name of the copyright holders not be used in advertising or |
8 | * that the name of the copyright holders not be used in advertising or |
9 | * publicity pertaining to distribution of the software without specific, |
9 | * publicity pertaining to distribution of the software without specific, |
10 | * written prior permission. The copyright holders make no representations |
10 | * written prior permission. The copyright holders make no representations |
11 | * about the suitability of this software for any purpose. It is provided "as |
11 | * about the suitability of this software for any purpose. It is provided "as |
12 | * is" without express or implied warranty. |
12 | * is" without express or implied warranty. |
13 | * |
13 | * |
14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
14 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
16 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
20 | * OF THIS SOFTWARE. |
20 | * OF THIS SOFTWARE. |
21 | */ |
21 | */ |
22 | #ifndef _DRM_DP_MST_HELPER_H_ |
22 | #ifndef _DRM_DP_MST_HELPER_H_ |
23 | #define _DRM_DP_MST_HELPER_H_ |
23 | #define _DRM_DP_MST_HELPER_H_ |
24 | 24 | ||
25 | #include |
25 | #include |
26 | #include |
26 | #include |
27 | 27 | ||
28 | struct drm_dp_mst_branch; |
28 | struct drm_dp_mst_branch; |
29 | 29 | ||
30 | /** |
30 | /** |
31 | * struct drm_dp_vcpi - Virtual Channel Payload Identifier |
31 | * struct drm_dp_vcpi - Virtual Channel Payload Identifier |
32 | * @vcpi: Virtual channel ID. |
32 | * @vcpi: Virtual channel ID. |
33 | * @pbn: Payload Bandwidth Number for this channel |
33 | * @pbn: Payload Bandwidth Number for this channel |
34 | * @aligned_pbn: PBN aligned with slot size |
34 | * @aligned_pbn: PBN aligned with slot size |
35 | * @num_slots: number of slots for this PBN |
35 | * @num_slots: number of slots for this PBN |
36 | */ |
36 | */ |
37 | struct drm_dp_vcpi { |
37 | struct drm_dp_vcpi { |
38 | int vcpi; |
38 | int vcpi; |
39 | int pbn; |
39 | int pbn; |
40 | int aligned_pbn; |
40 | int aligned_pbn; |
41 | int num_slots; |
41 | int num_slots; |
42 | }; |
42 | }; |
43 | 43 | ||
44 | /** |
44 | /** |
45 | * struct drm_dp_mst_port - MST port |
45 | * struct drm_dp_mst_port - MST port |
46 | * @kref: reference count for this port. |
46 | * @kref: reference count for this port. |
47 | * @port_num: port number |
47 | * @port_num: port number |
48 | * @input: if this port is an input port. |
48 | * @input: if this port is an input port. |
49 | * @mcs: message capability status - DP 1.2 spec. |
49 | * @mcs: message capability status - DP 1.2 spec. |
50 | * @ddps: DisplayPort Device Plug Status - DP 1.2 |
50 | * @ddps: DisplayPort Device Plug Status - DP 1.2 |
51 | * @pdt: Peer Device Type |
51 | * @pdt: Peer Device Type |
52 | * @ldps: Legacy Device Plug Status |
52 | * @ldps: Legacy Device Plug Status |
53 | * @dpcd_rev: DPCD revision of device on this port |
53 | * @dpcd_rev: DPCD revision of device on this port |
54 | * @num_sdp_streams: Number of simultaneous streams |
54 | * @num_sdp_streams: Number of simultaneous streams |
55 | * @num_sdp_stream_sinks: Number of stream sinks |
55 | * @num_sdp_stream_sinks: Number of stream sinks |
56 | * @available_pbn: Available bandwidth for this port. |
56 | * @available_pbn: Available bandwidth for this port. |
57 | * @next: link to next port on this branch device |
57 | * @next: link to next port on this branch device |
58 | * @mstb: branch device attach below this port |
58 | * @mstb: branch device attach below this port |
59 | * @aux: i2c aux transport to talk to device connected to this port. |
59 | * @aux: i2c aux transport to talk to device connected to this port. |
60 | * @parent: branch device parent of this port |
60 | * @parent: branch device parent of this port |
61 | * @vcpi: Virtual Channel Payload info for this port. |
61 | * @vcpi: Virtual Channel Payload info for this port. |
62 | * @connector: DRM connector this port is connected to. |
62 | * @connector: DRM connector this port is connected to. |
63 | * @mgr: topology manager this port lives under. |
63 | * @mgr: topology manager this port lives under. |
64 | * |
64 | * |
65 | * This structure represents an MST port endpoint on a device somewhere |
65 | * This structure represents an MST port endpoint on a device somewhere |
66 | * in the MST topology. |
66 | * in the MST topology. |
67 | */ |
67 | */ |
68 | struct drm_dp_mst_port { |
68 | struct drm_dp_mst_port { |
69 | struct kref kref; |
69 | struct kref kref; |
70 | 70 | ||
71 | u8 port_num; |
71 | u8 port_num; |
72 | bool input; |
72 | bool input; |
73 | bool mcs; |
73 | bool mcs; |
74 | bool ddps; |
74 | bool ddps; |
75 | u8 pdt; |
75 | u8 pdt; |
76 | bool ldps; |
76 | bool ldps; |
77 | u8 dpcd_rev; |
77 | u8 dpcd_rev; |
78 | u8 num_sdp_streams; |
78 | u8 num_sdp_streams; |
79 | u8 num_sdp_stream_sinks; |
79 | u8 num_sdp_stream_sinks; |
80 | uint16_t available_pbn; |
80 | uint16_t available_pbn; |
81 | struct list_head next; |
81 | struct list_head next; |
82 | struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */ |
82 | struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */ |
83 | struct drm_dp_aux aux; /* i2c bus for this port? */ |
83 | struct drm_dp_aux aux; /* i2c bus for this port? */ |
84 | struct drm_dp_mst_branch *parent; |
84 | struct drm_dp_mst_branch *parent; |
85 | 85 | ||
86 | struct drm_dp_vcpi vcpi; |
86 | struct drm_dp_vcpi vcpi; |
87 | struct drm_connector *connector; |
87 | struct drm_connector *connector; |
88 | struct drm_dp_mst_topology_mgr *mgr; |
88 | struct drm_dp_mst_topology_mgr *mgr; |
89 | 89 | ||
90 | struct edid *cached_edid; /* for DP logical ports - make tiling work */ |
90 | struct edid *cached_edid; /* for DP logical ports - make tiling work */ |
- | 91 | bool has_audio; |
|
91 | }; |
92 | }; |
92 | 93 | ||
93 | /** |
94 | /** |
94 | * struct drm_dp_mst_branch - MST branch device. |
95 | * struct drm_dp_mst_branch - MST branch device. |
95 | * @kref: reference count for this port. |
96 | * @kref: reference count for this port. |
96 | * @rad: Relative Address to talk to this branch device. |
97 | * @rad: Relative Address to talk to this branch device. |
97 | * @lct: Link count total to talk to this branch device. |
98 | * @lct: Link count total to talk to this branch device. |
98 | * @num_ports: number of ports on the branch. |
99 | * @num_ports: number of ports on the branch. |
99 | * @msg_slots: one bit per transmitted msg slot. |
100 | * @msg_slots: one bit per transmitted msg slot. |
100 | * @ports: linked list of ports on this branch. |
101 | * @ports: linked list of ports on this branch. |
101 | * @port_parent: pointer to the port parent, NULL if toplevel. |
102 | * @port_parent: pointer to the port parent, NULL if toplevel. |
102 | * @mgr: topology manager for this branch device. |
103 | * @mgr: topology manager for this branch device. |
103 | * @tx_slots: transmission slots for this device. |
104 | * @tx_slots: transmission slots for this device. |
104 | * @last_seqno: last sequence number used to talk to this. |
105 | * @last_seqno: last sequence number used to talk to this. |
105 | * @link_address_sent: if a link address message has been sent to this device yet. |
106 | * @link_address_sent: if a link address message has been sent to this device yet. |
106 | * @guid: guid for DP 1.2 branch device. port under this branch can be |
107 | * @guid: guid for DP 1.2 branch device. port under this branch can be |
107 | * identified by port #. |
108 | * identified by port #. |
108 | * |
109 | * |
109 | * This structure represents an MST branch device, there is one |
110 | * This structure represents an MST branch device, there is one |
110 | * primary branch device at the root, along with any other branches connected |
111 | * primary branch device at the root, along with any other branches connected |
111 | * to downstream port of parent branches. |
112 | * to downstream port of parent branches. |
112 | */ |
113 | */ |
113 | struct drm_dp_mst_branch { |
114 | struct drm_dp_mst_branch { |
114 | struct kref kref; |
115 | struct kref kref; |
115 | u8 rad[8]; |
116 | u8 rad[8]; |
116 | u8 lct; |
117 | u8 lct; |
117 | int num_ports; |
118 | int num_ports; |
118 | 119 | ||
119 | int msg_slots; |
120 | int msg_slots; |
120 | struct list_head ports; |
121 | struct list_head ports; |
121 | 122 | ||
122 | /* list of tx ops queue for this port */ |
123 | /* list of tx ops queue for this port */ |
123 | struct drm_dp_mst_port *port_parent; |
124 | struct drm_dp_mst_port *port_parent; |
124 | struct drm_dp_mst_topology_mgr *mgr; |
125 | struct drm_dp_mst_topology_mgr *mgr; |
125 | 126 | ||
126 | /* slots are protected by mstb->mgr->qlock */ |
127 | /* slots are protected by mstb->mgr->qlock */ |
127 | struct drm_dp_sideband_msg_tx *tx_slots[2]; |
128 | struct drm_dp_sideband_msg_tx *tx_slots[2]; |
128 | int last_seqno; |
129 | int last_seqno; |
129 | bool link_address_sent; |
130 | bool link_address_sent; |
130 | 131 | ||
131 | /* global unique identifier to identify branch devices */ |
132 | /* global unique identifier to identify branch devices */ |
132 | u8 guid[16]; |
133 | u8 guid[16]; |
133 | }; |
134 | }; |
134 | 135 | ||
135 | 136 | ||
136 | /* sideband msg header - not bit struct */ |
137 | /* sideband msg header - not bit struct */ |
137 | struct drm_dp_sideband_msg_hdr { |
138 | struct drm_dp_sideband_msg_hdr { |
138 | u8 lct; |
139 | u8 lct; |
139 | u8 lcr; |
140 | u8 lcr; |
140 | u8 rad[8]; |
141 | u8 rad[8]; |
141 | bool broadcast; |
142 | bool broadcast; |
142 | bool path_msg; |
143 | bool path_msg; |
143 | u8 msg_len; |
144 | u8 msg_len; |
144 | bool somt; |
145 | bool somt; |
145 | bool eomt; |
146 | bool eomt; |
146 | bool seqno; |
147 | bool seqno; |
147 | }; |
148 | }; |
148 | 149 | ||
149 | struct drm_dp_nak_reply { |
150 | struct drm_dp_nak_reply { |
150 | u8 guid[16]; |
151 | u8 guid[16]; |
151 | u8 reason; |
152 | u8 reason; |
152 | u8 nak_data; |
153 | u8 nak_data; |
153 | }; |
154 | }; |
154 | 155 | ||
155 | struct drm_dp_link_address_ack_reply { |
156 | struct drm_dp_link_address_ack_reply { |
156 | u8 guid[16]; |
157 | u8 guid[16]; |
157 | u8 nports; |
158 | u8 nports; |
158 | struct drm_dp_link_addr_reply_port { |
159 | struct drm_dp_link_addr_reply_port { |
159 | bool input_port; |
160 | bool input_port; |
160 | u8 peer_device_type; |
161 | u8 peer_device_type; |
161 | u8 port_number; |
162 | u8 port_number; |
162 | bool mcs; |
163 | bool mcs; |
163 | bool ddps; |
164 | bool ddps; |
164 | bool legacy_device_plug_status; |
165 | bool legacy_device_plug_status; |
165 | u8 dpcd_revision; |
166 | u8 dpcd_revision; |
166 | u8 peer_guid[16]; |
167 | u8 peer_guid[16]; |
167 | u8 num_sdp_streams; |
168 | u8 num_sdp_streams; |
168 | u8 num_sdp_stream_sinks; |
169 | u8 num_sdp_stream_sinks; |
169 | } ports[16]; |
170 | } ports[16]; |
170 | }; |
171 | }; |
171 | 172 | ||
172 | struct drm_dp_remote_dpcd_read_ack_reply { |
173 | struct drm_dp_remote_dpcd_read_ack_reply { |
173 | u8 port_number; |
174 | u8 port_number; |
174 | u8 num_bytes; |
175 | u8 num_bytes; |
175 | u8 bytes[255]; |
176 | u8 bytes[255]; |
176 | }; |
177 | }; |
177 | 178 | ||
178 | struct drm_dp_remote_dpcd_write_ack_reply { |
179 | struct drm_dp_remote_dpcd_write_ack_reply { |
179 | u8 port_number; |
180 | u8 port_number; |
180 | }; |
181 | }; |
181 | 182 | ||
182 | struct drm_dp_remote_dpcd_write_nak_reply { |
183 | struct drm_dp_remote_dpcd_write_nak_reply { |
183 | u8 port_number; |
184 | u8 port_number; |
184 | u8 reason; |
185 | u8 reason; |
185 | u8 bytes_written_before_failure; |
186 | u8 bytes_written_before_failure; |
186 | }; |
187 | }; |
187 | 188 | ||
188 | struct drm_dp_remote_i2c_read_ack_reply { |
189 | struct drm_dp_remote_i2c_read_ack_reply { |
189 | u8 port_number; |
190 | u8 port_number; |
190 | u8 num_bytes; |
191 | u8 num_bytes; |
191 | u8 bytes[255]; |
192 | u8 bytes[255]; |
192 | }; |
193 | }; |
193 | 194 | ||
194 | struct drm_dp_remote_i2c_read_nak_reply { |
195 | struct drm_dp_remote_i2c_read_nak_reply { |
195 | u8 port_number; |
196 | u8 port_number; |
196 | u8 nak_reason; |
197 | u8 nak_reason; |
197 | u8 i2c_nak_transaction; |
198 | u8 i2c_nak_transaction; |
198 | }; |
199 | }; |
199 | 200 | ||
200 | struct drm_dp_remote_i2c_write_ack_reply { |
201 | struct drm_dp_remote_i2c_write_ack_reply { |
201 | u8 port_number; |
202 | u8 port_number; |
202 | }; |
203 | }; |
203 | 204 | ||
204 | 205 | ||
205 | struct drm_dp_sideband_msg_rx { |
206 | struct drm_dp_sideband_msg_rx { |
206 | u8 chunk[48]; |
207 | u8 chunk[48]; |
207 | u8 msg[256]; |
208 | u8 msg[256]; |
208 | u8 curchunk_len; |
209 | u8 curchunk_len; |
209 | u8 curchunk_idx; /* chunk we are parsing now */ |
210 | u8 curchunk_idx; /* chunk we are parsing now */ |
210 | u8 curchunk_hdrlen; |
211 | u8 curchunk_hdrlen; |
211 | u8 curlen; /* total length of the msg */ |
212 | u8 curlen; /* total length of the msg */ |
212 | bool have_somt; |
213 | bool have_somt; |
213 | bool have_eomt; |
214 | bool have_eomt; |
214 | struct drm_dp_sideband_msg_hdr initial_hdr; |
215 | struct drm_dp_sideband_msg_hdr initial_hdr; |
215 | }; |
216 | }; |
216 | - | ||
- | 217 | ||
217 | 218 | #define DRM_DP_MAX_SDP_STREAMS 16 |
|
218 | struct drm_dp_allocate_payload { |
219 | struct drm_dp_allocate_payload { |
219 | u8 port_number; |
220 | u8 port_number; |
220 | u8 number_sdp_streams; |
221 | u8 number_sdp_streams; |
221 | u8 vcpi; |
222 | u8 vcpi; |
222 | u16 pbn; |
223 | u16 pbn; |
223 | u8 sdp_stream_sink[8]; |
224 | u8 sdp_stream_sink[DRM_DP_MAX_SDP_STREAMS]; |
224 | }; |
225 | }; |
225 | 226 | ||
226 | struct drm_dp_allocate_payload_ack_reply { |
227 | struct drm_dp_allocate_payload_ack_reply { |
227 | u8 port_number; |
228 | u8 port_number; |
228 | u8 vcpi; |
229 | u8 vcpi; |
229 | u16 allocated_pbn; |
230 | u16 allocated_pbn; |
230 | }; |
231 | }; |
231 | 232 | ||
232 | struct drm_dp_connection_status_notify { |
233 | struct drm_dp_connection_status_notify { |
233 | u8 guid[16]; |
234 | u8 guid[16]; |
234 | u8 port_number; |
235 | u8 port_number; |
235 | bool legacy_device_plug_status; |
236 | bool legacy_device_plug_status; |
236 | bool displayport_device_plug_status; |
237 | bool displayport_device_plug_status; |
237 | bool message_capability_status; |
238 | bool message_capability_status; |
238 | bool input_port; |
239 | bool input_port; |
239 | u8 peer_device_type; |
240 | u8 peer_device_type; |
240 | }; |
241 | }; |
241 | 242 | ||
242 | struct drm_dp_remote_dpcd_read { |
243 | struct drm_dp_remote_dpcd_read { |
243 | u8 port_number; |
244 | u8 port_number; |
244 | u32 dpcd_address; |
245 | u32 dpcd_address; |
245 | u8 num_bytes; |
246 | u8 num_bytes; |
246 | }; |
247 | }; |
247 | 248 | ||
248 | struct drm_dp_remote_dpcd_write { |
249 | struct drm_dp_remote_dpcd_write { |
249 | u8 port_number; |
250 | u8 port_number; |
250 | u32 dpcd_address; |
251 | u32 dpcd_address; |
251 | u8 num_bytes; |
252 | u8 num_bytes; |
252 | u8 *bytes; |
253 | u8 *bytes; |
253 | }; |
254 | }; |
254 | 255 | ||
255 | #define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS 4 |
256 | #define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS 4 |
256 | struct drm_dp_remote_i2c_read { |
257 | struct drm_dp_remote_i2c_read { |
257 | u8 num_transactions; |
258 | u8 num_transactions; |
258 | u8 port_number; |
259 | u8 port_number; |
259 | struct { |
260 | struct { |
260 | u8 i2c_dev_id; |
261 | u8 i2c_dev_id; |
261 | u8 num_bytes; |
262 | u8 num_bytes; |
262 | u8 *bytes; |
263 | u8 *bytes; |
263 | u8 no_stop_bit; |
264 | u8 no_stop_bit; |
264 | u8 i2c_transaction_delay; |
265 | u8 i2c_transaction_delay; |
265 | } transactions[DP_REMOTE_I2C_READ_MAX_TRANSACTIONS]; |
266 | } transactions[DP_REMOTE_I2C_READ_MAX_TRANSACTIONS]; |
266 | u8 read_i2c_device_id; |
267 | u8 read_i2c_device_id; |
267 | u8 num_bytes_read; |
268 | u8 num_bytes_read; |
268 | }; |
269 | }; |
269 | 270 | ||
270 | struct drm_dp_remote_i2c_write { |
271 | struct drm_dp_remote_i2c_write { |
271 | u8 port_number; |
272 | u8 port_number; |
272 | u8 write_i2c_device_id; |
273 | u8 write_i2c_device_id; |
273 | u8 num_bytes; |
274 | u8 num_bytes; |
274 | u8 *bytes; |
275 | u8 *bytes; |
275 | }; |
276 | }; |
276 | 277 | ||
277 | /* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */ |
278 | /* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */ |
278 | struct drm_dp_port_number_req { |
279 | struct drm_dp_port_number_req { |
279 | u8 port_number; |
280 | u8 port_number; |
280 | }; |
281 | }; |
281 | 282 | ||
282 | struct drm_dp_enum_path_resources_ack_reply { |
283 | struct drm_dp_enum_path_resources_ack_reply { |
283 | u8 port_number; |
284 | u8 port_number; |
284 | u16 full_payload_bw_number; |
285 | u16 full_payload_bw_number; |
285 | u16 avail_payload_bw_number; |
286 | u16 avail_payload_bw_number; |
286 | }; |
287 | }; |
287 | 288 | ||
288 | /* covers POWER_DOWN_PHY, POWER_UP_PHY */ |
289 | /* covers POWER_DOWN_PHY, POWER_UP_PHY */ |
289 | struct drm_dp_port_number_rep { |
290 | struct drm_dp_port_number_rep { |
290 | u8 port_number; |
291 | u8 port_number; |
291 | }; |
292 | }; |
292 | 293 | ||
293 | struct drm_dp_query_payload { |
294 | struct drm_dp_query_payload { |
294 | u8 port_number; |
295 | u8 port_number; |
295 | u8 vcpi; |
296 | u8 vcpi; |
296 | }; |
297 | }; |
297 | 298 | ||
298 | struct drm_dp_resource_status_notify { |
299 | struct drm_dp_resource_status_notify { |
299 | u8 port_number; |
300 | u8 port_number; |
300 | u8 guid[16]; |
301 | u8 guid[16]; |
301 | u16 available_pbn; |
302 | u16 available_pbn; |
302 | }; |
303 | }; |
303 | 304 | ||
304 | struct drm_dp_query_payload_ack_reply { |
305 | struct drm_dp_query_payload_ack_reply { |
305 | u8 port_number; |
306 | u8 port_number; |
306 | u8 allocated_pbn; |
307 | u8 allocated_pbn; |
307 | }; |
308 | }; |
308 | 309 | ||
309 | struct drm_dp_sideband_msg_req_body { |
310 | struct drm_dp_sideband_msg_req_body { |
310 | u8 req_type; |
311 | u8 req_type; |
311 | union ack_req { |
312 | union ack_req { |
312 | struct drm_dp_connection_status_notify conn_stat; |
313 | struct drm_dp_connection_status_notify conn_stat; |
313 | struct drm_dp_port_number_req port_num; |
314 | struct drm_dp_port_number_req port_num; |
314 | struct drm_dp_resource_status_notify resource_stat; |
315 | struct drm_dp_resource_status_notify resource_stat; |
315 | 316 | ||
316 | struct drm_dp_query_payload query_payload; |
317 | struct drm_dp_query_payload query_payload; |
317 | struct drm_dp_allocate_payload allocate_payload; |
318 | struct drm_dp_allocate_payload allocate_payload; |
318 | 319 | ||
319 | struct drm_dp_remote_dpcd_read dpcd_read; |
320 | struct drm_dp_remote_dpcd_read dpcd_read; |
320 | struct drm_dp_remote_dpcd_write dpcd_write; |
321 | struct drm_dp_remote_dpcd_write dpcd_write; |
321 | 322 | ||
322 | struct drm_dp_remote_i2c_read i2c_read; |
323 | struct drm_dp_remote_i2c_read i2c_read; |
323 | struct drm_dp_remote_i2c_write i2c_write; |
324 | struct drm_dp_remote_i2c_write i2c_write; |
324 | } u; |
325 | } u; |
325 | }; |
326 | }; |
326 | 327 | ||
327 | struct drm_dp_sideband_msg_reply_body { |
328 | struct drm_dp_sideband_msg_reply_body { |
328 | u8 reply_type; |
329 | u8 reply_type; |
329 | u8 req_type; |
330 | u8 req_type; |
330 | union ack_replies { |
331 | union ack_replies { |
331 | struct drm_dp_nak_reply nak; |
332 | struct drm_dp_nak_reply nak; |
332 | struct drm_dp_link_address_ack_reply link_addr; |
333 | struct drm_dp_link_address_ack_reply link_addr; |
333 | struct drm_dp_port_number_rep port_number; |
334 | struct drm_dp_port_number_rep port_number; |
334 | 335 | ||
335 | struct drm_dp_enum_path_resources_ack_reply path_resources; |
336 | struct drm_dp_enum_path_resources_ack_reply path_resources; |
336 | struct drm_dp_allocate_payload_ack_reply allocate_payload; |
337 | struct drm_dp_allocate_payload_ack_reply allocate_payload; |
337 | struct drm_dp_query_payload_ack_reply query_payload; |
338 | struct drm_dp_query_payload_ack_reply query_payload; |
338 | 339 | ||
339 | struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack; |
340 | struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack; |
340 | struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack; |
341 | struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack; |
341 | struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack; |
342 | struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack; |
342 | 343 | ||
343 | struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack; |
344 | struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack; |
344 | struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack; |
345 | struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack; |
345 | struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack; |
346 | struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack; |
346 | } u; |
347 | } u; |
347 | }; |
348 | }; |
348 | 349 | ||
349 | /* msg is queued to be put into a slot */ |
350 | /* msg is queued to be put into a slot */ |
350 | #define DRM_DP_SIDEBAND_TX_QUEUED 0 |
351 | #define DRM_DP_SIDEBAND_TX_QUEUED 0 |
351 | /* msg has started transmitting on a slot - still on msgq */ |
352 | /* msg has started transmitting on a slot - still on msgq */ |
352 | #define DRM_DP_SIDEBAND_TX_START_SEND 1 |
353 | #define DRM_DP_SIDEBAND_TX_START_SEND 1 |
353 | /* msg has finished transmitting on a slot - removed from msgq only in slot */ |
354 | /* msg has finished transmitting on a slot - removed from msgq only in slot */ |
354 | #define DRM_DP_SIDEBAND_TX_SENT 2 |
355 | #define DRM_DP_SIDEBAND_TX_SENT 2 |
355 | /* msg has received a response - removed from slot */ |
356 | /* msg has received a response - removed from slot */ |
356 | #define DRM_DP_SIDEBAND_TX_RX 3 |
357 | #define DRM_DP_SIDEBAND_TX_RX 3 |
357 | #define DRM_DP_SIDEBAND_TX_TIMEOUT 4 |
358 | #define DRM_DP_SIDEBAND_TX_TIMEOUT 4 |
358 | 359 | ||
359 | struct drm_dp_sideband_msg_tx { |
360 | struct drm_dp_sideband_msg_tx { |
360 | u8 msg[256]; |
361 | u8 msg[256]; |
361 | u8 chunk[48]; |
362 | u8 chunk[48]; |
362 | u8 cur_offset; |
363 | u8 cur_offset; |
363 | u8 cur_len; |
364 | u8 cur_len; |
364 | struct drm_dp_mst_branch *dst; |
365 | struct drm_dp_mst_branch *dst; |
365 | struct list_head next; |
366 | struct list_head next; |
366 | int seqno; |
367 | int seqno; |
367 | int state; |
368 | int state; |
368 | bool path_msg; |
369 | bool path_msg; |
369 | struct drm_dp_sideband_msg_reply_body reply; |
370 | struct drm_dp_sideband_msg_reply_body reply; |
370 | }; |
371 | }; |
371 | 372 | ||
372 | /* sideband msg handler */ |
373 | /* sideband msg handler */ |
373 | struct drm_dp_mst_topology_mgr; |
374 | struct drm_dp_mst_topology_mgr; |
374 | struct drm_dp_mst_topology_cbs { |
375 | struct drm_dp_mst_topology_cbs { |
375 | /* create a connector for a port */ |
376 | /* create a connector for a port */ |
376 | struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path); |
377 | struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path); |
377 | void (*register_connector)(struct drm_connector *connector); |
378 | void (*register_connector)(struct drm_connector *connector); |
378 | void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, |
379 | void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr, |
379 | struct drm_connector *connector); |
380 | struct drm_connector *connector); |
380 | void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); |
381 | void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr); |
381 | 382 | ||
382 | }; |
383 | }; |
383 | 384 | ||
384 | #define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8) |
385 | #define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8) |
385 | 386 | ||
386 | #define DP_PAYLOAD_LOCAL 1 |
387 | #define DP_PAYLOAD_LOCAL 1 |
387 | #define DP_PAYLOAD_REMOTE 2 |
388 | #define DP_PAYLOAD_REMOTE 2 |
388 | #define DP_PAYLOAD_DELETE_LOCAL 3 |
389 | #define DP_PAYLOAD_DELETE_LOCAL 3 |
389 | 390 | ||
390 | struct drm_dp_payload { |
391 | struct drm_dp_payload { |
391 | int payload_state; |
392 | int payload_state; |
392 | int start_slot; |
393 | int start_slot; |
393 | int num_slots; |
394 | int num_slots; |
394 | int vcpi; |
395 | int vcpi; |
395 | }; |
396 | }; |
396 | 397 | ||
397 | /** |
398 | /** |
398 | * struct drm_dp_mst_topology_mgr - DisplayPort MST manager |
399 | * struct drm_dp_mst_topology_mgr - DisplayPort MST manager |
399 | * @dev: device pointer for adding i2c devices etc. |
400 | * @dev: device pointer for adding i2c devices etc. |
400 | * @cbs: callbacks for connector addition and destruction. |
401 | * @cbs: callbacks for connector addition and destruction. |
401 | * @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go. |
402 | * @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go. |
402 | * @aux: aux channel for the DP connector. |
403 | * @aux: aux channel for the DP connector. |
403 | * @max_payloads: maximum number of payloads the GPU can generate. |
404 | * @max_payloads: maximum number of payloads the GPU can generate. |
404 | * @conn_base_id: DRM connector ID this mgr is connected to. |
405 | * @conn_base_id: DRM connector ID this mgr is connected to. |
405 | * @down_rep_recv: msg receiver state for down replies. |
406 | * @down_rep_recv: msg receiver state for down replies. |
406 | * @up_req_recv: msg receiver state for up requests. |
407 | * @up_req_recv: msg receiver state for up requests. |
407 | * @lock: protects mst state, primary, dpcd. |
408 | * @lock: protects mst state, primary, dpcd. |
408 | * @mst_state: if this manager is enabled for an MST capable port. |
409 | * @mst_state: if this manager is enabled for an MST capable port. |
409 | * @mst_primary: pointer to the primary branch device. |
410 | * @mst_primary: pointer to the primary branch device. |
410 | * @dpcd: cache of DPCD for primary port. |
411 | * @dpcd: cache of DPCD for primary port. |
411 | * @pbn_div: PBN to slots divisor. |
412 | * @pbn_div: PBN to slots divisor. |
412 | * |
413 | * |
413 | * This struct represents the toplevel displayport MST topology manager. |
414 | * This struct represents the toplevel displayport MST topology manager. |
414 | * There should be one instance of this for every MST capable DP connector |
415 | * There should be one instance of this for every MST capable DP connector |
415 | * on the GPU. |
416 | * on the GPU. |
416 | */ |
417 | */ |
417 | struct drm_dp_mst_topology_mgr { |
418 | struct drm_dp_mst_topology_mgr { |
418 | 419 | ||
419 | struct device *dev; |
420 | struct device *dev; |
420 | struct drm_dp_mst_topology_cbs *cbs; |
421 | const struct drm_dp_mst_topology_cbs *cbs; |
421 | int max_dpcd_transaction_bytes; |
422 | int max_dpcd_transaction_bytes; |
422 | struct drm_dp_aux *aux; /* auxch for this topology mgr to use */ |
423 | struct drm_dp_aux *aux; /* auxch for this topology mgr to use */ |
423 | int max_payloads; |
424 | int max_payloads; |
424 | int conn_base_id; |
425 | int conn_base_id; |
425 | 426 | ||
426 | /* only ever accessed from the workqueue - which should be serialised */ |
427 | /* only ever accessed from the workqueue - which should be serialised */ |
427 | struct drm_dp_sideband_msg_rx down_rep_recv; |
428 | struct drm_dp_sideband_msg_rx down_rep_recv; |
428 | struct drm_dp_sideband_msg_rx up_req_recv; |
429 | struct drm_dp_sideband_msg_rx up_req_recv; |
429 | 430 | ||
430 | /* pointer to info about the initial MST device */ |
431 | /* pointer to info about the initial MST device */ |
431 | struct mutex lock; /* protects mst_state + primary + dpcd */ |
432 | struct mutex lock; /* protects mst_state + primary + dpcd */ |
432 | 433 | ||
433 | bool mst_state; |
434 | bool mst_state; |
434 | struct drm_dp_mst_branch *mst_primary; |
435 | struct drm_dp_mst_branch *mst_primary; |
435 | 436 | ||
436 | u8 dpcd[DP_RECEIVER_CAP_SIZE]; |
437 | u8 dpcd[DP_RECEIVER_CAP_SIZE]; |
437 | u8 sink_count; |
438 | u8 sink_count; |
438 | int pbn_div; |
439 | int pbn_div; |
439 | int total_slots; |
440 | int total_slots; |
440 | int avail_slots; |
441 | int avail_slots; |
441 | int total_pbn; |
442 | int total_pbn; |
442 | 443 | ||
443 | /* messages to be transmitted */ |
444 | /* messages to be transmitted */ |
444 | /* qlock protects the upq/downq and in_progress, |
445 | /* qlock protects the upq/downq and in_progress, |
445 | the mstb tx_slots and txmsg->state once they are queued */ |
446 | the mstb tx_slots and txmsg->state once they are queued */ |
446 | struct mutex qlock; |
447 | struct mutex qlock; |
447 | struct list_head tx_msg_downq; |
448 | struct list_head tx_msg_downq; |
448 | bool tx_down_in_progress; |
449 | bool tx_down_in_progress; |
449 | 450 | ||
450 | /* payload info + lock for it */ |
451 | /* payload info + lock for it */ |
451 | struct mutex payload_lock; |
452 | struct mutex payload_lock; |
452 | struct drm_dp_vcpi **proposed_vcpis; |
453 | struct drm_dp_vcpi **proposed_vcpis; |
453 | struct drm_dp_payload *payloads; |
454 | struct drm_dp_payload *payloads; |
454 | unsigned long payload_mask; |
455 | unsigned long payload_mask; |
455 | unsigned long vcpi_mask; |
456 | unsigned long vcpi_mask; |
456 | 457 | ||
457 | wait_queue_head_t tx_waitq; |
458 | wait_queue_head_t tx_waitq; |
458 | struct work_struct work; |
459 | struct work_struct work; |
459 | 460 | ||
460 | struct work_struct tx_work; |
461 | struct work_struct tx_work; |
461 | 462 | ||
462 | struct list_head destroy_connector_list; |
463 | struct list_head destroy_connector_list; |
463 | struct mutex destroy_connector_lock; |
464 | struct mutex destroy_connector_lock; |
464 | struct work_struct destroy_connector_work; |
465 | struct work_struct destroy_connector_work; |
465 | }; |
466 | }; |
466 | 467 | ||
467 | int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id); |
468 | int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id); |
468 | 469 | ||
469 | void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr); |
470 | void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr); |
470 | 471 | ||
471 | 472 | ||
472 | int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state); |
473 | int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state); |
473 | 474 | ||
474 | 475 | ||
475 | int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled); |
476 | int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled); |
476 | 477 | ||
477 | 478 | ||
478 | enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
479 | enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
- | 480 | ||
- | 481 | bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr, |
|
479 | 482 | struct drm_dp_mst_port *port); |
|
480 | struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
483 | struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
481 | 484 | ||
482 | 485 | ||
483 | int drm_dp_calc_pbn_mode(int clock, int bpp); |
486 | int drm_dp_calc_pbn_mode(int clock, int bpp); |
484 | 487 | ||
485 | 488 | ||
486 | bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots); |
489 | bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots); |
487 | 490 | ||
488 | int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
491 | int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
489 | 492 | ||
490 | 493 | ||
491 | void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
494 | void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port); |
492 | 495 | ||
493 | 496 | ||
494 | void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, |
497 | void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, |
495 | struct drm_dp_mst_port *port); |
498 | struct drm_dp_mst_port *port); |
496 | 499 | ||
497 | 500 | ||
498 | int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, |
501 | int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, |
499 | int pbn); |
502 | int pbn); |
500 | 503 | ||
501 | 504 | ||
502 | int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr); |
505 | int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr); |
503 | 506 | ||
504 | 507 | ||
505 | int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr); |
508 | int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr); |
506 | 509 | ||
507 | int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr); |
510 | int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr); |
508 | 511 | ||
509 | void drm_dp_mst_dump_topology(struct seq_file *m, |
512 | void drm_dp_mst_dump_topology(struct seq_file *m, |
510 | struct drm_dp_mst_topology_mgr *mgr); |
513 | struct drm_dp_mst_topology_mgr *mgr); |
511 | 514 | ||
512 | void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr); |
515 | void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr); |
513 | int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr); |
516 | int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr); |
514 | #endif |
517 | #endif |