Subversion Repositories Kolibri OS

Rev

Rev 5354 | Rev 6660 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5354 Rev 6084
Line 29... Line 29...
29
#include 
29
#include 
30
#include 
30
#include 
31
#include 
31
#include 
32
#include 
32
#include 
33
#include 
33
#include 
-
 
34
#include 
34
#include 
35
#include 
35
#include 
36
#include 
36
#include "intel_drv.h"
37
#include "intel_drv.h"
37
#include 
38
#include 
38
#include "i915_drv.h"
39
#include "i915_drv.h"
Line 110... Line 111...
110
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
111
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
111
		return 0;
112
		return 0;
112
	}
113
	}
113
}
114
}
Line 114... Line 115...
114
 
115
 
115
static u32 hsw_infoframe_data_reg(enum hdmi_infoframe_type type,
116
static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv,
116
				  enum transcoder cpu_transcoder,
117
			    enum transcoder cpu_transcoder,
-
 
118
			    enum hdmi_infoframe_type type,
117
				  struct drm_i915_private *dev_priv)
119
			    int i)
118
{
120
{
119
	switch (type) {
121
	switch (type) {
120
	case HDMI_INFOFRAME_TYPE_AVI:
122
	case HDMI_INFOFRAME_TYPE_AVI:
121
		return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder);
123
		return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder, i);
122
	case HDMI_INFOFRAME_TYPE_SPD:
124
	case HDMI_INFOFRAME_TYPE_SPD:
123
		return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder);
125
		return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder, i);
124
	case HDMI_INFOFRAME_TYPE_VENDOR:
126
	case HDMI_INFOFRAME_TYPE_VENDOR:
125
		return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder);
127
		return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i);
126
	default:
128
	default:
127
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
129
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
128
		return 0;
130
		return 0;
129
	}
131
	}
Line 171... Line 173...
171
	struct drm_device *dev = encoder->dev;
173
	struct drm_device *dev = encoder->dev;
172
	struct drm_i915_private *dev_priv = dev->dev_private;
174
	struct drm_i915_private *dev_priv = dev->dev_private;
173
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
175
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
174
	u32 val = I915_READ(VIDEO_DIP_CTL);
176
	u32 val = I915_READ(VIDEO_DIP_CTL);
Line 175... Line 177...
175
 
177
 
176
	if (VIDEO_DIP_PORT(intel_dig_port->port) == (val & VIDEO_DIP_PORT_MASK))
178
	if ((val & VIDEO_DIP_ENABLE) == 0)
Line -... Line 179...
-
 
179
		return false;
177
		return val & VIDEO_DIP_ENABLE;
180
 
-
 
181
	if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port))
-
 
182
		return false;
-
 
183
 
178
 
184
	return val & (VIDEO_DIP_ENABLE_AVI |
Line 179... Line 185...
179
	return false;
185
		      VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD);
180
}
186
}
181
 
187
 
Line 220... Line 226...
220
static bool ibx_infoframe_enabled(struct drm_encoder *encoder)
226
static bool ibx_infoframe_enabled(struct drm_encoder *encoder)
221
{
227
{
222
	struct drm_device *dev = encoder->dev;
228
	struct drm_device *dev = encoder->dev;
223
	struct drm_i915_private *dev_priv = dev->dev_private;
229
	struct drm_i915_private *dev_priv = dev->dev_private;
224
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
230
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-
 
231
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
225
	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
232
	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
226
	u32 val = I915_READ(reg);
233
	u32 val = I915_READ(reg);
Line -... Line 234...
-
 
234
 
-
 
235
	if ((val & VIDEO_DIP_ENABLE) == 0)
-
 
236
		return false;
-
 
237
 
-
 
238
	if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port))
-
 
239
		return false;
227
 
240
 
-
 
241
	return val & (VIDEO_DIP_ENABLE_AVI |
-
 
242
		      VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
228
	return val & VIDEO_DIP_ENABLE;
243
		      VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
Line 229... Line 244...
229
}
244
}
230
 
245
 
231
static void cpt_write_infoframe(struct drm_encoder *encoder,
246
static void cpt_write_infoframe(struct drm_encoder *encoder,
Line 275... Line 290...
275
	struct drm_i915_private *dev_priv = dev->dev_private;
290
	struct drm_i915_private *dev_priv = dev->dev_private;
276
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
291
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
277
	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
292
	int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
278
	u32 val = I915_READ(reg);
293
	u32 val = I915_READ(reg);
Line -... Line 294...
-
 
294
 
-
 
295
	if ((val & VIDEO_DIP_ENABLE) == 0)
-
 
296
		return false;
279
 
297
 
-
 
298
	return val & (VIDEO_DIP_ENABLE_AVI |
-
 
299
		      VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
280
	return val & VIDEO_DIP_ENABLE;
300
		      VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
Line 281... Line 301...
281
}
301
}
282
 
302
 
283
static void vlv_write_infoframe(struct drm_encoder *encoder,
303
static void vlv_write_infoframe(struct drm_encoder *encoder,
Line 321... Line 341...
321
static bool vlv_infoframe_enabled(struct drm_encoder *encoder)
341
static bool vlv_infoframe_enabled(struct drm_encoder *encoder)
322
{
342
{
323
	struct drm_device *dev = encoder->dev;
343
	struct drm_device *dev = encoder->dev;
324
	struct drm_i915_private *dev_priv = dev->dev_private;
344
	struct drm_i915_private *dev_priv = dev->dev_private;
325
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
345
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-
 
346
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
326
	int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
347
	int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
327
	u32 val = I915_READ(reg);
348
	u32 val = I915_READ(reg);
Line -... Line 349...
-
 
349
 
-
 
350
	if ((val & VIDEO_DIP_ENABLE) == 0)
-
 
351
		return false;
-
 
352
 
-
 
353
	if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port))
-
 
354
		return false;
328
 
355
 
-
 
356
	return val & (VIDEO_DIP_ENABLE_AVI |
-
 
357
		      VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
329
	return val & VIDEO_DIP_ENABLE;
358
		      VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
Line 330... Line 359...
330
}
359
}
331
 
360
 
332
static void hsw_write_infoframe(struct drm_encoder *encoder,
361
static void hsw_write_infoframe(struct drm_encoder *encoder,
333
				enum hdmi_infoframe_type type,
362
				enum hdmi_infoframe_type type,
334
				const void *frame, ssize_t len)
363
				const void *frame, ssize_t len)
335
{
364
{
336
	const uint32_t *data = frame;
365
	const uint32_t *data = frame;
337
	struct drm_device *dev = encoder->dev;
366
	struct drm_device *dev = encoder->dev;
-
 
367
	struct drm_i915_private *dev_priv = dev->dev_private;
338
	struct drm_i915_private *dev_priv = dev->dev_private;
368
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
339
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
369
	enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
340
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
370
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder);
341
	u32 data_reg;
371
	u32 data_reg;
Line 342... Line 372...
342
	int i;
372
	int i;
343
	u32 val = I915_READ(ctl_reg);
-
 
344
 
-
 
345
	data_reg = hsw_infoframe_data_reg(type,
373
	u32 val = I915_READ(ctl_reg);
346
					  intel_crtc->config.cpu_transcoder,
374
 
Line 347... Line 375...
347
					  dev_priv);
375
	data_reg = hsw_dip_data_reg(dev_priv, cpu_transcoder, type, 0);
348
	if (data_reg == 0)
376
	if (data_reg == 0)
Line 349... Line 377...
349
		return;
377
		return;
350
 
378
 
351
	val &= ~hsw_infoframe_enable(type);
379
	val &= ~hsw_infoframe_enable(type);
-
 
380
	I915_WRITE(ctl_reg, val);
352
	I915_WRITE(ctl_reg, val);
381
 
353
 
382
	mmiowb();
354
	mmiowb();
383
	for (i = 0; i < len; i += 4) {
355
	for (i = 0; i < len; i += 4) {
384
		I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder,
356
		I915_WRITE(data_reg + i, *data);
385
					    type, i >> 2), *data);
-
 
386
		data++;
357
		data++;
387
	}
Line 358... Line 388...
358
	}
388
	/* Write every possible data byte to force correct ECC calculation. */
359
	/* Write every possible data byte to force correct ECC calculation. */
389
	for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
360
	for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
390
		I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder,
Line 369... Line 399...
369
static bool hsw_infoframe_enabled(struct drm_encoder *encoder)
399
static bool hsw_infoframe_enabled(struct drm_encoder *encoder)
370
{
400
{
371
	struct drm_device *dev = encoder->dev;
401
	struct drm_device *dev = encoder->dev;
372
	struct drm_i915_private *dev_priv = dev->dev_private;
402
	struct drm_i915_private *dev_priv = dev->dev_private;
373
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
403
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
374
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
404
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
375
	u32 val = I915_READ(ctl_reg);
405
	u32 val = I915_READ(ctl_reg);
Line 376... Line 406...
376
 
406
 
-
 
407
	return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
377
	return val & (VIDEO_DIP_ENABLE_AVI_HSW | VIDEO_DIP_ENABLE_SPD_HSW |
408
		      VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
378
		      VIDEO_DIP_ENABLE_VS_HSW);
409
		      VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
Line 379... Line 410...
379
}
410
}
380
 
411
 
381
/*
412
/*
Line 416... Line 447...
416
 
447
 
417
	intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len);
448
	intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len);
Line 418... Line 449...
418
}
449
}
419
 
450
 
420
static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
451
static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
421
					 struct drm_display_mode *adjusted_mode)
452
					 const struct drm_display_mode *adjusted_mode)
422
{
453
{
423
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
454
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
424
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
455
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Line 425... Line -...
425
	union hdmi_infoframe frame;
-
 
426
	int ret;
-
 
427
 
-
 
428
	/* Set user selected PAR to incoming mode's member */
456
	union hdmi_infoframe frame;
429
	adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
457
	int ret;
430
 
458
 
431
	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
459
	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
432
						       adjusted_mode);
460
						       adjusted_mode);
433
	if (ret < 0) {
461
	if (ret < 0) {
Line 434... Line 462...
434
		DRM_ERROR("couldn't fill AVI infoframe\n");
462
		DRM_ERROR("couldn't fill AVI infoframe\n");
435
		return;
463
		return;
436
	}
464
	}
437
 
465
 
438
	if (intel_hdmi->rgb_quant_range_selectable) {
466
	if (intel_hdmi->rgb_quant_range_selectable) {
439
		if (intel_crtc->config.limited_color_range)
467
		if (intel_crtc->config->limited_color_range)
440
			frame.avi.quantization_range =
468
			frame.avi.quantization_range =
Line 463... Line 491...
463
	intel_write_infoframe(encoder, &frame);
491
	intel_write_infoframe(encoder, &frame);
464
}
492
}
Line 465... Line 493...
465
 
493
 
466
static void
494
static void
467
intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
495
intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder,
468
			      struct drm_display_mode *adjusted_mode)
496
			      const struct drm_display_mode *adjusted_mode)
469
{
497
{
470
	union hdmi_infoframe frame;
498
	union hdmi_infoframe frame;
Line 471... Line 499...
471
	int ret;
499
	int ret;
Line 478... Line 506...
478
	intel_write_infoframe(encoder, &frame);
506
	intel_write_infoframe(encoder, &frame);
479
}
507
}
Line 480... Line 508...
480
 
508
 
481
static void g4x_set_infoframes(struct drm_encoder *encoder,
509
static void g4x_set_infoframes(struct drm_encoder *encoder,
482
			       bool enable,
510
			       bool enable,
483
			       struct drm_display_mode *adjusted_mode)
511
			       const struct drm_display_mode *adjusted_mode)
