xref: /dragonfly/sys/dev/drm/i915/intel_dp_mst.c (revision 8bf5b238)
1 /*
2  * Copyright © 2008 Intel Corporation
3  *             2014 Red Hat Inc.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  *
24  */
25 
26 #include <drm/drmP.h>
27 #include "i915_drv.h"
28 #include "intel_drv.h"
29 #include <drm/drm_atomic_helper.h>
30 #include <drm/drm_crtc_helper.h>
31 #include <drm/drm_edid.h>
32 
33 #if 0
34 static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
35 					struct intel_crtc_state *pipe_config)
36 {
37 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
38 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
39 	struct intel_dp *intel_dp = &intel_dig_port->dp;
40 	struct drm_atomic_state *state;
41 	int bpp, i;
42 	int lane_count, slots;
43 	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
44 	struct drm_connector *drm_connector;
45 	struct intel_connector *connector, *found = NULL;
46 	struct drm_connector_state *connector_state;
47 	int mst_pbn;
48 
49 	pipe_config->dp_encoder_is_mst = true;
50 	pipe_config->has_pch_encoder = false;
51 	pipe_config->has_dp_encoder = true;
52 	bpp = 24;
53 	/*
54 	 * for MST we always configure max link bw - the spec doesn't
55 	 * seem to suggest we should do otherwise.
56 	 */
57 	lane_count = drm_dp_max_lane_count(intel_dp->dpcd);
58 
59 
60 	pipe_config->lane_count = lane_count;
61 
62 	pipe_config->pipe_bpp = 24;
63 	pipe_config->port_clock = intel_dp_max_link_rate(intel_dp);
64 
65 	state = pipe_config->base.state;
66 
67 	for_each_connector_in_state(state, drm_connector, connector_state, i) {
68 		connector = to_intel_connector(drm_connector);
69 
70 		if (connector_state->best_encoder == &encoder->base) {
71 			found = connector;
72 			break;
73 		}
74 	}
75 
76 	if (!found) {
77 		DRM_ERROR("can't find connector\n");
78 		return false;
79 	}
80 
81 	if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, found->port))
82 		pipe_config->has_audio = true;
83 	mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
84 
85 	pipe_config->pbn = mst_pbn;
86 	slots = drm_dp_find_vcpi_slots(&intel_dp->mst_mgr, mst_pbn);
87 
88 	intel_link_compute_m_n(bpp, lane_count,
89 			       adjusted_mode->crtc_clock,
90 			       pipe_config->port_clock,
91 			       &pipe_config->dp_m_n);
92 
93 	pipe_config->dp_m_n.tu = slots;
94 
95 	return true;
96 
97 }
98 
99 static void intel_mst_disable_dp(struct intel_encoder *encoder)
100 {
101 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
102 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
103 	struct intel_dp *intel_dp = &intel_dig_port->dp;
104 	struct drm_device *dev = encoder->base.dev;
105 	struct drm_i915_private *dev_priv = dev->dev_private;
106 	struct drm_crtc *crtc = encoder->base.crtc;
107 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
108 
109 	int ret;
110 
111 	DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);
112 
113 	drm_dp_mst_reset_vcpi_slots(&intel_dp->mst_mgr, intel_mst->connector->port);
114 
115 	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
116 	if (ret) {
117 		DRM_ERROR("failed to update payload %d\n", ret);
118 	}
119 	if (intel_crtc->config->has_audio) {
120 		intel_audio_codec_disable(encoder);
121 		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
122 	}
123 }
124 
125 static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
126 {
127 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
128 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
129 	struct intel_dp *intel_dp = &intel_dig_port->dp;
130 
131 	DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);
132 
133 	/* this can fail */
134 	drm_dp_check_act_status(&intel_dp->mst_mgr);
135 	/* and this can also fail */
136 	drm_dp_update_payload_part2(&intel_dp->mst_mgr);
137 
138 	drm_dp_mst_deallocate_vcpi(&intel_dp->mst_mgr, intel_mst->connector->port);
139 
140 	intel_dp->active_mst_links--;
141 
142 	intel_mst->connector = NULL;
143 	if (intel_dp->active_mst_links == 0) {
144 		intel_dig_port->base.post_disable(&intel_dig_port->base);
145 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
146 	}
147 }
148 
149 static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
150 {
151 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
152 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
153 	struct intel_dp *intel_dp = &intel_dig_port->dp;
154 	struct drm_device *dev = encoder->base.dev;
155 	struct drm_i915_private *dev_priv = dev->dev_private;
156 	enum port port = intel_dig_port->port;
157 	int ret;
158 	uint32_t temp;
159 	struct intel_connector *found = NULL, *connector;
160 	int slots;
161 	struct drm_crtc *crtc = encoder->base.crtc;
162 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
163 
164 	for_each_intel_connector(dev, connector) {
165 		if (connector->base.state->best_encoder == &encoder->base) {
166 			found = connector;
167 			break;
168 		}
169 	}
170 
171 	if (!found) {
172 		DRM_ERROR("can't find connector\n");
173 		return;
174 	}
175 
176 	/* MST encoders are bound to a crtc, not to a connector,
177 	 * force the mapping here for get_hw_state.
178 	 */
179 	found->encoder = encoder;
180 
181 	DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);
182 
183 	intel_mst->connector = found;
184 
185 	if (intel_dp->active_mst_links == 0) {
186 		intel_prepare_ddi_buffer(&intel_dig_port->base);
187 
188 		intel_ddi_clk_select(&intel_dig_port->base, intel_crtc->config);
189 
190 		intel_dp_set_link_params(intel_dp, intel_crtc->config);
191 
192 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
193 
194 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
195 
196 		intel_dp_start_link_train(intel_dp);
197 		intel_dp_stop_link_train(intel_dp);
198 	}
199 
200 	ret = drm_dp_mst_allocate_vcpi(&intel_dp->mst_mgr,
201 				       intel_mst->connector->port,
202 				       intel_crtc->config->pbn, &slots);
203 	if (ret == false) {
204 		DRM_ERROR("failed to allocate vcpi\n");
205 		return;
206 	}
207 
208 
209 	intel_dp->active_mst_links++;
210 	temp = I915_READ(DP_TP_STATUS(port));
211 	I915_WRITE(DP_TP_STATUS(port), temp);
212 
213 	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
214 }
215 
216 static void intel_mst_enable_dp(struct intel_encoder *encoder)
217 {
218 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
219 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
220 	struct intel_dp *intel_dp = &intel_dig_port->dp;
221 	struct drm_device *dev = intel_dig_port->base.base.dev;
222 	struct drm_i915_private *dev_priv = dev->dev_private;
223 	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
224 	enum port port = intel_dig_port->port;
225 	int ret;
226 
227 	DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);
228 
229 	if (wait_for((I915_READ(DP_TP_STATUS(port)) & DP_TP_STATUS_ACT_SENT),
230 		     1))
231 		DRM_ERROR("Timed out waiting for ACT sent\n");
232 
233 	ret = drm_dp_check_act_status(&intel_dp->mst_mgr);
234 
235 	ret = drm_dp_update_payload_part2(&intel_dp->mst_mgr);
236 
237 	if (crtc->config->has_audio) {
238 		DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
239 				 pipe_name(crtc->pipe));
240 		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
241 		intel_audio_codec_enable(encoder);
242 	}
243 }
244 
245 static bool intel_dp_mst_enc_get_hw_state(struct intel_encoder *encoder,
246 				      enum pipe *pipe)
247 {
248 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
249 	*pipe = intel_mst->pipe;
250 	if (intel_mst->connector)
251 		return true;
252 	return false;
253 }
254 
255 static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
256 					struct intel_crtc_state *pipe_config)
257 {
258 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
259 	struct intel_digital_port *intel_dig_port = intel_mst->primary;
260 	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
261 	struct drm_device *dev = encoder->base.dev;
262 	struct drm_i915_private *dev_priv = dev->dev_private;
263 	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
264 	u32 temp, flags = 0;
265 
266 	pipe_config->has_dp_encoder = true;
267 
268 	pipe_config->has_audio =
269 		intel_ddi_is_audio_enabled(dev_priv, crtc);
270 
271 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
272 	if (temp & TRANS_DDI_PHSYNC)
273 		flags |= DRM_MODE_FLAG_PHSYNC;
274 	else
275 		flags |= DRM_MODE_FLAG_NHSYNC;
276 	if (temp & TRANS_DDI_PVSYNC)
277 		flags |= DRM_MODE_FLAG_PVSYNC;
278 	else
279 		flags |= DRM_MODE_FLAG_NVSYNC;
280 
281 	switch (temp & TRANS_DDI_BPC_MASK) {
282 	case TRANS_DDI_BPC_6:
283 		pipe_config->pipe_bpp = 18;
284 		break;
285 	case TRANS_DDI_BPC_8:
286 		pipe_config->pipe_bpp = 24;
287 		break;
288 	case TRANS_DDI_BPC_10:
289 		pipe_config->pipe_bpp = 30;
290 		break;
291 	case TRANS_DDI_BPC_12:
292 		pipe_config->pipe_bpp = 36;
293 		break;
294 	default:
295 		break;
296 	}
297 	pipe_config->base.adjusted_mode.flags |= flags;
298 
299 	pipe_config->lane_count =
300 		((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
301 
302 	intel_dp_get_m_n(crtc, pipe_config);
303 
304 	intel_ddi_clock_get(&intel_dig_port->base, pipe_config);
305 }
306 
307 static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector)
308 {
309 	struct intel_connector *intel_connector = to_intel_connector(connector);
310 	struct intel_dp *intel_dp = intel_connector->mst_port;
311 	struct edid *edid;
312 	int ret;
313 
314 	if (!intel_dp) {
315 		return intel_connector_update_modes(connector, NULL);
316 	}
317 
318 	edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port);
319 	ret = intel_connector_update_modes(connector, edid);
320 	kfree(edid);
321 
322 	return ret;
323 }
324 
325 static enum drm_connector_status
326 intel_dp_mst_detect(struct drm_connector *connector, bool force)
327 {
328 	struct intel_connector *intel_connector = to_intel_connector(connector);
329 	struct intel_dp *intel_dp = intel_connector->mst_port;
330 
331 	if (!intel_dp)
332 		return connector_status_disconnected;
333 	return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port);
334 }
335 
336 static int
337 intel_dp_mst_set_property(struct drm_connector *connector,
338 			  struct drm_property *property,
339 			  uint64_t val)
340 {
341 	return 0;
342 }
343 
344 static void
345 intel_dp_mst_connector_destroy(struct drm_connector *connector)
346 {
347 	struct intel_connector *intel_connector = to_intel_connector(connector);
348 
349 	if (!IS_ERR_OR_NULL(intel_connector->edid))
350 		kfree(intel_connector->edid);
351 
352 	drm_connector_cleanup(connector);
353 	kfree(connector);
354 }
355 
356 static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
357 	.dpms = drm_atomic_helper_connector_dpms,
358 	.detect = intel_dp_mst_detect,
359 	.fill_modes = drm_helper_probe_single_connector_modes,
360 	.set_property = intel_dp_mst_set_property,
361 	.atomic_get_property = intel_connector_atomic_get_property,
362 	.destroy = intel_dp_mst_connector_destroy,
363 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
364 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
365 };
366 
367 static int intel_dp_mst_get_modes(struct drm_connector *connector)
368 {
369 	return intel_dp_mst_get_ddc_modes(connector);
370 }
371 
372 static enum drm_mode_status
373 intel_dp_mst_mode_valid(struct drm_connector *connector,
374 			struct drm_display_mode *mode)
375 {
376 	int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
377 
378 	/* TODO - validate mode against available PBN for link */
379 	if (mode->clock < 10000)
380 		return MODE_CLOCK_LOW;
381 
382 	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
383 		return MODE_H_ILLEGAL;
384 
385 	if (mode->clock > max_dotclk)
386 		return MODE_CLOCK_HIGH;
387 
388 	return MODE_OK;
389 }
390 
391 static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *connector,
392 							 struct drm_connector_state *state)
393 {
394 	struct intel_connector *intel_connector = to_intel_connector(connector);
395 	struct intel_dp *intel_dp = intel_connector->mst_port;
396 	struct intel_crtc *crtc = to_intel_crtc(state->crtc);
397 
398 	if (!intel_dp)
399 		return NULL;
400 	return &intel_dp->mst_encoders[crtc->pipe]->base.base;
401 }
402 
403 static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector)
404 {
405 	struct intel_connector *intel_connector = to_intel_connector(connector);
406 	struct intel_dp *intel_dp = intel_connector->mst_port;
407 	if (!intel_dp)
408 		return NULL;
409 	return &intel_dp->mst_encoders[0]->base.base;
410 }
411 
412 static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = {
413 	.get_modes = intel_dp_mst_get_modes,
414 	.mode_valid = intel_dp_mst_mode_valid,
415 	.atomic_best_encoder = intel_mst_atomic_best_encoder,
416 	.best_encoder = intel_mst_best_encoder,
417 };
418 #endif
419 
420 #if 0 /* unused */
421 static void intel_dp_mst_encoder_destroy(struct drm_encoder *encoder)
422 {
423 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(encoder);
424 
425 	drm_encoder_cleanup(encoder);
426 	kfree(intel_mst);
427 }
428 
429 static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {
430 	.destroy = intel_dp_mst_encoder_destroy,
431 };
432 #endif
433 
434 #if 0
435 static bool intel_dp_mst_get_hw_state(struct intel_connector *connector)
436 {
437 	if (connector->encoder && connector->base.state->crtc) {
438 		enum pipe pipe;
439 		if (!connector->encoder->get_hw_state(connector->encoder, &pipe))
440 			return false;
441 		return true;
442 	}
443 	return false;
444 }
445 
446 static void intel_connector_add_to_fbdev(struct intel_connector *connector)
447 {
448 #ifdef CONFIG_DRM_FBDEV_EMULATION
449 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
450 
451 	if (dev_priv->fbdev)
452 		drm_fb_helper_add_one_connector(&dev_priv->fbdev->helper,
453 						&connector->base);
454 #endif
455 }
456 
457 static void intel_connector_remove_from_fbdev(struct intel_connector *connector)
458 {
459 #ifdef CONFIG_DRM_FBDEV_EMULATION
460 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
461 
462 	if (dev_priv->fbdev)
463 		drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper,
464 						   &connector->base);
465 #endif
466 }
467 
468 static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *pathprop)
469 {
470 	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
471 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
472 	struct drm_device *dev = intel_dig_port->base.base.dev;
473 	struct intel_connector *intel_connector;
474 	struct drm_connector *connector;
475 	int i;
476 
477 	intel_connector = intel_connector_alloc();
478 	if (!intel_connector)
479 		return NULL;
480 
481 	connector = &intel_connector->base;
482 	drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort);
483 	drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs);
484 
485 	intel_connector->unregister = intel_connector_unregister;
486 	intel_connector->get_hw_state = intel_dp_mst_get_hw_state;
487 	intel_connector->mst_port = intel_dp;
488 	intel_connector->port = port;
489 
490 	for (i = PIPE_A; i <= PIPE_C; i++) {
491 		drm_mode_connector_attach_encoder(&intel_connector->base,
492 						  &intel_dp->mst_encoders[i]->base.base);
493 	}
494 	intel_dp_add_properties(intel_dp, connector);
495 
496 	drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
497 	drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
498 
499 	drm_mode_connector_set_path_property(connector, pathprop);
500 	return connector;
501 }
502 
503 static void intel_dp_register_mst_connector(struct drm_connector *connector)
504 {
505 	struct intel_connector *intel_connector = to_intel_connector(connector);
506 	struct drm_device *dev = connector->dev;
507 	drm_modeset_lock_all(dev);
508 	intel_connector_add_to_fbdev(intel_connector);
509 	drm_modeset_unlock_all(dev);
510 	drm_connector_register(&intel_connector->base);
511 }
512 
513 static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
514 					   struct drm_connector *connector)
515 {
516 	struct intel_connector *intel_connector = to_intel_connector(connector);
517 	struct drm_device *dev = connector->dev;
518 
519 	intel_connector->unregister(intel_connector);
520 
521 	/* need to nuke the connector */
522 	drm_modeset_lock_all(dev);
523 	intel_connector_remove_from_fbdev(intel_connector);
524 	intel_connector->mst_port = NULL;
525 	drm_modeset_unlock_all(dev);
526 
527 	drm_connector_unreference(&intel_connector->base);
528 	DRM_DEBUG_KMS("\n");
529 }
530 
531 static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
532 {
533 	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
534 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
535 	struct drm_device *dev = intel_dig_port->base.base.dev;
536 
537 	drm_kms_helper_hotplug_event(dev);
538 }
539 
540 static const struct drm_dp_mst_topology_cbs mst_cbs = {
541 	.add_connector = intel_dp_add_mst_connector,
542 	.register_connector = intel_dp_register_mst_connector,
543 	.destroy_connector = intel_dp_destroy_mst_connector,
544 	.hotplug = intel_dp_mst_hotplug,
545 };
546 
547 static struct intel_dp_mst_encoder *
548 intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum pipe pipe)
549 {
550 	struct intel_dp_mst_encoder *intel_mst;
551 	struct intel_encoder *intel_encoder;
552 	struct drm_device *dev = intel_dig_port->base.base.dev;
553 
554 	intel_mst = kzalloc(sizeof(*intel_mst), GFP_KERNEL);
555 
556 	if (!intel_mst)
557 		return NULL;
558 
559 	intel_mst->pipe = pipe;
560 	intel_encoder = &intel_mst->base;
561 	intel_mst->primary = intel_dig_port;
562 
563 	drm_encoder_init(dev, &intel_encoder->base, &intel_dp_mst_enc_funcs,
564 			 DRM_MODE_ENCODER_DPMST, NULL);
565 
566 	intel_encoder->type = INTEL_OUTPUT_DP_MST;
567 	intel_encoder->crtc_mask = 0x7;
568 	intel_encoder->cloneable = 0;
569 
570 	intel_encoder->compute_config = intel_dp_mst_compute_config;
571 	intel_encoder->disable = intel_mst_disable_dp;
572 	intel_encoder->post_disable = intel_mst_post_disable_dp;
573 	intel_encoder->pre_enable = intel_mst_pre_enable_dp;
574 	intel_encoder->enable = intel_mst_enable_dp;
575 	intel_encoder->get_hw_state = intel_dp_mst_enc_get_hw_state;
576 	intel_encoder->get_config = intel_dp_mst_enc_get_config;
577 
578 	return intel_mst;
579 
580 }
581 
582 static bool
583 intel_dp_create_fake_mst_encoders(struct intel_digital_port *intel_dig_port)
584 {
585 	int i;
586 	struct intel_dp *intel_dp = &intel_dig_port->dp;
587 
588 	for (i = PIPE_A; i <= PIPE_C; i++)
589 		intel_dp->mst_encoders[i] = intel_dp_create_fake_mst_encoder(intel_dig_port, i);
590 	return true;
591 }
592 #endif
593 
594 int
595 intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_base_id)
596 {
597 	struct intel_dp *intel_dp = &intel_dig_port->dp;
598 #if 0
599 	struct drm_device *dev = intel_dig_port->base.base.dev;
600 	int ret;
601 
602 	intel_dp->can_mst = true;
603 	intel_dp->mst_mgr.cbs = &mst_cbs;
604 
605 	/* create encoders */
606 	intel_dp_create_fake_mst_encoders(intel_dig_port);
607 	ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, dev->dev, &intel_dp->aux, 16, 3, conn_base_id);
608 	if (ret) {
609 		intel_dp->can_mst = false;
610 		return ret;
611 	}
612 #endif
613 	intel_dp->can_mst = false;
614 	return 0;
615 }
616 
617 void
618 intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port)
619 {
620 	struct intel_dp *intel_dp = &intel_dig_port->dp;
621 
622 	if (!intel_dp->can_mst)
623 		return;
624 
625 #if 0
626 	drm_dp_mst_topology_mgr_destroy(&intel_dp->mst_mgr);
627 #endif
628 	/* encoders will get killed by normal cleanup */
629 }
630