xref: /dragonfly/sys/dev/drm/i915/intel_dp_mst.c (revision a3127495)
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 static void intel_dp_mst_encoder_destroy(struct drm_encoder *encoder)
421 {
422 	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(encoder);
423 
424 	drm_encoder_cleanup(encoder);
425 	kfree(intel_mst);
426 }
427 
428 static const struct drm_encoder_funcs intel_dp_mst_enc_funcs = {
429 	.destroy = intel_dp_mst_encoder_destroy,
430 };
431 
432 #if 0
433 static bool intel_dp_mst_get_hw_state(struct intel_connector *connector)
434 {
435 	if (connector->encoder && connector->base.state->crtc) {
436 		enum pipe pipe;
437 		if (!connector->encoder->get_hw_state(connector->encoder, &pipe))
438 			return false;
439 		return true;
440 	}
441 	return false;
442 }
443 
444 static void intel_connector_add_to_fbdev(struct intel_connector *connector)
445 {
446 #ifdef CONFIG_DRM_FBDEV_EMULATION
447 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
448 
449 	if (dev_priv->fbdev)
450 		drm_fb_helper_add_one_connector(&dev_priv->fbdev->helper,
451 						&connector->base);
452 #endif
453 }
454 
455 static void intel_connector_remove_from_fbdev(struct intel_connector *connector)
456 {
457 #ifdef CONFIG_DRM_FBDEV_EMULATION
458 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
459 
460 	if (dev_priv->fbdev)
461 		drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper,
462 						   &connector->base);
463 #endif
464 }
465 
466 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)
467 {
468 	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
469 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
470 	struct drm_device *dev = intel_dig_port->base.base.dev;
471 	struct intel_connector *intel_connector;
472 	struct drm_connector *connector;
473 	int i;
474 
475 	intel_connector = intel_connector_alloc();
476 	if (!intel_connector)
477 		return NULL;
478 
479 	connector = &intel_connector->base;
480 	drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort);
481 	drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs);
482 
483 	intel_connector->unregister = intel_connector_unregister;
484 	intel_connector->get_hw_state = intel_dp_mst_get_hw_state;
485 	intel_connector->mst_port = intel_dp;
486 	intel_connector->port = port;
487 
488 	for (i = PIPE_A; i <= PIPE_C; i++) {
489 		drm_mode_connector_attach_encoder(&intel_connector->base,
490 						  &intel_dp->mst_encoders[i]->base.base);
491 	}
492 	intel_dp_add_properties(intel_dp, connector);
493 
494 	drm_object_attach_property(&connector->base, dev->mode_config.path_property, 0);
495 	drm_object_attach_property(&connector->base, dev->mode_config.tile_property, 0);
496 
497 	drm_mode_connector_set_path_property(connector, pathprop);
498 	return connector;
499 }
500 
501 static void intel_dp_register_mst_connector(struct drm_connector *connector)
502 {
503 	struct intel_connector *intel_connector = to_intel_connector(connector);
504 	struct drm_device *dev = connector->dev;
505 	drm_modeset_lock_all(dev);
506 	intel_connector_add_to_fbdev(intel_connector);
507 	drm_modeset_unlock_all(dev);
508 	drm_connector_register(&intel_connector->base);
509 }
510 
511 static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
512 					   struct drm_connector *connector)
513 {
514 	struct intel_connector *intel_connector = to_intel_connector(connector);
515 	struct drm_device *dev = connector->dev;
516 
517 	intel_connector->unregister(intel_connector);
518 
519 	/* need to nuke the connector */
520 	drm_modeset_lock_all(dev);
521 	intel_connector_remove_from_fbdev(intel_connector);
522 	intel_connector->mst_port = NULL;
523 	drm_modeset_unlock_all(dev);
524 
525 	drm_connector_unreference(&intel_connector->base);
526 	DRM_DEBUG_KMS("\n");
527 }
528 
529 static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr)
530 {
531 	struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
532 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
533 	struct drm_device *dev = intel_dig_port->base.base.dev;
534 
535 	drm_kms_helper_hotplug_event(dev);
536 }
537 
538 static const struct drm_dp_mst_topology_cbs mst_cbs = {
539 	.add_connector = intel_dp_add_mst_connector,
540 	.register_connector = intel_dp_register_mst_connector,
541 	.destroy_connector = intel_dp_destroy_mst_connector,
542 	.hotplug = intel_dp_mst_hotplug,
543 };
544 
545 static struct intel_dp_mst_encoder *
546 intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum pipe pipe)
547 {
548 	struct intel_dp_mst_encoder *intel_mst;
549 	struct intel_encoder *intel_encoder;
550 	struct drm_device *dev = intel_dig_port->base.base.dev;
551 
552 	intel_mst = kzalloc(sizeof(*intel_mst), GFP_KERNEL);
553 
554 	if (!intel_mst)
555 		return NULL;
556 
557 	intel_mst->pipe = pipe;
558 	intel_encoder = &intel_mst->base;
559 	intel_mst->primary = intel_dig_port;
560 
561 	drm_encoder_init(dev, &intel_encoder->base, &intel_dp_mst_enc_funcs,
562 			 DRM_MODE_ENCODER_DPMST, NULL);
563 
564 	intel_encoder->type = INTEL_OUTPUT_DP_MST;
565 	intel_encoder->crtc_mask = 0x7;
566 	intel_encoder->cloneable = 0;
567 
568 	intel_encoder->compute_config = intel_dp_mst_compute_config;
569 	intel_encoder->disable = intel_mst_disable_dp;
570 	intel_encoder->post_disable = intel_mst_post_disable_dp;
571 	intel_encoder->pre_enable = intel_mst_pre_enable_dp;
572 	intel_encoder->enable = intel_mst_enable_dp;
573 	intel_encoder->get_hw_state = intel_dp_mst_enc_get_hw_state;
574 	intel_encoder->get_config = intel_dp_mst_enc_get_config;
575 
576 	return intel_mst;
577 
578 }
579 
580 static bool
581 intel_dp_create_fake_mst_encoders(struct intel_digital_port *intel_dig_port)
582 {
583 	int i;
584 	struct intel_dp *intel_dp = &intel_dig_port->dp;
585 
586 	for (i = PIPE_A; i <= PIPE_C; i++)
587 		intel_dp->mst_encoders[i] = intel_dp_create_fake_mst_encoder(intel_dig_port, i);
588 	return true;
589 }
590 #endif
591 
592 int
593 intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_base_id)
594 {
595 	struct intel_dp *intel_dp = &intel_dig_port->dp;
596 #if 0
597 	struct drm_device *dev = intel_dig_port->base.base.dev;
598 	int ret;
599 
600 	intel_dp->can_mst = true;
601 	intel_dp->mst_mgr.cbs = &mst_cbs;
602 
603 	/* create encoders */
604 	intel_dp_create_fake_mst_encoders(intel_dig_port);
605 	ret = drm_dp_mst_topology_mgr_init(&intel_dp->mst_mgr, dev->dev, &intel_dp->aux, 16, 3, conn_base_id);
606 	if (ret) {
607 		intel_dp->can_mst = false;
608 		return ret;
609 	}
610 #endif
611 	intel_dp->can_mst = false;
612 	return 0;
613 }
614 
615 void
616 intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port)
617 {
618 	struct intel_dp *intel_dp = &intel_dig_port->dp;
619 
620 	if (!intel_dp->can_mst)
621 		return;
622 
623 #if 0
624 	drm_dp_mst_topology_mgr_destroy(&intel_dp->mst_mgr);
625 #endif
626 	/* encoders will get killed by normal cleanup */
627 }
628