484
{
512
{
485
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
513
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
486
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
514
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
487
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
515
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
Line 503... Line 531...
503
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
531
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
Line 504... Line 532...
504
 
532
 
505
	if (!enable) {
533
	if (!enable) {
506
		if (!(val & VIDEO_DIP_ENABLE))
534
		if (!(val & VIDEO_DIP_ENABLE))
-
 
535
			return;
-
 
536
		if (port != (val & VIDEO_DIP_PORT_MASK)) {
-
 
537
			DRM_DEBUG_KMS("video DIP still enabled on port %c\n",
-
 
538
				      (val & VIDEO_DIP_PORT_MASK) >> 29);
-
 
539
			return;
507
			return;
540
		}
-
 
541
		val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI |
508
		val &= ~VIDEO_DIP_ENABLE;
542
			 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD);
509
		I915_WRITE(reg, val);
543
		I915_WRITE(reg, val);
510
		POSTING_READ(reg);
544
		POSTING_READ(reg);
511
		return;
545
		return;
Line 512... Line 546...
512
	}
546
	}
513
 
547
 
514
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
548
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
515
		if (val & VIDEO_DIP_ENABLE) {
549
		if (val & VIDEO_DIP_ENABLE) {
516
			val &= ~VIDEO_DIP_ENABLE;
550
			DRM_DEBUG_KMS("video DIP already enabled on port %c\n",
517
			I915_WRITE(reg, val);
551
				      (val & VIDEO_DIP_PORT_MASK) >> 29);
518
			POSTING_READ(reg);
552
			return;
519
		}
553
		}
520
		val &= ~VIDEO_DIP_PORT_MASK;
554
		val &= ~VIDEO_DIP_PORT_MASK;
Line 521... Line 555...
521
		val |= port;
555
		val |= port;
522
	}
556
	}
-
 
557
 
Line 523... Line 558...
523
 
558
	val |= VIDEO_DIP_ENABLE;
524
	val |= VIDEO_DIP_ENABLE;
559
	val &= ~(VIDEO_DIP_ENABLE_AVI |
Line 525... Line 560...
525
	val &= ~VIDEO_DIP_ENABLE_VENDOR;
560
		 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD);
526
 
561
 
527
	I915_WRITE(reg, val);
562
	I915_WRITE(reg, val);
528
	POSTING_READ(reg);
563
	POSTING_READ(reg);
Line -... Line 564...
-
 
564
 
-
 
565
	intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
-
 
566
	intel_hdmi_set_spd_infoframe(encoder);
-
 
567
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
-
 
568
}
-
 
569
 
-
 
570
static bool hdmi_sink_is_deep_color(struct drm_encoder *encoder)
-
 
571
{
-
 
572
	struct drm_device *dev = encoder->dev;
-
 
573
	struct drm_connector *connector;
-
 
574
 
-
 
575
	WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex));
-
 
576
 
-
 
577
	/*
-
 
578
	 * HDMI cloning is only supported on g4x which doesn't
-
 
579
	 * support deep color or GCP infoframes anyway so no
-
 
580
	 * need to worry about multiple HDMI sinks here.
-
 
581
	 */
-
 
582
	list_for_each_entry(connector, &dev->mode_config.connector_list, head)
-
 
583
		if (connector->encoder == encoder)
-
 
584
			return connector->display_info.bpc > 8;
-
 
585
 
-
 
586
	return false;
-
 
587
}
-
 
588
 
-
 
589
/*
-
 
590
 * Determine if default_phase=1 can be indicated in the GCP infoframe.
-
 
591
 *
-
 
592
 * From HDMI specification 1.4a:
-
 
593
 * - The first pixel of each Video Data Period shall always have a pixel packing phase of 0
-
 
594
 * - The first pixel following each Video Data Period shall have a pixel packing phase of 0
-
 
595
 * - The PP bits shall be constant for all GCPs and will be equal to the last packing phase
-
 
596
 * - The first pixel following every transition of HSYNC or VSYNC shall have a pixel packing
-
 
597
 *   phase of 0
-
 
598
 */
-
 
599
static bool gcp_default_phase_possible(int pipe_bpp,
-
 
600
				       const struct drm_display_mode *mode)
-
 
601
{
-
 
602
	unsigned int pixels_per_group;
-
 
603
 
-
 
604
	switch (pipe_bpp) {
-
 
605
	case 30:
-
 
606
		/* 4 pixels in 5 clocks */
-
 
607
		pixels_per_group = 4;
-
 
608
		break;
-
 
609
	case 36:
-
 
610
		/* 2 pixels in 3 clocks */
-
 
611
		pixels_per_group = 2;
-
 
612
		break;
-
 
613
	case 48:
-
 
614
		/* 1 pixel in 2 clocks */
-
 
615
		pixels_per_group = 1;
-
 
616
		break;
-
 
617
	default:
-
 
618
		/* phase information not relevant for 8bpc */
-
 
619
		return false;
-
 
620
	}
-
 
621
 
-
 
622
	return mode->crtc_hdisplay % pixels_per_group == 0 &&
-
 
623
		mode->crtc_htotal % pixels_per_group == 0 &&
-
 
624
		mode->crtc_hblank_start % pixels_per_group == 0 &&
-
 
625
		mode->crtc_hblank_end % pixels_per_group == 0 &&
-
 
626
		mode->crtc_hsync_start % pixels_per_group == 0 &&
-
 
627
		mode->crtc_hsync_end % pixels_per_group == 0 &&
-
 
628
		((mode->flags & DRM_MODE_FLAG_INTERLACE) == 0 ||
-
 
629
		 mode->crtc_htotal/2 % pixels_per_group == 0);
-
 
630
}
-
 
631
 
-
 
632
static bool intel_hdmi_set_gcp_infoframe(struct drm_encoder *encoder)
-
 
633
{
-
 
634
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
-
 
635
	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-
 
636
	u32 reg, val = 0;
-
 
637
 
-
 
638
	if (HAS_DDI(dev_priv))
-
 
639
		reg = HSW_TVIDEO_DIP_GCP(crtc->config->cpu_transcoder);
-
 
640
	else if (IS_VALLEYVIEW(dev_priv))
-
 
641
		reg = VLV_TVIDEO_DIP_GCP(crtc->pipe);
-
 
642
	else if (HAS_PCH_SPLIT(dev_priv->dev))
-
 
643
		reg = TVIDEO_DIP_GCP(crtc->pipe);
-
 
644
	else
-
 
645
		return false;
-
 
646
 
-
 
647
	/* Indicate color depth whenever the sink supports deep color */
-
 
648
	if (hdmi_sink_is_deep_color(encoder))
-
 
649
		val |= GCP_COLOR_INDICATION;
-
 
650
 
-
 
651
	/* Enable default_phase whenever the display mode is suitably aligned */
-
 
652
	if (gcp_default_phase_possible(crtc->config->pipe_bpp,
-
 
653
				       &crtc->config->base.adjusted_mode))
-
 
654
		val |= GCP_DEFAULT_PHASE_ENABLE;
529
 
655
 
530
	intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
656
	I915_WRITE(reg, val);
531
	intel_hdmi_set_spd_infoframe(encoder);
657
 
532
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
658
	return val != 0;
533
}
659
}
534
 
660
 
535
static void ibx_set_infoframes(struct drm_encoder *encoder,
661
static void ibx_set_infoframes(struct drm_encoder *encoder,
536
			       bool enable,
662
			       bool enable,
Line 550... Line 676...
550
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
676
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
Line 551... Line 677...
551
 
677
 
552
	if (!enable) {
678
	if (!enable) {
553
		if (!(val & VIDEO_DIP_ENABLE))
679
		if (!(val & VIDEO_DIP_ENABLE))
554
			return;
680
			return;
-
 
681
		val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI |
-
 
682
			 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
555
		val &= ~VIDEO_DIP_ENABLE;
683
			 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
556
		I915_WRITE(reg, val);
684
		I915_WRITE(reg, val);
557
		POSTING_READ(reg);
685
		POSTING_READ(reg);
558
		return;
686
		return;
Line 559... Line 687...
559
	}
687
	}
560
 
688
 
561
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
689
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
562
		if (val & VIDEO_DIP_ENABLE) {
690
		WARN(val & VIDEO_DIP_ENABLE,
563
			val &= ~VIDEO_DIP_ENABLE;
-
 
564
			I915_WRITE(reg, val);
-
 
565
			POSTING_READ(reg);
691
		     "DIP already enabled on port %c\n",
566
		}
692
		     (val & VIDEO_DIP_PORT_MASK) >> 29);
567
		val &= ~VIDEO_DIP_PORT_MASK;
693
		val &= ~VIDEO_DIP_PORT_MASK;
Line 568... Line 694...
568
		val |= port;
694
		val |= port;
-
 
695
	}
569
	}
696
 
-
 
697
	val |= VIDEO_DIP_ENABLE;
-
 
698
	val &= ~(VIDEO_DIP_ENABLE_AVI |
-
 
699
		 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
570
 
700
		 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
Line 571... Line 701...
571
	val |= VIDEO_DIP_ENABLE;
701
 
572
	val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
702
	if (intel_hdmi_set_gcp_infoframe(encoder))
Line 573... Line 703...
573
		 VIDEO_DIP_ENABLE_GCP);
703
		val |= VIDEO_DIP_ENABLE_GCP;
Line 580... Line 710...
580
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
710
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
581
}
711
}
Line 582... Line 712...
582
 
712
 
583
static void cpt_set_infoframes(struct drm_encoder *encoder,
713
static void cpt_set_infoframes(struct drm_encoder *encoder,
584
			       bool enable,
714
			       bool enable,
585
			       struct drm_display_mode *adjusted_mode)
715
			       const struct drm_display_mode *adjusted_mode)
586
{
716
{
587
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
717
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
588
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
718
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
589
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
719
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
Line 596... Line 726...
596
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
726
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
Line 597... Line 727...
597
 
727
 
598
	if (!enable) {
728
	if (!enable) {
599
		if (!(val & VIDEO_DIP_ENABLE))
729
		if (!(val & VIDEO_DIP_ENABLE))
600
			return;
730
			return;
-
 
731
		val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI |
-
 
732
			 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
601
		val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI);
733
			 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
602
		I915_WRITE(reg, val);
734
		I915_WRITE(reg, val);
603
		POSTING_READ(reg);
735
		POSTING_READ(reg);
604
		return;
736
		return;
Line 605... Line 737...
605
	}
737
	}
606
 
738
 
607
	/* Set both together, unset both together: see the spec. */
739
	/* Set both together, unset both together: see the spec. */
-
 
740
	val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI;
-
 
741
	val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
-
 
742
		 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
608
	val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI;
743
 
Line 609... Line 744...
609
	val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
744
	if (intel_hdmi_set_gcp_infoframe(encoder))
610
		 VIDEO_DIP_ENABLE_GCP);
745
		val |= VIDEO_DIP_ENABLE_GCP;
Line 611... Line 746...
611
 
746
 
Line 617... Line 752...
617
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
752
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
618
}
753
}
Line 619... Line 754...
619
 
754
 
620
static void vlv_set_infoframes(struct drm_encoder *encoder,
755
static void vlv_set_infoframes(struct drm_encoder *encoder,
621
			       bool enable,
756
			       bool enable,
622
			       struct drm_display_mode *adjusted_mode)
757
			       const struct drm_display_mode *adjusted_mode)
