Subversion Repositories Kolibri OS

Rev

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

Rev 3480 Rev 3746
Line 48... Line 48...
48
	struct drm_i915_private *dev_priv = dev->dev_private;
48
	struct drm_i915_private *dev_priv = dev->dev_private;
49
	uint32_t enabled_bits;
49
	uint32_t enabled_bits;
Line 50... Line 50...
50
 
50
 
Line 51... Line 51...
51
	enabled_bits = HAS_DDI(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE;
51
	enabled_bits = HAS_DDI(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE;
52
 
52
 
53
	WARN(I915_READ(intel_hdmi->sdvox_reg) & enabled_bits,
53
	WARN(I915_READ(intel_hdmi->hdmi_reg) & enabled_bits,
Line 54... Line 54...
54
	     "HDMI port enabled, expecting disabled\n");
54
	     "HDMI port enabled, expecting disabled\n");
55
}
55
}
Line 118... Line 118...
118
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
118
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
119
		return 0;
119
		return 0;
120
	}
120
	}
121
}
121
}
Line 122... Line 122...
122
 
122
 
-
 
123
static u32 hsw_infoframe_data_reg(struct dip_infoframe *frame,
123
static u32 hsw_infoframe_data_reg(struct dip_infoframe *frame, enum pipe pipe)
124
				  enum transcoder cpu_transcoder)
124
{
125
{
125
	switch (frame->type) {
126
	switch (frame->type) {
126
	case DIP_TYPE_AVI:
127
	case DIP_TYPE_AVI:
127
		return HSW_TVIDEO_DIP_AVI_DATA(pipe);
128
		return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder);
128
	case DIP_TYPE_SPD:
129
	case DIP_TYPE_SPD:
129
		return HSW_TVIDEO_DIP_SPD_DATA(pipe);
130
		return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder);
130
	default:
131
	default:
131
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
132
		DRM_DEBUG_DRIVER("unknown info frame type %d\n", frame->type);
132
		return 0;
133
		return 0;
133
	}
134
	}
Line 291... Line 292...
291
{
292
{
292
	uint32_t *data = (uint32_t *)frame;
293
	uint32_t *data = (uint32_t *)frame;
293
	struct drm_device *dev = encoder->dev;
294
	struct drm_device *dev = encoder->dev;
294
	struct drm_i915_private *dev_priv = dev->dev_private;
295
	struct drm_i915_private *dev_priv = dev->dev_private;
295
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
296
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
296
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->pipe);
297
	u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
297
	u32 data_reg = hsw_infoframe_data_reg(frame, intel_crtc->pipe);
298
	u32 data_reg = hsw_infoframe_data_reg(frame, intel_crtc->config.cpu_transcoder);
298
	unsigned int i, len = DIP_HEADER_SIZE + frame->len;
299
	unsigned int i, len = DIP_HEADER_SIZE + frame->len;
299
	u32 val = I915_READ(ctl_reg);
300
	u32 val = I915_READ(ctl_reg);
Line 300... Line 301...
300
 
301
 
301
	if (data_reg == 0)
302
	if (data_reg == 0)
Line 330... Line 331...
330
 
331
 
331
static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
332
static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
332
					 struct drm_display_mode *adjusted_mode)
333
					 struct drm_display_mode *adjusted_mode)