623
{
758
{
624
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
759
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
625
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
760
	struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
626
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
761
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Line 635... Line 770...
635
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
770
	val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
Line 636... Line 771...
636
 
771
 
637
	if (!enable) {
772
	if (!enable) {
638
		if (!(val & VIDEO_DIP_ENABLE))
773
		if (!(val & VIDEO_DIP_ENABLE))
639
			return;
774
			return;
-
 
775
		val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI |
-
 
776
			 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
640
		val &= ~VIDEO_DIP_ENABLE;
777
			 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
641
		I915_WRITE(reg, val);
778
		I915_WRITE(reg, val);
642
		POSTING_READ(reg);
779
		POSTING_READ(reg);
643
		return;
780
		return;
Line 644... Line 781...
644
	}
781
	}
645
 
782
 
646
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
783
	if (port != (val & VIDEO_DIP_PORT_MASK)) {
647
		if (val & VIDEO_DIP_ENABLE) {
784
		WARN(val & VIDEO_DIP_ENABLE,
648
			val &= ~VIDEO_DIP_ENABLE;
-
 
649
			I915_WRITE(reg, val);
-
 
650
			POSTING_READ(reg);
785
		     "DIP already enabled on port %c\n",
651
		}
786
		     (val & VIDEO_DIP_PORT_MASK) >> 29);
652
		val &= ~VIDEO_DIP_PORT_MASK;
787
		val &= ~VIDEO_DIP_PORT_MASK;
Line 653... Line 788...
653
		val |= port;
788
		val |= port;
-
 
789
	}
654
	}
790
 
655
 
791
	val |= VIDEO_DIP_ENABLE;
-
 
792
	val &= ~(VIDEO_DIP_ENABLE_AVI |
-
 
793
		 VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
-
 
794
		 VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP);
Line 656... Line 795...
656
	val |= VIDEO_DIP_ENABLE;
795
 
657
	val &= ~(VIDEO_DIP_ENABLE_AVI | VIDEO_DIP_ENABLE_VENDOR |
796
	if (intel_hdmi_set_gcp_infoframe(encoder))
Line 658... Line 797...
658
		 VIDEO_DIP_ENABLE_GAMUT | VIDEO_DIP_ENABLE_GCP);
797
		val |= VIDEO_DIP_ENABLE_GCP;
Line 665... Line 804...
665
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
804
	intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
666
}
805
}
Line 667... Line 806...
667
 
806
 
668
static void hsw_set_infoframes(struct drm_encoder *encoder,
807
static void hsw_set_infoframes(struct drm_encoder *encoder,
669
			       bool enable,
808
			       bool enable,
670
			       struct drm_display_mode *adjusted_mode)
809
			       const struct drm_display_mode *adjusted_mode)
671
{
810
{
672
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
811
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
673
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
812
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
674
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
813
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
675
	u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
814
	u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder);
Line 676... Line 815...
676
	u32 val = I915_READ(reg);
815
	u32 val = I915_READ(reg);
Line -... Line 816...
-
 
816
 
-
 
817
	assert_hdmi_port_disabled(intel_hdmi);
-
 
818
 
-
 
819
	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW |
677
 
820
		 VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |
678
	assert_hdmi_port_disabled(intel_hdmi);
821
		 VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW);
679
 
822
 
680
	if (!enable) {
823
	if (!enable) {
681
		I915_WRITE(reg, 0);
824
		I915_WRITE(reg, val);
Line 682... Line 825...
682
		POSTING_READ(reg);
825
		POSTING_READ(reg);
683
		return;
826
		return;
Line 684... Line 827...
684
	}
827
	}
685
 
828
 
Line 686... Line 829...
686
	val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_GCP_HSW |
829
	if (intel_hdmi_set_gcp_infoframe(encoder))
Line 698... Line 841...
698
{
841
{
699
	struct drm_device *dev = encoder->base.dev;
842
	struct drm_device *dev = encoder->base.dev;
700
	struct drm_i915_private *dev_priv = dev->dev_private;
843
	struct drm_i915_private *dev_priv = dev->dev_private;
701
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
844
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
702
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
845
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
703
	struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
846
	const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
704
	u32 hdmi_val;
847
	u32 hdmi_val;
Line 705... Line 848...
705
 
848
 
706
	hdmi_val = SDVO_ENCODING_HDMI;
849
	hdmi_val = SDVO_ENCODING_HDMI;
707
	if (!HAS_PCH_SPLIT(dev))
850
	if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range)
708
		hdmi_val |= intel_hdmi->color_range;
851
		hdmi_val |= HDMI_COLOR_RANGE_16_235;
709
	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
852
	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
710
		hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
853
		hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
711
	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
854
	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
Line 712... Line 855...
712
		hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
855
		hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
713
 
856
 
714
	if (crtc->config.pipe_bpp > 24)
857
	if (crtc->config->pipe_bpp > 24)
715
		hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
858
		hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
Line 716... Line 859...
716
	else
859
	else
717
		hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
860
		hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
Line 718... Line 861...
718
 
861
 
719
	if (crtc->config.has_hdmi_sink)
862
	if (crtc->config->has_hdmi_sink)
720
		hdmi_val |= HDMI_MODE_SELECT_HDMI;
863
		hdmi_val |= HDMI_MODE_SELECT_HDMI;
Line 757... Line 900...
757
 
900
 
758
	return true;
901
	return true;
Line 759... Line 902...
759
}
902
}
760
 
903
 
761
static void intel_hdmi_get_config(struct intel_encoder *encoder,
904
static void intel_hdmi_get_config(struct intel_encoder *encoder,
762
				  struct intel_crtc_config *pipe_config)
905
				  struct intel_crtc_state *pipe_config)
763
{
906
{
764
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
907
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
765
	struct drm_device *dev = encoder->base.dev;
908
	struct drm_device *dev = encoder->base.dev;
Line 790... Line 933...
790
 
933
 
791
	if (!HAS_PCH_SPLIT(dev) &&
934
	if (!HAS_PCH_SPLIT(dev) &&
792
	    tmp & HDMI_COLOR_RANGE_16_235)
935
	    tmp & HDMI_COLOR_RANGE_16_235)
Line 793... Line 936...
793
		pipe_config->limited_color_range = true;
936
		pipe_config->limited_color_range = true;
Line 794... Line 937...
794
 
937
 
795
	pipe_config->adjusted_mode.flags |= flags;
938
	pipe_config->base.adjusted_mode.flags |= flags;
796
 
939
 
797
	if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
940
	if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc)
Line -... Line 941...
-
 
941
		dotclock = pipe_config->port_clock * 2 / 3;
-
 
942
	else
-
 
943
		dotclock = pipe_config->port_clock;
798
		dotclock = pipe_config->port_clock * 2 / 3;
944
 
799
	else
945
	if (pipe_config->pixel_multiplier)
Line 800... Line 946...
800
		dotclock = pipe_config->port_clock;
946
		dotclock /= pipe_config->pixel_multiplier;
801
 
947
 
Line -... Line 948...
-
 
948
	if (HAS_PCH_SPLIT(dev_priv->dev))
-
 
949
		ironlake_check_encoder_dotclock(pipe_config, dotclock);
-
 
950
 
-
 
951
	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
-
 
952
}
-
 
953
 
-
 
954
static void intel_enable_hdmi_audio(struct intel_encoder *encoder)
-
 
955
{
-
 
956
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-
 
957
 
802
	if (HAS_PCH_SPLIT(dev_priv->dev))
958
	WARN_ON(!crtc->config->has_hdmi_sink);
803
		ironlake_check_encoder_dotclock(pipe_config, dotclock);
959
	DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
804
 
960
			 pipe_name(crtc->pipe));
805
	pipe_config->adjusted_mode.crtc_clock = dotclock;
961
	intel_audio_codec_enable(encoder);
806
}
962
}
807
 
963
 
808
static void intel_enable_hdmi(struct intel_encoder *encoder)
964
static void g4x_enable_hdmi(struct intel_encoder *encoder)
809
{
-
 
Line -... Line 965...
-
 
965
{
-
 
966
	struct drm_device *dev = encoder->base.dev;
-
 
967
	struct drm_i915_private *dev_priv = dev->dev_private;
810
	struct drm_device *dev = encoder->base.dev;
968
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
811
	struct drm_i915_private *dev_priv = dev->dev_private;
969
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
-
 
970
	u32 temp;
-
 
971
 
-
 
972
	temp = I915_READ(intel_hdmi->hdmi_reg);
-
 
973
 
-
 
974
	temp |= SDVO_ENABLE;
-
 
975
	if (crtc->config->has_audio)
-
 
976
		temp |= SDVO_AUDIO_ENABLE;
-
 
977
 
-
 
978
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
979
	POSTING_READ(intel_hdmi->hdmi_reg);
-
 
980
 
-
 
981
	if (crtc->config->has_audio)
-
 
982
		intel_enable_hdmi_audio(encoder);
-
 
983
}
-
 
984
 
Line 812... Line 985...
812
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
985
static void ibx_enable_hdmi(struct intel_encoder *encoder)
Line 813... Line 986...
813
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
986
{
814
	u32 temp;
-
 
815
	u32 enable_bits = SDVO_ENABLE;
987
	struct drm_device *dev = encoder->base.dev;
816
 
988
	struct drm_i915_private *dev_priv = dev->dev_private;
Line -... Line 989...
-
 
989
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
817
	if (intel_crtc->config.has_audio)
990
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
818
		enable_bits |= SDVO_AUDIO_ENABLE;
991
	u32 temp;
819
 
992
 
-
 
993
	temp = I915_READ(intel_hdmi->hdmi_reg);
-
 
994
 
-
 
995
	temp |= SDVO_ENABLE;
-
 
996
	if (crtc->config->has_audio)
-
 
997
		temp |= SDVO_AUDIO_ENABLE;
-
 
998
 
-
 
999
	/*
-
 
1000
	 * HW workaround, need to write this twice for issue
-
 
1001
	 * that may result in first write getting masked.
-
 
1002
	 */
-
 
1003
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1004
	POSTING_READ(intel_hdmi->hdmi_reg);
820
	temp = I915_READ(intel_hdmi->hdmi_reg);
1005
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1006
	POSTING_READ(intel_hdmi->hdmi_reg);
821
 
1007
 
822
	/* HW workaround for IBX, we need to move the port to transcoder A
1008
	/*
-
 
1009
	 * HW workaround, need to toggle enable bit off and on
-
 
1010
	 * for 12bpc with pixel repeat.
-
 
1011
	 *
-
 
1012
	 * FIXME: BSpec says this should be done at the end of
-
 
1013
	 * of the modeset sequence, so not sure if this isn't too soon.
-
 
1014
	 */
-
 
1015
	if (crtc->config->pipe_bpp > 24 &&
-
 
1016
	    crtc->config->pixel_multiplier > 1) {
-
 
1017
		I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
823
	 * before disabling it, so restore the transcoder select bit here. */
1018
		POSTING_READ(intel_hdmi->hdmi_reg);
Line -... Line 1019...
-
 
1019
 
-
 
1020
		/*
-
 
1021
		 * HW workaround, need to write this twice for issue
-
 
1022
		 * that may result in first write getting masked.
-
 
1023
		 */
-
 
1024
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1025
		POSTING_READ(intel_hdmi->hdmi_reg);
-
 
1026
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1027
		POSTING_READ(intel_hdmi->hdmi_reg);
-
 
1028
	}
-
 
1029
 
-
 
1030
	if (crtc->config->has_audio)
-
 
1031
		intel_enable_hdmi_audio(encoder);
-
 
1032
}
-
 
1033
 
824
	if (HAS_PCH_IBX(dev))
1034
static void cpt_enable_hdmi(struct intel_encoder *encoder)
-
 
1035
{
-
 
1036
	struct drm_device *dev = encoder->base.dev;
-
 
1037
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
1038
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-
 
1039
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
-
 
1040
	enum pipe pipe = crtc->pipe;
-
 
1041
	u32 temp;
-
 
1042
 
-
 
1043
	temp = I915_READ(intel_hdmi->hdmi_reg);
-
 
1044
 
-
 
1045
	temp |= SDVO_ENABLE;
-
 
1046
	if (crtc->config->has_audio)
-
 
1047
		temp |= SDVO_AUDIO_ENABLE;
-
 
1048
 
-
 
1049
	/*
-
 
1050
	 * WaEnableHDMI8bpcBefore12bpc:snb,ivb
-
 
1051
	 *
-
 
1052
	 * The procedure for 12bpc is as follows:
-
 
1053
	 * 1. disable HDMI clock gating
-
 
1054
	 * 2. enable HDMI with 8bpc
-
 
1055
	 * 3. enable HDMI with 12bpc
Line 825... Line 1056...
825
		enable_bits |= SDVO_PIPE_SEL(intel_crtc->pipe);
1056
	 * 4. enable HDMI clock gating
826
 
1057
	 */
Line 827... Line 1058...
827
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
1058
 
828
	 * we do this anyway which shows more stable in testing.
1059
	if (crtc->config->pipe_bpp > 24) {
829
	 */
-
 
830
	if (HAS_PCH_SPLIT(dev)) {
1060
		I915_WRITE(TRANS_CHICKEN1(pipe),
-
 
1061
			   I915_READ(TRANS_CHICKEN1(pipe)) |
831
		I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
1062
			   TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE);
832
		POSTING_READ(intel_hdmi->hdmi_reg);
1063
 
833
	}
-
 
Line 834... Line -...
834
 
-
 
835
	temp |= enable_bits;
-
 
836
 
1064
		temp &= ~SDVO_COLOR_FORMAT_MASK;
837
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
1065
		temp |= SDVO_COLOR_FORMAT_8bpc;
838
	POSTING_READ(intel_hdmi->hdmi_reg);
1066
	}
839
 
1067
 
-
 
1068
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1069
	POSTING_READ(intel_hdmi->hdmi_reg);
-
 
1070
 
840
	/* HW workaround, need to write this twice for issue that may result
1071
	if (crtc->config->pipe_bpp > 24) {
Line 841... Line 1072...
841
	 * in first write getting masked.
1072
		temp &= ~SDVO_COLOR_FORMAT_MASK;
842
	 */
1073
		temp |= HDMI_COLOR_FORMAT_12bpc;
843
	if (HAS_PCH_SPLIT(dev)) {
1074
 
Line 862... Line 1093...
862
	struct drm_device *dev = encoder->base.dev;
1093
	struct drm_device *dev = encoder->base.dev;
863
	struct drm_i915_private *dev_priv = dev->dev_private;
1094
	struct drm_i915_private *dev_priv = dev->dev_private;
864
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
1095
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
865
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
1096
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
866
	u32 temp;
1097
	u32 temp;
867
	u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;
-
 
868
 
-
 
869
	if (crtc->config.has_audio)
-
 
870
		intel_audio_codec_disable(encoder);
-
 
Line 871... Line 1098...
871
 
1098
 
Line 872... Line -...
872
	temp = I915_READ(intel_hdmi->hdmi_reg);
-
 
873
 
-
 
874
	/* HW workaround for IBX, we need to move the port to transcoder A
1099
	temp = I915_READ(intel_hdmi->hdmi_reg);
875
	 * before disabling it. */
1100
 
876
	if (HAS_PCH_IBX(dev)) {
1101
	temp &= ~(SDVO_ENABLE | SDVO_AUDIO_ENABLE);
Line -... Line 1102...
-
 
1102
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
1103
	POSTING_READ(intel_hdmi->hdmi_reg);
-
 
1104
 
-
 
1105
	/*
-
 
1106
	 * HW workaround for IBX, we need to move the port
877
		struct drm_crtc *crtc = encoder->base.crtc;
1107
	 * to transcoder A after disabling it to allow the
878
		int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
1108
	 * matching DP port to be enabled on transcoder A.
-
 
1109
	 */
-
 
1110
	if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B) {
-
 
1111
		temp &= ~SDVO_PIPE_B_SELECT;
-
 
1112
		temp |= SDVO_ENABLE;
-
 
1113
		/*
879
 
1114
		 * HW workaround, need to write this twice for issue
880
			if (temp & SDVO_PIPE_B_SELECT) {
1115
		 * that may result in first write getting masked.
881
				temp &= ~SDVO_PIPE_B_SELECT;
-
 
882
			I915_WRITE(intel_hdmi->hdmi_reg, temp);
-
 
883
			POSTING_READ(intel_hdmi->hdmi_reg);
1116
		 */
884
 
1117
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
Line 885... Line -...
885
				/* Again we need to write this twice. */
-
 
886
			I915_WRITE(intel_hdmi->hdmi_reg, temp);
1118
		POSTING_READ(intel_hdmi->hdmi_reg);
887
			POSTING_READ(intel_hdmi->hdmi_reg);
-
 
888
 
1119
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
889
				/* Transcoder selection bits only update
-
 
890
				 * effectively on vblank. */
1120
		POSTING_READ(intel_hdmi->hdmi_reg);
891
				if (crtc)
-
 
892
					intel_wait_for_vblank(dev, pipe);
1121
 
Line 893... Line -...
893
				else
-
 
894
					msleep(50);
-
 
895
			}
-
 
896
	}
-
 
897
 
1122
		temp &= ~SDVO_ENABLE;
898
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
-
 
899
	 * we do this anyway which shows more stable in testing.
1123
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
Line -... Line 1124...
-
 
1124
		POSTING_READ(intel_hdmi->hdmi_reg);
-
 
1125
	}
900
	 */
1126
 
Line 901... Line 1127...
901
	if (HAS_PCH_SPLIT(dev)) {
1127
	intel_hdmi->set_infoframes(&encoder->base, false, NULL);
902
		I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
1128
}
Line 903... Line 1129...
903
		POSTING_READ(intel_hdmi->hdmi_reg);
1129
 
-
 
1130
static void g4x_disable_hdmi(struct intel_encoder *encoder)
-
 
1131
{
904
	}
1132
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
905
 
1133
 
906
		temp &= ~enable_bits;
1134
	if (crtc->config->has_audio)
-
 
1135
		intel_audio_codec_disable(encoder);
907
 
1136
 
908
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
1137
	intel_disable_hdmi(encoder);
909
	POSTING_READ(intel_hdmi->hdmi_reg);
1138
}
-
 
1139
 
-
 
1140
static void pch_disable_hdmi(struct intel_encoder *encoder)
-
 
1141
{
-
 
1142
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
910
 
1143
 
Line 911... Line 1144...
911
	/* HW workaround, need to write this twice for issue that may result
1144
	if (crtc->config->has_audio)
912
	 * in first write getting masked.
1145
		intel_audio_codec_disable(encoder);
913
	 */
1146
}
Line 914... Line 1147...
914
	if (HAS_PCH_SPLIT(dev)) {
1147
 
915
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
1148
static void pch_post_disable_hdmi(struct intel_encoder *encoder)
Line 928... Line 1161...
928
	else
1161
	else
929
		return 225000;
1162
		return 225000;
930
}
1163
}
Line 931... Line 1164...
931
 
1164
 
-
 
1165
static enum drm_mode_status
-
 
1166
hdmi_port_clock_valid(struct intel_hdmi *hdmi,
-
 
1167
		      int clock, bool respect_dvi_limit)
-
 
1168
{
-
 
1169
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
-
 
1170
 
-
 
1171
	if (clock < 25000)
-
 
1172
		return MODE_CLOCK_LOW;
-
 
1173
	if (clock > hdmi_port_clock_limit(hdmi, respect_dvi_limit))
-
 
1174
		return MODE_CLOCK_HIGH;
-
 
1175
 
-
 
1176
	/* BXT DPLL can't generate 223-240 MHz */
-
 
1177
	if (IS_BROXTON(dev) && clock > 223333 && clock < 240000)
-
 
1178
		return MODE_CLOCK_RANGE;
-
 
1179
 
-
 
1180
	/* CHV DPLL can't generate 216-240 MHz */
-
 
1181
	if (IS_CHERRYVIEW(dev) && clock > 216000 && clock < 240000)
-
 
1182
		return MODE_CLOCK_RANGE;
-
 
1183
 
-
 
1184
	return MODE_OK;
-
 
1185
}
-
 
1186
 
932
static enum drm_mode_status
1187
static enum drm_mode_status
933
intel_hdmi_mode_valid(struct drm_connector *connector,
1188
intel_hdmi_mode_valid(struct drm_connector *connector,
934
				 struct drm_display_mode *mode)
1189
		      struct drm_display_mode *mode)
-
 
1190
{
-
 
1191
	struct intel_hdmi *hdmi = intel_attached_hdmi(connector);
-
 
1192
	struct drm_device *dev = intel_hdmi_to_dev(hdmi);
935
{
1193
	enum drm_mode_status status;
Line -... Line 1194...
-
 
1194
	int clock;
-
 
1195
 
-
 
1196
	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-
 
1197
		return MODE_NO_DBLESCAN;
936
	int clock = mode->clock;
1198
 
937
 
1199
	clock = mode->clock;
Line 938... Line -...
938
	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
-
 
939
		clock *= 2;
-
 
940
 
-
 
941
	if (clock > hdmi_portclock_limit(intel_attached_hdmi(connector),
1200
	if (mode->flags & DRM_MODE_FLAG_DBLCLK)
942
					       true))
1201
		clock *= 2;
Line -... Line 1202...
-
 
1202
 
943
		return MODE_CLOCK_HIGH;
1203
	/* check if we can do 8bpc */
944
	if (clock < 20000)
1204
	status = hdmi_port_clock_valid(hdmi, clock, true);
Line 945... Line 1205...
945
		return MODE_CLOCK_LOW;
1205
 
946
 
1206
	/* if we can't do 8bpc we may still be able to do 12bpc */
Line 947... Line 1207...
947
	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
1207
	if (!HAS_GMCH_DISPLAY(dev) && status != MODE_OK)
948
		return MODE_NO_DBLESCAN;
1208
		status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true);
949
 
1209
 
-
 
1210
	return status;
950
	return MODE_OK;
1211
}
-
 
1212
 
-
 