333
{
334
{
-
 
335
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
334
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
336
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
335
	struct dip_infoframe avi_if = {
337
	struct dip_infoframe avi_if = {
336
		.type = DIP_TYPE_AVI,
338
		.type = DIP_TYPE_AVI,
337
		.ver = DIP_VERSION_AVI,
339
		.ver = DIP_VERSION_AVI,
338
		.len = DIP_LEN_AVI,
340
		.len = DIP_LEN_AVI,
Line 339... Line 341...
339
	};
341
	};
340
 
342
 
Line 341... Line 343...
341
	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
343
	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
342
		avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;
344
		avi_if.body.avi.YQ_CN_PR |= DIP_AVI_PR_2;
343
 
345
 
344
	if (intel_hdmi->rgb_quant_range_selectable) {
346
	if (intel_hdmi->rgb_quant_range_selectable) {
345
		if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
347
		if (intel_crtc->config.limited_color_range)
346
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED;
348
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED;
Line 566... Line 568...
566
			       struct drm_display_mode *adjusted_mode)
568
			       struct drm_display_mode *adjusted_mode)
567
{
569
{
568
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
570
	struct drm_i915_private *dev_priv = encoder->dev->dev_private;
569
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
571
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
570
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
572
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
571
	u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->pipe);
573
	u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
572
	u32 val = I915_READ(reg);
574
	u32 val = I915_READ(reg);
Line 573... Line 575...
573
 
575
 
Line 574... Line 576...
574
	assert_hdmi_port_disabled(intel_hdmi);
576
	assert_hdmi_port_disabled(intel_hdmi);
Line 595... Line 597...
595
{
597
{
596
	struct drm_device *dev = encoder->dev;
598
	struct drm_device *dev = encoder->dev;
597
	struct drm_i915_private *dev_priv = dev->dev_private;
599
	struct drm_i915_private *dev_priv = dev->dev_private;
598
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
600
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
599
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
601
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
600
	u32 sdvox;
602
	u32 hdmi_val;
Line 601... Line 603...
601
 
603
 
602
	sdvox = SDVO_ENCODING_HDMI;
604
	hdmi_val = SDVO_ENCODING_HDMI;
603
	if (!HAS_PCH_SPLIT(dev))
605
	if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev))
604
		sdvox |= intel_hdmi->color_range;
606
		hdmi_val |= intel_hdmi->color_range;
605
	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
607
	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
606
		sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
608
		hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
607
	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
609
	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
Line 608... Line 610...
608
		sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
610
		hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
609
 
611
 
610
	if (intel_crtc->bpp > 24)
612
	if (intel_crtc->config.pipe_bpp > 24)
611
		sdvox |= COLOR_FORMAT_12bpc;
613
		hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
Line 612... Line 614...
612
	else
614
	else
613
		sdvox |= COLOR_FORMAT_8bpc;
615
		hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
614
 
616
 
Line 615... Line 617...
615
	/* Required on CPT */
617
	/* Required on CPT */
616
	if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
618
	if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
617
		sdvox |= HDMI_MODE_SELECT;
619
		hdmi_val |= HDMI_MODE_SELECT_HDMI;
618
 
620
 
619
	if (intel_hdmi->has_audio) {
621
	if (intel_hdmi->has_audio) {
620
		DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
622
		DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
621
				 pipe_name(intel_crtc->pipe));
623
				 pipe_name(intel_crtc->pipe));
Line 622... Line 624...
622
		sdvox |= SDVO_AUDIO_ENABLE;
624
		hdmi_val |= SDVO_AUDIO_ENABLE;
623
		sdvox |= SDVO_NULL_PACKETS_DURING_VSYNC;
625
		hdmi_val |= HDMI_MODE_SELECT_HDMI;
624
		intel_write_eld(encoder, adjusted_mode);
626
		intel_write_eld(encoder, adjusted_mode);
625
	}
627
	}
Line 626... Line 628...
626
 
628
 
627
		if (HAS_PCH_CPT(dev))
629
		if (HAS_PCH_CPT(dev))
Line 628... Line 630...
628
		sdvox |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
630
		hdmi_val |= SDVO_PIPE_SEL_CPT(intel_crtc->pipe);
629
	else if (intel_crtc->pipe == PIPE_B)
631
	else
Line 630... Line 632...
630
			sdvox |= SDVO_PIPE_B_SELECT;
632
		hdmi_val |= SDVO_PIPE_SEL(intel_crtc->pipe);
Line 641... Line 643...
641
	struct drm_device *dev = encoder->base.dev;
643
	struct drm_device *dev = encoder->base.dev;
642
	struct drm_i915_private *dev_priv = dev->dev_private;
644
	struct drm_i915_private *dev_priv = dev->dev_private;
643
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
645
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
644
	u32 tmp;
646
	u32 tmp;
Line 645... Line 647...
645
 
647
 
Line 646... Line 648...
646
	tmp = I915_READ(intel_hdmi->sdvox_reg);
648
	tmp = I915_READ(intel_hdmi->hdmi_reg);
647
 
649
 
Line 648... Line 650...
648
	if (!(tmp & SDVO_ENABLE))
650
	if (!(tmp & SDVO_ENABLE))
Line 658... Line 660...
658
 
660
 
659
static void intel_enable_hdmi(struct intel_encoder *encoder)
661
static void intel_enable_hdmi(struct intel_encoder *encoder)
660
{
662
{
661
	struct drm_device *dev = encoder->base.dev;
663
	struct drm_device *dev = encoder->base.dev;
-
 
664
	struct drm_i915_private *dev_priv = dev->dev_private;
662
	struct drm_i915_private *dev_priv = dev->dev_private;
665
	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
663
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
666
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
664
	u32 temp;
667
	u32 temp;
Line 665... Line 668...
665
	u32 enable_bits = SDVO_ENABLE;
668
	u32 enable_bits = SDVO_ENABLE;
666
 
669
 
Line 667... Line 670...
667
	if (intel_hdmi->has_audio)
670
	if (intel_hdmi->has_audio)
Line 668... Line 671...
668
		enable_bits |= SDVO_AUDIO_ENABLE;
671
		enable_bits |= SDVO_AUDIO_ENABLE;
669
 
672
 
670
	temp = I915_READ(intel_hdmi->sdvox_reg);
673
	temp = I915_READ(intel_hdmi->hdmi_reg);
671
 
-
 
672
	/* HW workaround for IBX, we need to move the port to transcoder A
-
 
673
	 * before disabling it. */
-
 
674
	if (HAS_PCH_IBX(dev)) {
-
 
675
		struct drm_crtc *crtc = encoder->base.crtc;
-
 
676
		int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
674
 
677
 
-
 
Line 678... Line 675...
678
		/* Restore the transcoder select bit. */
675
	/* HW workaround for IBX, we need to move the port to transcoder A
679
		if (pipe == PIPE_B)
676
	 * before disabling it, so restore the transcoder select bit here. */
680
			enable_bits |= SDVO_PIPE_B_SELECT;
677
	if (HAS_PCH_IBX(dev))
681
	}
678
		enable_bits |= SDVO_PIPE_SEL(intel_crtc->pipe);
682
 
679
 
683
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
680
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
684
	 * we do this anyway which shows more stable in testing.
681
	 * we do this anyway which shows more stable in testing.
Line 685... Line 682...
685
	 */
682
	 */
Line 686... Line 683...
686
	if (HAS_PCH_SPLIT(dev)) {
683
	if (HAS_PCH_SPLIT(dev)) {
687
		I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_ENABLE);
684
		I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
Line 688... Line 685...
688
		POSTING_READ(intel_hdmi->sdvox_reg);
685
		POSTING_READ(intel_hdmi->hdmi_reg);
689
	}
686
	}
690
 
687
 
691
	temp |= enable_bits;
688
	temp |= enable_bits;
692
 
689
 
693
	I915_WRITE(intel_hdmi->sdvox_reg, temp);
690
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
694
	POSTING_READ(intel_hdmi->sdvox_reg);
691
	POSTING_READ(intel_hdmi->hdmi_reg);
695
 
692
 
Line 696... Line 693...
696
	/* HW workaround, need to write this twice for issue that may result
693
	/* HW workaround, need to write this twice for issue that may result
697
	 * in first write getting masked.
694
	 * in first write getting masked.
Line 708... Line 705...
708
	struct drm_i915_private *dev_priv = dev->dev_private;
705
	struct drm_i915_private *dev_priv = dev->dev_private;
709
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
706
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
710
	u32 temp;
707
	u32 temp;
711
	u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;
708
	u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;
Line 712... Line 709...
712
 
709
 
Line 713... Line 710...
713
	temp = I915_READ(intel_hdmi->sdvox_reg);
710
	temp = I915_READ(intel_hdmi->hdmi_reg);
714
 
711
 
715
	/* HW workaround for IBX, we need to move the port to transcoder A
712
	/* HW workaround for IBX, we need to move the port to transcoder A
716
	 * before disabling it. */
713
	 * before disabling it. */
717
	if (HAS_PCH_IBX(dev)) {
714
	if (HAS_PCH_IBX(dev)) {
Line 718... Line 715...
718
		struct drm_crtc *crtc = encoder->base.crtc;
715
		struct drm_crtc *crtc = encoder->base.crtc;
719
		int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
716
		int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
720
 
717
 
721
			if (temp & SDVO_PIPE_B_SELECT) {
718
			if (temp & SDVO_PIPE_B_SELECT) {
Line 722... Line 719...
722
				temp &= ~SDVO_PIPE_B_SELECT;
719
				temp &= ~SDVO_PIPE_B_SELECT;
723
				I915_WRITE(intel_hdmi->sdvox_reg, temp);
720
			I915_WRITE(intel_hdmi->hdmi_reg, temp);
724
				POSTING_READ(intel_hdmi->sdvox_reg);
721
			POSTING_READ(intel_hdmi->hdmi_reg);
Line 725... Line 722...
725
 
722
 
726
				/* Again we need to write this twice. */
723
				/* Again we need to write this twice. */
727
				I915_WRITE(intel_hdmi->sdvox_reg, temp);
724
			I915_WRITE(intel_hdmi->hdmi_reg, temp);
728
				POSTING_READ(intel_hdmi->sdvox_reg);
725
			POSTING_READ(intel_hdmi->hdmi_reg);
Line 738... Line 735...
738
 
735
 
739
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
736
	/* HW workaround, need to toggle enable bit off and on for 12bpc, but
740
	 * we do this anyway which shows more stable in testing.
737
	 * we do this anyway which shows more stable in testing.
741
	 */
738
	 */
742
	if (HAS_PCH_SPLIT(dev)) {
739
	if (HAS_PCH_SPLIT(dev)) {
743
		I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_ENABLE);
740
		I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
744
		POSTING_READ(intel_hdmi->sdvox_reg);
741
		POSTING_READ(intel_hdmi->hdmi_reg);
Line 745... Line 742...
745
	}
742
	}
Line 746... Line 743...
746
 
743
 
747
		temp &= ~enable_bits;
744
		temp &= ~enable_bits;
Line 748... Line 745...
748
 
745
 
749
	I915_WRITE(intel_hdmi->sdvox_reg, temp);
746
	I915_WRITE(intel_hdmi->hdmi_reg, temp);
750
	POSTING_READ(intel_hdmi->sdvox_reg);
747
	POSTING_READ(intel_hdmi->hdmi_reg);
751
 
748
 
752
	/* HW workaround, need to write this twice for issue that may result
749
	/* HW workaround, need to write this twice for issue that may result
753
	 * in first write getting masked.
750
	 * in first write getting masked.
754
	 */
751
	 */
755
	if (HAS_PCH_SPLIT(dev)) {
752
	if (HAS_PCH_SPLIT(dev)) {
Line 756... Line 753...
756
		I915_WRITE(intel_hdmi->sdvox_reg, temp);
753
		I915_WRITE(intel_hdmi->hdmi_reg, temp);
757
		POSTING_READ(intel_hdmi->sdvox_reg);
754
		POSTING_READ(intel_hdmi->hdmi_reg);
Line 770... Line 767...
770
		return MODE_NO_DBLESCAN;
767
		return MODE_NO_DBLESCAN;
Line 771... Line 768...
771
 
768
 
772
	return MODE_OK;
769
	return MODE_OK;
Line 773... Line 770...
773
}
770
}
774
 
-
 
775
bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
771
 
776
				  const struct drm_display_mode *mode,
772
bool intel_hdmi_compute_config(struct intel_encoder *encoder,
777
				  struct drm_display_mode *adjusted_mode)
773
			       struct intel_crtc_config *pipe_config)
-
 
774
{
-
 
775
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
Line 778... Line 776...
778
{
776
	struct drm_device *dev = encoder->base.dev;
779
	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
777
	struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
780
 
778
 
781
	if (intel_hdmi->color_range_auto) {
779
	if (intel_hdmi->color_range_auto) {
782
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
780
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
783
		if (intel_hdmi->has_hdmi_sink &&
781
		if (intel_hdmi->has_hdmi_sink &&
784
		    drm_match_cea_mode(adjusted_mode) > 1)
782
		    drm_match_cea_mode(adjusted_mode) > 1)
785
			intel_hdmi->color_range = SDVO_COLOR_RANGE_16_235;
783
			intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
Line 786... Line 784...
786
		else
784
		else
-
 
785
			intel_hdmi->color_range = 0;
-
 
786
	}
-
 
787
 
-
 
788
	if (intel_hdmi->color_range)
-
 
789
		pipe_config->limited_color_range = true;
-
 
790
 
-
 
791
	if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev))
-
 
792
		pipe_config->has_pch_encoder = true;
-
 
793
 
-
 
794
	/*
787
			intel_hdmi->color_range = 0;
795
	 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
-
 
796
	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
-
 
797
	 * outputs.
-
 
798
	 */
-
 
799
	if (pipe_config->pipe_bpp > 8*3 && HAS_PCH_SPLIT(dev)) {
-
 
800
		DRM_DEBUG_KMS("forcing bpc to 12 for HDMI\n");
-
 
801
		pipe_config->pipe_bpp = 12*3;
Line 788... Line 802...
788
	}
802
	} else {
789
 
803
		DRM_DEBUG_KMS("forcing bpc to 8 for HDMI\n");
Line 790... Line 804...
790
	if (intel_hdmi->color_range)
804
		pipe_config->pipe_bpp = 8*3;
Line 904... Line 918...
904
		intel_hdmi->has_audio = has_audio;
918
		intel_hdmi->has_audio = has_audio;
905
		goto done;
919
		goto done;
906
	}
920
	}
Line 907... Line 921...
907
 
921
 
-
 
922
	if (property == dev_priv->broadcast_rgb_property) {
-
 
923
		bool old_auto = intel_hdmi->color_range_auto;
-
 
924
		uint32_t old_range = intel_hdmi->color_range;
908
	if (property == dev_priv->broadcast_rgb_property) {
925
 
909
		switch (val) {
926
		switch (val) {
910
		case INTEL_BROADCAST_RGB_AUTO:
927
		case INTEL_BROADCAST_RGB_AUTO:
911
			intel_hdmi->color_range_auto = true;
928
			intel_hdmi->color_range_auto = true;
912
			break;
929
			break;
913
		case INTEL_BROADCAST_RGB_FULL:
930
		case INTEL_BROADCAST_RGB_FULL:
914
			intel_hdmi->color_range_auto = false;
931
			intel_hdmi->color_range_auto = false;
915
			intel_hdmi->color_range = 0;
932
			intel_hdmi->color_range = 0;
916
			break;
933
			break;
917
		case INTEL_BROADCAST_RGB_LIMITED:
934
		case INTEL_BROADCAST_RGB_LIMITED:
918
			intel_hdmi->color_range_auto = false;
935
			intel_hdmi->color_range_auto = false;
919
			intel_hdmi->color_range = SDVO_COLOR_RANGE_16_235;
936
			intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
920
			break;
937
			break;
921
		default:
938
		default:
922
			return -EINVAL;
939
			return -EINVAL;
-
 
940
		}
-
 
941
 
-
 
942
		if (old_auto == intel_hdmi->color_range_auto &&
-
 
943
		    old_range == intel_hdmi->color_range)
-
 
944
			return 0;
923
		}
945
 
924
		goto done;
946
		goto done;
Line 925... Line 947...
925
	}
947
	}
Line 939... Line 961...
939
	drm_connector_cleanup(connector);
961
	drm_connector_cleanup(connector);
940
	kfree(connector);
962
	kfree(connector);
941
}
963
}
Line 942... Line 964...
942
 
964
 
943
static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
-
 
944
	.mode_fixup = intel_hdmi_mode_fixup,
965
static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
945
	.mode_set = intel_hdmi_mode_set,
966
	.mode_set = intel_hdmi_mode_set,
Line 946... Line 967...
946
};
967
};
947
 