1213
static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state)
951
}
1214
{
-
 
1215
	struct drm_device *dev = crtc_state->base.crtc->dev;
Line 952... Line 1216...
952
 
1216
	struct drm_atomic_state *state;
953
static bool hdmi_12bpc_possible(struct intel_crtc *crtc)
1217
	struct intel_encoder *encoder;
Line -... Line 1218...
-
 
1218
	struct drm_connector *connector;
-
 
1219
	struct drm_connector_state *connector_state;
954
{
1220
	int count = 0, count_hdmi = 0;
955
	struct drm_device *dev = crtc->base.dev;
1221
	int i;
956
	struct intel_encoder *encoder;
1222
 
Line -... Line 1223...
-
 
1223
	if (HAS_GMCH_DISPLAY(dev))
-
 
1224
		return false;
957
	int count = 0, count_hdmi = 0;
1225
 
958
 
1226
	state = crtc_state->base.state;
959
	if (HAS_GMCH_DISPLAY(dev))
1227
 
Line 960... Line 1228...
960
		return false;
1228
	for_each_connector_in_state(state, connector, connector_state, i) {
Line 973... Line 1241...
973
	 */
1241
	 */
974
	return count_hdmi > 0 && count_hdmi == count;
1242
	return count_hdmi > 0 && count_hdmi == count;
975
}
1243
}
Line 976... Line 1244...
976
 
1244
 
977
bool intel_hdmi_compute_config(struct intel_encoder *encoder,
1245
bool intel_hdmi_compute_config(struct intel_encoder *encoder,
978
			       struct intel_crtc_config *pipe_config)
1246
			       struct intel_crtc_state *pipe_config)
979
{
1247
{
980
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
1248
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
981
	struct drm_device *dev = encoder->base.dev;
1249
	struct drm_device *dev = encoder->base.dev;
982
	struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
1250
	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
983
	int clock_12bpc = pipe_config->adjusted_mode.crtc_clock * 3 / 2;
1251
	int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;
984
	int portclock_limit = hdmi_portclock_limit(intel_hdmi, false);
1252
	int clock_12bpc = clock_8bpc * 3 / 2;
Line 985... Line 1253...
985
	int desired_bpp;
1253
	int desired_bpp;
Line 986... Line 1254...
986
 
1254
 
987
	pipe_config->has_hdmi_sink = intel_hdmi->has_hdmi_sink;
1255
	pipe_config->has_hdmi_sink = intel_hdmi->has_hdmi_sink;
Line 988... Line 1256...
988
 
1256
 
989
	if (pipe_config->has_hdmi_sink)
1257
	if (pipe_config->has_hdmi_sink)
-
 
1258
		pipe_config->has_infoframe = true;
990
		pipe_config->has_infoframe = true;
1259
 
991
 
1260
	if (intel_hdmi->color_range_auto) {
992
	if (intel_hdmi->color_range_auto) {
-
 
993
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
1261
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
-
 
1262
		pipe_config->limited_color_range =
994
		if (pipe_config->has_hdmi_sink &&
1263
			pipe_config->has_hdmi_sink &&
995
		    drm_match_cea_mode(adjusted_mode) > 1)
1264
			drm_match_cea_mode(adjusted_mode) > 1;
Line 996... Line 1265...
996
			intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
1265
	} else {
997
		else
1266
		pipe_config->limited_color_range =
-
 
1267
			intel_hdmi->limited_color_range;
-
 
1268
	}
998
			intel_hdmi->color_range = 0;
1269
 
Line 999... Line -...
999
	}
-
 
1000
 
-
 
1001
	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) {
-
 
1002
		pipe_config->pixel_multiplier = 2;
1270
	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) {
1003
	}
1271
		pipe_config->pixel_multiplier = 2;
Line 1004... Line 1272...
1004
 
1272
		clock_8bpc *= 2;
1005
	if (intel_hdmi->color_range)
1273
		clock_12bpc *= 2;
Line 1016... Line 1284...
1016
	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
1284
	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
1017
	 * outputs. We also need to check that the higher clock still fits
1285
	 * outputs. We also need to check that the higher clock still fits
1018
	 * within limits.
1286
	 * within limits.
1019
	 */
1287
	 */
1020
	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
1288
	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
1021
	    clock_12bpc <= portclock_limit &&
1289
	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, false) == MODE_OK &&
1022
	    hdmi_12bpc_possible(encoder->new_crtc)) {
1290
	    hdmi_12bpc_possible(pipe_config)) {
1023
		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
1291
		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
1024
		desired_bpp = 12*3;
1292
		desired_bpp = 12*3;
Line 1025... Line 1293...
1025
 
1293
 
1026
		/* Need to adjust the port link by 1.5x for 12bpc. */
1294
		/* Need to adjust the port link by 1.5x for 12bpc. */
1027
		pipe_config->port_clock = clock_12bpc;
1295
		pipe_config->port_clock = clock_12bpc;
1028
	} else {
1296
	} else {
1029
		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
1297
		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
-
 
1298
		desired_bpp = 8*3;
-
 
1299
 
1030
		desired_bpp = 8*3;
1300
		pipe_config->port_clock = clock_8bpc;
Line 1031... Line 1301...
1031
	}
1301
	}
1032
 
1302
 
1033
	if (!pipe_config->bw_constrained) {
1303
	if (!pipe_config->bw_constrained) {
1034
		DRM_DEBUG_KMS("forcing pipe bpc to %i for HDMI\n", desired_bpp);
1304
		DRM_DEBUG_KMS("forcing pipe bpc to %i for HDMI\n", desired_bpp);
Line 1035... Line 1305...
1035
		pipe_config->pipe_bpp = desired_bpp;
1305
		pipe_config->pipe_bpp = desired_bpp;
-
 
1306
	}
1036
	}
1307
 
1037
 
1308
	if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock,
1038
	if (adjusted_mode->crtc_clock > portclock_limit) {
1309
				  false) != MODE_OK) {
Line -... Line 1310...
-
 
1310
		DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n");
-
 
1311
		return false;
-
 
1312
	}
1039
		DRM_DEBUG_KMS("too high HDMI clock, rejecting mode\n");
1313
 
1040
		return false;
1314
	/* Set user selected PAR to incoming mode's member */
Line 1041... Line 1315...
1041
	}
1315
	adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
1042
 
1316
 
Line 1055... Line 1329...
1055
	kfree(to_intel_connector(connector)->detect_edid);
1329
	kfree(to_intel_connector(connector)->detect_edid);
1056
	to_intel_connector(connector)->detect_edid = NULL;
1330
	to_intel_connector(connector)->detect_edid = NULL;
1057
}
1331
}
Line 1058... Line 1332...
1058
 
1332
 
1059
static bool
1333
static bool
1060
intel_hdmi_set_edid(struct drm_connector *connector)
1334
intel_hdmi_set_edid(struct drm_connector *connector, bool force)
1061
{
1335
{
1062
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
1336
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
1063
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
 
1064
	struct intel_encoder *intel_encoder =
-
 
1065
		&hdmi_to_dig_port(intel_hdmi)->base;
-
 
1066
	enum intel_display_power_domain power_domain;
1337
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1067
	struct edid *edid;
1338
	struct edid *edid = NULL;
Line 1068... Line -...
1068
	bool connected = false;
-
 
1069
 
1339
	bool connected = false;
Line -... Line 1340...
-
 
1340
 
1070
	power_domain = intel_display_port_power_domain(intel_encoder);
1341
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1071
	intel_display_power_get(dev_priv, power_domain);
1342
 
1072
 
1343
	if (force)
Line 1073... Line 1344...
1073
	edid = drm_get_edid(connector,
1344
		edid = drm_get_edid(connector,
Line 1074... Line 1345...
1074
			    intel_gmbus_get_adapter(dev_priv,
1345
				    intel_gmbus_get_adapter(dev_priv,
1075
						    intel_hdmi->ddc_bus));
1346
				    intel_hdmi->ddc_bus));
1076
 
1347
 
1077
	intel_display_power_put(dev_priv, power_domain);
1348
	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
Line 1098... Line 1369...
1098
 
1369
 
1099
static enum drm_connector_status
1370
static enum drm_connector_status
1100
intel_hdmi_detect(struct drm_connector *connector, bool force)
1371
intel_hdmi_detect(struct drm_connector *connector, bool force)
1101
{
1372
{
-
 
1373
	enum drm_connector_status status;
-
 
1374
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
 
1375
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-
 
1376
	bool live_status = false;
Line 1102... Line 1377...
1102
	enum drm_connector_status status;
1377
	unsigned int try;
1103
 
1378
 
Line -... Line 1379...
-
 
1379
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
-
 
1380
		      connector->base.id, connector->name);
-
 
1381
 
-
 
1382
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
-
 
1383
 
-
 
1384
	for (try = 0; !live_status && try < 9; try++) {
-
 
1385
		if (try)
-
 
1386
			msleep(10);
-
 
1387
		live_status = intel_digital_port_connected(dev_priv,
-
 
1388
				hdmi_to_dig_port(intel_hdmi));
-
 
1389
	}
-
 
1390
 
1104
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1391
	if (!live_status)
Line 1105... Line 1392...
1105
		      connector->base.id, connector->name);
1392
		DRM_DEBUG_KMS("Live status not up!");
1106
 
1393
 
Line 1107... Line 1394...
1107
	intel_hdmi_unset_edid(connector);
1394
	intel_hdmi_unset_edid(connector);
1108
 
1395
 
1109
	if (intel_hdmi_set_edid(connector)) {
1396
	if (intel_hdmi_set_edid(connector, live_status)) {
1110
		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1397
		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
Line -... Line 1398...
-
 
1398
 
-
 
1399
		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1111
 
1400
		status = connector_status_connected;
1112
		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1401
	} else
Line 1113... Line 1402...
1113
		status = connector_status_connected;
1402
		status = connector_status_disconnected;
1114
	} else
1403
 
Line 1128... Line 1417...
1128
	intel_hdmi_unset_edid(connector);
1417
	intel_hdmi_unset_edid(connector);
Line 1129... Line 1418...
1129
 
1418
 
1130
	if (connector->status != connector_status_connected)
1419
	if (connector->status != connector_status_connected)
Line 1131... Line 1420...
1131
		return;
1420
		return;
1132
 
1421
 
1133
	intel_hdmi_set_edid(connector);
1422
	intel_hdmi_set_edid(connector, true);
Line 1134... Line 1423...
1134
	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1423
	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1135
}
1424
}
Line 1194... Line 1483...
1194
		goto done;
1483
		goto done;
1195
	}
1484
	}
Line 1196... Line 1485...
1196
 
1485
 
1197
	if (property == dev_priv->broadcast_rgb_property) {
1486
	if (property == dev_priv->broadcast_rgb_property) {
1198
		bool old_auto = intel_hdmi->color_range_auto;
1487
		bool old_auto = intel_hdmi->color_range_auto;
Line 1199... Line 1488...
1199
		uint32_t old_range = intel_hdmi->color_range;
1488
		bool old_range = intel_hdmi->limited_color_range;
1200
 
1489
 
1201
		switch (val) {
1490
		switch (val) {
1202
		case INTEL_BROADCAST_RGB_AUTO:
1491
		case INTEL_BROADCAST_RGB_AUTO:
1203
			intel_hdmi->color_range_auto = true;
1492
			intel_hdmi->color_range_auto = true;
1204
			break;
1493
			break;
1205
		case INTEL_BROADCAST_RGB_FULL:
1494
		case INTEL_BROADCAST_RGB_FULL:
1206
			intel_hdmi->color_range_auto = false;
1495
			intel_hdmi->color_range_auto = false;
1207
			intel_hdmi->color_range = 0;
1496
			intel_hdmi->limited_color_range = false;
1208
			break;
1497
			break;
1209
		case INTEL_BROADCAST_RGB_LIMITED:
1498
		case INTEL_BROADCAST_RGB_LIMITED:
1210
			intel_hdmi->color_range_auto = false;
1499
			intel_hdmi->color_range_auto = false;
1211
			intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
1500
			intel_hdmi->limited_color_range = true;
1212
			break;
1501
			break;
1213
		default:
1502
		default:
Line 1214... Line 1503...
1214
			return -EINVAL;
1503
			return -EINVAL;
1215
		}
1504
		}
1216
 
1505
 
Line 1217... Line 1506...
1217
		if (old_auto == intel_hdmi->color_range_auto &&
1506
		if (old_auto == intel_hdmi->color_range_auto &&
1218
		    old_range == intel_hdmi->color_range)
1507
		    old_range == intel_hdmi->limited_color_range)
Line 1249... Line 1538...
1249
 
1538
 
1250
static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
1539
static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
1251
{
1540
{
1252
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
1541
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
1253
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
1542
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
1254
	struct drm_display_mode *adjusted_mode =
-
 
Line 1255... Line 1543...
1255
		&intel_crtc->config.adjusted_mode;
1543
	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
Line 1256... Line 1544...
1256
 
1544
 
1257
	intel_hdmi_prepare(encoder);
1545
	intel_hdmi_prepare(encoder);
1258
 
1546
 
1259
	intel_hdmi->set_infoframes(&encoder->base,
1547
	intel_hdmi->set_infoframes(&encoder->base,
Line 1260... Line 1548...
1260
				   intel_crtc->config.has_hdmi_sink,
1548
				   intel_crtc->config->has_hdmi_sink,
1261
				   adjusted_mode);
1549
				   adjusted_mode);
Line 1267... Line 1555...
1267
	struct intel_hdmi *intel_hdmi = &dport->hdmi;
1555
	struct intel_hdmi *intel_hdmi = &dport->hdmi;
1268
	struct drm_device *dev = encoder->base.dev;
1556
	struct drm_device *dev = encoder->base.dev;
1269
	struct drm_i915_private *dev_priv = dev->dev_private;
1557
	struct drm_i915_private *dev_priv = dev->dev_private;
1270
	struct intel_crtc *intel_crtc =
1558
	struct intel_crtc *intel_crtc =
1271
		to_intel_crtc(encoder->base.crtc);
1559
		to_intel_crtc(encoder->base.crtc);
1272
	struct drm_display_mode *adjusted_mode =
1560
	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
1273
		&intel_crtc->config.adjusted_mode;
-
 
1274
	enum dpio_channel port = vlv_dport_to_channel(dport);
1561
	enum dpio_channel port = vlv_dport_to_channel(dport);
1275
	int pipe = intel_crtc->pipe;
1562
	int pipe = intel_crtc->pipe;
1276
	u32 val;
1563
	u32 val;
Line 1277... Line 1564...
1277
 
1564
 
1278
	/* Enable clock channels for this port */
1565
	/* Enable clock channels for this port */
1279
	mutex_lock(&dev_priv->dpio_lock);
1566
	mutex_lock(&dev_priv->sb_lock);
1280
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(port));
1567
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(port));
1281
	val = 0;
1568
	val = 0;
1282
	if (pipe)
1569
	if (pipe)
1283
		val |= (1<<21);
1570
		val |= (1<<21);
Line 1297... Line 1584...
1297
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN);
1584
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN);
Line 1298... Line 1585...
1298
 
1585
 
1299
	/* Program lane clock */
1586
	/* Program lane clock */
1300
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW14(port), 0x00760018);
1587
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW14(port), 0x00760018);
1301
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW23(port), 0x00400888);
1588
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW23(port), 0x00400888);
Line 1302... Line 1589...
1302
	mutex_unlock(&dev_priv->dpio_lock);
1589
	mutex_unlock(&dev_priv->sb_lock);
1303
 
1590
 
1304
	intel_hdmi->set_infoframes(&encoder->base,
1591
	intel_hdmi->set_infoframes(&encoder->base,
Line 1305... Line 1592...
1305
				   intel_crtc->config.has_hdmi_sink,
1592
				   intel_crtc->config->has_hdmi_sink,
Line 1306... Line 1593...
1306
				   adjusted_mode);
1593
				   adjusted_mode);
1307
 
1594
 
Line 1308... Line 1595...
1308
	intel_enable_hdmi(encoder);
1595
	g4x_enable_hdmi(encoder);
1309
 
1596
 
1310
	vlv_wait_port_ready(dev_priv, dport);
1597
	vlv_wait_port_ready(dev_priv, dport, 0x0);
Line 1321... Line 1608...
1321
	int pipe = intel_crtc->pipe;
1608
	int pipe = intel_crtc->pipe;
Line 1322... Line 1609...
1322
 
1609
 
Line 1323... Line 1610...
1323
	intel_hdmi_prepare(encoder);
1610
	intel_hdmi_prepare(encoder);
1324
 
1611
 
1325
	/* Program Tx lane resets to default */
1612
	/* Program Tx lane resets to default */
1326
	mutex_lock(&dev_priv->dpio_lock);
1613
	mutex_lock(&dev_priv->sb_lock);
1327
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port),
1614
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port),
1328
			 DPIO_PCS_TX_LANE2_RESET |
1615
			 DPIO_PCS_TX_LANE2_RESET |
1329
			 DPIO_PCS_TX_LANE1_RESET);
1616
			 DPIO_PCS_TX_LANE1_RESET);
Line 1338... Line 1625...
1338
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW11(port), 0x00001500);
1625
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW11(port), 0x00001500);
1339
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW14(port), 0x40400000);
1626
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW14(port), 0x40400000);
Line 1340... Line 1627...
1340
 
1627
 
1341
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW9(port), 0x00002000);
1628
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW9(port), 0x00002000);
1342
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN);
1629
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN);
-
 
1630
	mutex_unlock(&dev_priv->sb_lock);
-
 
1631
}
-
 
1632
 
-
 
1633
static void chv_data_lane_soft_reset(struct intel_encoder *encoder,
-
 
1634
				     bool reset)
-
 
1635
{
-
 
1636
	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-
 
1637
	enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base));
-
 
1638
	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
-
 
1639
	enum pipe pipe = crtc->pipe;
-
 
1640
	uint32_t val;
-
 
1641
 
-
 
1642
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW0(ch));
-
 
1643
	if (reset)
-
 
1644
		val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
-
 
1645
	else
-
 
1646
		val |= DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET;
-
 
1647
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW0(ch), val);
-
 
1648
 
-
 
1649
	if (crtc->config->lane_count > 2) {
-
 
1650
		val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW0(ch));
-
 
1651
		if (reset)
-
 
1652
			val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
-
 
1653
		else
-
 
1654
			val |= DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET;
-
 
1655
		vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW0(ch), val);
-
 
1656
	}
-
 
1657
 
-
 
1658
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW1(ch));
-
 
1659
	val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1660
	if (reset)
-
 
1661
		val &= ~DPIO_PCS_CLK_SOFT_RESET;
-
 
1662
	else
-
 
1663
		val |= DPIO_PCS_CLK_SOFT_RESET;
-
 
1664
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW1(ch), val);
-
 
1665
 
-
 
1666
	if (crtc->config->lane_count > 2) {
-
 
1667
		val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW1(ch));
-
 
1668
		val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1669
		if (reset)
-
 
1670
			val &= ~DPIO_PCS_CLK_SOFT_RESET;
-
 
1671
		else
-
 
1672
			val |= DPIO_PCS_CLK_SOFT_RESET;
-
 
1673
		vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW1(ch), val);
1343
	mutex_unlock(&dev_priv->dpio_lock);
1674
	}
Line 1344... Line 1675...
1344
}
1675
}
1345
 
1676
 
1346
static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
1677
static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
Line 1354... Line 1685...
1354
	enum pipe pipe = intel_crtc->pipe;
1685
	enum pipe pipe = intel_crtc->pipe;
1355
	u32 val;
1686
	u32 val;
Line 1356... Line 1687...
1356
 
1687
 
Line -... Line 1688...
-
 
1688
	intel_hdmi_prepare(encoder);
-
 
1689
 
-
 
1690
	/*
-
 
1691
	 * Must trick the second common lane into life.
-
 
1692
	 * Otherwise we can't even access the PLL.
-
 
1693
	 */
-
 
1694
	if (ch == DPIO_CH0 && pipe == PIPE_B)
-
 
1695
		dport->release_cl2_override =
-
 
1696
			!chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true);
-
 
1697
 
1357
	intel_hdmi_prepare(encoder);
1698
	chv_phy_powergate_lanes(encoder, true, 0x0);
-
 
1699
 
-
 
1700
	mutex_lock(&dev_priv->sb_lock);
-
 
1701
 
Line 1358... Line 1702...
1358
 
1702
	/* Assert data lane reset */
1359
	mutex_lock(&dev_priv->dpio_lock);
1703
	chv_data_lane_soft_reset(encoder, true);
1360
 
1704
 
1361
	/* program left/right clock distribution */
1705
	/* program left/right clock distribution */
Line 1404... Line 1748...
1404
		val &= ~CHV_CMN_USEDCLKCHANNEL;
1748
		val &= ~CHV_CMN_USEDCLKCHANNEL;
1405
	else
1749
	else
1406
		val |= CHV_CMN_USEDCLKCHANNEL;
1750
		val |= CHV_CMN_USEDCLKCHANNEL;
1407
	vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val);
1751
	vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val);
Line 1408... Line 1752...
1408
 
1752
 
-
 
1753
	mutex_unlock(&dev_priv->sb_lock);
-
 
1754
}
-
 
1755
 
-
 
1756
static void chv_hdmi_post_pll_disable(struct intel_encoder *encoder)
-
 
1757
{
-
 
1758
	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-
 
1759
	enum pipe pipe = to_intel_crtc(encoder->base.crtc)->pipe;
-
 
1760
	u32 val;
-
 
1761
 
-
 
1762
	mutex_lock(&dev_priv->sb_lock);
-
 
1763
 
-
 
1764
	/* disable left/right clock distribution */
-
 
1765
	if (pipe != PIPE_B) {
-
 
1766
		val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0);
-
 
1767
		val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK);
-
 
1768
		vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val);
-
 
1769
	} else {
-
 
1770
		val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1);
-
 
1771
		val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK);
-
 
1772
		vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val);
-
 
1773
	}
-
 
1774
 
-
 
1775
	mutex_unlock(&dev_priv->sb_lock);
-
 
1776
 
-
 
1777
	/*
-
 
1778
	 * Leave the power down bit cleared for at least one
-
 
1779
	 * lane so that chv_powergate_phy_ch() will power
-
 
1780
	 * on something when the channel is otherwise unused.
-
 
1781
	 * When the port is off and the override is removed
-
 
1782
	 * the lanes power down anyway, so otherwise it doesn't
-
 
1783
	 * really matter what the state of power down bits is
-
 
1784
	 * after this.
-
 
1785
	 */
1409
	mutex_unlock(&dev_priv->dpio_lock);
1786
	chv_phy_powergate_lanes(encoder, false, 0x0);
Line 1410... Line 1787...
1410
}
1787
}
1411
 
1788
 
1412
static void vlv_hdmi_post_disable(struct intel_encoder *encoder)
1789
static void vlv_hdmi_post_disable(struct intel_encoder *encoder)
Line 1417... Line 1794...
1417
		to_intel_crtc(encoder->base.crtc);
1794
		to_intel_crtc(encoder->base.crtc);
1418
	enum dpio_channel port = vlv_dport_to_channel(dport);
1795
	enum dpio_channel port = vlv_dport_to_channel(dport);
1419
	int pipe = intel_crtc->pipe;
1796
	int pipe = intel_crtc->pipe;
Line 1420... Line 1797...
1420
 
1797
 
1421
	/* Reset lanes to avoid HDMI flicker (VLV w/a) */
1798
	/* Reset lanes to avoid HDMI flicker (VLV w/a) */
1422
	mutex_lock(&dev_priv->dpio_lock);
1799
	mutex_lock(&dev_priv->sb_lock);
1423
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port), 0x00000000);
1800
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port), 0x00000000);
1424
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW1(port), 0x00e00060);
1801
	vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW1(port), 0x00e00060);