968
 
Line 983... Line 1004...
983
 
1004
 
984
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
1005
	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
985
			   DRM_MODE_CONNECTOR_HDMIA);
1006
			   DRM_MODE_CONNECTOR_HDMIA);
Line 986... Line -...
986
	drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
-
 
987
 
1007
	drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
988
	connector->polled = DRM_CONNECTOR_POLL_HPD;
1008
 
Line 989... Line 1009...
989
	connector->interlace_allowed = 1;
1009
	connector->interlace_allowed = 1;
990
	connector->doublescan_allowed = 0;
1010
	connector->doublescan_allowed = 0;
991
 
1011
 
992
	switch (port) {
1012
	switch (port) {
993
	case PORT_B:
1013
	case PORT_B:
994
		intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
1014
		intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
995
		dev_priv->hotplug_supported_mask |= PORTB_HOTPLUG_INT_STATUS;
1015
		intel_encoder->hpd_pin = HPD_PORT_B;
996
		break;
1016
		break;
997
	case PORT_C:
1017
	case PORT_C:
998
		intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
1018
		intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
999
		dev_priv->hotplug_supported_mask |= PORTC_HOTPLUG_INT_STATUS;
1019
		intel_encoder->hpd_pin = HPD_PORT_C;
1000
		break;
1020
		break;
1001
	case PORT_D:
1021
	case PORT_D:
1002
		intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
1022
		intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
-
 
1023
		intel_encoder->hpd_pin = HPD_PORT_D;
1003
		dev_priv->hotplug_supported_mask |= PORTD_HOTPLUG_INT_STATUS;
1024
		break;
1004
		break;
1025
	case PORT_A:
1005
	case PORT_A:
1026
		intel_encoder->hpd_pin = HPD_PORT_A;
1006
		/* Internal port only for eDP. */
1027
		/* Internal port only for eDP. */
Line 1007... Line -...
1007
	default:
-
 
1008
		BUG();
-
 
1009
	}
-
 
1010
 
1028
	default:
1011
	if (!HAS_PCH_SPLIT(dev)) {
1029
		BUG();
1012
		intel_hdmi->write_infoframe = g4x_write_infoframe;
1030
	}
-
 
1031
 
-
 
1032
	if (IS_VALLEYVIEW(dev)) {
-
 
1033
		intel_hdmi->write_infoframe = vlv_write_infoframe;
1013
		intel_hdmi->set_infoframes = g4x_set_infoframes;
1034
		intel_hdmi->set_infoframes = vlv_set_infoframes;
1014
	} else if (IS_VALLEYVIEW(dev)) {
1035
	} else if (!HAS_PCH_SPLIT(dev)) {
1015
		intel_hdmi->write_infoframe = vlv_write_infoframe;
1036
		intel_hdmi->write_infoframe = g4x_write_infoframe;
1016
		intel_hdmi->set_infoframes = vlv_set_infoframes;
1037
		intel_hdmi->set_infoframes = g4x_set_infoframes;
1017
	} else if (IS_HASWELL(dev)) {
1038
	} else if (HAS_DDI(dev)) {
1018
		intel_hdmi->write_infoframe = hsw_write_infoframe;
1039
		intel_hdmi->write_infoframe = hsw_write_infoframe;
Line 1043... Line 1064...
1043
		u32 temp = I915_READ(PEG_BAND_GAP_DATA);
1064
		u32 temp = I915_READ(PEG_BAND_GAP_DATA);
1044
		I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
1065
		I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
1045
	}
1066
	}