1425
	mutex_unlock(&dev_priv->dpio_lock);
1802
	mutex_unlock(&dev_priv->sb_lock);
Line 1426... Line 1803...
1426
}
1803
}
1427
 
1804
 
1428
static void chv_hdmi_post_disable(struct intel_encoder *encoder)
-
 
1429
{
1805
static void chv_hdmi_post_disable(struct intel_encoder *encoder)
1430
	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1806
{
1431
	struct drm_device *dev = encoder->base.dev;
-
 
1432
	struct drm_i915_private *dev_priv = dev->dev_private;
-
 
1433
	struct intel_crtc *intel_crtc =
-
 
1434
		to_intel_crtc(encoder->base.crtc);
-
 
1435
	enum dpio_channel ch = vlv_dport_to_channel(dport);
-
 
Line 1436... Line 1807...
1436
	enum pipe pipe = intel_crtc->pipe;
1807
	struct drm_device *dev = encoder->base.dev;
Line 1437... Line 1808...
1437
	u32 val;
1808
	struct drm_i915_private *dev_priv = dev->dev_private;
1438
 
1809
 
1439
	mutex_lock(&dev_priv->dpio_lock);
-
 
1440
 
-
 
1441
	/* Propagate soft reset to data lane reset */
-
 
1442
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW1(ch));
-
 
1443
	val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1444
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW1(ch), val);
-
 
Line 1445... Line -...
1445
 
-
 
1446
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW1(ch));
-
 
1447
	val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1448
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW1(ch), val);
-
 
1449
 
-
 
1450
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW0(ch));
-
 
1451
	val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
-
 
1452
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW0(ch), val);
-
 
1453
 
1810
	mutex_lock(&dev_priv->sb_lock);
1454
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW0(ch));
1811
 
Line 1455... Line 1812...
1455
	val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
1812
	/* Assert data lane reset */
1456
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW0(ch), val);
1813
	chv_data_lane_soft_reset(encoder, true);
1457
 
1814
 
1458
	mutex_unlock(&dev_priv->dpio_lock);
1815
	mutex_unlock(&dev_priv->sb_lock);
1459
}
1816
}
1460
 
1817
 
1461
static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
1818
static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
1462
{
1819
{
1463
	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1820
	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1464
	struct intel_hdmi *intel_hdmi = &dport->hdmi;
-
 
1465
	struct drm_device *dev = encoder->base.dev;
1821
	struct intel_hdmi *intel_hdmi = &dport->hdmi;
1466
	struct drm_i915_private *dev_priv = dev->dev_private;
1822
	struct drm_device *dev = encoder->base.dev;
1467
	struct intel_crtc *intel_crtc =
1823
	struct drm_i915_private *dev_priv = dev->dev_private;
1468
		to_intel_crtc(encoder->base.crtc);
1824
	struct intel_crtc *intel_crtc =
Line 1469... Line 1825...
1469
	struct drm_display_mode *adjusted_mode =
1825
		to_intel_crtc(encoder->base.crtc);
Line 1470... Line 1826...
1470
		&intel_crtc->config.adjusted_mode;
1826
	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
1471
	enum dpio_channel ch = vlv_dport_to_channel(dport);
1827
	enum dpio_channel ch = vlv_dport_to_channel(dport);
1472
	int pipe = intel_crtc->pipe;
1828
	int pipe = intel_crtc->pipe;
1473
	int data, i;
1829
	int data, i, stagger;
Line 1474... Line 1830...
1474
	u32 val;
1830
	u32 val;
1475
 
1831
 
1476
	mutex_lock(&dev_priv->dpio_lock);
1832
	mutex_lock(&dev_priv->sb_lock);
Line 1477... Line -...
1477
 
-
 
1478
	/* allow hardware to manage TX FIFO reset source */
-
 
1479
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW11(ch));
-
 
1480
	val &= ~DPIO_LANEDESKEW_STRAP_OVRD;
-
 
1481
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW11(ch), val);
-
 
1482
 
-
 
1483
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW11(ch));
-
 
1484
	val &= ~DPIO_LANEDESKEW_STRAP_OVRD;
-
 
1485
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW11(ch), val);
-
 
1486
 
-
 
1487
	/* Deassert soft data lane reset*/
-
 
1488
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW1(ch));
-
 
1489
	val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1490
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW1(ch), val);
-
 
1491
 
-
 
1492
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW1(ch));
-
 
1493
	val |= CHV_PCS_REQ_SOFTRESET_EN;
-
 
1494
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW1(ch), val);
1833
 
1495
 
1834
	/* allow hardware to manage TX FIFO reset source */
1496
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW0(ch));
-
 
1497
	val |= (DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
-
 
1498
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW0(ch), val);
-
 
1499
 
-
 
1500
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW0(ch));
-
 
1501
	val |= (DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET);
1835
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW11(ch));
1502
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW0(ch), val);
1836
	val &= ~DPIO_LANEDESKEW_STRAP_OVRD;
1503
 
1837
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW11(ch), val);
1504
	/* Program Tx latency optimal setting */
1838
 
1505
	for (i = 0; i < 4; i++) {
1839
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW11(ch));
Line 1506... Line 1840...
1506
		/* Set the latency optimal bit */
1840
	val &= ~DPIO_LANEDESKEW_STRAP_OVRD;
-
 
1841
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW11(ch), val);
-
 
1842
 
-
 
1843
	/* Program Tx latency optimal setting */
-
 
1844
	for (i = 0; i < 4; i++) {
-
 
1845
		/* Set the upar bit */
-
 
1846
		data = (i == 1) ? 0x0 : 0x1;
-
 
1847
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW14(ch, i),
-
 
1848
				data << DPIO_UPAR_SHIFT);
-
 
1849
	}
-
 
1850
 
-
 
1851
	/* Data lane stagger programming */
-
 
1852
	if (intel_crtc->config->port_clock > 270000)
-
 
1853
		stagger = 0x18;
-
 
1854
	else if (intel_crtc->config->port_clock > 135000)
-
 
1855
		stagger = 0xd;
-
 
1856
	else if (intel_crtc->config->port_clock > 67500)
-
 
1857
		stagger = 0x7;
-
 
1858
	else if (intel_crtc->config->port_clock > 33750)
-
 
1859
		stagger = 0x4;
-
 
1860
	else
-
 
1861
		stagger = 0x2;
-
 
1862
 
-
 
1863
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW11(ch));
-
 
1864
	val |= DPIO_TX2_STAGGER_MASK(0x1f);
-
 
1865
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW11(ch), val);
-
 
1866
 
-
 
1867
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW11(ch));
-
 
1868
	val |= DPIO_TX2_STAGGER_MASK(0x1f);
-
 
1869
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW11(ch), val);
-
 
1870
 
-
 
1871
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW12(ch),
-
 
1872
		       DPIO_LANESTAGGER_STRAP(stagger) |
-
 
1873
		       DPIO_LANESTAGGER_STRAP_OVRD |
1507
		data = (i == 1) ? 0x0 : 0x6;
1874
		       DPIO_TX1_STAGGER_MASK(0x1f) |
-
 
1875
		       DPIO_TX1_STAGGER_MULT(6) |
Line 1508... Line 1876...
1508
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW11(ch, i),
1876
		       DPIO_TX2_STAGGER_MULT(0));
1509
				data << DPIO_FRC_LATENCY_SHFIT);
1877
 
1510
 
1878
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW12(ch),
1511
		/* Set the upar bit */
1879
		       DPIO_LANESTAGGER_STRAP(stagger) |
Line 1549... Line 1917...
1549
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW4(ch, i), val);
1917
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW4(ch, i), val);
1550
	}
1918
	}
Line 1551... Line 1919...
1551
 
1919
 
1552
	for (i = 0; i < 4; i++) {
1920
	for (i = 0; i < 4; i++) {
-
 
1921
		val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW2(ch, i));
1553
		val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW2(ch, i));
1922
 
1554
		val &= ~DPIO_SWING_MARGIN000_MASK;
1923
		val &= ~DPIO_SWING_MARGIN000_MASK;
-
 
1924
		val |= 102 << DPIO_SWING_MARGIN000_SHIFT;
-
 
1925
 
-
 
1926
		/*
-
 
1927
		 * Supposedly this value shouldn't matter when unique transition
-
 
1928
		 * scale is disabled, but in fact it does matter. Let's just
-
 
1929
		 * always program the same value and hope it's OK.
-
 
1930
		 */
-
 
1931
		val &= ~(0xff << DPIO_UNIQ_TRANS_SCALE_SHIFT);
-
 
1932
		val |= 0x9a << DPIO_UNIQ_TRANS_SCALE_SHIFT;
1555
		val |= 102 << DPIO_SWING_MARGIN000_SHIFT;
1933
 
1556
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW2(ch, i), val);
1934
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW2(ch, i), val);
Line -... Line 1935...
-
 
1935
	}
-
 
1936
 
-
 
1937
	/*
1557
	}
1938
	 * The document said it needs to set bit 27 for ch0 and bit 26
-
 
1939
	 * for ch1. Might be a typo in the doc.
-
 
1940
	 * For now, for this unique transition scale selection, set bit
1558
 
1941
	 * 27 for ch0 and ch1.
1559
	/* Disable unique transition scale */
1942
	 */
1560
	for (i = 0; i < 4; i++) {
1943
	for (i = 0; i < 4; i++) {
1561
		val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW3(ch, i));
1944
		val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW3(ch, i));
1562
		val &= ~DPIO_TX_UNIQ_TRANS_SCALE_EN;
1945
		val &= ~DPIO_TX_UNIQ_TRANS_SCALE_EN;
Line 1563... Line -...
1563
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW3(ch, i), val);
-
 
1564
	}
-
 
1565
 
-
 
1566
	/* Additional steps for 1200mV-0dB */
-
 
1567
#if 0
-
 
1568
	val = vlv_dpio_read(dev_priv, pipe, VLV_TX_DW3(ch));
-
 
1569
	if (ch)
-
 
1570
		val |= DPIO_TX_UNIQ_TRANS_SCALE_CH1;
-
 
1571
	else
-
 
1572
		val |= DPIO_TX_UNIQ_TRANS_SCALE_CH0;
-
 
1573
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW3(ch), val);
-
 
1574
 
-
 
1575
	vlv_dpio_write(dev_priv, pipe, VLV_TX_DW2(ch),
-
 
1576
			vlv_dpio_read(dev_priv, pipe, VLV_TX_DW2(ch)) |
1946
		vlv_dpio_write(dev_priv, pipe, CHV_TX_DW3(ch, i), val);
1577
				(0x9a << DPIO_UNIQ_TRANS_SCALE_SHIFT));
1947
	}
1578
#endif
1948
 
1579
	/* Start swing calculation */
1949
	/* Start swing calculation */
Line 1580... Line 1950...
1580
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW10(ch));
1950
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW10(ch));
1581
	val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3;
1951
	val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3;
1582
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW10(ch), val);
1952
	vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW10(ch), val);
Line 1583... Line -...
1583
 
-
 
1584
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW10(ch));
-
 
1585
	val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3;
-
 
1586
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW10(ch), val);
-
 
1587
 
-
 
1588
	/* LRC Bypass */
1953
 
Line 1589... Line 1954...
1589
	val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW30);
1954
	val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW10(ch));
1590
	val |= DPIO_LRC_BYPASS;
1955
	val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3;
1591
	vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW30, val);
1956
	vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW10(ch), val);
Line 1592... Line 1957...
1592
 
1957
 
Line 1593... Line 1958...
1593
	mutex_unlock(&dev_priv->dpio_lock);
1958
	mutex_unlock(&dev_priv->sb_lock);
-
 
1959
 
-
 
1960
	intel_hdmi->set_infoframes(&encoder->base,
-
 
1961
				   intel_crtc->config->has_hdmi_sink,
-
 
1962
				   adjusted_mode);
-
 
1963
 
-
 
1964
	g4x_enable_hdmi(encoder);
1594
 
1965
 
Line 1595... Line 1966...
1595
	intel_hdmi->set_infoframes(&encoder->base,
1966
	vlv_wait_port_ready(dev_priv, dport, 0x0);
1596
				   intel_crtc->config.has_hdmi_sink,
1967
 
1597
				   adjusted_mode);
1968
	/* Second common lane will stay alive on its own now */
1598
 
1969
	if (dport->release_cl2_override) {
1599
	intel_enable_hdmi(encoder);
1970
		chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, false);
1600
 
1971
		dport->release_cl2_override = false;
Line 1601... Line 1972...
1601
	vlv_wait_port_ready(dev_priv, dport);
1972
	}
1602
}
1973
}
1603
 
1974
 
1604
static void intel_hdmi_destroy(struct drm_connector *connector)
1975
static void intel_hdmi_destroy(struct drm_connector *connector)
1605
{
1976
{
1606
	kfree(to_intel_connector(connector)->detect_edid);
1977
	kfree(to_intel_connector(connector)->detect_edid);
-
 
1978
	drm_connector_cleanup(connector);
1607
	drm_connector_cleanup(connector);
1979
	kfree(connector);
-
 
1980
}
-
 
1981
 
1608
	kfree(connector);
1982
static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
Line 1609... Line 1983...
1609
}
1983
	.dpms = drm_atomic_helper_connector_dpms,
1610
 
1984
	.detect = intel_hdmi_detect,
1611
static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
1985
	.force = intel_hdmi_force,
Line 1626... Line 2000...
1626
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
2000
static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
1627
	.destroy = intel_encoder_destroy,
2001
	.destroy = intel_encoder_destroy,
1628
};
2002
};
Line 1629... Line 2003...
1629
 
2003
 
1630
static void
-
 
1631
intel_attach_aspect_ratio_property(struct drm_connector *connector)
-
 
1632
{
-
 
1633
	if (!drm_mode_create_aspect_ratio_property(connector->dev))
-
 
1634
		drm_object_attach_property(&connector->base,
-
 
1635
			connector->dev->mode_config.aspect_ratio_property,
-
 
1636
			DRM_MODE_PICTURE_ASPECT_NONE);
-
 
1637
}
-
 
1638
 
-
 
1639
static void
2004
static void
1640
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
2005
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
1641
{
2006
{
1642
	intel_attach_force_audio_property(connector);
2007
	intel_attach_force_audio_property(connector);
1643
	intel_attach_broadcast_rgb_property(connector);
2008
	intel_attach_broadcast_rgb_property(connector);
Line 1653... Line 2018...
1653
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
2018
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
1654
	struct intel_encoder *intel_encoder = &intel_dig_port->base;
2019
	struct intel_encoder *intel_encoder = &intel_dig_port->base;
1655
	struct drm_device *dev = intel_encoder->base.dev;
2020
	struct drm_device *dev = intel_encoder->base.dev;
1656
	struct drm_i915_private *dev_priv = dev->dev_private;
2021
	struct drm_i915_private *dev_priv = dev->dev_private;
1657
	enum port port = intel_dig_port->port;
2022
	enum port port = intel_dig_port->port;
-
 
2023
	uint8_t alternate_ddc_pin;
Line 1658... Line 2024...
1658
 
2024
 
1659
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
2025
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
1660
			   DRM_MODE_CONNECTOR_HDMIA);
2026
			   DRM_MODE_CONNECTOR_HDMIA);
Line 1664... Line 2030...
1664
	connector->doublescan_allowed = 0;
2030
	connector->doublescan_allowed = 0;
1665
	connector->stereo_allowed = 1;
2031
	connector->stereo_allowed = 1;
Line 1666... Line 2032...
1666
 
2032
 
1667
	switch (port) {
2033
	switch (port) {
-
 
2034
	case PORT_B:
-
 
2035
		if (IS_BROXTON(dev_priv))
-
 
2036
			intel_hdmi->ddc_bus = GMBUS_PIN_1_BXT;
1668
	case PORT_B:
2037
		else
-
 
2038
			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
-
 
2039
		/*
-
 
2040
		 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
-
 
2041
		 * interrupts to check the external panel connection.
-
 
2042
		 */
-
 
2043
		if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0))
-
 
2044
			intel_encoder->hpd_pin = HPD_PORT_A;
1669
		intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
2045
		else
1670
		intel_encoder->hpd_pin = HPD_PORT_B;
2046
			intel_encoder->hpd_pin = HPD_PORT_B;
1671
		break;
2047
		break;
-
 
2048
	case PORT_C:
-
 
2049
		if (IS_BROXTON(dev_priv))
-
 
2050
			intel_hdmi->ddc_bus = GMBUS_PIN_2_BXT;
1672
	case PORT_C:
2051
		else
1673
		intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
2052
			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
1674
		intel_encoder->hpd_pin = HPD_PORT_C;
2053
		intel_encoder->hpd_pin = HPD_PORT_C;
1675
		break;
2054
		break;
-
 
2055
	case PORT_D:
-
 
2056
		if (WARN_ON(IS_BROXTON(dev_priv)))
1676
	case PORT_D:
2057
			intel_hdmi->ddc_bus = GMBUS_PIN_DISABLED;
1677
		if (IS_CHERRYVIEW(dev))
2058
		else if (IS_CHERRYVIEW(dev_priv))
1678
			intel_hdmi->ddc_bus = GMBUS_PORT_DPD_CHV;
2059
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD_CHV;
1679
		else
2060
		else
1680
		intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
2061
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
1681
		intel_encoder->hpd_pin = HPD_PORT_D;
2062
		intel_encoder->hpd_pin = HPD_PORT_D;
-
 
2063
		break;
-
 
2064
	case PORT_E:
-
 
2065
		/* On SKL PORT E doesn't have seperate GMBUS pin
-
 
2066
		 *  We rely on VBT to set a proper alternate GMBUS pin. */
-
 
2067
		alternate_ddc_pin =
-
 
2068
			dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin;
-
 
2069
		switch (alternate_ddc_pin) {
-
 
2070
		case DDC_PIN_B:
-
 
2071
			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
-
 
2072
			break;
-
 
2073
		case DDC_PIN_C:
-
 
2074
			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
-
 
2075
			break;
-
 
2076
		case DDC_PIN_D:
-
 
2077
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
-
 
2078
			break;
-
 
2079
		default:
-
 
2080
			MISSING_CASE(alternate_ddc_pin);
-
 
2081
		}
-
 
2082
		intel_encoder->hpd_pin = HPD_PORT_E;
1682
		break;
2083
		break;
1683
	case PORT_A:
2084
	case PORT_A:
1684
		intel_encoder->hpd_pin = HPD_PORT_A;
2085
		intel_encoder->hpd_pin = HPD_PORT_A;
1685
		/* Internal port only for eDP. */
2086
		/* Internal port only for eDP. */
1686
	default:
2087
	default:
Line 1717... Line 2118...
1717
 
2118
 
Line 1718... Line 2119...
1718
	intel_hdmi_add_properties(intel_hdmi, connector);
2119
	intel_hdmi_add_properties(intel_hdmi, connector);
1719
 
2120
 
-
 
2121
	intel_connector_attach_encoder(intel_connector, intel_encoder);
Line 1720... Line 2122...
1720
	intel_connector_attach_encoder(intel_connector, intel_encoder);
2122
	drm_connector_register(connector);
1721
	drm_connector_register(connector);
2123
	intel_hdmi->attached_connector = intel_connector;
1722
 
2124
 
1723
	/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
2125
	/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
Line 1738... Line 2140...
1738
 
2140
 
1739
	intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
2141
	intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
1740
	if (!intel_dig_port)
2142
	if (!intel_dig_port)
Line 1741... Line 2143...
1741
		return;
2143
		return;
1742
 
2144
 
1743
	intel_connector = kzalloc(sizeof(*intel_connector), GFP_KERNEL);
2145
	intel_connector = intel_connector_alloc();
1744
	if (!intel_connector) {
2146
	if (!intel_connector) {
1745
		kfree(intel_dig_port);
2147
		kfree(intel_dig_port);
Line 1750... Line 2152...
1750
 
2152
 
1751
	drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
2153
	drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
Line 1752... Line 2154...
1752
			 DRM_MODE_ENCODER_TMDS);
2154
			 DRM_MODE_ENCODER_TMDS);
-
 
2155
 
1753
 
2156
	intel_encoder->compute_config = intel_hdmi_compute_config;
-
 
2157
	if (HAS_PCH_SPLIT(dev)) {
-
 
2158
		intel_encoder->disable = pch_disable_hdmi;
-
 
2159
		intel_encoder->post_disable = pch_post_disable_hdmi;
-
 
2160
	} else {
1754
	intel_encoder->compute_config = intel_hdmi_compute_config;
2161
		intel_encoder->disable = g4x_disable_hdmi;
1755
	intel_encoder->disable = intel_disable_hdmi;
2162
	}
1756
	intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
2163
	intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
1757
	intel_encoder->get_config = intel_hdmi_get_config;
2164
	intel_encoder->get_config = intel_hdmi_get_config;
1758
	if (IS_CHERRYVIEW(dev)) {
2165
	if (IS_CHERRYVIEW(dev)) {
1759
		intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable;
2166
		intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable;
1760
		intel_encoder->pre_enable = chv_hdmi_pre_enable;
2167
		intel_encoder->pre_enable = chv_hdmi_pre_enable;
-
 
2168
		intel_encoder->enable = vlv_enable_hdmi;
1761
		intel_encoder->enable = vlv_enable_hdmi;
2169
		intel_encoder->post_disable = chv_hdmi_post_disable;
1762
		intel_encoder->post_disable = chv_hdmi_post_disable;
2170
		intel_encoder->post_pll_disable = chv_hdmi_post_pll_disable;
1763
	} else if (IS_VALLEYVIEW(dev)) {
2171
	} else if (IS_VALLEYVIEW(dev)) {
1764
		intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable;
2172
		intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable;
1765
		intel_encoder->pre_enable = vlv_hdmi_pre_enable;
2173
		intel_encoder->pre_enable = vlv_hdmi_pre_enable;
1766
		intel_encoder->enable = vlv_enable_hdmi;
2174
		intel_encoder->enable = vlv_enable_hdmi;
1767
		intel_encoder->post_disable = vlv_hdmi_post_disable;
2175
		intel_encoder->post_disable = vlv_hdmi_post_disable;
-
 
2176
	} else {
1768
	} else {
2177
		intel_encoder->pre_enable = intel_hdmi_pre_enable;
-
 
2178
		if (HAS_PCH_CPT(dev))
-
 
2179
			intel_encoder->enable = cpt_enable_hdmi;
-
 
2180
		else if (HAS_PCH_IBX(dev))
-
 
2181
			intel_encoder->enable = ibx_enable_hdmi;
1769
		intel_encoder->pre_enable = intel_hdmi_pre_enable;
2182
		else
Line 1770... Line 2183...
1770
		intel_encoder->enable = intel_enable_hdmi;
2183
			intel_encoder->enable = g4x_enable_hdmi;
1771
	}
2184
	}
1772
 
2185