1046
}
1067
}
Line 1047... Line 1068...
1047
 
1068
 
1048
void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
1069
void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
1049
{
1070
{
1050
	struct intel_digital_port *intel_dig_port;
1071
	struct intel_digital_port *intel_dig_port;
1051
	struct intel_encoder *intel_encoder;
1072
	struct intel_encoder *intel_encoder;
1052
	struct drm_encoder *encoder;
1073
	struct drm_encoder *encoder;
Line 1067... Line 1088...
1067
 
1088
 
1068
	drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
1089
	drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
1069
			 DRM_MODE_ENCODER_TMDS);
1090
			 DRM_MODE_ENCODER_TMDS);
Line -... Line 1091...
-
 
1091
	drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs);
1070
	drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs);
1092
 
1071
 
1093
	intel_encoder->compute_config = intel_hdmi_compute_config;
1072
	intel_encoder->enable = intel_enable_hdmi;
1094
	intel_encoder->enable = intel_enable_hdmi;
Line 1073... Line 1095...
1073
	intel_encoder->disable = intel_disable_hdmi;
1095
	intel_encoder->disable = intel_disable_hdmi;
1074
	intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
1096
	intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
1075
 
1097
 
Line 1076... Line 1098...
1076
	intel_encoder->type = INTEL_OUTPUT_HDMI;
1098
	intel_encoder->type = INTEL_OUTPUT_HDMI;
1077
	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
1099
	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
1078
	intel_encoder->cloneable = false;
1100
	intel_encoder->cloneable = false;
Line 1079... Line 1101...
1079
 
1101
 
1080
	intel_dig_port->port = port;
1102
	intel_dig_port->port = port;