All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] drm/i915/skl: Enable DDI-E
@ 2015-08-06  7:51 Xiong Zhang
  2015-08-06  7:51 ` [PATCH 2/6] drm/i915: Set power domain for DDI-E Xiong Zhang
                   ` (6 more replies)
  0 siblings, 7 replies; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

There are OEMs using DDI-E out there,
so let's enable it.

Unfortunately there is no detection bit for DDI-E
So we need to rely on VBT for that.

I also need to give credits to Xiong since before seing
his approach to check info->support_* I was creating an ugly
vbt->ddie_sfuse_strap in order to propagate the ddi presence info

Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
 drivers/gpu/drm/i915/intel_bios.h    |  2 ++
 drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 2ff9eb0..55b5072 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	/* Each DDI port can have more than one value on the "DVO Port" field,
 	 * so look for all the possible values for each port and abort if more
 	 * than one is found. */
-	int dvo_ports[][2] = {
-		{DVO_PORT_HDMIA, DVO_PORT_DPA},
-		{DVO_PORT_HDMIB, DVO_PORT_DPB},
-		{DVO_PORT_HDMIC, DVO_PORT_DPC},
-		{DVO_PORT_HDMID, DVO_PORT_DPD},
-		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
+	int dvo_ports[][3] = {
+		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
+		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
+		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
+		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
+		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
 	};
 
 	/* Find the child device to use, abort if more than one found. */
 	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
 		it = dev_priv->vbt.child_dev + i;
 
-		for (j = 0; j < 2; j++) {
+		for (j = 0; j < 3; j++) {
 			if (dvo_ports[port][j] == -1)
 				break;
 
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index f7ad6a5..02255d8 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -764,6 +764,8 @@ int intel_parse_bios(struct drm_device *dev);
 #define DVO_PORT_DPC	8
 #define DVO_PORT_DPD	9
 #define DVO_PORT_DPA	10
+#define DVO_PORT_DPE	11
+#define DVO_PORT_HDMIE	12
 #define DVO_PORT_MIPIA	21
 #define DVO_PORT_MIPIB	22
 #define DVO_PORT_MIPIC	23
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index af0bcfe..aaa34b8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14123,6 +14123,15 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_ddi_init(dev, PORT_C);
 		if (found & SFUSE_STRAP_DDID_DETECTED)
 			intel_ddi_init(dev, PORT_D);
+		/*
+		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
+		 */
+		if (IS_SKYLAKE(dev) &&
+		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
+		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
+		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
+			intel_ddi_init(dev, PORT_E);
+
 	} else if (HAS_PCH_SPLIT(dev)) {
 		int found;
 		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 2/6] drm/i915: Set power domain for DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
@ 2015-08-06  7:51 ` Xiong Zhang
  2015-08-11  6:12   ` Zhang, Xiong Y
  2015-08-06  7:51 ` [PATCH 3/6] drm/i915: Set alternate aux " Xiong Zhang
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

DDI-E and DDI-4 share 4 DDI-A lanes.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index aaa34b8..ea10fa8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5134,6 +5134,7 @@ static enum intel_display_power_domain port_to_power_domain(enum port port)
 {
 	switch (port) {
 	case PORT_A:
+	case PORT_E:
 		return POWER_DOMAIN_PORT_DDI_A_4_LANES;
 	case PORT_B:
 		return POWER_DOMAIN_PORT_DDI_B_4_LANES;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 3/6] drm/i915: Set alternate aux for DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
  2015-08-06  7:51 ` [PATCH 2/6] drm/i915: Set power domain for DDI-E Xiong Zhang
@ 2015-08-06  7:51 ` Xiong Zhang
  2015-08-08  0:01   ` [PATCH] " Rodrigo Vivi
  2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

There is no correspondent Aux channel for DDI-E.

So we need to rely on VBT to let us know witch one
is being used instead.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  7 +++++++
 drivers/gpu/drm/i915/intel_bios.c | 23 +++++++++++++++++++----
 drivers/gpu/drm/i915/intel_ddi.c  |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c   | 29 ++++++++++++++++++++++++++++-
 4 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index b94ada9..8d50d4f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1408,6 +1408,11 @@ enum modeset_restore {
 	MODESET_SUSPENDED,
 };
 
+#define DP_AUX_A 0x40
+#define DP_AUX_B 0x10
+#define DP_AUX_C 0x20
+#define DP_AUX_D 0x30
+
 struct ddi_vbt_port_info {
 	/*
 	 * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1420,6 +1425,8 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dvi:1;
 	uint8_t supports_hdmi:1;
 	uint8_t supports_dp:1;
+
+	uint8_t alternate_aux_channel;
 };
 
 enum psr_lines_to_wait {
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 55b5072..16cdf17 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -968,13 +968,28 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	}
 
 	if (is_dp) {
-		if (aux_channel == 0x40 && port != PORT_A)
+		if (port == PORT_E) {
+			info->alternate_aux_channel = aux_channel;
+			/* if DDIE share aux channel with other port, then
+			 * DP couldn't exist on the shared port. Otherwise
+			 * they share the same aux channel and system
+			 * couldn't communicate with them seperately. */
+			if (aux_channel == DP_AUX_A)
+				dev_priv->vbt.ddi_port_info[PORT_A].supports_dp = 0;
+			else if (aux_channel == DP_AUX_B)
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_dp = 0;  
+			else if (aux_channel == DP_AUX_C)
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_dp = 0;  
+			else if (aux_channel == DP_AUX_D)
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_dp = 0;  
+		}
+		else if (aux_channel == DP_AUX_A && port != PORT_A)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port A\n");
-		if (aux_channel == 0x10 && port != PORT_B)
+		else if (aux_channel == DP_AUX_B && port != PORT_B)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port B\n");
-		if (aux_channel == 0x20 && port != PORT_C)
+		else if (aux_channel == DP_AUX_C && port != PORT_C)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port C\n");
-		if (aux_channel == 0x30 && port != PORT_D)
+		else if (aux_channel == DP_AUX_D && port != PORT_D)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port D\n");
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 9a40bfb..110d546 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3184,10 +3184,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
 	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
 	if (!init_dp && !init_hdmi) {
-		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, assuming it is\n",
+		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
 			      port_name(port));
-		init_hdmi = true;
-		init_dp = true;
+		return;
 	}
 
 	intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f1b9f93..7cd47bc 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1026,11 +1026,34 @@ static void
 intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	enum port port = intel_dig_port->port;
+	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	const char *name = NULL;
+	uint32_t porte_aux_ctl_reg = DPA_AUX_CH_CTL;
 	int ret;
 
+	/* On SKL we don't have Aux for port E so we rely on VBT to set
+	 * a proper alternate aux channel.
+	 */
+	if (IS_SKYLAKE(dev) && port == PORT_E) {
+		switch (info->alternate_aux_channel) {
+		case DP_AUX_B:
+			porte_aux_ctl_reg = DPB_AUX_CH_CTL;
+			break;
+		case DP_AUX_C:
+			porte_aux_ctl_reg = DPC_AUX_CH_CTL;
+			break;
+		case DP_AUX_D:
+			porte_aux_ctl_reg = DPD_AUX_CH_CTL;
+			break;
+		case DP_AUX_A:
+		default:
+			porte_aux_ctl_reg = DPA_AUX_CH_CTL;
+		}
+	}
+
 	switch (port) {
 	case PORT_A:
 		intel_dp->aux_ch_ctl_reg = DPA_AUX_CH_CTL;
@@ -1048,6 +1071,10 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 		intel_dp->aux_ch_ctl_reg = PCH_DPD_AUX_CH_CTL;
 		name = "DPDDC-D";
 		break;
+	case PORT_E:
+		intel_dp->aux_ch_ctl_reg = porte_aux_ctl_reg;
+		name = "DPDDC-E";
+		break;	
 	default:
 		BUG();
 	}
@@ -1061,7 +1088,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 	 *
 	 * Skylake moves AUX_CTL back next to DDI_BUF_CTL, on the CPU.
 	 */
-	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev))
+	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) && port != PORT_E)
 		intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10;
 
 	intel_dp->aux.name = name;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
  2015-08-06  7:51 ` [PATCH 2/6] drm/i915: Set power domain for DDI-E Xiong Zhang
  2015-08-06  7:51 ` [PATCH 3/6] drm/i915: Set alternate aux " Xiong Zhang
@ 2015-08-06  7:51 ` Xiong Zhang
  2015-08-11  6:27   ` Zhang, Xiong Y
                     ` (2 more replies)
  2015-08-06  7:51 ` [PATCH 5/6] drm/i915/skl: enable DDIE hotplug Xiong Zhang
                   ` (3 subsequent siblings)
  6 siblings, 3 replies; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Skylake we have eDP-to-VGA using DDI-E and another aux.
So let's identify it properly.

Also let's remove duplicated definitions to avoid later
confusion.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.h | 5 -----
 drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 02255d8..a2ef0df 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
 #define		DVO_C		2
 #define		DVO_D		3
 
-/* define the PORT for DP output type */
-#define		PORT_IDPB	7
-#define		PORT_IDPC	8
-#define		PORT_IDPD	9
-
 /* Possible values for the "DVO Port" field for versions >= 155: */
 #define DVO_PORT_HDMIA	0
 #define DVO_PORT_HDMIB	1
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 7cd47bc..0643a91 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
 	return -1;
 }
 
-/* check the VBT to see whether the eDP is on DP-D port */
+/* check the VBT to see whether the eDP is on another port */
 bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	union child_device_config *p_child;
 	int i;
 	static const short port_mapping[] = {
-		[PORT_B] = PORT_IDPB,
-		[PORT_C] = PORT_IDPC,
-		[PORT_D] = PORT_IDPD,
+		[PORT_B] = DVO_PORT_DPB,
+		[PORT_C] = DVO_PORT_DPC,
+		[PORT_D] = DVO_PORT_DPD,
+		[PORT_E] = DVO_PORT_DPE,
 	};
 
 	if (port == PORT_A)
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 5/6] drm/i915/skl: enable DDIE hotplug
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
                   ` (2 preceding siblings ...)
  2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
@ 2015-08-06  7:51 ` Xiong Zhang
  2015-08-08  0:06   ` Rodrigo Vivi
  2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |  1 +
 drivers/gpu/drm/i915/i915_irq.c      | 49 +++++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++
 drivers/gpu/drm/i915/intel_display.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++
 drivers/gpu/drm/i915/intel_hotplug.c |  3 +++
 6 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8d50d4f..6d93334 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -214,6 +214,7 @@ enum hpd_pin {
 	HPD_PORT_B,
 	HPD_PORT_C,
 	HPD_PORT_D,
+	HPD_PORT_E,
 	HPD_NUM_PINS
 };
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 1118c39..420cf5a 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
 	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
 };
 
+static const u32 hpd_spt[HPD_NUM_PINS] = {
+	[HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
+	[HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
+	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
+	[HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
+};
+
 static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
 	[HPD_CRT] = CRT_HOTPLUG_INT_EN,
 	[HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
@@ -1252,6 +1259,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)
 		return val & PORTC_HOTPLUG_LONG_DETECT;
 	case PORT_D:
 		return val & PORTD_HOTPLUG_LONG_DETECT;
+	case PORT_E:
+		return val & PORTE_HOTPLUG_LONG_DETECT;
 	default:
 		return false;
 	}
@@ -1752,7 +1761,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
-	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
+	u32 hotplug_trigger;
+
+	if (HAS_PCH_SPT(dev))
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
+	else
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
 
 	if (hotplug_trigger) {
 		u32 dig_hotplug_reg, pin_mask, long_mask;
@@ -1760,9 +1774,24 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
 		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
 
-		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
-				   dig_hotplug_reg, hpd_cpt,
-				   pch_port_hotplug_long_detect);
+		if (HAS_PCH_SPT(dev)) {
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_spt,
+					   pch_port_hotplug_long_detect);
+
+			/* detect PORTE HP event */
+			dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
+			if (pch_port_hotplug_long_detect(PORT_E,
+							 dig_hotplug_reg))
+				long_mask |= 1 << HPD_PORT_E;
+		}
+		else
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_cpt,
+					   pch_port_hotplug_long_detect);
+
 		intel_hpd_irq_handler(dev, pin_mask, long_mask);
 	}
 
@@ -2984,6 +3013,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 		for_each_intel_encoder(dev, intel_encoder)
 			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
 				enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
+	} else if (HAS_PCH_SPT(dev)) {
+		hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
+		for_each_intel_encoder(dev, intel_encoder)
+			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
+				enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];
 	} else {
 		hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
 		for_each_intel_encoder(dev, intel_encoder)
@@ -3005,6 +3039,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
 	hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
+
+	/* enable SPT PORTE hot plug */
+	if (HAS_PCH_SPT(dev)) {
+		hotplug = I915_READ(PCH_PORT_HOTPLUG2);
+		hotplug |= PORTE_HOTPLUG_ENABLE;
+		I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
+	}
 }
 
 static void bxt_hpd_irq_setup(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3a77678..cdd2244 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5940,6 +5940,7 @@ enum skl_disp_power_wells {
 #define SDE_AUXC_CPT		(1 << 26)
 #define SDE_AUXB_CPT		(1 << 25)
 #define SDE_AUX_MASK_CPT	(7 << 25)
+#define SDE_PORTE_HOTPLUG_SPT	(1 << 25)
 #define SDE_PORTD_HOTPLUG_CPT	(1 << 23)
 #define SDE_PORTC_HOTPLUG_CPT	(1 << 22)
 #define SDE_PORTB_HOTPLUG_CPT	(1 << 21)
@@ -5950,6 +5951,10 @@ enum skl_disp_power_wells {
 				 SDE_PORTD_HOTPLUG_CPT |	\
 				 SDE_PORTC_HOTPLUG_CPT |	\
 				 SDE_PORTB_HOTPLUG_CPT)
+#define SDE_HOTPLUG_MASK_SPT	(SDE_PORTE_HOTPLUG_SPT |	\
+				 SDE_PORTD_HOTPLUG_CPT |	\
+				 SDE_PORTC_HOTPLUG_CPT |	\
+				 SDE_PORTB_HOTPLUG_CPT)
 #define SDE_GMBUS_CPT		(1 << 17)
 #define SDE_ERROR_CPT		(1 << 16)
 #define SDE_AUDIO_CP_REQ_C_CPT	(1 << 10)
@@ -6021,6 +6026,13 @@ enum skl_disp_power_wells {
 #define  PORTB_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTB_HOTPLUG_LONG_DETECT	(2 << 0)
 
+#define PCH_PORT_HOTPLUG2        0xc403C		/* SHOTPLUG_CTL2 */
+#define PORTE_HOTPLUG_ENABLE            (1 << 4)
+#define PORTE_HOTPLUG_STATUS_MASK	(0x3 << 0)
+#define  PORTE_HOTPLUG_NO_DETECT	(0 << 0)
+#define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
+#define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
+
 #define PCH_GPIOA               0xc5010
 #define PCH_GPIOB               0xc5014
 #define PCH_GPIOC               0xc5018
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ea10fa8..5009b01 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1098,6 +1098,8 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
 		case PORT_D:
 			bit = SDE_PORTD_HOTPLUG_CPT;
 			break;
+		case PORT_E:
+			bit = SDE_PORTE_HOTPLUG_SPT;
 		default:
 			return true;
 		}
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0643a91..3b5c0ee 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5823,6 +5823,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	case PORT_D:
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	default:
 		BUG();
 	}
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 032a0bf..53c0173 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)
 	case HPD_PORT_D:
 		*port = PORT_D;
 		return true;
+	case HPD_PORT_E:
+		*port = PORT_E;
+		return true;
 	default:
 		return false;	/* no hpd */
 	}
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 6/6] drm/i915: Enable HDMI on DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
                   ` (3 preceding siblings ...)
  2015-08-06  7:51 ` [PATCH 5/6] drm/i915/skl: enable DDIE hotplug Xiong Zhang
@ 2015-08-06  7:51 ` Xiong Zhang
  2015-08-08  0:09   ` Rodrigo Vivi
                     ` (2 more replies)
  2015-08-06 13:30 ` [PATCH 1/6] drm/i915/skl: Enable DDI-E Daniel Vetter
  2015-08-06 15:14 ` [PATCH 1/6] " Daniel Vetter
  6 siblings, 3 replies; 52+ messages in thread
From: Xiong Zhang @ 2015-08-06  7:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: rodrigo.vivi

DDI-E doesn't have the correspondent GMBUS pin.

We rely on VBT to tell us which one it being used instead.

The DVI/HDMI on shared port couldn't exist.

This patch isn't tested without hardware wchich has HDMI
on DDI-E.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
 drivers/gpu/drm/i915/intel_bios.c | 28 ++++++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6d93334..5d8e7fe 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1414,6 +1414,10 @@ enum modeset_restore {
 #define DP_AUX_C 0x20
 #define DP_AUX_D 0x30
 
+#define DDC_PIN_B  0x05
+#define DDC_PIN_C  0x04
+#define DDC_PIN_D  0x06
+
 struct ddi_vbt_port_info {
 	/*
 	 * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dp:1;
 
 	uint8_t alternate_aux_channel;
+	uint8_t alternate_ddc_pin;
 };
 
 enum psr_lines_to_wait {
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 16cdf17..265227f 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	uint8_t hdmi_level_shift;
 	int i, j;
 	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
-	uint8_t aux_channel;
+	uint8_t aux_channel, ddc_pin;
 	/* Each DDI port can have more than one value on the "DVO Port" field,
 	 * so look for all the possible values for each port and abort if more
 	 * than one is found. */
@@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		return;
 
 	aux_channel = child->raw[25];
+	ddc_pin = child->common.ddc_pin;
 
 	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
 	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
@@ -959,11 +960,30 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
 
 	if (is_dvi) {
-		if (child->common.ddc_pin == 0x05 && port != PORT_B)
+		if (port == PORT_E) {
+			info->alternate_ddc_pin = ddc_pin;
+			/* if DDIE share ddc pin with other port, then
+			 * dvi/hdmi couldn't exist on the shared port. 
+			 * Otherwise they share the same ddc bin and system
+			 * couldn't communicate with them seperately. */
+			if (ddc_pin == DDC_PIN_B) {
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
+			}
+			else if (ddc_pin == DDC_PIN_C) {
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
+			}	
+			else if (ddc_pin == DDC_PIN_D) {
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
+			}
+		}
+		else if (ddc_pin == DDC_PIN_B && port != PORT_B)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
-		if (child->common.ddc_pin == 0x04 && port != PORT_C)
+		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
-		if (child->common.ddc_pin == 0x06 && port != PORT_D)
+		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 70bad5b..e1f6e81 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		/* On SKL PORT E doesn't have seperate GMBUS pin
+		 *  We rely on VBT to set a proper alternate GMBUS pin. */
+		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
+		case DDC_PIN_B:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
+			break;
+		case DDC_PIN_C:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
+			break;
+		case DDC_PIN_D:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
+			break;
+		default:
+			BUG();
+		}
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	case PORT_A:
 		intel_encoder->hpd_pin = HPD_PORT_A;
 		/* Internal port only for eDP. */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 1/6] drm/i915/skl: Enable DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
                   ` (4 preceding siblings ...)
  2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
@ 2015-08-06 13:30 ` Daniel Vetter
  2015-08-06 15:37   ` Vivi, Rodrigo
  2015-08-08  0:35   ` [PATCH 8/6] " Rodrigo Vivi
  2015-08-06 15:14 ` [PATCH 1/6] " Daniel Vetter
  6 siblings, 2 replies; 52+ messages in thread
From: Daniel Vetter @ 2015-08-06 13:30 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx, rodrigo.vivi

On Thu, Aug 06, 2015 at 03:51:36PM +0800, Xiong Zhang wrote:
> From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> There are OEMs using DDI-E out there,
> so let's enable it.
> 
> Unfortunately there is no detection bit for DDI-E
> So we need to rely on VBT for that.
> 
> I also need to give credits to Xiong since before seing
> his approach to check info->support_* I was creating an ugly
> vbt->ddie_sfuse_strap in order to propagate the ddi presence info
> 
> Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Enable patches like these should be last in the series, since before all
the other stuff things will simply be broken.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
>  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 2ff9eb0..55b5072 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> -	int dvo_ports[][2] = {
> -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> +	int dvo_ports[][3] = {
> +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
>  	};
>  
>  	/* Find the child device to use, abort if more than one found. */
>  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
>  		it = dev_priv->vbt.child_dev + i;
>  
> -		for (j = 0; j < 2; j++) {
> +		for (j = 0; j < 3; j++) {
>  			if (dvo_ports[port][j] == -1)
>  				break;
>  
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index f7ad6a5..02255d8 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -764,6 +764,8 @@ int intel_parse_bios(struct drm_device *dev);
>  #define DVO_PORT_DPC	8
>  #define DVO_PORT_DPD	9
>  #define DVO_PORT_DPA	10
> +#define DVO_PORT_DPE	11
> +#define DVO_PORT_HDMIE	12
>  #define DVO_PORT_MIPIA	21
>  #define DVO_PORT_MIPIB	22
>  #define DVO_PORT_MIPIC	23
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index af0bcfe..aaa34b8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14123,6 +14123,15 @@ static void intel_setup_outputs(struct drm_device *dev)
>  			intel_ddi_init(dev, PORT_C);
>  		if (found & SFUSE_STRAP_DDID_DETECTED)
>  			intel_ddi_init(dev, PORT_D);
> +		/*
> +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> +		 */
> +		if (IS_SKYLAKE(dev) &&
> +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> +			intel_ddi_init(dev, PORT_E);
> +
>  	} else if (HAS_PCH_SPLIT(dev)) {
>  		int found;
>  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 1/6] drm/i915/skl: Enable DDI-E
  2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
                   ` (5 preceding siblings ...)
  2015-08-06 13:30 ` [PATCH 1/6] drm/i915/skl: Enable DDI-E Daniel Vetter
@ 2015-08-06 15:14 ` Daniel Vetter
  2015-08-06 15:50   ` Vivi, Rodrigo
  2015-08-08  0:33   ` [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes Rodrigo Vivi
  6 siblings, 2 replies; 52+ messages in thread
From: Daniel Vetter @ 2015-08-06 15:14 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx, rodrigo.vivi

On Thu, Aug 06, 2015 at 03:51:36PM +0800, Xiong Zhang wrote:
> From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> There are OEMs using DDI-E out there,
> so let's enable it.
> 
> Unfortunately there is no detection bit for DDI-E
> So we need to rely on VBT for that.
> 
> I also need to give credits to Xiong since before seing
> his approach to check info->support_* I was creating an ugly
> vbt->ddie_sfuse_strap in order to propagate the ddi presence info
> 
> Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

btw how is this series related to

http://lists.freedesktop.org/archives/intel-gfx/2015-April/065227.html

Do we need that still? Can you please include that patch in your series if
so?
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
>  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 2ff9eb0..55b5072 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> -	int dvo_ports[][2] = {
> -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> +	int dvo_ports[][3] = {
> +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
>  	};
>  
>  	/* Find the child device to use, abort if more than one found. */
>  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
>  		it = dev_priv->vbt.child_dev + i;
>  
> -		for (j = 0; j < 2; j++) {
> +		for (j = 0; j < 3; j++) {
>  			if (dvo_ports[port][j] == -1)
>  				break;
>  
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index f7ad6a5..02255d8 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -764,6 +764,8 @@ int intel_parse_bios(struct drm_device *dev);
>  #define DVO_PORT_DPC	8
>  #define DVO_PORT_DPD	9
>  #define DVO_PORT_DPA	10
> +#define DVO_PORT_DPE	11
> +#define DVO_PORT_HDMIE	12
>  #define DVO_PORT_MIPIA	21
>  #define DVO_PORT_MIPIB	22
>  #define DVO_PORT_MIPIC	23
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index af0bcfe..aaa34b8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14123,6 +14123,15 @@ static void intel_setup_outputs(struct drm_device *dev)
>  			intel_ddi_init(dev, PORT_C);
>  		if (found & SFUSE_STRAP_DDID_DETECTED)
>  			intel_ddi_init(dev, PORT_D);
> +		/*
> +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> +		 */
> +		if (IS_SKYLAKE(dev) &&
> +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> +			intel_ddi_init(dev, PORT_E);
> +
>  	} else if (HAS_PCH_SPLIT(dev)) {
>  		int found;
>  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 1/6] drm/i915/skl: Enable DDI-E
  2015-08-06 13:30 ` [PATCH 1/6] drm/i915/skl: Enable DDI-E Daniel Vetter
@ 2015-08-06 15:37   ` Vivi, Rodrigo
  2015-08-08  0:35   ` [PATCH 8/6] " Rodrigo Vivi
  1 sibling, 0 replies; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-06 15:37 UTC (permalink / raw)
  To: daniel; +Cc: intel-gfx

On Thu, 2015-08-06 at 15:30 +0200, Daniel Vetter wrote:
> On Thu, Aug 06, 2015 at 03:51:36PM +0800, Xiong Zhang wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > 
> > There are OEMs using DDI-E out there,
> > so let's enable it.
> > 
> > Unfortunately there is no detection bit for DDI-E
> > So we need to rely on VBT for that.
> > 
> > I also need to give credits to Xiong since before seing
> > his approach to check info->support_* I was creating an ugly
> > vbt->ddie_sfuse_strap in order to propagate the ddi presence info
> > 
> > Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> > Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> Enable patches like these should be last in the series, since before all
> the other stuff things will simply be broken.

ops, my bad...
totally agree...
I will rebase locally here moving this up...

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
> >  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
> >  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
> >  3 files changed, 18 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> > index 2ff9eb0..55b5072 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
> >  	/* Each DDI port can have more than one value on the "DVO Port" field,
> >  	 * so look for all the possible values for each port and abort if more
> >  	 * than one is found. */
> > -	int dvo_ports[][2] = {
> > -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> > -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> > -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> > -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> > -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> > +	int dvo_ports[][3] = {
> > +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> > +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> > +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> > +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> > +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
> >  	};
> >  
> >  	/* Find the child device to use, abort if more than one found. */
> >  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> >  		it = dev_priv->vbt.child_dev + i;
> >  
> > -		for (j = 0; j < 2; j++) {
> > +		for (j = 0; j < 3; j++) {
> >  			if (dvo_ports[port][j] == -1)
> >  				break;
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> > index f7ad6a5..02255d8 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.h
> > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > @@ -764,6 +764,8 @@ int intel_parse_bios(struct drm_device *dev);
> >  #define DVO_PORT_DPC	8
> >  #define DVO_PORT_DPD	9
> >  #define DVO_PORT_DPA	10
> > +#define DVO_PORT_DPE	11
> > +#define DVO_PORT_HDMIE	12
> >  #define DVO_PORT_MIPIA	21
> >  #define DVO_PORT_MIPIB	22
> >  #define DVO_PORT_MIPIC	23
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index af0bcfe..aaa34b8 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -14123,6 +14123,15 @@ static void intel_setup_outputs(struct drm_device *dev)
> >  			intel_ddi_init(dev, PORT_C);
> >  		if (found & SFUSE_STRAP_DDID_DETECTED)
> >  			intel_ddi_init(dev, PORT_D);
> > +		/*
> > +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> > +		 */
> > +		if (IS_SKYLAKE(dev) &&
> > +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> > +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> > +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> > +			intel_ddi_init(dev, PORT_E);
> > +
> >  	} else if (HAS_PCH_SPLIT(dev)) {
> >  		int found;
> >  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 1/6] drm/i915/skl: Enable DDI-E
  2015-08-06 15:14 ` [PATCH 1/6] " Daniel Vetter
@ 2015-08-06 15:50   ` Vivi, Rodrigo
  2015-08-08  0:33   ` [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes Rodrigo Vivi
  1 sibling, 0 replies; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-06 15:50 UTC (permalink / raw)
  To: daniel; +Cc: intel-gfx

On Thu, 2015-08-06 at 17:14 +0200, Daniel Vetter wrote:
> On Thu, Aug 06, 2015 at 03:51:36PM +0800, Xiong Zhang wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > 
> > There are OEMs using DDI-E out there,
> > so let's enable it.
> > 
> > Unfortunately there is no detection bit for DDI-E
> > So we need to rely on VBT for that.
> > 
> > I also need to give credits to Xiong since before seing
> > his approach to check info->support_* I was creating an ugly
> > vbt->ddie_sfuse_strap in order to propagate the ddi presence info
> > 
> > Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> > Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> btw how is this series related to
> 
> http://lists.freedesktop.org/archives/intel-gfx/2015-April/065227.html
> 
> Do we need that still? Can you please include that patch in your series if
> so?

yes, that patch is related because DDI-A and DDI-E shares 2 lanes...
when DDI-E is in use DDI-A needs to be configured to use only 2 lanes
and 4 otherwise.

However the approach on that patch was wrong anyway since on the last
line we see that DDI_A_4_LANES was being set unconditionally already.

So I believe we probably need to unset or avoid setting this when vbt
tells ddi-e is in use instead of setting it when ddi-e is not used like
in that patch.

Thanks

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
> >  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
> >  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
> >  3 files changed, 18 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> > index 2ff9eb0..55b5072 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
> >  	/* Each DDI port can have more than one value on the "DVO Port" field,
> >  	 * so look for all the possible values for each port and abort if more
> >  	 * than one is found. */
> > -	int dvo_ports[][2] = {
> > -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> > -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> > -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> > -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> > -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> > +	int dvo_ports[][3] = {
> > +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> > +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> > +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> > +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> > +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
> >  	};
> >  
> >  	/* Find the child device to use, abort if more than one found. */
> >  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> >  		it = dev_priv->vbt.child_dev + i;
> >  
> > -		for (j = 0; j < 2; j++) {
> > +		for (j = 0; j < 3; j++) {
> >  			if (dvo_ports[port][j] == -1)
> >  				break;
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> > index f7ad6a5..02255d8 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.h
> > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > @@ -764,6 +764,8 @@ int intel_parse_bios(struct drm_device *dev);
> >  #define DVO_PORT_DPC	8
> >  #define DVO_PORT_DPD	9
> >  #define DVO_PORT_DPA	10
> > +#define DVO_PORT_DPE	11
> > +#define DVO_PORT_HDMIE	12
> >  #define DVO_PORT_MIPIA	21
> >  #define DVO_PORT_MIPIB	22
> >  #define DVO_PORT_MIPIC	23
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index af0bcfe..aaa34b8 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -14123,6 +14123,15 @@ static void intel_setup_outputs(struct drm_device *dev)
> >  			intel_ddi_init(dev, PORT_C);
> >  		if (found & SFUSE_STRAP_DDID_DETECTED)
> >  			intel_ddi_init(dev, PORT_D);
> > +		/*
> > +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> > +		 */
> > +		if (IS_SKYLAKE(dev) &&
> > +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> > +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> > +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> > +			intel_ddi_init(dev, PORT_E);
> > +
> >  	} else if (HAS_PCH_SPLIT(dev)) {
> >  		int found;
> >  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH] drm/i915: Set alternate aux for DDI-E
  2015-08-06  7:51 ` [PATCH 3/6] drm/i915: Set alternate aux " Xiong Zhang
@ 2015-08-08  0:01   ` Rodrigo Vivi
  2015-08-11  6:18     ` Zhang, Xiong Y
  2015-08-13  8:40     ` shuang.he
  0 siblings, 2 replies; 52+ messages in thread
From: Rodrigo Vivi @ 2015-08-08  0:01 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

There is no correspondent Aux channel for DDI-E.

So we need to rely on VBT to let us know witch one
is being used instead.

v2: Removing some trailing spaces and giving proper
credit to Xiong that added a nice way to avoid port
conflicts by setting supports_dp = 0 when using
equivalent aux for DDI-E.

Credits-to: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  7 +++++++
 drivers/gpu/drm/i915/intel_bios.c | 23 +++++++++++++++++++----
 drivers/gpu/drm/i915/intel_ddi.c  |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c   | 29 ++++++++++++++++++++++++++++-
 4 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4932d29..3ffd962 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1409,6 +1409,11 @@ enum modeset_restore {
 	MODESET_SUSPENDED,
 };
 
+#define DP_AUX_A 0x40
+#define DP_AUX_B 0x10
+#define DP_AUX_C 0x20
+#define DP_AUX_D 0x30
+
 struct ddi_vbt_port_info {
 	/*
 	 * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1421,6 +1426,8 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dvi:1;
 	uint8_t supports_hdmi:1;
 	uint8_t supports_dp:1;
+
+	uint8_t alternate_aux_channel;
 };
 
 enum psr_lines_to_wait {
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 31b1079..990acc2 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -968,13 +968,28 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	}
 
 	if (is_dp) {
-		if (aux_channel == 0x40 && port != PORT_A)
+		if (port == PORT_E) {
+			info->alternate_aux_channel = aux_channel;
+			/* if DDIE share aux channel with other port, then
+			 * DP couldn't exist on the shared port. Otherwise
+			 * they share the same aux channel and system
+			 * couldn't communicate with them seperately. */
+			if (aux_channel == DP_AUX_A)
+				dev_priv->vbt.ddi_port_info[PORT_A].supports_dp = 0;
+			else if (aux_channel == DP_AUX_B)
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_dp = 0;
+			else if (aux_channel == DP_AUX_C)
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_dp = 0;
+			else if (aux_channel == DP_AUX_D)
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_dp = 0;
+		}
+		else if (aux_channel == DP_AUX_A && port != PORT_A)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port A\n");
-		if (aux_channel == 0x10 && port != PORT_B)
+		else if (aux_channel == DP_AUX_B && port != PORT_B)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port B\n");
-		if (aux_channel == 0x20 && port != PORT_C)
+		else if (aux_channel == DP_AUX_C && port != PORT_C)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port C\n");
-		if (aux_channel == 0x30 && port != PORT_D)
+		else if (aux_channel == DP_AUX_D && port != PORT_D)
 			DRM_DEBUG_KMS("Unexpected AUX channel for port D\n");
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 9a40bfb..110d546 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3184,10 +3184,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
 	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
 	if (!init_dp && !init_hdmi) {
-		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, assuming it is\n",
+		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
 			      port_name(port));
-		init_hdmi = true;
-		init_dp = true;
+		return;
 	}
 
 	intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 15f0d72..601a12a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1033,11 +1033,34 @@ static void
 intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	enum port port = intel_dig_port->port;
+	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	const char *name = NULL;
+	uint32_t porte_aux_ctl_reg = DPA_AUX_CH_CTL;
 	int ret;
 
+	/* On SKL we don't have Aux for port E so we rely on VBT to set
+	 * a proper alternate aux channel.
+	 */
+	if (IS_SKYLAKE(dev) && port == PORT_E) {
+		switch (info->alternate_aux_channel) {
+		case DP_AUX_B:
+			porte_aux_ctl_reg = DPB_AUX_CH_CTL;
+			break;
+		case DP_AUX_C:
+			porte_aux_ctl_reg = DPC_AUX_CH_CTL;
+			break;
+		case DP_AUX_D:
+			porte_aux_ctl_reg = DPD_AUX_CH_CTL;
+			break;
+		case DP_AUX_A:
+		default:
+			porte_aux_ctl_reg = DPA_AUX_CH_CTL;
+		}
+	}
+
 	switch (port) {
 	case PORT_A:
 		intel_dp->aux_ch_ctl_reg = DPA_AUX_CH_CTL;
@@ -1055,6 +1078,10 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 		intel_dp->aux_ch_ctl_reg = PCH_DPD_AUX_CH_CTL;
 		name = "DPDDC-D";
 		break;
+	case PORT_E:
+		intel_dp->aux_ch_ctl_reg = porte_aux_ctl_reg;
+		name = "DPDDC-E";
+		break;
 	default:
 		BUG();
 	}
@@ -1068,7 +1095,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 	 *
 	 * Skylake moves AUX_CTL back next to DDI_BUF_CTL, on the CPU.
 	 */
-	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev))
+	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) && port != PORT_E)
 		intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10;
 
 	intel_dp->aux.name = name;
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 5/6] drm/i915/skl: enable DDIE hotplug
  2015-08-06  7:51 ` [PATCH 5/6] drm/i915/skl: enable DDIE hotplug Xiong Zhang
@ 2015-08-08  0:06   ` Rodrigo Vivi
  2015-08-10  6:53     ` [PATCH 5/6 v2] drm/i915/skl: enable DDI-E hotplug Xiong Zhang
  0 siblings, 1 reply; 52+ messages in thread
From: Rodrigo Vivi @ 2015-08-08  0:06 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx; +Cc: rodrigo.vivi


[-- Attachment #1.1: Type: text/plain, Size: 9186 bytes --]

Great!

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


On Thu, Aug 6, 2015 at 12:45 AM Xiong Zhang <xiong.y.zhang@intel.com> wrote:

> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h      |  1 +
>  drivers/gpu/drm/i915/i915_irq.c      | 49
> +++++++++++++++++++++++++++++++++---
>  drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++
>  drivers/gpu/drm/i915/intel_display.c |  2 ++
>  drivers/gpu/drm/i915/intel_dp.c      |  3 +++
>  drivers/gpu/drm/i915/intel_hotplug.c |  3 +++
>  6 files changed, 66 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> index 8d50d4f..6d93334 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -214,6 +214,7 @@ enum hpd_pin {
>         HPD_PORT_B,
>         HPD_PORT_C,
>         HPD_PORT_D,
> +       HPD_PORT_E,
>         HPD_NUM_PINS
>  };
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c
> b/drivers/gpu/drm/i915/i915_irq.c
> index 1118c39..420cf5a 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
>         [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
>  };
>
> +static const u32 hpd_spt[HPD_NUM_PINS] = {
> +       [HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
> +       [HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
> +       [HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
> +       [HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
> +};
> +
>  static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
>         [HPD_CRT] = CRT_HOTPLUG_INT_EN,
>         [HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
> @@ -1252,6 +1259,8 @@ static bool pch_port_hotplug_long_detect(enum port
> port, u32 val)
>                 return val & PORTC_HOTPLUG_LONG_DETECT;
>         case PORT_D:
>                 return val & PORTD_HOTPLUG_LONG_DETECT;
> +       case PORT_E:
> +               return val & PORTE_HOTPLUG_LONG_DETECT;
>         default:
>                 return false;
>         }
> @@ -1752,7 +1761,12 @@ static void cpt_irq_handler(struct drm_device *dev,
> u32 pch_iir)
>  {
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         int pipe;
> -       u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
> +       u32 hotplug_trigger;
> +
> +       if (HAS_PCH_SPT(dev))
> +               hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
> +       else
> +               hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
>
>         if (hotplug_trigger) {
>                 u32 dig_hotplug_reg, pin_mask, long_mask;
> @@ -1760,9 +1774,24 @@ static void cpt_irq_handler(struct drm_device *dev,
> u32 pch_iir)
>                 dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
>                 I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
>
> -               intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
> -                                  dig_hotplug_reg, hpd_cpt,
> -                                  pch_port_hotplug_long_detect);
> +               if (HAS_PCH_SPT(dev)) {
> +                       intel_get_hpd_pins(&pin_mask, &long_mask,
> +                                          hotplug_trigger,
> +                                          dig_hotplug_reg, hpd_spt,
> +                                          pch_port_hotplug_long_detect);
> +
> +                       /* detect PORTE HP event */
> +                       dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
> +                       if (pch_port_hotplug_long_detect(PORT_E,
> +                                                        dig_hotplug_reg))
> +                               long_mask |= 1 << HPD_PORT_E;
> +               }
> +               else
> +                       intel_get_hpd_pins(&pin_mask, &long_mask,
> +                                          hotplug_trigger,
> +                                          dig_hotplug_reg, hpd_cpt,
> +                                          pch_port_hotplug_long_detect);
> +
>                 intel_hpd_irq_handler(dev, pin_mask, long_mask);
>         }
>
> @@ -2984,6 +3013,11 @@ static void ibx_hpd_irq_setup(struct drm_device
> *dev)
>                 for_each_intel_encoder(dev, intel_encoder)
>                         if
> (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
>                                 enabled_irqs |=
> hpd_ibx[intel_encoder->hpd_pin];
> +       } else if (HAS_PCH_SPT(dev)) {
> +               hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
> +               for_each_intel_encoder(dev, intel_encoder)
> +                       if
> (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
> +                               enabled_irqs |=
> hpd_spt[intel_encoder->hpd_pin];
>         } else {
>                 hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
>                 for_each_intel_encoder(dev, intel_encoder)
> @@ -3005,6 +3039,13 @@ static void ibx_hpd_irq_setup(struct drm_device
> *dev)
>         hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
>         hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
>         I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
> +
> +       /* enable SPT PORTE hot plug */
> +       if (HAS_PCH_SPT(dev)) {
> +               hotplug = I915_READ(PCH_PORT_HOTPLUG2);
> +               hotplug |= PORTE_HOTPLUG_ENABLE;
> +               I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
> +       }
>  }
>
>  static void bxt_hpd_irq_setup(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/i915/i915_reg.h
> b/drivers/gpu/drm/i915/i915_reg.h
> index 3a77678..cdd2244 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5940,6 +5940,7 @@ enum skl_disp_power_wells {
>  #define SDE_AUXC_CPT           (1 << 26)
>  #define SDE_AUXB_CPT           (1 << 25)
>  #define SDE_AUX_MASK_CPT       (7 << 25)
> +#define SDE_PORTE_HOTPLUG_SPT  (1 << 25)
>  #define SDE_PORTD_HOTPLUG_CPT  (1 << 23)
>  #define SDE_PORTC_HOTPLUG_CPT  (1 << 22)
>  #define SDE_PORTB_HOTPLUG_CPT  (1 << 21)
> @@ -5950,6 +5951,10 @@ enum skl_disp_power_wells {
>                                  SDE_PORTD_HOTPLUG_CPT |        \
>                                  SDE_PORTC_HOTPLUG_CPT |        \
>                                  SDE_PORTB_HOTPLUG_CPT)
> +#define SDE_HOTPLUG_MASK_SPT   (SDE_PORTE_HOTPLUG_SPT |        \
> +                                SDE_PORTD_HOTPLUG_CPT |        \
> +                                SDE_PORTC_HOTPLUG_CPT |        \
> +                                SDE_PORTB_HOTPLUG_CPT)
>  #define SDE_GMBUS_CPT          (1 << 17)
>  #define SDE_ERROR_CPT          (1 << 16)
>  #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10)
> @@ -6021,6 +6026,13 @@ enum skl_disp_power_wells {
>  #define  PORTB_HOTPLUG_SHORT_DETECT    (1 << 0)
>  #define  PORTB_HOTPLUG_LONG_DETECT     (2 << 0)
>
> +#define PCH_PORT_HOTPLUG2        0xc403C               /* SHOTPLUG_CTL2 */
> +#define PORTE_HOTPLUG_ENABLE            (1 << 4)
> +#define PORTE_HOTPLUG_STATUS_MASK      (0x3 << 0)
> +#define  PORTE_HOTPLUG_NO_DETECT       (0 << 0)
> +#define  PORTE_HOTPLUG_SHORT_DETECT    (1 << 0)
> +#define  PORTE_HOTPLUG_LONG_DETECT     (2 << 0)
> +
>  #define PCH_GPIOA               0xc5010
>  #define PCH_GPIOB               0xc5014
>  #define PCH_GPIOC               0xc5018
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index ea10fa8..5009b01 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1098,6 +1098,8 @@ bool ibx_digital_port_connected(struct
> drm_i915_private *dev_priv,
>                 case PORT_D:
>                         bit = SDE_PORTD_HOTPLUG_CPT;
>                         break;
> +               case PORT_E:
> +                       bit = SDE_PORTE_HOTPLUG_SPT;
>                 default:
>                         return true;
>                 }
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index 0643a91..3b5c0ee 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5823,6 +5823,9 @@ intel_dp_init_connector(struct intel_digital_port
> *intel_dig_port,
>         case PORT_D:
>                 intel_encoder->hpd_pin = HPD_PORT_D;
>                 break;
> +       case PORT_E:
> +               intel_encoder->hpd_pin = HPD_PORT_E;
> +               break;
>         default:
>                 BUG();
>         }
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c
> b/drivers/gpu/drm/i915/intel_hotplug.c
> index 032a0bf..53c0173 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port
> *port)
>         case HPD_PORT_D:
>                 *port = PORT_D;
>                 return true;
> +       case HPD_PORT_E:
> +               *port = PORT_E;
> +               return true;
>         default:
>                 return false;   /* no hpd */
>         }
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>

[-- Attachment #1.2: Type: text/html, Size: 11592 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6] drm/i915: Enable HDMI on DDI-E
  2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
@ 2015-08-08  0:09   ` Rodrigo Vivi
  2015-08-11  9:58   ` Daniel Vetter
  2015-08-12 14:19   ` [PATCH 6/6] " shuang.he
  2 siblings, 0 replies; 52+ messages in thread
From: Rodrigo Vivi @ 2015-08-08  0:09 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx; +Cc: rodrigo.vivi


[-- Attachment #1.1: Type: text/plain, Size: 6018 bytes --]

On Thu, Aug 6, 2015 at 12:45 AM Xiong Zhang <xiong.y.zhang@intel.com> wrote:

> DDI-E doesn't have the correspondent GMBUS pin.
>
> We rely on VBT to tell us which one it being used instead.
>
> The DVI/HDMI on shared port couldn't exist.
>
> This patch isn't tested without hardware wchich has HDMI
> on DDI-E.
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
>  drivers/gpu/drm/i915/intel_bios.c | 28 ++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
>  3 files changed, 47 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> index 6d93334..5d8e7fe 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1414,6 +1414,10 @@ enum modeset_restore {
>  #define DP_AUX_C 0x20
>  #define DP_AUX_D 0x30
>
> +#define DDC_PIN_B  0x05
> +#define DDC_PIN_C  0x04
> +#define DDC_PIN_D  0x06
> +
>  struct ddi_vbt_port_info {
>         /*
>          * This is an index in the HDMI/DVI DDI buffer translation table.
> @@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
>         uint8_t supports_dp:1;
>
>         uint8_t alternate_aux_channel;
> +       uint8_t alternate_ddc_pin;
>  };
>
>  enum psr_lines_to_wait {
> diff --git a/drivers/gpu/drm/i915/intel_bios.c
> b/drivers/gpu/drm/i915/intel_bios.c
> index 16cdf17..265227f 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
>         uint8_t hdmi_level_shift;
>         int i, j;
>         bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> -       uint8_t aux_channel;
> +       uint8_t aux_channel, ddc_pin;
>         /* Each DDI port can have more than one value on the "DVO Port"
> field,
>          * so look for all the possible values for each port and abort if
> more
>          * than one is found. */
> @@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
>                 return;
>
>         aux_channel = child->raw[25];
> +       ddc_pin = child->common.ddc_pin;
>
>         is_dvi = child->common.device_type &
> DEVICE_TYPE_TMDS_DVI_SIGNALING;
>         is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> @@ -959,11 +960,30 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
>                 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
>
>         if (is_dvi) {
> -               if (child->common.ddc_pin == 0x05 && port != PORT_B)
> +               if (port == PORT_E) {
> +                       info->alternate_ddc_pin = ddc_pin;
> +                       /* if DDIE share ddc pin with other port, then
> +                        * dvi/hdmi couldn't exist on the shared port.
>

I see a trailing space here

+                        * Otherwise they share the same ddc bin and system
> +                        * couldn't communicate with them seperately. */
> +                       if (ddc_pin == DDC_PIN_B) {
> +
>  dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> +
>  dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> +                       }
> +                       else if (ddc_pin == DDC_PIN_C) {
> +
>  dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> +
>  dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> +                       }
>

and here

But the concept and patch is totally right so with trailing whitespaces
fixed
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>



> +                       else if (ddc_pin == DDC_PIN_D) {
> +
>  dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> +
>  dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> +                       }
> +               }
> +               else if (ddc_pin == DDC_PIN_B && port != PORT_B)
>                         DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> -               if (child->common.ddc_pin == 0x04 && port != PORT_C)
> +               else if (ddc_pin == DDC_PIN_C && port != PORT_C)
>                         DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> -               if (child->common.ddc_pin == 0x06 && port != PORT_D)
> +               else if (ddc_pin == DDC_PIN_D && port != PORT_D)
>                         DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
>         }


> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> b/drivers/gpu/drm/i915/intel_hdmi.c
> index 70bad5b..e1f6e81 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct
> intel_digital_port *intel_dig_port,
>                         intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
>                 intel_encoder->hpd_pin = HPD_PORT_D;
>                 break;
> +       case PORT_E:
> +               /* On SKL PORT E doesn't have seperate GMBUS pin
> +                *  We rely on VBT to set a proper alternate GMBUS pin. */
> +               switch
> (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
> +               case DDC_PIN_B:
> +                       intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> +                       break;
> +               case DDC_PIN_C:
> +                       intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> +                       break;
> +               case DDC_PIN_D:
> +                       intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> +                       break;
> +               default:
> +                       BUG();
> +               }
> +               intel_encoder->hpd_pin = HPD_PORT_E;
> +               break;
>         case PORT_A:
>                 intel_encoder->hpd_pin = HPD_PORT_A;
>                 /* Internal port only for eDP. */
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>

[-- Attachment #1.2: Type: text/html, Size: 8412 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-06 15:14 ` [PATCH 1/6] " Daniel Vetter
  2015-08-06 15:50   ` Vivi, Rodrigo
@ 2015-08-08  0:33   ` Rodrigo Vivi
  2015-08-11  7:05     ` Zhang, Xiong Y
  1 sibling, 1 reply; 52+ messages in thread
From: Rodrigo Vivi @ 2015-08-08  0:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present
we need to configure lane count propperly for both.

This was based on Sonika's
[PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt

Credits-to: Sonika Jindal <sonika.jindal@intel.com>
Cc: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
 drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 110d546..557cecf 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct drm_encoder *encoder;
-	bool init_hdmi, init_dp;
+	bool init_hdmi, init_dp, ddi_e_present;
+
+	/*
+	 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
+	 */
+	ddie_present = IS_SKYLAKE(dev) &&
+		(dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
+		 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
+		 dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi);
 
 	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
 		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
@@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_dig_port->port = port;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
-					   DDI_A_4_LANES);
+					   ddi_e_present ? 0 : DDI_A_4_LANES);
 
 	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3ff2080..7ada79e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -159,9 +159,11 @@ static u8 intel_dp_max_lane_count(struct intel_dp *intel_dp)
 	u8 source_max, sink_max;
 
 	source_max = 4;
-	if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
-	    (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
-		source_max = 2;
+	if (HAS_DDI(dev) && (intel_dig_port->port == PORT_E ||
+			     (intel_dig_port->port == PORT_A &&
+			      (intel_dig_port->saved_port_bits &
+			       DDI_A_4_LANES) == 0))
+	    source_max = 2;
 
 	sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
 
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 8/6] drm/i915/skl: Enable DDI-E
  2015-08-06 13:30 ` [PATCH 1/6] drm/i915/skl: Enable DDI-E Daniel Vetter
  2015-08-06 15:37   ` Vivi, Rodrigo
@ 2015-08-08  0:35   ` Rodrigo Vivi
  2015-08-11  7:12     ` Zhang, Xiong Y
  2015-08-31 15:48     ` Jani Nikula
  1 sibling, 2 replies; 52+ messages in thread
From: Rodrigo Vivi @ 2015-08-08  0:35 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

There are OEMs using DDI-E out there,
so let's enable it.

Unfortunately there is no detection bit for DDI-E
So we need to rely on VBT for that.

I also need to give credits to Xiong since before seing
his approach to check info->support_* I was creating an ugly
vbt->ddie_sfuse_strap in order to propagate the ddi presence info

v2: Rebased as last patch in the series. since all other patches
in this series are needed for anything working propperly on DDI-E.

Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
 drivers/gpu/drm/i915/intel_bios.h    |  2 ++
 drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c417973..c5b5a59b 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	/* Each DDI port can have more than one value on the "DVO Port" field,
 	 * so look for all the possible values for each port and abort if more
 	 * than one is found. */
-	int dvo_ports[][2] = {
-		{DVO_PORT_HDMIA, DVO_PORT_DPA},
-		{DVO_PORT_HDMIB, DVO_PORT_DPB},
-		{DVO_PORT_HDMIC, DVO_PORT_DPC},
-		{DVO_PORT_HDMID, DVO_PORT_DPD},
-		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
+	int dvo_ports[][3] = {
+		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
+		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
+		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
+		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
+		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
 	};
 
 	/* Find the child device to use, abort if more than one found. */
 	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
 		it = dev_priv->vbt.child_dev + i;
 
-		for (j = 0; j < 2; j++) {
+		for (j = 0; j < 3; j++) {
 			if (dvo_ports[port][j] == -1)
 				break;
 
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 77bf1dd..a2ef0df 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -759,6 +759,8 @@ int intel_parse_bios(struct drm_device *dev);
 #define DVO_PORT_DPC	8
 #define DVO_PORT_DPD	9
 #define DVO_PORT_DPA	10
+#define DVO_PORT_DPE	11
+#define DVO_PORT_HDMIE	12
 #define DVO_PORT_MIPIA	21
 #define DVO_PORT_MIPIB	22
 #define DVO_PORT_MIPIC	23
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fcf1230..7bf6209 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13961,6 +13961,15 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_ddi_init(dev, PORT_C);
 		if (found & SFUSE_STRAP_DDID_DETECTED)
 			intel_ddi_init(dev, PORT_D);
+		/*
+		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
+		 */
+		if (IS_SKYLAKE(dev) &&
+		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
+		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
+		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
+			intel_ddi_init(dev, PORT_E);
+
 	} else if (HAS_PCH_SPLIT(dev)) {
 		int found;
 		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
-- 
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 5/6 v2] drm/i915/skl: enable DDI-E hotplug
  2015-08-08  0:06   ` Rodrigo Vivi
@ 2015-08-10  6:53     ` Xiong Zhang
  2015-08-17  7:55       ` [PATCH 5/6 v3] " Xiong Zhang
  0 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-10  6:53 UTC (permalink / raw)
  To: intel-gfx

v2: fix one error found by checkpath.pl

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |  1 +
 drivers/gpu/drm/i915/i915_irq.c      | 48 +++++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++
 drivers/gpu/drm/i915/intel_display.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++
 drivers/gpu/drm/i915/intel_hotplug.c |  3 +++
 6 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8d50d4f..6d93334 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -214,6 +214,7 @@ enum hpd_pin {
 	HPD_PORT_B,
 	HPD_PORT_C,
 	HPD_PORT_D,
+	HPD_PORT_E,
 	HPD_NUM_PINS
 };
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 1118c39..d94c92d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
 	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
 };
 
+static const u32 hpd_spt[HPD_NUM_PINS] = {
+	[HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
+	[HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
+	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
+	[HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
+};
+
 static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
 	[HPD_CRT] = CRT_HOTPLUG_INT_EN,
 	[HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
@@ -1252,6 +1259,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)
 		return val & PORTC_HOTPLUG_LONG_DETECT;
 	case PORT_D:
 		return val & PORTD_HOTPLUG_LONG_DETECT;
+	case PORT_E:
+		return val & PORTE_HOTPLUG_LONG_DETECT;
 	default:
 		return false;
 	}
@@ -1752,7 +1761,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
-	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
+	u32 hotplug_trigger;
+
+	if (HAS_PCH_SPT(dev))
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
+	else
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
 
 	if (hotplug_trigger) {
 		u32 dig_hotplug_reg, pin_mask, long_mask;
@@ -1760,9 +1774,23 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
 		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
 
-		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
-				   dig_hotplug_reg, hpd_cpt,
-				   pch_port_hotplug_long_detect);
+		if (HAS_PCH_SPT(dev)) {
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_spt,
+					   pch_port_hotplug_long_detect);
+
+			/* detect PORTE HP event */
+			dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
+			if (pch_port_hotplug_long_detect(PORT_E,
+							 dig_hotplug_reg))
+				long_mask |= 1 << HPD_PORT_E;
+		} else
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_cpt,
+					   pch_port_hotplug_long_detect);
+
 		intel_hpd_irq_handler(dev, pin_mask, long_mask);
 	}
 
@@ -2984,6 +3012,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 		for_each_intel_encoder(dev, intel_encoder)
 			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
 				enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
+	} else if (HAS_PCH_SPT(dev)) {
+		hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
+		for_each_intel_encoder(dev, intel_encoder)
+			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
+				enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];
 	} else {
 		hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
 		for_each_intel_encoder(dev, intel_encoder)
@@ -3005,6 +3038,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
 	hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
+
+	/* enable SPT PORTE hot plug */
+	if (HAS_PCH_SPT(dev)) {
+		hotplug = I915_READ(PCH_PORT_HOTPLUG2);
+		hotplug |= PORTE_HOTPLUG_ENABLE;
+		I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
+	}
 }
 
 static void bxt_hpd_irq_setup(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3a77678..cdd2244 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5940,6 +5940,7 @@ enum skl_disp_power_wells {
 #define SDE_AUXC_CPT		(1 << 26)
 #define SDE_AUXB_CPT		(1 << 25)
 #define SDE_AUX_MASK_CPT	(7 << 25)
+#define SDE_PORTE_HOTPLUG_SPT	(1 << 25)
 #define SDE_PORTD_HOTPLUG_CPT	(1 << 23)
 #define SDE_PORTC_HOTPLUG_CPT	(1 << 22)
 #define SDE_PORTB_HOTPLUG_CPT	(1 << 21)
@@ -5950,6 +5951,10 @@ enum skl_disp_power_wells {
 				 SDE_PORTD_HOTPLUG_CPT |	\
 				 SDE_PORTC_HOTPLUG_CPT |	\
 				 SDE_PORTB_HOTPLUG_CPT)
+#define SDE_HOTPLUG_MASK_SPT	(SDE_PORTE_HOTPLUG_SPT |	\
+				 SDE_PORTD_HOTPLUG_CPT |	\
+				 SDE_PORTC_HOTPLUG_CPT |	\
+				 SDE_PORTB_HOTPLUG_CPT)
 #define SDE_GMBUS_CPT		(1 << 17)
 #define SDE_ERROR_CPT		(1 << 16)
 #define SDE_AUDIO_CP_REQ_C_CPT	(1 << 10)
@@ -6021,6 +6026,13 @@ enum skl_disp_power_wells {
 #define  PORTB_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTB_HOTPLUG_LONG_DETECT	(2 << 0)
 
+#define PCH_PORT_HOTPLUG2        0xc403C		/* SHOTPLUG_CTL2 */
+#define PORTE_HOTPLUG_ENABLE            (1 << 4)
+#define PORTE_HOTPLUG_STATUS_MASK	(0x3 << 0)
+#define  PORTE_HOTPLUG_NO_DETECT	(0 << 0)
+#define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
+#define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
+
 #define PCH_GPIOA               0xc5010
 #define PCH_GPIOB               0xc5014
 #define PCH_GPIOC               0xc5018
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ea10fa8..5009b01 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1098,6 +1098,8 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
 		case PORT_D:
 			bit = SDE_PORTD_HOTPLUG_CPT;
 			break;
+		case PORT_E:
+			bit = SDE_PORTE_HOTPLUG_SPT;
 		default:
 			return true;
 		}
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0643a91..3b5c0ee 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5823,6 +5823,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	case PORT_D:
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	default:
 		BUG();
 	}
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 032a0bf..53c0173 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)
 	case HPD_PORT_D:
 		*port = PORT_D;
 		return true;
+	case HPD_PORT_E:
+		*port = PORT_E;
+		return true;
 	default:
 		return false;	/* no hpd */
 	}
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 2/6] drm/i915: Set power domain for DDI-E
  2015-08-06  7:51 ` [PATCH 2/6] drm/i915: Set power domain for DDI-E Xiong Zhang
@ 2015-08-11  6:12   ` Zhang, Xiong Y
  0 siblings, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11  6:12 UTC (permalink / raw)
  To: intel-gfx; +Cc: Vivi, Rodrigo

DDI-4 should be DDI-A in  commit message.
Reviewed-by: Xiong Zhang <xiong.y.zhang@intel.com>

thanks
________________________________________
From: Intel-gfx [intel-gfx-bounces@lists.freedesktop.org] on behalf of Xiong Zhang [xiong.y.zhang@intel.com]
Sent: Thursday, August 06, 2015 3:51 PM
To: intel-gfx@lists.freedesktop.org
Cc: Vivi, Rodrigo
Subject: [Intel-gfx] [PATCH 2/6] drm/i915: Set power domain for DDI-E

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

DDI-E and DDI-4 share 4 DDI-A lanes.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index aaa34b8..ea10fa8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5134,6 +5134,7 @@ static enum intel_display_power_domain port_to_power_domain(enum port port)
 {
        switch (port) {
        case PORT_A:
+       case PORT_E:
                return POWER_DOMAIN_PORT_DDI_A_4_LANES;
        case PORT_B:
                return POWER_DOMAIN_PORT_DDI_B_4_LANES;
--
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH] drm/i915: Set alternate aux for DDI-E
  2015-08-08  0:01   ` [PATCH] " Rodrigo Vivi
@ 2015-08-11  6:18     ` Zhang, Xiong Y
  2015-08-13  8:40     ` shuang.he
  1 sibling, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11  6:18 UTC (permalink / raw)
  To: intel-gfx; +Cc: Vivi, Rodrigo

Reviewed-by: Xiong Zhang <xiong.y.zhang@intel.com>

thanks
________________________________________
From: Intel-gfx [intel-gfx-bounces@lists.freedesktop.org] on behalf of Rodrigo Vivi [rodrigo.vivi@intel.com]
Sent: Saturday, August 08, 2015 8:01 AM
To: intel-gfx@lists.freedesktop.org
Cc: Vivi, Rodrigo
Subject: [Intel-gfx] [PATCH] drm/i915: Set alternate aux for DDI-E

There is no correspondent Aux channel for DDI-E.

So we need to rely on VBT to let us know witch one
is being used instead.

v2: Removing some trailing spaces and giving proper
credit to Xiong that added a nice way to avoid port
conflicts by setting supports_dp = 0 when using
equivalent aux for DDI-E.

Credits-to: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  7 +++++++
 drivers/gpu/drm/i915/intel_bios.c | 23 +++++++++++++++++++----
 drivers/gpu/drm/i915/intel_ddi.c  |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c   | 29 ++++++++++++++++++++++++++++-
 4 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4932d29..3ffd962 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1409,6 +1409,11 @@ enum modeset_restore {
        MODESET_SUSPENDED,
 };

+#define DP_AUX_A 0x40
+#define DP_AUX_B 0x10
+#define DP_AUX_C 0x20
+#define DP_AUX_D 0x30
+
 struct ddi_vbt_port_info {
        /*
         * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1421,6 +1426,8 @@ struct ddi_vbt_port_info {
        uint8_t supports_dvi:1;
        uint8_t supports_hdmi:1;
        uint8_t supports_dp:1;
+
+       uint8_t alternate_aux_channel;
 };

 enum psr_lines_to_wait {
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 31b1079..990acc2 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -968,13 +968,28 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
        }

        if (is_dp) {
-               if (aux_channel == 0x40 && port != PORT_A)
+               if (port == PORT_E) {
+                       info->alternate_aux_channel = aux_channel;
+                       /* if DDIE share aux channel with other port, then
+                        * DP couldn't exist on the shared port. Otherwise
+                        * they share the same aux channel and system
+                        * couldn't communicate with them seperately. */
+                       if (aux_channel == DP_AUX_A)
+                               dev_priv->vbt.ddi_port_info[PORT_A].supports_dp = 0;
+                       else if (aux_channel == DP_AUX_B)
+                               dev_priv->vbt.ddi_port_info[PORT_B].supports_dp = 0;
+                       else if (aux_channel == DP_AUX_C)
+                               dev_priv->vbt.ddi_port_info[PORT_C].supports_dp = 0;
+                       else if (aux_channel == DP_AUX_D)
+                               dev_priv->vbt.ddi_port_info[PORT_D].supports_dp = 0;
+               }
+               else if (aux_channel == DP_AUX_A && port != PORT_A)
                        DRM_DEBUG_KMS("Unexpected AUX channel for port A\n");
-               if (aux_channel == 0x10 && port != PORT_B)
+               else if (aux_channel == DP_AUX_B && port != PORT_B)
                        DRM_DEBUG_KMS("Unexpected AUX channel for port B\n");
-               if (aux_channel == 0x20 && port != PORT_C)
+               else if (aux_channel == DP_AUX_C && port != PORT_C)
                        DRM_DEBUG_KMS("Unexpected AUX channel for port C\n");
-               if (aux_channel == 0x30 && port != PORT_D)
+               else if (aux_channel == DP_AUX_D && port != PORT_D)
                        DRM_DEBUG_KMS("Unexpected AUX channel for port D\n");
        }

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 9a40bfb..110d546 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3184,10 +3184,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
                     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
        init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
        if (!init_dp && !init_hdmi) {
-               DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, assuming it is\n",
+               DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
                              port_name(port));
-               init_hdmi = true;
-               init_dp = true;
+               return;
        }

        intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 15f0d72..601a12a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1033,11 +1033,34 @@ static void
 intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 {
        struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
        enum port port = intel_dig_port->port;
+       struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
        const char *name = NULL;
+       uint32_t porte_aux_ctl_reg = DPA_AUX_CH_CTL;
        int ret;

+       /* On SKL we don't have Aux for port E so we rely on VBT to set
+        * a proper alternate aux channel.
+        */
+       if (IS_SKYLAKE(dev) && port == PORT_E) {
+               switch (info->alternate_aux_channel) {
+               case DP_AUX_B:
+                       porte_aux_ctl_reg = DPB_AUX_CH_CTL;
+                       break;
+               case DP_AUX_C:
+                       porte_aux_ctl_reg = DPC_AUX_CH_CTL;
+                       break;
+               case DP_AUX_D:
+                       porte_aux_ctl_reg = DPD_AUX_CH_CTL;
+                       break;
+               case DP_AUX_A:
+               default:
+                       porte_aux_ctl_reg = DPA_AUX_CH_CTL;
+               }
+       }
+
        switch (port) {
        case PORT_A:
                intel_dp->aux_ch_ctl_reg = DPA_AUX_CH_CTL;
@@ -1055,6 +1078,10 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
                intel_dp->aux_ch_ctl_reg = PCH_DPD_AUX_CH_CTL;
                name = "DPDDC-D";
                break;
+       case PORT_E:
+               intel_dp->aux_ch_ctl_reg = porte_aux_ctl_reg;
+               name = "DPDDC-E";
+               break;
        default:
                BUG();
        }
@@ -1068,7 +1095,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
         *
         * Skylake moves AUX_CTL back next to DDI_BUF_CTL, on the CPU.
         */
-       if (!IS_HASWELL(dev) && !IS_BROADWELL(dev))
+       if (!IS_HASWELL(dev) && !IS_BROADWELL(dev) && port != PORT_E)
                intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10;

        intel_dp->aux.name = name;
--
2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
@ 2015-08-11  6:27   ` Zhang, Xiong Y
  2015-08-11  9:47   ` Daniel Vetter
  2015-08-31 15:47   ` Jani Nikula
  2 siblings, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11  6:27 UTC (permalink / raw)
  To: intel-gfx; +Cc: Vivi, Rodrigo

Reviewed-by: Xiong Zhang <xiong.y.zhang@intel.com>

thanks
________________________________________
From: Intel-gfx [intel-gfx-bounces@lists.freedesktop.org] on behalf of Xiong Zhang [xiong.y.zhang@intel.com]
Sent: Thursday, August 06, 2015 3:51 PM
To: intel-gfx@lists.freedesktop.org
Cc: Vivi, Rodrigo
Subject: [Intel-gfx] [PATCH 4/6] drm/i915: eDP can be present on DDI-E

From: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Skylake we have eDP-to-VGA using DDI-E and another aux.
So let's identify it properly.

Also let's remove duplicated definitions to avoid later
confusion.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_bios.h | 5 -----
 drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 02255d8..a2ef0df 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
 #define                DVO_C           2
 #define                DVO_D           3

-/* define the PORT for DP output type */
-#define                PORT_IDPB       7
-#define                PORT_IDPC       8
-#define                PORT_IDPD       9
-
 /* Possible values for the "DVO Port" field for versions >= 155: */
 #define DVO_PORT_HDMIA 0
 #define DVO_PORT_HDMIB 1
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 7cd47bc..0643a91 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
        return -1;
 }

-/* check the VBT to see whether the eDP is on DP-D port */
+/* check the VBT to see whether the eDP is on another port */
 bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
        union child_device_config *p_child;
        int i;
        static const short port_mapping[] = {
-               [PORT_B] = PORT_IDPB,
-               [PORT_C] = PORT_IDPC,
-               [PORT_D] = PORT_IDPD,
+               [PORT_B] = DVO_PORT_DPB,
+               [PORT_C] = DVO_PORT_DPC,
+               [PORT_D] = DVO_PORT_DPD,
+               [PORT_E] = DVO_PORT_DPE,
        };

        if (port == PORT_A)
--
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-08  0:33   ` [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes Rodrigo Vivi
@ 2015-08-11  7:05     ` Zhang, Xiong Y
  2015-08-11 18:38       ` Vivi, Rodrigo
  2015-08-12 21:29       ` Timo Aaltonen
  0 siblings, 2 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11  7:05 UTC (permalink / raw)
  To: Vivi, Rodrigo, intel-gfx

> -----Original Message-----
> From: Vivi, Rodrigo
> Sent: Saturday, August 8, 2015 8:34 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Vivi, Rodrigo; Zhang, Xiong Y
> Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
> 
> DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we need to
> configure lane count propperly for both.
> 
> This was based on Sonika's
> [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
> 
> Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> b/drivers/gpu/drm/i915/intel_ddi.c
> index 110d546..557cecf 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device *dev, enum
> port port)
>  	struct intel_digital_port *intel_dig_port;
>  	struct intel_encoder *intel_encoder;
>  	struct drm_encoder *encoder;
> -	bool init_hdmi, init_dp;
> +	bool init_hdmi, init_dp, ddi_e_present;
> +
> +	/*
> +	 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> +	 */
> +	ddie_present = IS_SKYLAKE(dev) &&
> +		(dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi);
[Zhang, Xiong Y]  ddie_present should be ddi_e_present
> 
>  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
>  		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
> @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device *dev, enum
> port port)
>  	intel_dig_port->port = port;
>  	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
>  					  (DDI_BUF_PORT_REVERSAL |
> -					   DDI_A_4_LANES);
> +					   ddi_e_present ? 0 : DDI_A_4_LANES);
[Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when DDI-E doesn't exist,
I think your patch will do nothing.
> 
>  	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
>  	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); diff --git
> a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index
> 3ff2080..7ada79e 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -159,9 +159,11 @@ static u8 intel_dp_max_lane_count(struct intel_dp
> *intel_dp)
>  	u8 source_max, sink_max;
> 
>  	source_max = 4;
> -	if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
> -	    (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
> -		source_max = 2;
> +	if (HAS_DDI(dev) && (intel_dig_port->port == PORT_E ||
> +			     (intel_dig_port->port == PORT_A &&
> +			      (intel_dig_port->saved_port_bits &
> +			       DDI_A_4_LANES) == 0))
> +	    source_max = 2;
[Zhang, Xiong Y] it miss ')' at the end line. 
> 
>  	sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
> 
> --
> 2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 8/6] drm/i915/skl: Enable DDI-E
  2015-08-08  0:35   ` [PATCH 8/6] " Rodrigo Vivi
@ 2015-08-11  7:12     ` Zhang, Xiong Y
  2015-08-31 15:48     ` Jani Nikula
  1 sibling, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11  7:12 UTC (permalink / raw)
  To: Vivi, Rodrigo, intel-gfx

Reviewed-by: Xiong Zhang <xiong.y.zhang@intel.com>

thanks
> -----Original Message-----
> From: Vivi, Rodrigo
> Sent: Saturday, August 8, 2015 8:35 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Vivi, Rodrigo; Zhang, Xiong Y
> Subject: [PATCH 8/6] drm/i915/skl: Enable DDI-E
> 
> There are OEMs using DDI-E out there,
> so let's enable it.
> 
> Unfortunately there is no detection bit for DDI-E So we need to rely on VBT for
> that.
> 
> I also need to give credits to Xiong since before seing his approach to check
> info->support_* I was creating an ugly
> vbt->ddie_sfuse_strap in order to propagate the ddi presence info
> 
> v2: Rebased as last patch in the series. since all other patches in this series are
> needed for anything working propperly on DDI-E.
> 
> Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
>  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.c
> b/drivers/gpu/drm/i915/intel_bios.c
> index c417973..c5b5a59b 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> -	int dvo_ports[][2] = {
> -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> +	int dvo_ports[][3] = {
> +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
>  	};
> 
>  	/* Find the child device to use, abort if more than one found. */
>  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
>  		it = dev_priv->vbt.child_dev + i;
> 
> -		for (j = 0; j < 2; j++) {
> +		for (j = 0; j < 3; j++) {
>  			if (dvo_ports[port][j] == -1)
>  				break;
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.h
> b/drivers/gpu/drm/i915/intel_bios.h
> index 77bf1dd..a2ef0df 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -759,6 +759,8 @@ int intel_parse_bios(struct drm_device *dev);
>  #define DVO_PORT_DPC	8
>  #define DVO_PORT_DPD	9
>  #define DVO_PORT_DPA	10
> +#define DVO_PORT_DPE	11
> +#define DVO_PORT_HDMIE	12
>  #define DVO_PORT_MIPIA	21
>  #define DVO_PORT_MIPIB	22
>  #define DVO_PORT_MIPIC	23
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index fcf1230..7bf6209 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13961,6 +13961,15 @@ static void intel_setup_outputs(struct
> drm_device *dev)
>  			intel_ddi_init(dev, PORT_C);
>  		if (found & SFUSE_STRAP_DDID_DETECTED)
>  			intel_ddi_init(dev, PORT_D);
> +		/*
> +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> +		 */
> +		if (IS_SKYLAKE(dev) &&
> +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> +			intel_ddi_init(dev, PORT_E);
> +
>  	} else if (HAS_PCH_SPLIT(dev)) {
>  		int found;
>  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> --
> 2.4.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
  2015-08-11  6:27   ` Zhang, Xiong Y
@ 2015-08-11  9:47   ` Daniel Vetter
  2015-08-11 10:09     ` Zhang, Xiong Y
  2015-08-11 18:42     ` Vivi, Rodrigo
  2015-08-31 15:47   ` Jani Nikula
  2 siblings, 2 replies; 52+ messages in thread
From: Daniel Vetter @ 2015-08-11  9:47 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx, rodrigo.vivi

On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> On Skylake we have eDP-to-VGA using DDI-E and another aux.
> So let's identify it properly.

eDP means panel (the only difference in the code we have between eDP and
DP is the power panel sequncing). VGA very much means no panel.

Is this some impressive hack (dp->vga dongle using panel power as it's
power source) or what's going on here? Or just confused commit message?

I'll punt on this for now.
-Daniel

> 
> Also let's remove duplicated definitions to avoid later
> confusion.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.h | 5 -----
>  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 02255d8..a2ef0df 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
>  #define		DVO_C		2
>  #define		DVO_D		3
>  
> -/* define the PORT for DP output type */
> -#define		PORT_IDPB	7
> -#define		PORT_IDPC	8
> -#define		PORT_IDPD	9
> -
>  /* Possible values for the "DVO Port" field for versions >= 155: */
>  #define DVO_PORT_HDMIA	0
>  #define DVO_PORT_HDMIB	1
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 7cd47bc..0643a91 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
>  	return -1;
>  }
>  
> -/* check the VBT to see whether the eDP is on DP-D port */
> +/* check the VBT to see whether the eDP is on another port */
>  bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	union child_device_config *p_child;
>  	int i;
>  	static const short port_mapping[] = {
> -		[PORT_B] = PORT_IDPB,
> -		[PORT_C] = PORT_IDPC,
> -		[PORT_D] = PORT_IDPD,
> +		[PORT_B] = DVO_PORT_DPB,
> +		[PORT_C] = DVO_PORT_DPC,
> +		[PORT_D] = DVO_PORT_DPD,
> +		[PORT_E] = DVO_PORT_DPE,
>  	};
>  
>  	if (port == PORT_A)
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6] drm/i915: Enable HDMI on DDI-E
  2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
  2015-08-08  0:09   ` Rodrigo Vivi
@ 2015-08-11  9:58   ` Daniel Vetter
  2015-08-12 10:39     ` [PATCH 6/6 v3] " Xiong Zhang
  2015-08-12 14:19   ` [PATCH 6/6] " shuang.he
  2 siblings, 1 reply; 52+ messages in thread
From: Daniel Vetter @ 2015-08-11  9:58 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx, rodrigo.vivi

On Thu, Aug 06, 2015 at 03:51:41PM +0800, Xiong Zhang wrote:
> DDI-E doesn't have the correspondent GMBUS pin.
> 
> We rely on VBT to tell us which one it being used instead.
> 
> The DVI/HDMI on shared port couldn't exist.
> 
> This patch isn't tested without hardware wchich has HDMI
> on DDI-E.
> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
>  drivers/gpu/drm/i915/intel_bios.c | 28 ++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
>  3 files changed, 47 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 6d93334..5d8e7fe 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1414,6 +1414,10 @@ enum modeset_restore {
>  #define DP_AUX_C 0x20
>  #define DP_AUX_D 0x30
>  
> +#define DDC_PIN_B  0x05
> +#define DDC_PIN_C  0x04
> +#define DDC_PIN_D  0x06
> +
>  struct ddi_vbt_port_info {
>  	/*
>  	 * This is an index in the HDMI/DVI DDI buffer translation table.
> @@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
>  	uint8_t supports_dp:1;
>  
>  	uint8_t alternate_aux_channel;
> +	uint8_t alternate_ddc_pin;
>  };
>  
>  enum psr_lines_to_wait {
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 16cdf17..265227f 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	uint8_t hdmi_level_shift;
>  	int i, j;
>  	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> -	uint8_t aux_channel;
> +	uint8_t aux_channel, ddc_pin;
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> @@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		return;
>  
>  	aux_channel = child->raw[25];
> +	ddc_pin = child->common.ddc_pin;
>  
>  	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
>  	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> @@ -959,11 +960,30 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
>  
>  	if (is_dvi) {
> -		if (child->common.ddc_pin == 0x05 && port != PORT_B)
> +		if (port == PORT_E) {
> +			info->alternate_ddc_pin = ddc_pin;
> +			/* if DDIE share ddc pin with other port, then
> +			 * dvi/hdmi couldn't exist on the shared port. 
> +			 * Otherwise they share the same ddc bin and system
> +			 * couldn't communicate with them seperately. */
> +			if (ddc_pin == DDC_PIN_B) {
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> +			}
> +			else if (ddc_pin == DDC_PIN_C) {
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> +			}	
> +			else if (ddc_pin == DDC_PIN_D) {
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> +			}
> +		}
> +		else if (ddc_pin == DDC_PIN_B && port != PORT_B)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> -		if (child->common.ddc_pin == 0x04 && port != PORT_C)
> +		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> -		if (child->common.ddc_pin == 0x06 && port != PORT_D)
> +		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 70bad5b..e1f6e81 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
>  		intel_encoder->hpd_pin = HPD_PORT_D;
>  		break;
> +	case PORT_E:
> +		/* On SKL PORT E doesn't have seperate GMBUS pin
> +		 *  We rely on VBT to set a proper alternate GMBUS pin. */
> +		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
> +		case DDC_PIN_B:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> +			break;
> +		case DDC_PIN_C:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> +			break;
> +		case DDC_PIN_D:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> +			break;
> +		default:
> +			BUG();

BUG considered evil. Please use MISSING_CASE instead. The only places
where I accept a BUG is where a) it will blow up right afterwards anyway
b) the BUG_ON adds useful information c) there's no easy way to get out
without killing the kernel.

BUG in modeset code is really bad since the first modeset is done under
console_lock, which means _nothing_ at all reaches dmesg if we die in
there.

Also your patch has some whitespace issues, please fix those too.

I merged the other reviewed patches from this series, except the other one
I commented on.

Thanks, Daniel

> +		}
> +		intel_encoder->hpd_pin = HPD_PORT_E;
> +		break;
>  	case PORT_A:
>  		intel_encoder->hpd_pin = HPD_PORT_A;
>  		/* Internal port only for eDP. */
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-11  9:47   ` Daniel Vetter
@ 2015-08-11 10:09     ` Zhang, Xiong Y
  2015-08-11 18:42     ` Vivi, Rodrigo
  1 sibling, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-11 10:09 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, Vivi, Rodrigo

> -----Original Message-----
> From: Daniel Vetter [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel Vetter
> Sent: Tuesday, August 11, 2015 5:47 PM
> To: Zhang, Xiong Y
> Cc: intel-gfx@lists.freedesktop.org; Vivi, Rodrigo
> Subject: Re: [Intel-gfx] [PATCH 4/6] drm/i915: eDP can be present on DDI-E
> 
> On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> >
> > On Skylake we have eDP-to-VGA using DDI-E and another aux.
> > So let's identify it properly.
> 
> eDP means panel (the only difference in the code we have between eDP and
> DP is the power panel sequncing). VGA very much means no panel.
> 
> Is this some impressive hack (dp->vga dongle using panel power as it's power
> source) or what's going on here? Or just confused commit message?
[Zhang, Xiong Y] Sorry, it's a dp-to-vga converter connected to DDI-E.
DDI-E has the same role as DDI-B/C/D, so eDP could connect to DDI-E also.
> 
> I'll punt on this for now.
> -Daniel
> 
> >
> > Also let's remove duplicated definitions to avoid later confusion.
> >
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_bios.h | 5 -----
> >  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
> >  2 files changed, 5 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_bios.h
> > b/drivers/gpu/drm/i915/intel_bios.h
> > index 02255d8..a2ef0df 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.h
> > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
> >  #define		DVO_C		2
> >  #define		DVO_D		3
> >
> > -/* define the PORT for DP output type */
> > -#define		PORT_IDPB	7
> > -#define		PORT_IDPC	8
> > -#define		PORT_IDPD	9
> > -
> >  /* Possible values for the "DVO Port" field for versions >= 155: */
> >  #define DVO_PORT_HDMIA	0
> >  #define DVO_PORT_HDMIB	1
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c
> > b/drivers/gpu/drm/i915/intel_dp.c index 7cd47bc..0643a91 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
> >  	return -1;
> >  }
> >
> > -/* check the VBT to see whether the eDP is on DP-D port */
> > +/* check the VBT to see whether the eDP is on another port */
> >  bool intel_dp_is_edp(struct drm_device *dev, enum port port)  {
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	union child_device_config *p_child;
> >  	int i;
> >  	static const short port_mapping[] = {
> > -		[PORT_B] = PORT_IDPB,
> > -		[PORT_C] = PORT_IDPC,
> > -		[PORT_D] = PORT_IDPD,
> > +		[PORT_B] = DVO_PORT_DPB,
> > +		[PORT_C] = DVO_PORT_DPC,
> > +		[PORT_D] = DVO_PORT_DPD,
> > +		[PORT_E] = DVO_PORT_DPE,
> >  	};
> >
> >  	if (port == PORT_A)
> > --
> > 2.1.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-11  7:05     ` Zhang, Xiong Y
@ 2015-08-11 18:38       ` Vivi, Rodrigo
  2015-08-12  2:20         ` Zhang, Xiong Y
  2015-08-12 21:29       ` Timo Aaltonen
  1 sibling, 1 reply; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-11 18:38 UTC (permalink / raw)
  To: intel-gfx, Zhang, Xiong Y

On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > -----Original Message-----
> > From: Vivi, Rodrigo
> > Sent: Saturday, August 8, 2015 8:34 AM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
> > 
> > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we 
> > need to
> > configure lane count propperly for both.
> > 
> > This was based on Sonika's
> > [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
> > 
> > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> >  2 files changed, 15 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > b/drivers/gpu/drm/i915/intel_ddi.c
> > index 110d546..557cecf 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device *dev, 
> > enum
> > port port)
> >  	struct intel_digital_port *intel_dig_port;
> >  	struct intel_encoder *intel_encoder;
> >  	struct drm_encoder *encoder;
> > -	bool init_hdmi, init_dp;
> > +	bool init_hdmi, init_dp, ddi_e_present;
> > +
> > +	/*
> > +	 * On SKL we don't have a way to detect DDI-E so we rely 
> > on VBT.
> > +	 */
> > +	ddie_present = IS_SKYLAKE(dev) &&
> > +		(dev_priv->vbt.ddi_port_info[PORT_E].supports_dp 
> > ||
> > +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi 
> > ||
> > +		 dev_priv
> > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > 
> >  	init_hdmi = (dev_priv
> > ->vbt.ddi_port_info[port].supports_dvi ||
> >  		     dev_priv
> > ->vbt.ddi_port_info[port].supports_hdmi);
> > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device *dev, 
> > enum
> > port port)
> >  	intel_dig_port->port = port;
> >  	intel_dig_port->saved_port_bits = 
> > I915_READ(DDI_BUF_CTL(port)) &
> >  					  (DDI_BUF_PORT_REVERSAL |
> > -					   DDI_A_4_LANES);
> > +					   ddi_e_present ? 0 : 
> > DDI_A_4_LANES);
> [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when DDI-E 
> doesn't exist,
> I think your patch will do nothing.

Actually DDI_A_4_LANES is being already set unconditionally, so
Sonika's patch has no effect.

saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and also
it is used to calculate the number of lanes.

With this patch we stop setting DDI_A_4_LANES when ddi_e is present so
DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E

> > 
> >  	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
> >  	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); 
> > diff --git
> > a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c 
> > index
> > 3ff2080..7ada79e 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -159,9 +159,11 @@ static u8 intel_dp_max_lane_count(struct 
> > intel_dp
> > *intel_dp)
> >  	u8 source_max, sink_max;
> > 
> >  	source_max = 4;
> > -	if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
> > -	    (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 
> > 0)
> > -		source_max = 2;
> > +	if (HAS_DDI(dev) && (intel_dig_port->port == PORT_E ||
> > +			     (intel_dig_port->port == PORT_A &&
> > +			      (intel_dig_port->saved_port_bits &
> > +			       DDI_A_4_LANES) == 0))
> > +	    source_max = 2;
> [Zhang, Xiong Y] it miss ')' at the end line. 
> > 
> >  	sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
> > 
> > --
> > 2.4.3
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-11  9:47   ` Daniel Vetter
  2015-08-11 10:09     ` Zhang, Xiong Y
@ 2015-08-11 18:42     ` Vivi, Rodrigo
  2015-08-12 10:27       ` Zhang, Xiong Y
  1 sibling, 1 reply; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-11 18:42 UTC (permalink / raw)
  To: daniel, Zhang, Xiong Y; +Cc: intel-gfx

On Tue, 2015-08-11 at 11:47 +0200, Daniel Vetter wrote:
> On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > 
> > On Skylake we have eDP-to-VGA using DDI-E and another aux.
> > So let's identify it properly.
> 
> eDP means panel (the only difference in the code we have between eDP 
> and
> DP is the power panel sequncing). VGA very much means no panel.
> 
> Is this some impressive hack (dp->vga dongle using panel power as 
> it's
> power source) or what's going on here? Or just confused commit 
> message?

That's a good question. I've heard from customer the embedded converter
is eDP-to-VGA, not DP-to-VGA so I'm not sure what is behind and I have
no machine here with me.

Xiong, could you please check with customer if everything works without
this patch?

Thanks,
Rodrigo.

> I'll punt on this for now.
> -Daniel
> 
> > 
> > Also let's remove duplicated definitions to avoid later
> > confusion.
> > 
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_bios.h | 5 -----
> >  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
> >  2 files changed, 5 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_bios.h 
> > b/drivers/gpu/drm/i915/intel_bios.h
> > index 02255d8..a2ef0df 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.h
> > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
> >  #define		DVO_C		2
> >  #define		DVO_D		3
> >  
> > -/* define the PORT for DP output type */
> > -#define		PORT_IDPB	7
> > -#define		PORT_IDPC	8
> > -#define		PORT_IDPD	9
> > -
> >  /* Possible values for the "DVO Port" field for versions >= 155: 
> > */
> >  #define DVO_PORT_HDMIA	0
> >  #define DVO_PORT_HDMIB	1
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index 7cd47bc..0643a91 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc 
> > *crtc)
> >  	return -1;
> >  }
> >  
> > -/* check the VBT to see whether the eDP is on DP-D port */
> > +/* check the VBT to see whether the eDP is on another port */
> >  bool intel_dp_is_edp(struct drm_device *dev, enum port port)
> >  {
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	union child_device_config *p_child;
> >  	int i;
> >  	static const short port_mapping[] = {
> > -		[PORT_B] = PORT_IDPB,
> > -		[PORT_C] = PORT_IDPC,
> > -		[PORT_D] = PORT_IDPD,
> > +		[PORT_B] = DVO_PORT_DPB,
> > +		[PORT_C] = DVO_PORT_DPC,
> > +		[PORT_D] = DVO_PORT_DPD,
> > +		[PORT_E] = DVO_PORT_DPE,
> >  	};
> >  
> >  	if (port == PORT_A)
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-11 18:38       ` Vivi, Rodrigo
@ 2015-08-12  2:20         ` Zhang, Xiong Y
  2015-08-12 16:51           ` Vivi, Rodrigo
  0 siblings, 1 reply; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-12  2:20 UTC (permalink / raw)
  To: Vivi, Rodrigo; +Cc: intel-gfx

> On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > > -----Original Message-----
> > > From: Vivi, Rodrigo
> > > Sent: Saturday, August 8, 2015 8:34 AM
> > > To: intel-gfx@lists.freedesktop.org
> > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
> > >
> > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we need
> > > to configure lane count propperly for both.
> > >
> > > This was based on Sonika's
> > > [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
> > >
> > > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > >  2 files changed, 15 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > index 110d546..557cecf 100644
> > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device *dev,
> > > enum port port)
> > >  	struct intel_digital_port *intel_dig_port;
> > >  	struct intel_encoder *intel_encoder;
> > >  	struct drm_encoder *encoder;
> > > -	bool init_hdmi, init_dp;
> > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > +
> > > +	/*
> > > +	 * On SKL we don't have a way to detect DDI-E so we rely
> > > on VBT.
> > > +	 */
> > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > +		(dev_priv->vbt.ddi_port_info[PORT_E].supports_dp
> > > ||
> > > +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi
> > > ||
> > > +		 dev_priv
> > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > >
> > >  	init_hdmi = (dev_priv
> > > ->vbt.ddi_port_info[port].supports_dvi ||
> > >  		     dev_priv
> > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device *dev,
> > > enum port port)
> > >  	intel_dig_port->port = port;
> > >  	intel_dig_port->saved_port_bits =
> > > I915_READ(DDI_BUF_CTL(port)) &
> > >  					  (DDI_BUF_PORT_REVERSAL |
> > > -					   DDI_A_4_LANES);
> > > +					   ddi_e_present ? 0 :
> > > DDI_A_4_LANES);
> > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when DDI-E
> > doesn't exist, I think your patch will do nothing.
> 
> Actually DDI_A_4_LANES is being already set unconditionally, so Sonika's
> patch has no effect.
[Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under many conditions.
+	if (IS_SKYLAKE(dev) && port == PORT_A
+		&& !(val & DDI_BUF_CTL_ENABLE)
+		&& !dev_priv->vbt.ddi_e_used)
+		I915_WRITE(DDI_BUF_CTL(port), val | DDI_A_4_LANES)
> 
> saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and also it is
> used to calculate the number of lanes.
> 
> With this patch we stop setting DDI_A_4_LANES when ddi_e is present so
> DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
[Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES when ddi_e is present.
But this patch won't set DDI_A_4_LANES under following conditions which is purpose for Sonika patch
1. Bios fail to driver eDP and doesn't enable DDI_A buffer
2. Bios clear DDI_A_4_LANES
3. DDI_E isn't present

thanks
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-11 18:42     ` Vivi, Rodrigo
@ 2015-08-12 10:27       ` Zhang, Xiong Y
  2015-08-12 12:32         ` Daniel Vetter
  0 siblings, 1 reply; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-12 10:27 UTC (permalink / raw)
  To: Vivi, Rodrigo, daniel; +Cc: intel-gfx

> On Tue, 2015-08-11 at 11:47 +0200, Daniel Vetter wrote:
> > On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> > > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > >
> > > On Skylake we have eDP-to-VGA using DDI-E and another aux.
> > > So let's identify it properly.
> >
> > eDP means panel (the only difference in the code we have between eDP
> > and DP is the power panel sequncing). VGA very much means no panel.
> >
> > Is this some impressive hack (dp->vga dongle using panel power as it's
> > power source) or what's going on here? Or just confused commit
> > message?
> 
> That's a good question. I've heard from customer the embedded converter is
> eDP-to-VGA, not DP-to-VGA so I'm not sure what is behind and I have no
> machine here with me.
[Xiong, Zhang]: From vbt, it is a DP-to-VGA, not eDP-to-VGA
[  103.407648] [drm:parse_ddi_port] Port E VBT info: DP:1 HDMI:0 DVI:0 EDP:0 CRT:0
> 
> Xiong, could you please check with customer if everything works without this
> patch?
[Xiong, Zhang]: Everything works well without this patch on customer's machine. But if a eDP indeed connect to DDI-E without this patch, intel_dp_is_edp(PORT_E) will return false, then eDP on DDI-E couldn't work.
> 
> Thanks,
> Rodrigo.
> 
> > I'll punt on this for now.
> > -Daniel
> >
> > >
> > > Also let's remove duplicated definitions to avoid later confusion.
> > >
> > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_bios.h | 5 -----
> > >  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
> > >  2 files changed, 5 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_bios.h
> > > b/drivers/gpu/drm/i915/intel_bios.h
> > > index 02255d8..a2ef0df 100644
> > > --- a/drivers/gpu/drm/i915/intel_bios.h
> > > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > > @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
> > >  #define		DVO_C		2
> > >  #define		DVO_D		3
> > >
> > > -/* define the PORT for DP output type */
> > > -#define		PORT_IDPB	7
> > > -#define		PORT_IDPC	8
> > > -#define		PORT_IDPD	9
> > > -
> > >  /* Possible values for the "DVO Port" field for versions >= 155:
> > > */
> > >  #define DVO_PORT_HDMIA	0
> > >  #define DVO_PORT_HDMIB	1
> > > diff --git a/drivers/gpu/drm/i915/intel_dp.c
> > > b/drivers/gpu/drm/i915/intel_dp.c index 7cd47bc..0643a91 100644
> > > --- a/drivers/gpu/drm/i915/intel_dp.c
> > > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > > @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc
> > > *crtc)
> > >  	return -1;
> > >  }
> > >
> > > -/* check the VBT to see whether the eDP is on DP-D port */
> > > +/* check the VBT to see whether the eDP is on another port */
> > >  bool intel_dp_is_edp(struct drm_device *dev, enum port port)  {
> > >  	struct drm_i915_private *dev_priv = dev->dev_private;
> > >  	union child_device_config *p_child;
> > >  	int i;
> > >  	static const short port_mapping[] = {
> > > -		[PORT_B] = PORT_IDPB,
> > > -		[PORT_C] = PORT_IDPC,
> > > -		[PORT_D] = PORT_IDPD,
> > > +		[PORT_B] = DVO_PORT_DPB,
> > > +		[PORT_C] = DVO_PORT_DPC,
> > > +		[PORT_D] = DVO_PORT_DPD,
> > > +		[PORT_E] = DVO_PORT_DPE,
> > >  	};
> > >
> > >  	if (port == PORT_A)
> > > --
> > > 2.1.4
> > >
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> >
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-11  9:58   ` Daniel Vetter
@ 2015-08-12 10:39     ` Xiong Zhang
  2015-08-12 12:33       ` Daniel Vetter
  0 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-12 10:39 UTC (permalink / raw)
  To: intel-gfx

DDI-E doesn't have the correspondent GMBUS pin.

We rely on VBT to tell us which one it being used instead.

The DVI/HDMI on shared port couldn't exist.

This patch isn't tested without hardware wchich has HDMI
on DDI-E.

v2: fix trailing whitespace
v3: WARN() take place of BUG()

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
 drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
 3 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6d93334..5d8e7fe 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1414,6 +1414,10 @@ enum modeset_restore {
 #define DP_AUX_C 0x20
 #define DP_AUX_D 0x30
 
+#define DDC_PIN_B  0x05
+#define DDC_PIN_C  0x04
+#define DDC_PIN_D  0x06
+
 struct ddi_vbt_port_info {
 	/*
 	 * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dp:1;
 
 	uint8_t alternate_aux_channel;
+	uint8_t alternate_ddc_pin;
 };
 
 enum psr_lines_to_wait {
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 16cdf17..8140531 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	uint8_t hdmi_level_shift;
 	int i, j;
 	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
-	uint8_t aux_channel;
+	uint8_t aux_channel, ddc_pin;
 	/* Each DDI port can have more than one value on the "DVO Port" field,
 	 * so look for all the possible values for each port and abort if more
 	 * than one is found. */
@@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		return;
 
 	aux_channel = child->raw[25];
+	ddc_pin = child->common.ddc_pin;
 
 	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
 	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
@@ -959,11 +960,27 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
 
 	if (is_dvi) {
-		if (child->common.ddc_pin == 0x05 && port != PORT_B)
+		if (port == PORT_E) {
+			info->alternate_ddc_pin = ddc_pin;
+			/* if DDIE share ddc pin with other port, then
+			 * dvi/hdmi couldn't exist on the shared port.
+			 * Otherwise they share the same ddc bin and system
+			 * couldn't communicate with them seperately. */
+			if (ddc_pin == DDC_PIN_B) {
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
+			} else if (ddc_pin == DDC_PIN_C) {
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
+			} else if (ddc_pin == DDC_PIN_D) {
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
+			}
+		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
-		if (child->common.ddc_pin == 0x04 && port != PORT_C)
+		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
-		if (child->common.ddc_pin == 0x06 && port != PORT_D)
+		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 70bad5b..a4129f2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		/* On SKL PORT E doesn't have seperate GMBUS pin
+		 *  We rely on VBT to set a proper alternate GMBUS pin. */
+		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
+		case DDC_PIN_B:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
+			break;
+		case DDC_PIN_C:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
+			break;
+		case DDC_PIN_D:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
+			break;
+		default:
+			WARN(1, "VBT assign invalid DDC PIN for	HDMI on PORT_E.\n");
+		}
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	case PORT_A:
 		intel_encoder->hpd_pin = HPD_PORT_A;
 		/* Internal port only for eDP. */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-12 10:27       ` Zhang, Xiong Y
@ 2015-08-12 12:32         ` Daniel Vetter
  2015-08-12 16:38           ` Vivi, Rodrigo
  0 siblings, 1 reply; 52+ messages in thread
From: Daniel Vetter @ 2015-08-12 12:32 UTC (permalink / raw)
  To: Zhang, Xiong Y; +Cc: intel-gfx, Vivi, Rodrigo

On Wed, Aug 12, 2015 at 10:27:08AM +0000, Zhang, Xiong Y wrote:
> > On Tue, 2015-08-11 at 11:47 +0200, Daniel Vetter wrote:
> > > On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> > > > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > >
> > > > On Skylake we have eDP-to-VGA using DDI-E and another aux.
> > > > So let's identify it properly.
> > >
> > > eDP means panel (the only difference in the code we have between eDP
> > > and DP is the power panel sequncing). VGA very much means no panel.
> > >
> > > Is this some impressive hack (dp->vga dongle using panel power as it's
> > > power source) or what's going on here? Or just confused commit
> > > message?
> > 
> > That's a good question. I've heard from customer the embedded converter is
> > eDP-to-VGA, not DP-to-VGA so I'm not sure what is behind and I have no
> > machine here with me.
> [Xiong, Zhang]: From vbt, it is a DP-to-VGA, not eDP-to-VGA
> [  103.407648] [drm:parse_ddi_port] Port E VBT info: DP:1 HDMI:0 DVI:0 EDP:0 CRT:0
> > 
> > Xiong, could you please check with customer if everything works without this
> > patch?
> [Xiong, Zhang]: Everything works well without this patch on customer's
> machine. But if a eDP indeed connect to DDI-E without this patch,
> intel_dp_is_edp(PORT_E) will return false, then eDP on DDI-E couldn't
> work.

So if I understand it correctly this isn't about a dp2vga dongle but
simply about edp on ddi-E? And it's also not tested with a panel connected
to ddi-E?

If that's correct I'll update the commit message to reflect this
accurately and merge the patch.
-Daniel

> > 
> > Thanks,
> > Rodrigo.
> > 
> > > I'll punt on this for now.
> > > -Daniel
> > >
> > > >
> > > > Also let's remove duplicated definitions to avoid later confusion.
> > > >
> > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/intel_bios.h | 5 -----
> > > >  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
> > > >  2 files changed, 5 insertions(+), 9 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/intel_bios.h
> > > > b/drivers/gpu/drm/i915/intel_bios.h
> > > > index 02255d8..a2ef0df 100644
> > > > --- a/drivers/gpu/drm/i915/intel_bios.h
> > > > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > > > @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
> > > >  #define		DVO_C		2
> > > >  #define		DVO_D		3
> > > >
> > > > -/* define the PORT for DP output type */
> > > > -#define		PORT_IDPB	7
> > > > -#define		PORT_IDPC	8
> > > > -#define		PORT_IDPD	9
> > > > -
> > > >  /* Possible values for the "DVO Port" field for versions >= 155:
> > > > */
> > > >  #define DVO_PORT_HDMIA	0
> > > >  #define DVO_PORT_HDMIB	1
> > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c
> > > > b/drivers/gpu/drm/i915/intel_dp.c index 7cd47bc..0643a91 100644
> > > > --- a/drivers/gpu/drm/i915/intel_dp.c
> > > > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > > > @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc
> > > > *crtc)
> > > >  	return -1;
> > > >  }
> > > >
> > > > -/* check the VBT to see whether the eDP is on DP-D port */
> > > > +/* check the VBT to see whether the eDP is on another port */
> > > >  bool intel_dp_is_edp(struct drm_device *dev, enum port port)  {
> > > >  	struct drm_i915_private *dev_priv = dev->dev_private;
> > > >  	union child_device_config *p_child;
> > > >  	int i;
> > > >  	static const short port_mapping[] = {
> > > > -		[PORT_B] = PORT_IDPB,
> > > > -		[PORT_C] = PORT_IDPC,
> > > > -		[PORT_D] = PORT_IDPD,
> > > > +		[PORT_B] = DVO_PORT_DPB,
> > > > +		[PORT_C] = DVO_PORT_DPC,
> > > > +		[PORT_D] = DVO_PORT_DPD,
> > > > +		[PORT_E] = DVO_PORT_DPE,
> > > >  	};
> > > >
> > > >  	if (port == PORT_A)
> > > > --
> > > > 2.1.4
> > > >
> > > > _______________________________________________
> > > > Intel-gfx mailing list
> > > > Intel-gfx@lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > >

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-12 10:39     ` [PATCH 6/6 v3] " Xiong Zhang
@ 2015-08-12 12:33       ` Daniel Vetter
  2015-08-13  2:57         ` Zhang, Xiong Y
  0 siblings, 1 reply; 52+ messages in thread
From: Daniel Vetter @ 2015-08-12 12:33 UTC (permalink / raw)
  To: Xiong Zhang; +Cc: intel-gfx

On Wed, Aug 12, 2015 at 06:39:34PM +0800, Xiong Zhang wrote:
> DDI-E doesn't have the correspondent GMBUS pin.
> 
> We rely on VBT to tell us which one it being used instead.
> 
> The DVI/HDMI on shared port couldn't exist.
> 
> This patch isn't tested without hardware wchich has HDMI
> on DDI-E.
> 
> v2: fix trailing whitespace
> v3: WARN() take place of BUG()

I asked for MISSING_CASE, not WARN.
-Daniel

> 
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
>  drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
>  3 files changed, 44 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 6d93334..5d8e7fe 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1414,6 +1414,10 @@ enum modeset_restore {
>  #define DP_AUX_C 0x20
>  #define DP_AUX_D 0x30
>  
> +#define DDC_PIN_B  0x05
> +#define DDC_PIN_C  0x04
> +#define DDC_PIN_D  0x06
> +
>  struct ddi_vbt_port_info {
>  	/*
>  	 * This is an index in the HDMI/DVI DDI buffer translation table.
> @@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
>  	uint8_t supports_dp:1;
>  
>  	uint8_t alternate_aux_channel;
> +	uint8_t alternate_ddc_pin;
>  };
>  
>  enum psr_lines_to_wait {
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 16cdf17..8140531 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	uint8_t hdmi_level_shift;
>  	int i, j;
>  	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> -	uint8_t aux_channel;
> +	uint8_t aux_channel, ddc_pin;
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> @@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		return;
>  
>  	aux_channel = child->raw[25];
> +	ddc_pin = child->common.ddc_pin;
>  
>  	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
>  	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> @@ -959,11 +960,27 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
>  
>  	if (is_dvi) {
> -		if (child->common.ddc_pin == 0x05 && port != PORT_B)
> +		if (port == PORT_E) {
> +			info->alternate_ddc_pin = ddc_pin;
> +			/* if DDIE share ddc pin with other port, then
> +			 * dvi/hdmi couldn't exist on the shared port.
> +			 * Otherwise they share the same ddc bin and system
> +			 * couldn't communicate with them seperately. */
> +			if (ddc_pin == DDC_PIN_B) {
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> +			} else if (ddc_pin == DDC_PIN_C) {
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> +			} else if (ddc_pin == DDC_PIN_D) {
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> +			}
> +		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> -		if (child->common.ddc_pin == 0x04 && port != PORT_C)
> +		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> -		if (child->common.ddc_pin == 0x06 && port != PORT_D)
> +		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 70bad5b..a4129f2 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
>  		intel_encoder->hpd_pin = HPD_PORT_D;
>  		break;
> +	case PORT_E:
> +		/* On SKL PORT E doesn't have seperate GMBUS pin
> +		 *  We rely on VBT to set a proper alternate GMBUS pin. */
> +		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
> +		case DDC_PIN_B:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> +			break;
> +		case DDC_PIN_C:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> +			break;
> +		case DDC_PIN_D:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> +			break;
> +		default:
> +			WARN(1, "VBT assign invalid DDC PIN for	HDMI on PORT_E.\n");
> +		}
> +		intel_encoder->hpd_pin = HPD_PORT_E;
> +		break;
>  	case PORT_A:
>  		intel_encoder->hpd_pin = HPD_PORT_A;
>  		/* Internal port only for eDP. */
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6] drm/i915: Enable HDMI on DDI-E
  2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
  2015-08-08  0:09   ` Rodrigo Vivi
  2015-08-11  9:58   ` Daniel Vetter
@ 2015-08-12 14:19   ` shuang.he
  2 siblings, 0 replies; 52+ messages in thread
From: shuang.he @ 2015-08-12 14:19 UTC (permalink / raw)
  To: shuang.he, julianx.dumez, christophe.sureau, lei.a.liu,
	intel-gfx, xiong.y.zhang

Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 7093
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  302/302              302/302
SNB                                  315/315              315/315
IVB                                  336/336              336/336
BYT                 -2              283/283              281/283
HSW                                  378/378              378/378
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*BYT  igt@gem_persistent_relocs@interruptible      PASS(1)      FAIL(1)
*BYT  igt@gem_tiled_partial_pwrite_pread@reads      PASS(1)      FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-12 12:32         ` Daniel Vetter
@ 2015-08-12 16:38           ` Vivi, Rodrigo
  0 siblings, 0 replies; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-12 16:38 UTC (permalink / raw)
  To: daniel, Zhang, Xiong Y; +Cc: intel-gfx

On Wed, 2015-08-12 at 14:32 +0200, Daniel Vetter wrote:
> On Wed, Aug 12, 2015 at 10:27:08AM +0000, Zhang, Xiong Y wrote:
> > > On Tue, 2015-08-11 at 11:47 +0200, Daniel Vetter wrote:
> > > > On Thu, Aug 06, 2015 at 03:51:39PM +0800, Xiong Zhang wrote:
> > > > > From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > 
> > > > > On Skylake we have eDP-to-VGA using DDI-E and another aux.
> > > > > So let's identify it properly.
> > > > 
> > > > eDP means panel (the only difference in the code we have 
> > > > between eDP
> > > > and DP is the power panel sequncing). VGA very much means no 
> > > > panel.
> > > > 
> > > > Is this some impressive hack (dp->vga dongle using panel power 
> > > > as it's
> > > > power source) or what's going on here? Or just confused commit
> > > > message?
> > > 
> > > That's a good question. I've heard from customer the embedded 
> > > converter is
> > > eDP-to-VGA, not DP-to-VGA so I'm not sure what is behind and I 
> > > have no
> > > machine here with me.
> > [Xiong, Zhang]: From vbt, it is a DP-to-VGA, not eDP-to-VGA
> > [  103.407648] [drm:parse_ddi_port] Port E VBT info: DP:1 HDMI:0 
> > DVI:0 EDP:0 CRT:0
> > > 
> > > Xiong, could you please check with customer if everything works 
> > > without this
> > > patch?
> > [Xiong, Zhang]: Everything works well without this patch on 
> > customer's
> > machine. But if a eDP indeed connect to DDI-E without this patch,
> > intel_dp_is_edp(PORT_E) will return false, then eDP on DDI-E 
> > couldn't
> > work.
> 
> So if I understand it correctly this isn't about a dp2vga dongle but
> simply about edp on ddi-E? And it's also not tested with a panel 
> connected
> to ddi-E?

Yes, I had miss-understood the case and messed the commit message.

> 
> If that's correct I'll update the commit message to reflect this
> accurately and merge the patch.

Thanks.

> -Daniel
> 
> > > 
> > > Thanks,
> > > Rodrigo.
> > > 
> > > > I'll punt on this for now.
> > > > -Daniel
> > > > 
> > > > > 
> > > > > Also let's remove duplicated definitions to avoid later 
> > > > > confusion.
> > > > > 
> > > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/intel_bios.h | 5 -----
> > > > >  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
> > > > >  2 files changed, 5 insertions(+), 9 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/gpu/drm/i915/intel_bios.h
> > > > > b/drivers/gpu/drm/i915/intel_bios.h
> > > > > index 02255d8..a2ef0df 100644
> > > > > --- a/drivers/gpu/drm/i915/intel_bios.h
> > > > > +++ b/drivers/gpu/drm/i915/intel_bios.h
> > > > > @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device 
> > > > > *dev);
> > > > >  #define		DVO_C		2
> > > > >  #define		DVO_D		3
> > > > > 
> > > > > -/* define the PORT for DP output type */
> > > > > -#define		PORT_IDPB	7
> > > > > -#define		PORT_IDPC	8
> > > > > -#define		PORT_IDPD	9
> > > > > -
> > > > >  /* Possible values for the "DVO Port" field for versions >= 
> > > > > 155:
> > > > > */
> > > > >  #define DVO_PORT_HDMIA	0
> > > > >  #define DVO_PORT_HDMIB	1
> > > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c
> > > > > b/drivers/gpu/drm/i915/intel_dp.c index 7cd47bc..0643a91 
> > > > > 100644
> > > > > --- a/drivers/gpu/drm/i915/intel_dp.c
> > > > > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > > > > @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct 
> > > > > drm_crtc
> > > > > *crtc)
> > > > >  	return -1;
> > > > >  }
> > > > > 
> > > > > -/* check the VBT to see whether the eDP is on DP-D port */
> > > > > +/* check the VBT to see whether the eDP is on another port 
> > > > > */
> > > > >  bool intel_dp_is_edp(struct drm_device *dev, enum port port)
> > > > >   {
> > > > >  	struct drm_i915_private *dev_priv = dev
> > > > > ->dev_private;
> > > > >  	union child_device_config *p_child;
> > > > >  	int i;
> > > > >  	static const short port_mapping[] = {
> > > > > -		[PORT_B] = PORT_IDPB,
> > > > > -		[PORT_C] = PORT_IDPC,
> > > > > -		[PORT_D] = PORT_IDPD,
> > > > > +		[PORT_B] = DVO_PORT_DPB,
> > > > > +		[PORT_C] = DVO_PORT_DPC,
> > > > > +		[PORT_D] = DVO_PORT_DPD,
> > > > > +		[PORT_E] = DVO_PORT_DPE,
> > > > >  	};
> > > > > 
> > > > >  	if (port == PORT_A)
> > > > > --
> > > > > 2.1.4
> > > > > 
> > > > > _______________________________________________
> > > > > Intel-gfx mailing list
> > > > > Intel-gfx@lists.freedesktop.org
> > > > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > > > 
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-12  2:20         ` Zhang, Xiong Y
@ 2015-08-12 16:51           ` Vivi, Rodrigo
  2015-08-13  3:27             ` Zhang, Xiong Y
  0 siblings, 1 reply; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-12 16:51 UTC (permalink / raw)
  To: Zhang, Xiong Y; +Cc: intel-gfx

On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
> > On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > > > -----Original Message-----
> > > > From: Vivi, Rodrigo
> > > > Sent: Saturday, August 8, 2015 8:34 AM
> > > > To: intel-gfx@lists.freedesktop.org
> > > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 
> > > > lanes.
> > > > 
> > > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we 
> > > > need
> > > > to configure lane count propperly for both.
> > > > 
> > > > This was based on Sonika's
> > > > [PATCH] drm/i915/skl: Select DDIA lane capability based upon 
> > > > vbt
> > > > 
> > > > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > ---
> > > >  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > > >  2 files changed, 15 insertions(+), 5 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > > index 110d546..557cecf 100644
> > > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device 
> > > > *dev,
> > > > enum port port)
> > > >  	struct intel_digital_port *intel_dig_port;
> > > >  	struct intel_encoder *intel_encoder;
> > > >  	struct drm_encoder *encoder;
> > > > -	bool init_hdmi, init_dp;
> > > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > > +
> > > > +	/*
> > > > +	 * On SKL we don't have a way to detect DDI-E so we 
> > > > rely
> > > > on VBT.
> > > > +	 */
> > > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > > +		(dev_priv
> > > > ->vbt.ddi_port_info[PORT_E].supports_dp
> > > > > > 
> > > > +		 dev_priv
> > > > ->vbt.ddi_port_info[PORT_E].supports_dvi
> > > > > > 
> > > > +		 dev_priv
> > > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > > [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > > > 
> > > >  	init_hdmi = (dev_priv
> > > > ->vbt.ddi_port_info[port].supports_dvi ||
> > > >  		     dev_priv
> > > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device 
> > > > *dev,
> > > > enum port port)
> > > >  	intel_dig_port->port = port;
> > > >  	intel_dig_port->saved_port_bits =
> > > > I915_READ(DDI_BUF_CTL(port)) &
> > > >  					 
> > > >  (DDI_BUF_PORT_REVERSAL |
> > > > -					   DDI_A_4_LANES);
> > > > +					   ddi_e_present ? 0 :
> > > > DDI_A_4_LANES);
> > > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when 
> > > DDI-E
> > > doesn't exist, I think your patch will do nothing.
> > 
> > Actually DDI_A_4_LANES is being already set unconditionally, so 
> > Sonika's
> > patch has no effect.
> [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under many 
> conditions.
> +	if (IS_SKYLAKE(dev) && port == PORT_A
> +		&& !(val & DDI_BUF_CTL_ENABLE)
> +		&& !dev_priv->vbt.ddi_e_used)
> +		I915_WRITE(DDI_BUF_CTL(port), val | DDI_A_4_LANES)
> > 
> > saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and 
> > also it is
> > used to calculate the number of lanes.
> > 
> > With this patch we stop setting DDI_A_4_LANES when ddi_e is present 
> > so
> > DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
> [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES when ddi_e 
> is present.
> But this patch won't set DDI_A_4_LANES under following conditions 
> which is purpose for Sonika patch
> 1. Bios fail to driver eDP and doesn't enable DDI_A buffer

If DDI_A isn't enabled we don't need to set DDI_A_4_LANES

> 2. Bios clear DDI_A_4_LANES
> 3. DDI_E isn't present

I don't agree... This is already covered on current code. DDI_A_4_LANES
is already being set when enabling DDI_A.


> 
> thanks
> > 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-11  7:05     ` Zhang, Xiong Y
  2015-08-11 18:38       ` Vivi, Rodrigo
@ 2015-08-12 21:29       ` Timo Aaltonen
  1 sibling, 0 replies; 52+ messages in thread
From: Timo Aaltonen @ 2015-08-12 21:29 UTC (permalink / raw)
  To: Zhang, Xiong Y, Vivi, Rodrigo, intel-gfx

On 11.08.2015 10:05, Zhang, Xiong Y wrote:
>> -----Original Message-----
>> From: Vivi, Rodrigo
>> Sent: Saturday, August 8, 2015 8:34 AM
>> To: intel-gfx@lists.freedesktop.org
>> Cc: Vivi, Rodrigo; Zhang, Xiong Y
>> Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
>>
>> DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we need to
>> configure lane count propperly for both.
>>
>> This was based on Sonika's
>> [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
>>
>> Credits-to: Sonika Jindal <sonika.jindal@intel.com>
>> Cc: Xiong Zhang <xiong.y.zhang@intel.com>
>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
>> drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
>>  2 files changed, 15 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>> b/drivers/gpu/drm/i915/intel_ddi.c
>> index 110d546..557cecf 100644
>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device *dev, enum
>> port port)
>>  	struct intel_digital_port *intel_dig_port;
>>  	struct intel_encoder *intel_encoder;
>>  	struct drm_encoder *encoder;
>> -	bool init_hdmi, init_dp;
>> +	bool init_hdmi, init_dp, ddi_e_present;
>> +
>> +	/*
>> +	 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
>> +	 */
>> +	ddie_present = IS_SKYLAKE(dev) &&
>> +		(dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
>> +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
>> +		 dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi);
> [Zhang, Xiong Y]  ddie_present should be ddi_e_present
>>
>>  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
>>  		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
>> @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device *dev, enum
>> port port)
>>  	intel_dig_port->port = port;
>>  	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
>>  					  (DDI_BUF_PORT_REVERSAL |
>> -					   DDI_A_4_LANES);
>> +					   ddi_e_present ? 0 : DDI_A_4_LANES);
> [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when DDI-E doesn't exist,
> I think your patch will do nothing.
>>
>>  	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
>>  	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); diff --git
>> a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index
>> 3ff2080..7ada79e 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -159,9 +159,11 @@ static u8 intel_dp_max_lane_count(struct intel_dp
>> *intel_dp)
>>  	u8 source_max, sink_max;
>>
>>  	source_max = 4;
>> -	if (HAS_DDI(dev) && intel_dig_port->port == PORT_A &&
>> -	    (intel_dig_port->saved_port_bits & DDI_A_4_LANES) == 0)
>> -		source_max = 2;
>> +	if (HAS_DDI(dev) && (intel_dig_port->port == PORT_E ||
>> +			     (intel_dig_port->port == PORT_A &&
>> +			      (intel_dig_port->saved_port_bits &
>> +			       DDI_A_4_LANES) == 0))
>> +	    source_max = 2;
> [Zhang, Xiong Y] it miss ')' at the end line. 
>>
>>  	sink_max = drm_dp_max_lane_count(intel_dp->dpcd);

with these build fixes the series is

Tested-by: Timo Aaltonen <timo.aaltonen@canonical.com>


the VGA port on SKL-H SDP was functional after all.. (DP-to-VGA)



-- 
t
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-12 12:33       ` Daniel Vetter
@ 2015-08-13  2:57         ` Zhang, Xiong Y
  2015-08-14  8:42           ` Daniel Vetter
  0 siblings, 1 reply; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-13  2:57 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

> On Wed, Aug 12, 2015 at 06:39:34PM +0800, Xiong Zhang wrote:
> > DDI-E doesn't have the correspondent GMBUS pin.
> >
> > We rely on VBT to tell us which one it being used instead.
> >
> > The DVI/HDMI on shared port couldn't exist.
> >
> > This patch isn't tested without hardware wchich has HDMI on DDI-E.
> >
> > v2: fix trailing whitespace
> > v3: WARN() take place of BUG()
> 
> I asked for MISSING_CASE, not WARN.
> -Daniel
[Zhang, Xiong Y] Because DDI-E on SKL doesn't have correspondent GMBUS pin, it should share such pin with DDI-B/C/D. We don't know the default GMBUS pin for DDI-E if VBT doesn't tell us. 
If VBT don't tell us or give us an invalid GMBUS pin, driver will fail in getting HDMI info. In such case, we really need a warn which tell us why driver couldn't read EDID info for HDMI on DDI-E.

thanks
> 
> >
> > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
> >  drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
> > drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
> >  3 files changed, 44 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > b/drivers/gpu/drm/i915/i915_drv.h index 6d93334..5d8e7fe 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1414,6 +1414,10 @@ enum modeset_restore {  #define DP_AUX_C
> 0x20
> > #define DP_AUX_D 0x30
> >
> > +#define DDC_PIN_B  0x05
> > +#define DDC_PIN_C  0x04
> > +#define DDC_PIN_D  0x06
> > +
> >  struct ddi_vbt_port_info {
> >  	/*
> >  	 * This is an index in the HDMI/DVI DDI buffer translation table.
> > @@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
> >  	uint8_t supports_dp:1;
> >
> >  	uint8_t alternate_aux_channel;
> > +	uint8_t alternate_ddc_pin;
> >  };
> >
> >  enum psr_lines_to_wait {
> > diff --git a/drivers/gpu/drm/i915/intel_bios.c
> > b/drivers/gpu/drm/i915/intel_bios.c
> > index 16cdf17..8140531 100644
> > --- a/drivers/gpu/drm/i915/intel_bios.c
> > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > @@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
> >  	uint8_t hdmi_level_shift;
> >  	int i, j;
> >  	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> > -	uint8_t aux_channel;
> > +	uint8_t aux_channel, ddc_pin;
> >  	/* Each DDI port can have more than one value on the "DVO Port" field,
> >  	 * so look for all the possible values for each port and abort if more
> >  	 * than one is found. */
> > @@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private
> *dev_priv, enum port port,
> >  		return;
> >
> >  	aux_channel = child->raw[25];
> > +	ddc_pin = child->common.ddc_pin;
> >
> >  	is_dvi = child->common.device_type &
> DEVICE_TYPE_TMDS_DVI_SIGNALING;
> >  	is_dp = child->common.device_type &
> DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> > @@ -959,11 +960,27 @@ static void parse_ddi_port(struct
> drm_i915_private *dev_priv, enum port port,
> >  		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
> >
> >  	if (is_dvi) {
> > -		if (child->common.ddc_pin == 0x05 && port != PORT_B)
> > +		if (port == PORT_E) {
> > +			info->alternate_ddc_pin = ddc_pin;
> > +			/* if DDIE share ddc pin with other port, then
> > +			 * dvi/hdmi couldn't exist on the shared port.
> > +			 * Otherwise they share the same ddc bin and system
> > +			 * couldn't communicate with them seperately. */
> > +			if (ddc_pin == DDC_PIN_B) {
> > +				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> > +				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> > +			} else if (ddc_pin == DDC_PIN_C) {
> > +				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> > +				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> > +			} else if (ddc_pin == DDC_PIN_D) {
> > +				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> > +				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> > +			}
> > +		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
> >  			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> > -		if (child->common.ddc_pin == 0x04 && port != PORT_C)
> > +		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
> >  			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> > -		if (child->common.ddc_pin == 0x06 && port != PORT_D)
> > +		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
> >  			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
> >  	}
> >
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> > b/drivers/gpu/drm/i915/intel_hdmi.c
> > index 70bad5b..a4129f2 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct
> intel_digital_port *intel_dig_port,
> >  			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> >  		intel_encoder->hpd_pin = HPD_PORT_D;
> >  		break;
> > +	case PORT_E:
> > +		/* On SKL PORT E doesn't have seperate GMBUS pin
> > +		 *  We rely on VBT to set a proper alternate GMBUS pin. */
> > +		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
> > +		case DDC_PIN_B:
> > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> > +			break;
> > +		case DDC_PIN_C:
> > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> > +			break;
> > +		case DDC_PIN_D:
> > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> > +			break;
> > +		default:
> > +			WARN(1, "VBT assign invalid DDC PIN for	HDMI on
> PORT_E.\n");
> > +		}
> > +		intel_encoder->hpd_pin = HPD_PORT_E;
> > +		break;
> >  	case PORT_A:
> >  		intel_encoder->hpd_pin = HPD_PORT_A;
> >  		/* Internal port only for eDP. */
> > --
> > 2.1.4
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-12 16:51           ` Vivi, Rodrigo
@ 2015-08-13  3:27             ` Zhang, Xiong Y
  2015-08-13  5:48               ` Jindal, Sonika
  0 siblings, 1 reply; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-13  3:27 UTC (permalink / raw)
  To: Vivi, Rodrigo, Jindal, Sonika; +Cc: intel-gfx

> On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
> > > On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > > > > -----Original Message-----
> > > > > From: Vivi, Rodrigo
> > > > > Sent: Saturday, August 8, 2015 8:34 AM
> > > > > To: intel-gfx@lists.freedesktop.org
> > > > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4
> > > > > lanes.
> > > > >
> > > > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we
> > > > > need to configure lane count propperly for both.
> > > > >
> > > > > This was based on Sonika's
> > > > > [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
> > > > >
> > > > > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > > > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > ---
> > > > >  drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > > > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > > > >  2 files changed, 15 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > index 110d546..557cecf 100644
> > > > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device
> > > > > *dev, enum port port)
> > > > >  	struct intel_digital_port *intel_dig_port;
> > > > >  	struct intel_encoder *intel_encoder;
> > > > >  	struct drm_encoder *encoder;
> > > > > -	bool init_hdmi, init_dp;
> > > > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > > > +
> > > > > +	/*
> > > > > +	 * On SKL we don't have a way to detect DDI-E so we
> > > > > rely
> > > > > on VBT.
> > > > > +	 */
> > > > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > > > +		(dev_priv
> > > > > ->vbt.ddi_port_info[PORT_E].supports_dp
> > > > > > >
> > > > > +		 dev_priv
> > > > > ->vbt.ddi_port_info[PORT_E].supports_dvi
> > > > > > >
> > > > > +		 dev_priv
> > > > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > > > [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > > > >
> > > > >  	init_hdmi = (dev_priv
> > > > > ->vbt.ddi_port_info[port].supports_dvi ||
> > > > >  		     dev_priv
> > > > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device
> > > > > *dev, enum port port)
> > > > >  	intel_dig_port->port = port;
> > > > >  	intel_dig_port->saved_port_bits =
> > > > > I915_READ(DDI_BUF_CTL(port)) &
> > > > >
> > > > >  (DDI_BUF_PORT_REVERSAL |
> > > > > -					   DDI_A_4_LANES);
> > > > > +					   ddi_e_present ? 0 :
> > > > > DDI_A_4_LANES);
> > > > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when
> > > > DDI-E doesn't exist, I think your patch will do nothing.
> > >
> > > Actually DDI_A_4_LANES is being already set unconditionally, so
> > > Sonika's patch has no effect.
> > [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under many
> > conditions.
> > +	if (IS_SKYLAKE(dev) && port == PORT_A
> > +		&& !(val & DDI_BUF_CTL_ENABLE)
> > +		&& !dev_priv->vbt.ddi_e_used)
> > +		I915_WRITE(DDI_BUF_CTL(port), val | DDI_A_4_LANES)
> > >
> > > saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and
> > > also it is used to calculate the number of lanes.
> > >
> > > With this patch we stop setting DDI_A_4_LANES when ddi_e is present
> > > so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
> > [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES when ddi_e
> > is present.
> > But this patch won't set DDI_A_4_LANES under following conditions
> > which is purpose for Sonika patch 1. Bios fail to driver eDP and
> > doesn't enable DDI_A buffer
> 
> If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
[Zhang, Xiong Y] From commit message on Sonika patch, she want to 
set DDI_A_4_LANES on such case. Maybe she met such fail case on one high
resolution eDP screen. Let's Sonikia explain it.
> 
> > 2. Bios clear DDI_A_4_LANES
> > 3. DDI_E isn't present
> 
> I don't agree... This is already covered on current code. DDI_A_4_LANES is
> already being set when enabling DDI_A.
> 
> 
> >
> > thanks
> > >
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-13  3:27             ` Zhang, Xiong Y
@ 2015-08-13  5:48               ` Jindal, Sonika
  2015-08-26  8:15                 ` Jani Nikula
  0 siblings, 1 reply; 52+ messages in thread
From: Jindal, Sonika @ 2015-08-13  5:48 UTC (permalink / raw)
  To: Zhang, Xiong Y, Vivi, Rodrigo; +Cc: intel-gfx



On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
>> On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
>>>> On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
>>>>>> -----Original Message-----
>>>>>> From: Vivi, Rodrigo
>>>>>> Sent: Saturday, August 8, 2015 8:34 AM
>>>>>> To: intel-gfx@lists.freedesktop.org
>>>>>> Cc: Vivi, Rodrigo; Zhang, Xiong Y
>>>>>> Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4
>>>>>> lanes.
>>>>>>
>>>>>> DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we
>>>>>> need to configure lane count propperly for both.
>>>>>>
>>>>>> This was based on Sonika's
>>>>>> [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
>>>>>>
>>>>>> Credits-to: Sonika Jindal <sonika.jindal@intel.com>
>>>>>> Cc: Xiong Zhang <xiong.y.zhang@intel.com>
>>>>>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>>>> ---
>>>>>>   drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
>>>>>> drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
>>>>>>   2 files changed, 15 insertions(+), 5 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>> b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>> index 110d546..557cecf 100644
>>>>>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>> @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device
>>>>>> *dev, enum port port)
>>>>>>   	struct intel_digital_port *intel_dig_port;
>>>>>>   	struct intel_encoder *intel_encoder;
>>>>>>   	struct drm_encoder *encoder;
>>>>>> -	bool init_hdmi, init_dp;
>>>>>> +	bool init_hdmi, init_dp, ddi_e_present;
>>>>>> +
>>>>>> +	/*
>>>>>> +	 * On SKL we don't have a way to detect DDI-E so we
>>>>>> rely
>>>>>> on VBT.
>>>>>> +	 */
>>>>>> +	ddie_present = IS_SKYLAKE(dev) &&
>>>>>> +		(dev_priv
>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dp
>>>>>>>>
>>>>>> +		 dev_priv
>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dvi
>>>>>>>>
>>>>>> +		 dev_priv
>>>>>> ->vbt.ddi_port_info[PORT_E].supports_hdmi);
>>>>> [Zhang, Xiong Y]  ddie_present should be ddi_e_present
>>>>>>
>>>>>>   	init_hdmi = (dev_priv
>>>>>> ->vbt.ddi_port_info[port].supports_dvi ||
>>>>>>   		     dev_priv
>>>>>> ->vbt.ddi_port_info[port].supports_hdmi);
>>>>>> @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device
>>>>>> *dev, enum port port)
>>>>>>   	intel_dig_port->port = port;
>>>>>>   	intel_dig_port->saved_port_bits =
>>>>>> I915_READ(DDI_BUF_CTL(port)) &
>>>>>>
>>>>>>   (DDI_BUF_PORT_REVERSAL |
>>>>>> -					   DDI_A_4_LANES);
>>>>>> +					   ddi_e_present ? 0 :
>>>>>> DDI_A_4_LANES);
>>>>> [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when
>>>>> DDI-E doesn't exist, I think your patch will do nothing.
>>>>
>>>> Actually DDI_A_4_LANES is being already set unconditionally, so
>>>> Sonika's patch has no effect.
>>> [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under many
>>> conditions.
>>> +	if (IS_SKYLAKE(dev) && port == PORT_A
>>> +		&& !(val & DDI_BUF_CTL_ENABLE)
>>> +		&& !dev_priv->vbt.ddi_e_used)
>>> +		I915_WRITE(DDI_BUF_CTL(port), val | DDI_A_4_LANES)
>>>>
>>>> saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and
>>>> also it is used to calculate the number of lanes.
>>>>
>>>> With this patch we stop setting DDI_A_4_LANES when ddi_e is present
>>>> so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
>>> [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES when ddi_e
>>> is present.
>>> But this patch won't set DDI_A_4_LANES under following conditions
>>> which is purpose for Sonika patch 1. Bios fail to driver eDP and
>>> doesn't enable DDI_A buffer
>>
>> If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
> [Zhang, Xiong Y] From commit message on Sonika patch, she want to
> set DDI_A_4_LANES on such case. Maybe she met such fail case on one high
> resolution eDP screen. Let's Sonikia explain it.
>>
>>> 2. Bios clear DDI_A_4_LANES
>>> 3. DDI_E isn't present
>>
>> I don't agree... This is already covered on current code. DDI_A_4_LANES is
>> already being set when enabling DDI_A.
>>
As Zhang mentioned and as my commit message explains, my patch is needed 
when bios failed to drive edp (In my case it was an intermediate 
frequency supported panel which was set to 3.24 GHz and bios didn't have 
support for intermediate frequencies), it will not enable DDIA in which 
case, it will not set DDI_BUF_CTL and DDI Lane capability will remain 0 
(which is DDIA with 2 lanes and DDIE with 2 lanes).
So, since the native resolution of that panel was high and couldn't work 
with 2 lanes.
So, ideally we should not rely on bios to set the initial value and set 
it based upon whether DDI_E is used or not.
So, my patch has some effect :)
>>
>>>
>>> thanks
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH] drm/i915: Set alternate aux for DDI-E
  2015-08-08  0:01   ` [PATCH] " Rodrigo Vivi
  2015-08-11  6:18     ` Zhang, Xiong Y
@ 2015-08-13  8:40     ` shuang.he
  1 sibling, 0 replies; 52+ messages in thread
From: shuang.he @ 2015-08-13  8:40 UTC (permalink / raw)
  To: shuang.he, julianx.dumez, christophe.sureau, lei.a.liu,
	intel-gfx, rodrigo.vivi

Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 7119
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                 -1              302/302              301/302
SNB                                  315/315              315/315
IVB                 -11              336/336              325/336
BYT                 -1              283/283              282/283
HSW                                  378/378              378/378
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*ILK  igt@kms_flip@flip-vs-dpms-interruptible      PASS(1)      DMESG_WARN(1)
*IVB  igt@kms_cursor_crc@cursor-128x128-onscreen      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-128x128-random      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-128x128-sliding      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-256x256-offscreen      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-256x256-onscreen      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-256x256-sliding      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-64x64-offscreen      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-64x64-onscreen      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-64x64-random      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-64x64-sliding      PASS(1)      FAIL(1)
*IVB  igt@kms_cursor_crc@cursor-size-change      PASS(1)      FAIL(1)
*BYT  igt@gem_tiled_partial_pwrite_pread@reads      PASS(1)      FAIL(1)
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-13  2:57         ` Zhang, Xiong Y
@ 2015-08-14  8:42           ` Daniel Vetter
  2015-08-14 10:38             ` Zhang, Xiong Y
  2015-08-17  8:04             ` Xiong Zhang
  0 siblings, 2 replies; 52+ messages in thread
From: Daniel Vetter @ 2015-08-14  8:42 UTC (permalink / raw)
  To: Zhang, Xiong Y; +Cc: intel-gfx

On Thu, Aug 13, 2015 at 02:57:38AM +0000, Zhang, Xiong Y wrote:
> > On Wed, Aug 12, 2015 at 06:39:34PM +0800, Xiong Zhang wrote:
> > > DDI-E doesn't have the correspondent GMBUS pin.
> > >
> > > We rely on VBT to tell us which one it being used instead.
> > >
> > > The DVI/HDMI on shared port couldn't exist.
> > >
> > > This patch isn't tested without hardware wchich has HDMI on DDI-E.
> > >
> > > v2: fix trailing whitespace
> > > v3: WARN() take place of BUG()
> > 
> > I asked for MISSING_CASE, not WARN.
> > -Daniel
> [Zhang, Xiong Y] Because DDI-E on SKL doesn't have correspondent GMBUS pin, it should share such pin with DDI-B/C/D. We don't know the default GMBUS pin for DDI-E if VBT doesn't tell us. 
> If VBT don't tell us or give us an invalid GMBUS pin, driver will fail in getting HDMI info. In such case, we really need a warn which tell us why driver couldn't read EDID info for HDMI on DDI-E.

Have you bothered to look at the MISSING_CASE macro?! It does boil down to
a WARN, but I prefer it much over a WARN_ON since it's nicely
standardized.

Thanks, Daniel

> 
> thanks
> > 
> > >
> > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> > > Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
> > >  drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
> > > drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++++++++
> > >  3 files changed, 44 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > > b/drivers/gpu/drm/i915/i915_drv.h index 6d93334..5d8e7fe 100644
> > > --- a/drivers/gpu/drm/i915/i915_drv.h
> > > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > > @@ -1414,6 +1414,10 @@ enum modeset_restore {  #define DP_AUX_C
> > 0x20
> > > #define DP_AUX_D 0x30
> > >
> > > +#define DDC_PIN_B  0x05
> > > +#define DDC_PIN_C  0x04
> > > +#define DDC_PIN_D  0x06
> > > +
> > >  struct ddi_vbt_port_info {
> > >  	/*
> > >  	 * This is an index in the HDMI/DVI DDI buffer translation table.
> > > @@ -1428,6 +1432,7 @@ struct ddi_vbt_port_info {
> > >  	uint8_t supports_dp:1;
> > >
> > >  	uint8_t alternate_aux_channel;
> > > +	uint8_t alternate_ddc_pin;
> > >  };
> > >
> > >  enum psr_lines_to_wait {
> > > diff --git a/drivers/gpu/drm/i915/intel_bios.c
> > > b/drivers/gpu/drm/i915/intel_bios.c
> > > index 16cdf17..8140531 100644
> > > --- a/drivers/gpu/drm/i915/intel_bios.c
> > > +++ b/drivers/gpu/drm/i915/intel_bios.c
> > > @@ -894,7 +894,7 @@ static void parse_ddi_port(struct drm_i915_private
> > *dev_priv, enum port port,
> > >  	uint8_t hdmi_level_shift;
> > >  	int i, j;
> > >  	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> > > -	uint8_t aux_channel;
> > > +	uint8_t aux_channel, ddc_pin;
> > >  	/* Each DDI port can have more than one value on the "DVO Port" field,
> > >  	 * so look for all the possible values for each port and abort if more
> > >  	 * than one is found. */
> > > @@ -928,6 +928,7 @@ static void parse_ddi_port(struct drm_i915_private
> > *dev_priv, enum port port,
> > >  		return;
> > >
> > >  	aux_channel = child->raw[25];
> > > +	ddc_pin = child->common.ddc_pin;
> > >
> > >  	is_dvi = child->common.device_type &
> > DEVICE_TYPE_TMDS_DVI_SIGNALING;
> > >  	is_dp = child->common.device_type &
> > DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> > > @@ -959,11 +960,27 @@ static void parse_ddi_port(struct
> > drm_i915_private *dev_priv, enum port port,
> > >  		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
> > >
> > >  	if (is_dvi) {
> > > -		if (child->common.ddc_pin == 0x05 && port != PORT_B)
> > > +		if (port == PORT_E) {
> > > +			info->alternate_ddc_pin = ddc_pin;
> > > +			/* if DDIE share ddc pin with other port, then
> > > +			 * dvi/hdmi couldn't exist on the shared port.
> > > +			 * Otherwise they share the same ddc bin and system
> > > +			 * couldn't communicate with them seperately. */
> > > +			if (ddc_pin == DDC_PIN_B) {
> > > +				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> > > +				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> > > +			} else if (ddc_pin == DDC_PIN_C) {
> > > +				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> > > +				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> > > +			} else if (ddc_pin == DDC_PIN_D) {
> > > +				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> > > +				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> > > +			}
> > > +		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
> > >  			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> > > -		if (child->common.ddc_pin == 0x04 && port != PORT_C)
> > > +		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
> > >  			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> > > -		if (child->common.ddc_pin == 0x06 && port != PORT_D)
> > > +		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
> > >  			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
> > >  	}
> > >
> > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
> > > b/drivers/gpu/drm/i915/intel_hdmi.c
> > > index 70bad5b..a4129f2 100644
> > > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > > @@ -1991,6 +1991,24 @@ void intel_hdmi_init_connector(struct
> > intel_digital_port *intel_dig_port,
> > >  			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> > >  		intel_encoder->hpd_pin = HPD_PORT_D;
> > >  		break;
> > > +	case PORT_E:
> > > +		/* On SKL PORT E doesn't have seperate GMBUS pin
> > > +		 *  We rely on VBT to set a proper alternate GMBUS pin. */
> > > +		switch (dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin) {
> > > +		case DDC_PIN_B:
> > > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> > > +			break;
> > > +		case DDC_PIN_C:
> > > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> > > +			break;
> > > +		case DDC_PIN_D:
> > > +			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> > > +			break;
> > > +		default:
> > > +			WARN(1, "VBT assign invalid DDC PIN for	HDMI on
> > PORT_E.\n");
> > > +		}
> > > +		intel_encoder->hpd_pin = HPD_PORT_E;
> > > +		break;
> > >  	case PORT_A:
> > >  		intel_encoder->hpd_pin = HPD_PORT_A;
> > >  		/* Internal port only for eDP. */
> > > --
> > > 2.1.4
> > >
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> > 
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-14  8:42           ` Daniel Vetter
@ 2015-08-14 10:38             ` Zhang, Xiong Y
  2015-08-17  8:04             ` Xiong Zhang
  1 sibling, 0 replies; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-14 10:38 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

> On Thu, Aug 13, 2015 at 02:57:38AM +0000, Zhang, Xiong Y wrote:
> > > On Wed, Aug 12, 2015 at 06:39:34PM +0800, Xiong Zhang wrote:
> > > > DDI-E doesn't have the correspondent GMBUS pin.
> > > >
> > > > We rely on VBT to tell us which one it being used instead.
> > > >
> > > > The DVI/HDMI on shared port couldn't exist.
> > > >
> > > > This patch isn't tested without hardware wchich has HDMI on DDI-E.
> > > >
> > > > v2: fix trailing whitespace
> > > > v3: WARN() take place of BUG()
> > >
> > > I asked for MISSING_CASE, not WARN.
> > > -Daniel
> > [Zhang, Xiong Y] Because DDI-E on SKL doesn't have correspondent GMBUS
> pin, it should share such pin with DDI-B/C/D. We don't know the default
> GMBUS pin for DDI-E if VBT doesn't tell us.
> > If VBT don't tell us or give us an invalid GMBUS pin, driver will fail in getting
> HDMI info. In such case, we really need a warn which tell us why driver
> couldn't read EDID info for HDMI on DDI-E.
> 
> Have you bothered to look at the MISSING_CASE macro?! It does boil down to
> a WARN, but I prefer it much over a WARN_ON since it's nicely standardized.
> 
[Zhang, Xiong Y] Please forgive my innocence! I misunderstand MISSING_CASE at the beginning.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH 5/6 v3] drm/i915/skl: enable DDI-E hotplug
  2015-08-10  6:53     ` [PATCH 5/6 v2] drm/i915/skl: enable DDI-E hotplug Xiong Zhang
@ 2015-08-17  7:55       ` Xiong Zhang
  2015-08-26  7:25         ` Jani Nikula
  0 siblings, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-17  7:55 UTC (permalink / raw)
  To: intel-gfx

v2: fix one error found by checkpath.pl
v3: Add one ignored break for switch-case. DDI-E hotplug
    function doesn't work after updating drm-intel tree,
    I checked the code and found this missing which isn't
    the root cause for broke DDI-E hp.  The broken
    DDI-E hp function is fixed by "Adding DDI_E power
    well domain".

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Tested-by: Timo Aaltonen <timo.aaltonen@canonical.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |  1 +
 drivers/gpu/drm/i915/i915_irq.c      | 48 +++++++++++++++++++++++++++++++++---
 drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++
 drivers/gpu/drm/i915/intel_display.c |  3 +++
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++
 drivers/gpu/drm/i915/intel_hotplug.c |  3 +++
 6 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e0f3f05..5f6fd0b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -215,6 +215,7 @@ enum hpd_pin {
 	HPD_PORT_B,
 	HPD_PORT_C,
 	HPD_PORT_D,
+	HPD_PORT_E,
 	HPD_NUM_PINS
 };
 
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a051045..8485bea 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
 	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
 };
 
+static const u32 hpd_spt[HPD_NUM_PINS] = {
+	[HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
+	[HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
+	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
+	[HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
+};
+
 static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
 	[HPD_CRT] = CRT_HOTPLUG_INT_EN,
 	[HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
@@ -1253,6 +1260,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)
 		return val & PORTC_HOTPLUG_LONG_DETECT;
 	case PORT_D:
 		return val & PORTD_HOTPLUG_LONG_DETECT;
+	case PORT_E:
+		return val & PORTE_HOTPLUG_LONG_DETECT;
 	default:
 		return false;
 	}
@@ -1753,7 +1762,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int pipe;
-	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
+	u32 hotplug_trigger;
+
+	if (HAS_PCH_SPT(dev))
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
+	else
+		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
 
 	if (hotplug_trigger) {
 		u32 dig_hotplug_reg, pin_mask, long_mask;
@@ -1761,9 +1775,23 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
 		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
 		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
 
-		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
-				   dig_hotplug_reg, hpd_cpt,
-				   pch_port_hotplug_long_detect);
+		if (HAS_PCH_SPT(dev)) {
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_spt,
+					   pch_port_hotplug_long_detect);
+
+			/* detect PORTE HP event */
+			dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
+			if (pch_port_hotplug_long_detect(PORT_E,
+							 dig_hotplug_reg))
+				long_mask |= 1 << HPD_PORT_E;
+		} else
+			intel_get_hpd_pins(&pin_mask, &long_mask,
+					   hotplug_trigger,
+					   dig_hotplug_reg, hpd_cpt,
+					   pch_port_hotplug_long_detect);
+
 		intel_hpd_irq_handler(dev, pin_mask, long_mask);
 	}
 
@@ -2985,6 +3013,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 		for_each_intel_encoder(dev, intel_encoder)
 			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
 				enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
+	} else if (HAS_PCH_SPT(dev)) {
+		hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
+		for_each_intel_encoder(dev, intel_encoder)
+			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
+				enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];
 	} else {
 		hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
 		for_each_intel_encoder(dev, intel_encoder)
@@ -3006,6 +3039,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
 	hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
 	hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
 	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
+
+	/* enable SPT PORTE hot plug */
+	if (HAS_PCH_SPT(dev)) {
+		hotplug = I915_READ(PCH_PORT_HOTPLUG2);
+		hotplug |= PORTE_HOTPLUG_ENABLE;
+		I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
+	}
 }
 
 static void bxt_hpd_irq_setup(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 1fa0554..7187383 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5958,6 +5958,7 @@ enum skl_disp_power_wells {
 #define SDE_AUXC_CPT		(1 << 26)
 #define SDE_AUXB_CPT		(1 << 25)
 #define SDE_AUX_MASK_CPT	(7 << 25)
+#define SDE_PORTE_HOTPLUG_SPT	(1 << 25)
 #define SDE_PORTD_HOTPLUG_CPT	(1 << 23)
 #define SDE_PORTC_HOTPLUG_CPT	(1 << 22)
 #define SDE_PORTB_HOTPLUG_CPT	(1 << 21)
@@ -5968,6 +5969,10 @@ enum skl_disp_power_wells {
 				 SDE_PORTD_HOTPLUG_CPT |	\
 				 SDE_PORTC_HOTPLUG_CPT |	\
 				 SDE_PORTB_HOTPLUG_CPT)
+#define SDE_HOTPLUG_MASK_SPT	(SDE_PORTE_HOTPLUG_SPT |	\
+				 SDE_PORTD_HOTPLUG_CPT |	\
+				 SDE_PORTC_HOTPLUG_CPT |	\
+				 SDE_PORTB_HOTPLUG_CPT)
 #define SDE_GMBUS_CPT		(1 << 17)
 #define SDE_ERROR_CPT		(1 << 16)
 #define SDE_AUDIO_CP_REQ_C_CPT	(1 << 10)
@@ -6039,6 +6044,13 @@ enum skl_disp_power_wells {
 #define  PORTB_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTB_HOTPLUG_LONG_DETECT	(2 << 0)
 
+#define PCH_PORT_HOTPLUG2        0xc403C		/* SHOTPLUG_CTL2 */
+#define PORTE_HOTPLUG_ENABLE            (1 << 4)
+#define PORTE_HOTPLUG_STATUS_MASK	(0x3 << 0)
+#define  PORTE_HOTPLUG_NO_DETECT	(0 << 0)
+#define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
+#define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
+
 #define PCH_GPIOA               0xc5010
 #define PCH_GPIOB               0xc5014
 #define PCH_GPIOC               0xc5018
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f604ce1..5510eb8c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1098,6 +1098,9 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
 		case PORT_D:
 			bit = SDE_PORTD_HOTPLUG_CPT;
 			break;
+		case PORT_E:
+			bit = SDE_PORTE_HOTPLUG_SPT;
+			break;
 		default:
 			return true;
 		}
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b905c19..4776f87 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5916,6 +5916,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	case PORT_D:
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	default:
 		BUG();
 	}
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 032a0bf..53c0173 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)
 	case HPD_PORT_D:
 		*port = PORT_D;
 		return true;
+	case HPD_PORT_E:
+		*port = PORT_E;
+		return true;
 	default:
 		return false;	/* no hpd */
 	}
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-14  8:42           ` Daniel Vetter
  2015-08-14 10:38             ` Zhang, Xiong Y
@ 2015-08-17  8:04             ` Xiong Zhang
  2015-08-31 15:47               ` Jani Nikula
  1 sibling, 1 reply; 52+ messages in thread
From: Xiong Zhang @ 2015-08-17  8:04 UTC (permalink / raw)
  To: intel-gfx

DDI-E doesn't have the correspondent GMBUS pin.

We rely on VBT to tell us which one it being used instead.

The DVI/HDMI on shared port couldn't exist.

This patch isn't tested without hardware wchich has HDMI
on DDI-E.

v2: fix trailing whitespace
v3: MISSING_CASE take place of BUG()

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
 drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_hdmi.c | 21 +++++++++++++++++++++
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 35192d2..22e8bf0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1418,6 +1418,10 @@ enum modeset_restore {
 #define DP_AUX_C 0x20
 #define DP_AUX_D 0x30
 
+#define DDC_PIN_B  0x05
+#define DDC_PIN_C  0x04
+#define DDC_PIN_D  0x06
+
 struct ddi_vbt_port_info {
 	/*
 	 * This is an index in the HDMI/DVI DDI buffer translation table.
@@ -1432,6 +1436,7 @@ struct ddi_vbt_port_info {
 	uint8_t supports_dp:1;
 
 	uint8_t alternate_aux_channel;
+	uint8_t alternate_ddc_pin;
 
 	uint8_t dp_boost_level;
 	uint8_t hdmi_boost_level;
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 8e46149..a2ee347 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -905,7 +905,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 	uint8_t hdmi_level_shift;
 	int i, j;
 	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
-	uint8_t aux_channel;
+	uint8_t aux_channel, ddc_pin;
 	/* Each DDI port can have more than one value on the "DVO Port" field,
 	 * so look for all the possible values for each port and abort if more
 	 * than one is found. */
@@ -939,6 +939,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		return;
 
 	aux_channel = child->raw[25];
+	ddc_pin = child->common.ddc_pin;
 
 	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
 	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
@@ -970,11 +971,27 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
 
 	if (is_dvi) {
-		if (child->common.ddc_pin == 0x05 && port != PORT_B)
+		if (port == PORT_E) {
+			info->alternate_ddc_pin = ddc_pin;
+			/* if DDIE share ddc pin with other port, then
+			 * dvi/hdmi couldn't exist on the shared port.
+			 * Otherwise they share the same ddc bin and system
+			 * couldn't communicate with them seperately. */
+			if (ddc_pin == DDC_PIN_B) {
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
+			} else if (ddc_pin == DDC_PIN_C) {
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
+			} else if (ddc_pin == DDC_PIN_D) {
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
+				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
+			}
+		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
-		if (child->common.ddc_pin == 0x04 && port != PORT_C)
+		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
-		if (child->common.ddc_pin == 0x06 && port != PORT_D)
+		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
 			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 7185062..d1a7f7b 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1956,6 +1956,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 	struct drm_device *dev = intel_encoder->base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum port port = intel_dig_port->port;
+	uint8_t alternate_ddc_pin;
 
 	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_HDMIA);
@@ -1996,6 +1997,26 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
 		intel_encoder->hpd_pin = HPD_PORT_D;
 		break;
+	case PORT_E:
+		/* On SKL PORT E doesn't have seperate GMBUS pin
+		 *  We rely on VBT to set a proper alternate GMBUS pin. */
+		alternate_ddc_pin =
+			dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin;
+		switch (alternate_ddc_pin) {
+		case DDC_PIN_B:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
+			break;
+		case DDC_PIN_C:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
+			break;
+		case DDC_PIN_D:
+			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
+			break;
+		default:
+			MISSING_CASE(alternate_ddc_pin);
+		}
+		intel_encoder->hpd_pin = HPD_PORT_E;
+		break;
 	case PORT_A:
 		intel_encoder->hpd_pin = HPD_PORT_A;
 		/* Internal port only for eDP. */
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH 5/6 v3] drm/i915/skl: enable DDI-E hotplug
  2015-08-17  7:55       ` [PATCH 5/6 v3] " Xiong Zhang
@ 2015-08-26  7:25         ` Jani Nikula
  0 siblings, 0 replies; 52+ messages in thread
From: Jani Nikula @ 2015-08-26  7:25 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx

On Mon, 17 Aug 2015, Xiong Zhang <xiong.y.zhang@intel.com> wrote:
> v2: fix one error found by checkpath.pl
> v3: Add one ignored break for switch-case. DDI-E hotplug
>     function doesn't work after updating drm-intel tree,
>     I checked the code and found this missing which isn't
>     the root cause for broke DDI-E hp.  The broken
>     DDI-E hp function is fixed by "Adding DDI_E power
>     well domain".
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Tested-by: Timo Aaltonen <timo.aaltonen@canonical.com>

Pushed to drm-intel-next-fixes.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/i915_drv.h      |  1 +
>  drivers/gpu/drm/i915/i915_irq.c      | 48 +++++++++++++++++++++++++++++++++---
>  drivers/gpu/drm/i915/i915_reg.h      | 12 +++++++++
>  drivers/gpu/drm/i915/intel_display.c |  3 +++
>  drivers/gpu/drm/i915/intel_dp.c      |  3 +++
>  drivers/gpu/drm/i915/intel_hotplug.c |  3 +++
>  6 files changed, 66 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index e0f3f05..5f6fd0b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -215,6 +215,7 @@ enum hpd_pin {
>  	HPD_PORT_B,
>  	HPD_PORT_C,
>  	HPD_PORT_D,
> +	HPD_PORT_E,
>  	HPD_NUM_PINS
>  };
>  
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index a051045..8485bea 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -61,6 +61,13 @@ static const u32 hpd_cpt[HPD_NUM_PINS] = {
>  	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT
>  };
>  
> +static const u32 hpd_spt[HPD_NUM_PINS] = {
> +	[HPD_PORT_B] = SDE_PORTB_HOTPLUG_CPT,
> +	[HPD_PORT_C] = SDE_PORTC_HOTPLUG_CPT,
> +	[HPD_PORT_D] = SDE_PORTD_HOTPLUG_CPT,
> +	[HPD_PORT_E] = SDE_PORTE_HOTPLUG_SPT
> +};
> +
>  static const u32 hpd_mask_i915[HPD_NUM_PINS] = {
>  	[HPD_CRT] = CRT_HOTPLUG_INT_EN,
>  	[HPD_SDVO_B] = SDVOB_HOTPLUG_INT_EN,
> @@ -1253,6 +1260,8 @@ static bool pch_port_hotplug_long_detect(enum port port, u32 val)
>  		return val & PORTC_HOTPLUG_LONG_DETECT;
>  	case PORT_D:
>  		return val & PORTD_HOTPLUG_LONG_DETECT;
> +	case PORT_E:
> +		return val & PORTE_HOTPLUG_LONG_DETECT;
>  	default:
>  		return false;
>  	}
> @@ -1753,7 +1762,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int pipe;
> -	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
> +	u32 hotplug_trigger;
> +
> +	if (HAS_PCH_SPT(dev))
> +		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT;
> +	else
> +		hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
>  
>  	if (hotplug_trigger) {
>  		u32 dig_hotplug_reg, pin_mask, long_mask;
> @@ -1761,9 +1775,23 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
>  		dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
>  		I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
>  
> -		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
> -				   dig_hotplug_reg, hpd_cpt,
> -				   pch_port_hotplug_long_detect);
> +		if (HAS_PCH_SPT(dev)) {
> +			intel_get_hpd_pins(&pin_mask, &long_mask,
> +					   hotplug_trigger,
> +					   dig_hotplug_reg, hpd_spt,
> +					   pch_port_hotplug_long_detect);
> +
> +			/* detect PORTE HP event */
> +			dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG2);
> +			if (pch_port_hotplug_long_detect(PORT_E,
> +							 dig_hotplug_reg))
> +				long_mask |= 1 << HPD_PORT_E;
> +		} else
> +			intel_get_hpd_pins(&pin_mask, &long_mask,
> +					   hotplug_trigger,
> +					   dig_hotplug_reg, hpd_cpt,
> +					   pch_port_hotplug_long_detect);
> +
>  		intel_hpd_irq_handler(dev, pin_mask, long_mask);
>  	}
>  
> @@ -2985,6 +3013,11 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
>  		for_each_intel_encoder(dev, intel_encoder)
>  			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
>  				enabled_irqs |= hpd_ibx[intel_encoder->hpd_pin];
> +	} else if (HAS_PCH_SPT(dev)) {
> +		hotplug_irqs = SDE_HOTPLUG_MASK_SPT;
> +		for_each_intel_encoder(dev, intel_encoder)
> +			if (dev_priv->hotplug.stats[intel_encoder->hpd_pin].state == HPD_ENABLED)
> +				enabled_irqs |= hpd_spt[intel_encoder->hpd_pin];
>  	} else {
>  		hotplug_irqs = SDE_HOTPLUG_MASK_CPT;
>  		for_each_intel_encoder(dev, intel_encoder)
> @@ -3006,6 +3039,13 @@ static void ibx_hpd_irq_setup(struct drm_device *dev)
>  	hotplug |= PORTC_HOTPLUG_ENABLE | PORTC_PULSE_DURATION_2ms;
>  	hotplug |= PORTB_HOTPLUG_ENABLE | PORTB_PULSE_DURATION_2ms;
>  	I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
> +
> +	/* enable SPT PORTE hot plug */
> +	if (HAS_PCH_SPT(dev)) {
> +		hotplug = I915_READ(PCH_PORT_HOTPLUG2);
> +		hotplug |= PORTE_HOTPLUG_ENABLE;
> +		I915_WRITE(PCH_PORT_HOTPLUG2, hotplug);
> +	}
>  }
>  
>  static void bxt_hpd_irq_setup(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 1fa0554..7187383 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5958,6 +5958,7 @@ enum skl_disp_power_wells {
>  #define SDE_AUXC_CPT		(1 << 26)
>  #define SDE_AUXB_CPT		(1 << 25)
>  #define SDE_AUX_MASK_CPT	(7 << 25)
> +#define SDE_PORTE_HOTPLUG_SPT	(1 << 25)
>  #define SDE_PORTD_HOTPLUG_CPT	(1 << 23)
>  #define SDE_PORTC_HOTPLUG_CPT	(1 << 22)
>  #define SDE_PORTB_HOTPLUG_CPT	(1 << 21)
> @@ -5968,6 +5969,10 @@ enum skl_disp_power_wells {
>  				 SDE_PORTD_HOTPLUG_CPT |	\
>  				 SDE_PORTC_HOTPLUG_CPT |	\
>  				 SDE_PORTB_HOTPLUG_CPT)
> +#define SDE_HOTPLUG_MASK_SPT	(SDE_PORTE_HOTPLUG_SPT |	\
> +				 SDE_PORTD_HOTPLUG_CPT |	\
> +				 SDE_PORTC_HOTPLUG_CPT |	\
> +				 SDE_PORTB_HOTPLUG_CPT)
>  #define SDE_GMBUS_CPT		(1 << 17)
>  #define SDE_ERROR_CPT		(1 << 16)
>  #define SDE_AUDIO_CP_REQ_C_CPT	(1 << 10)
> @@ -6039,6 +6044,13 @@ enum skl_disp_power_wells {
>  #define  PORTB_HOTPLUG_SHORT_DETECT	(1 << 0)
>  #define  PORTB_HOTPLUG_LONG_DETECT	(2 << 0)
>  
> +#define PCH_PORT_HOTPLUG2        0xc403C		/* SHOTPLUG_CTL2 */
> +#define PORTE_HOTPLUG_ENABLE            (1 << 4)
> +#define PORTE_HOTPLUG_STATUS_MASK	(0x3 << 0)
> +#define  PORTE_HOTPLUG_NO_DETECT	(0 << 0)
> +#define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
> +#define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
> +
>  #define PCH_GPIOA               0xc5010
>  #define PCH_GPIOB               0xc5014
>  #define PCH_GPIOC               0xc5018
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index f604ce1..5510eb8c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1098,6 +1098,9 @@ bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
>  		case PORT_D:
>  			bit = SDE_PORTD_HOTPLUG_CPT;
>  			break;
> +		case PORT_E:
> +			bit = SDE_PORTE_HOTPLUG_SPT;
> +			break;
>  		default:
>  			return true;
>  		}
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index b905c19..4776f87 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5916,6 +5916,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  	case PORT_D:
>  		intel_encoder->hpd_pin = HPD_PORT_D;
>  		break;
> +	case PORT_E:
> +		intel_encoder->hpd_pin = HPD_PORT_E;
> +		break;
>  	default:
>  		BUG();
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
> index 032a0bf..53c0173 100644
> --- a/drivers/gpu/drm/i915/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/intel_hotplug.c
> @@ -91,6 +91,9 @@ bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port)
>  	case HPD_PORT_D:
>  		*port = PORT_D;
>  		return true;
> +	case HPD_PORT_E:
> +		*port = PORT_E;
> +		return true;
>  	default:
>  		return false;	/* no hpd */
>  	}
> -- 
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-13  5:48               ` Jindal, Sonika
@ 2015-08-26  8:15                 ` Jani Nikula
  2015-08-26 16:38                   ` Vivi, Rodrigo
  0 siblings, 1 reply; 52+ messages in thread
From: Jani Nikula @ 2015-08-26  8:15 UTC (permalink / raw)
  To: Jindal, Sonika, Zhang, Xiong Y, Vivi, Rodrigo; +Cc: intel-gfx

On Thu, 13 Aug 2015, "Jindal, Sonika" <sonika.jindal@intel.com> wrote:
> On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
>>> On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
>>>>> On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
>>>>>>> -----Original Message-----
>>>>>>> From: Vivi, Rodrigo
>>>>>>> Sent: Saturday, August 8, 2015 8:34 AM
>>>>>>> To: intel-gfx@lists.freedesktop.org
>>>>>>> Cc: Vivi, Rodrigo; Zhang, Xiong Y
>>>>>>> Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4
>>>>>>> lanes.
>>>>>>>
>>>>>>> DDI-A and DDI-E shares the 4 lanes. So when DDI-E is present we
>>>>>>> need to configure lane count propperly for both.
>>>>>>>
>>>>>>> This was based on Sonika's
>>>>>>> [PATCH] drm/i915/skl: Select DDIA lane capability based upon vbt
>>>>>>>
>>>>>>> Credits-to: Sonika Jindal <sonika.jindal@intel.com>
>>>>>>> Cc: Xiong Zhang <xiong.y.zhang@intel.com>
>>>>>>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>>>>> ---
>>>>>>>   drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
>>>>>>> drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
>>>>>>>   2 files changed, 15 insertions(+), 5 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>> b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>> index 110d546..557cecf 100644
>>>>>>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>> @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct drm_device
>>>>>>> *dev, enum port port)
>>>>>>>   	struct intel_digital_port *intel_dig_port;
>>>>>>>   	struct intel_encoder *intel_encoder;
>>>>>>>   	struct drm_encoder *encoder;
>>>>>>> -	bool init_hdmi, init_dp;
>>>>>>> +	bool init_hdmi, init_dp, ddi_e_present;
>>>>>>> +
>>>>>>> +	/*
>>>>>>> +	 * On SKL we don't have a way to detect DDI-E so we
>>>>>>> rely
>>>>>>> on VBT.
>>>>>>> +	 */
>>>>>>> +	ddie_present = IS_SKYLAKE(dev) &&
>>>>>>> +		(dev_priv
>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dp
>>>>>>>>>
>>>>>>> +		 dev_priv
>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dvi
>>>>>>>>>
>>>>>>> +		 dev_priv
>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_hdmi);
>>>>>> [Zhang, Xiong Y]  ddie_present should be ddi_e_present
>>>>>>>
>>>>>>>   	init_hdmi = (dev_priv
>>>>>>> ->vbt.ddi_port_info[port].supports_dvi ||
>>>>>>>   		     dev_priv
>>>>>>> ->vbt.ddi_port_info[port].supports_hdmi);
>>>>>>> @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct drm_device
>>>>>>> *dev, enum port port)
>>>>>>>   	intel_dig_port->port = port;
>>>>>>>   	intel_dig_port->saved_port_bits =
>>>>>>> I915_READ(DDI_BUF_CTL(port)) &
>>>>>>>
>>>>>>>   (DDI_BUF_PORT_REVERSAL |
>>>>>>> -					   DDI_A_4_LANES);
>>>>>>> +					   ddi_e_present ? 0 :
>>>>>>> DDI_A_4_LANES);
>>>>>> [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes when
>>>>>> DDI-E doesn't exist, I think your patch will do nothing.
>>>>>
>>>>> Actually DDI_A_4_LANES is being already set unconditionally, so
>>>>> Sonika's patch has no effect.
>>>> [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under many
>>>> conditions.
>>>> +	if (IS_SKYLAKE(dev) && port == PORT_A
>>>> +		&& !(val & DDI_BUF_CTL_ENABLE)
>>>> +		&& !dev_priv->vbt.ddi_e_used)
>>>> +		I915_WRITE(DDI_BUF_CTL(port), val | DDI_A_4_LANES)
>>>>>
>>>>> saved_port_bits goes to intel_dp->DP that goes to DDI_BUF_CTL and
>>>>> also it is used to calculate the number of lanes.
>>>>>
>>>>> With this patch we stop setting DDI_A_4_LANES when ddi_e is present
>>>>> so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
>>>> [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES when ddi_e
>>>> is present.
>>>> But this patch won't set DDI_A_4_LANES under following conditions
>>>> which is purpose for Sonika patch 1. Bios fail to driver eDP and
>>>> doesn't enable DDI_A buffer
>>>
>>> If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
>> [Zhang, Xiong Y] From commit message on Sonika patch, she want to
>> set DDI_A_4_LANES on such case. Maybe she met such fail case on one high
>> resolution eDP screen. Let's Sonikia explain it.
>>>
>>>> 2. Bios clear DDI_A_4_LANES
>>>> 3. DDI_E isn't present
>>>
>>> I don't agree... This is already covered on current code. DDI_A_4_LANES is
>>> already being set when enabling DDI_A.
>>>
> As Zhang mentioned and as my commit message explains, my patch is needed 
> when bios failed to drive edp (In my case it was an intermediate 
> frequency supported panel which was set to 3.24 GHz and bios didn't have 
> support for intermediate frequencies), it will not enable DDIA in which 
> case, it will not set DDI_BUF_CTL and DDI Lane capability will remain 0 
> (which is DDIA with 2 lanes and DDIE with 2 lanes).
> So, since the native resolution of that panel was high and couldn't work 
> with 2 lanes.
> So, ideally we should not rely on bios to set the initial value and set 
> it based upon whether DDI_E is used or not.
> So, my patch has some effect :)

Rodrigo? Please figure out what the needed patch is, and send it.

BR,
Jani.



>>>
>>>>
>>>> thanks
>>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-26  8:15                 ` Jani Nikula
@ 2015-08-26 16:38                   ` Vivi, Rodrigo
  2015-08-27  2:52                     ` Zhang, Xiong Y
  0 siblings, 1 reply; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-26 16:38 UTC (permalink / raw)
  To: Jindal, Sonika, jani.nikula, Zhang, Xiong Y; +Cc: intel-gfx

On Wed, 2015-08-26 at 11:15 +0300, Jani Nikula wrote:
> On Thu, 13 Aug 2015, "Jindal, Sonika" <sonika.jindal@intel.com> 
> wrote:
> > On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
> > > > On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
> > > > > > On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > > > > > > > -----Original Message-----
> > > > > > > > From: Vivi, Rodrigo
> > > > > > > > Sent: Saturday, August 8, 2015 8:34 AM
> > > > > > > > To: intel-gfx@lists.freedesktop.org
> > > > > > > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > > > > > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A 
> > > > > > > > shares 4
> > > > > > > > lanes.
> > > > > > > > 
> > > > > > > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is 
> > > > > > > > present we
> > > > > > > > need to configure lane count propperly for both.
> > > > > > > > 
> > > > > > > > This was based on Sonika's
> > > > > > > > [PATCH] drm/i915/skl: Select DDIA lane capability based 
> > > > > > > > upon vbt
> > > > > > > > 
> > > > > > > > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > > > > > > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > > > > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > > > > ---
> > > > > > > >   drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > > > > > > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > > > > > > >   2 files changed, 15 insertions(+), 5 deletions(-)
> > > > > > > > 
> > > > > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > index 110d546..557cecf 100644
> > > > > > > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct 
> > > > > > > > drm_device
> > > > > > > > *dev, enum port port)
> > > > > > > >   	struct intel_digital_port *intel_dig_port;
> > > > > > > >   	struct intel_encoder *intel_encoder;
> > > > > > > >   	struct drm_encoder *encoder;
> > > > > > > > -	bool init_hdmi, init_dp;
> > > > > > > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > > > > > > +
> > > > > > > > +	/*
> > > > > > > > +	 * On SKL we don't have a way to detect DDI-E 
> > > > > > > > so we
> > > > > > > > rely
> > > > > > > > on VBT.
> > > > > > > > +	 */
> > > > > > > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > > > > > > +		(dev_priv
> > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dp
> > > > > > > > > > 
> > > > > > > > +		 dev_priv
> > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dvi
> > > > > > > > > > 
> > > > > > > > +		 dev_priv
> > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > > > > > > [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > > > > > > > 
> > > > > > > >   	init_hdmi = (dev_priv
> > > > > > > > ->vbt.ddi_port_info[port].supports_dvi ||
> > > > > > > >   		     dev_priv
> > > > > > > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > > > > > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct 
> > > > > > > > drm_device
> > > > > > > > *dev, enum port port)
> > > > > > > >   	intel_dig_port->port = port;
> > > > > > > >   	intel_dig_port->saved_port_bits =
> > > > > > > > I915_READ(DDI_BUF_CTL(port)) &
> > > > > > > > 
> > > > > > > >   (DDI_BUF_PORT_REVERSAL |
> > > > > > > > -					  
> > > > > > > >  DDI_A_4_LANES);
> > > > > > > > +					  
> > > > > > > >  ddi_e_present ? 0 :
> > > > > > > > DDI_A_4_LANES);
> > > > > > > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes 
> > > > > > > when
> > > > > > > DDI-E doesn't exist, I think your patch will do nothing.
> > > > > > 
> > > > > > Actually DDI_A_4_LANES is being already set 
> > > > > > unconditionally, so
> > > > > > Sonika's patch has no effect.
> > > > > [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under 
> > > > > many
> > > > > conditions.
> > > > > +	if (IS_SKYLAKE(dev) && port == PORT_A
> > > > > +		&& !(val & DDI_BUF_CTL_ENABLE)
> > > > > +		&& !dev_priv->vbt.ddi_e_used)
> > > > > +		I915_WRITE(DDI_BUF_CTL(port), val | 
> > > > > DDI_A_4_LANES)
> > > > > > 
> > > > > > saved_port_bits goes to intel_dp->DP that goes to 
> > > > > > DDI_BUF_CTL and
> > > > > > also it is used to calculate the number of lanes.
> > > > > > 
> > > > > > With this patch we stop setting DDI_A_4_LANES when ddi_e is 
> > > > > > present
> > > > > > so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
> > > > > [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES 
> > > > > when ddi_e
> > > > > is present.
> > > > > But this patch won't set DDI_A_4_LANES under following 
> > > > > conditions
> > > > > which is purpose for Sonika patch 1. Bios fail to driver eDP 
> > > > > and
> > > > > doesn't enable DDI_A buffer
> > > > 
> > > > If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
> > > [Zhang, Xiong Y] From commit message on Sonika patch, she want to
> > > set DDI_A_4_LANES on such case. Maybe she met such fail case on 
> > > one high
> > > resolution eDP screen. Let's Sonikia explain it.
> > > > 
> > > > > 2. Bios clear DDI_A_4_LANES
> > > > > 3. DDI_E isn't present
> > > > 
> > > > I don't agree... This is already covered on current code. 
> > > > DDI_A_4_LANES is
> > > > already being set when enabling DDI_A.
> > > > 
> > As Zhang mentioned and as my commit message explains, my patch is 
> > needed 
> > when bios failed to drive edp (In my case it was an intermediate 
> > frequency supported panel which was set to 3.24 GHz and bios didn't 
> > have 
> > support for intermediate frequencies), it will not enable DDIA in 
> > which 
> > case, it will not set DDI_BUF_CTL and DDI Lane capability will 
> > remain 0 
> > (which is DDIA with 2 lanes and DDIE with 2 lanes).
> > So, since the native resolution of that panel was high and couldn't 
> > work 
> > with 2 lanes.
> > So, ideally we should not rely on bios to set the initial value and 
> > set 
> > it based upon whether DDI_E is used or not.
> > So, my patch has some effect :)
> 
> Rodrigo? Please figure out what the needed patch is, and send it.

I've just read Sonika's patch again to see if I could convince myself
to stop being stubborn...

I realized that our patches are independent. I still believe we need
this one here... We just need a reviewer.

But I'm really a stubborn and I'm not convinced we need the other
patch. I still can't see how we would end up enabling DDI-A without
setting the lanes. For me if we don't call intel_ddi_init(port_A) we
don't need to set lanes or there is something else really wrong, and if
we call it this bit will be *always* set already.

> 
> BR,
> Jani.
> 
> 
> 
> > > > 
> > > > > 
> > > > > thanks
> > > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-26 16:38                   ` Vivi, Rodrigo
@ 2015-08-27  2:52                     ` Zhang, Xiong Y
  2015-08-27 14:31                       ` Timo Aaltonen
  0 siblings, 1 reply; 52+ messages in thread
From: Zhang, Xiong Y @ 2015-08-27  2:52 UTC (permalink / raw)
  To: Vivi, Rodrigo; +Cc: intel-gfx

> On Wed, 2015-08-26 at 11:15 +0300, Jani Nikula wrote:
> > On Thu, 13 Aug 2015, "Jindal, Sonika" <sonika.jindal@intel.com>
> > wrote:
> > > On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
> > > > > On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
> > > > > > > On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Vivi, Rodrigo
> > > > > > > > > Sent: Saturday, August 8, 2015 8:34 AM
> > > > > > > > > To: intel-gfx@lists.freedesktop.org
> > > > > > > > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > > > > > > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A
> > > > > > > > > shares 4
> > > > > > > > > lanes.
> > > > > > > > >
> > > > > > > > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E is
> > > > > > > > > present we
> > > > > > > > > need to configure lane count propperly for both.
> > > > > > > > >
> > > > > > > > > This was based on Sonika's
> > > > > > > > > [PATCH] drm/i915/skl: Select DDIA lane capability based
> > > > > > > > > upon vbt
> > > > > > > > >
> > > > > > > > > Credits-to: Sonika Jindal <sonika.jindal@intel.com>
> > > > > > > > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > > > > > > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > > > > > > > ---
> > > > > > > > >   drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
> > > > > > > > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > > > > > > > >   2 files changed, 15 insertions(+), 5 deletions(-)
> > > > > > > > >
> > > > > > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > index 110d546..557cecf 100644
> > > > > > > > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct
> > > > > > > > > drm_device
> > > > > > > > > *dev, enum port port)
> > > > > > > > >   	struct intel_digital_port *intel_dig_port;
> > > > > > > > >   	struct intel_encoder *intel_encoder;
> > > > > > > > >   	struct drm_encoder *encoder;
> > > > > > > > > -	bool init_hdmi, init_dp;
> > > > > > > > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > > > > > > > +
> > > > > > > > > +	/*
> > > > > > > > > +	 * On SKL we don't have a way to detect DDI-E
> > > > > > > > > so we
> > > > > > > > > rely
> > > > > > > > > on VBT.
> > > > > > > > > +	 */
> > > > > > > > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > > > > > > > +		(dev_priv
> > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dp
> > > > > > > > > > >
> > > > > > > > > +		 dev_priv
> > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dvi
> > > > > > > > > > >
> > > > > > > > > +		 dev_priv
> > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > > > > > > > [Zhang, Xiong Y]  ddie_present should be ddi_e_present
> > > > > > > > >
> > > > > > > > >   	init_hdmi = (dev_priv
> > > > > > > > > ->vbt.ddi_port_info[port].supports_dvi ||
> > > > > > > > >   		     dev_priv
> > > > > > > > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > > > > > > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct
> > > > > > > > > drm_device
> > > > > > > > > *dev, enum port port)
> > > > > > > > >   	intel_dig_port->port = port;
> > > > > > > > >   	intel_dig_port->saved_port_bits =
> > > > > > > > > I915_READ(DDI_BUF_CTL(port)) &
> > > > > > > > >
> > > > > > > > >   (DDI_BUF_PORT_REVERSAL |
> > > > > > > > > -
> > > > > > > > >  DDI_A_4_LANES);
> > > > > > > > > +
> > > > > > > > >  ddi_e_present ? 0 :
> > > > > > > > > DDI_A_4_LANES);
> > > > > > > > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes
> > > > > > > > when
> > > > > > > > DDI-E doesn't exist, I think your patch will do nothing.
> > > > > > >
> > > > > > > Actually DDI_A_4_LANES is being already set
> > > > > > > unconditionally, so
> > > > > > > Sonika's patch has no effect.
> > > > > > [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under
> > > > > > many
> > > > > > conditions.
> > > > > > +	if (IS_SKYLAKE(dev) && port == PORT_A
> > > > > > +		&& !(val & DDI_BUF_CTL_ENABLE)
> > > > > > +		&& !dev_priv->vbt.ddi_e_used)
> > > > > > +		I915_WRITE(DDI_BUF_CTL(port), val |
> > > > > > DDI_A_4_LANES)
> > > > > > >
> > > > > > > saved_port_bits goes to intel_dp->DP that goes to
> > > > > > > DDI_BUF_CTL and
> > > > > > > also it is used to calculate the number of lanes.
> > > > > > >
> > > > > > > With this patch we stop setting DDI_A_4_LANES when ddi_e is
> > > > > > > present
> > > > > > > so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
> > > > > > [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES
> > > > > > when ddi_e
> > > > > > is present.
> > > > > > But this patch won't set DDI_A_4_LANES under following
> > > > > > conditions
> > > > > > which is purpose for Sonika patch 1. Bios fail to driver eDP
> > > > > > and
> > > > > > doesn't enable DDI_A buffer
> > > > >
> > > > > If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
> > > > [Zhang, Xiong Y] From commit message on Sonika patch, she want to
> > > > set DDI_A_4_LANES on such case. Maybe she met such fail case on
> > > > one high
> > > > resolution eDP screen. Let's Sonikia explain it.
> > > > >
> > > > > > 2. Bios clear DDI_A_4_LANES
> > > > > > 3. DDI_E isn't present
> > > > >
> > > > > I don't agree... This is already covered on current code.
> > > > > DDI_A_4_LANES is
> > > > > already being set when enabling DDI_A.
> > > > >
> > > As Zhang mentioned and as my commit message explains, my patch is
> > > needed
> > > when bios failed to drive edp (In my case it was an intermediate
> > > frequency supported panel which was set to 3.24 GHz and bios didn't
> > > have
> > > support for intermediate frequencies), it will not enable DDIA in
> > > which
> > > case, it will not set DDI_BUF_CTL and DDI Lane capability will
> > > remain 0
> > > (which is DDIA with 2 lanes and DDIE with 2 lanes).
> > > So, since the native resolution of that panel was high and couldn't
> > > work
> > > with 2 lanes.
> > > So, ideally we should not rely on bios to set the initial value and
> > > set
> > > it based upon whether DDI_E is used or not.
> > > So, my patch has some effect :)
> >
> > Rodrigo? Please figure out what the needed patch is, and send it.
> 
> I've just read Sonika's patch again to see if I could convince myself
> to stop being stubborn...
> 
> I realized that our patches are independent. I still believe we need
> this one here... We just need a reviewer.
> 
> But I'm really a stubborn and I'm not convinced we need the other
> patch. I still can't see how we would end up enabling DDI-A without
> setting the lanes. For me if we don't call intel_ddi_init(port_A) we
> don't need to set lanes or there is something else really wrong, and if
> we call it this bit will be *always* set already.
[Zhang, Xiong Y] From Sonika experience, "always" isn't true because bios fail in initialize eDP.
In a short, if DDI-E is present, we should clear DDI_A_4_LANES, your patch will do this.
If DDI-E isn't present, we should set DDI_A_4_LANES, Sonika's patch will do it, but your patch miss it.
If you think your and Sonika's patch are independent, you could resend your patch with modified commit message.

thanks
> 
> >
> > BR,
> > Jani.
> >
> >
> >
> > > > >
> > > > > >
> > > > > > thanks
> > > >
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> >
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-27  2:52                     ` Zhang, Xiong Y
@ 2015-08-27 14:31                       ` Timo Aaltonen
  2015-08-27 17:59                         ` Vivi, Rodrigo
  0 siblings, 1 reply; 52+ messages in thread
From: Timo Aaltonen @ 2015-08-27 14:31 UTC (permalink / raw)
  To: Zhang, Xiong Y, Vivi, Rodrigo; +Cc: intel-gfx

On 27.08.2015 05:52, Zhang, Xiong Y wrote:
>> On Wed, 2015-08-26 at 11:15 +0300, Jani Nikula wrote:
>>> On Thu, 13 Aug 2015, "Jindal, Sonika" <sonika.jindal@intel.com>
>>> wrote:
>>>> On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
>>>>>> On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
>>>>>>>> On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y wrote:
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Vivi, Rodrigo
>>>>>>>>>> Sent: Saturday, August 8, 2015 8:34 AM
>>>>>>>>>> To: intel-gfx@lists.freedesktop.org
>>>>>>>>>> Cc: Vivi, Rodrigo; Zhang, Xiong Y
>>>>>>>>>> Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A
>>>>>>>>>> shares 4
>>>>>>>>>> lanes.
>>>>>>>>>>
>>>>>>>>>> DDI-A and DDI-E shares the 4 lanes. So when DDI-E is
>>>>>>>>>> present we
>>>>>>>>>> need to configure lane count propperly for both.
>>>>>>>>>>
>>>>>>>>>> This was based on Sonika's
>>>>>>>>>> [PATCH] drm/i915/skl: Select DDIA lane capability based
>>>>>>>>>> upon vbt
>>>>>>>>>>
>>>>>>>>>> Credits-to: Sonika Jindal <sonika.jindal@intel.com>
>>>>>>>>>> Cc: Xiong Zhang <xiong.y.zhang@intel.com>
>>>>>>>>>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>>>>>>>> ---
>>>>>>>>>>   drivers/gpu/drm/i915/intel_ddi.c | 12 ++++++++++--
>>>>>>>>>> drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
>>>>>>>>>>   2 files changed, 15 insertions(+), 5 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>>>>> b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>>>>> index 110d546..557cecf 100644
>>>>>>>>>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>>>>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>>>>>>>>>> @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct
>>>>>>>>>> drm_device
>>>>>>>>>> *dev, enum port port)
>>>>>>>>>>   	struct intel_digital_port *intel_dig_port;
>>>>>>>>>>   	struct intel_encoder *intel_encoder;
>>>>>>>>>>   	struct drm_encoder *encoder;
>>>>>>>>>> -	bool init_hdmi, init_dp;
>>>>>>>>>> +	bool init_hdmi, init_dp, ddi_e_present;
>>>>>>>>>> +
>>>>>>>>>> +	/*
>>>>>>>>>> +	 * On SKL we don't have a way to detect DDI-E
>>>>>>>>>> so we
>>>>>>>>>> rely
>>>>>>>>>> on VBT.
>>>>>>>>>> +	 */
>>>>>>>>>> +	ddie_present = IS_SKYLAKE(dev) &&
>>>>>>>>>> +		(dev_priv
>>>>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dp
>>>>>>>>>>>>
>>>>>>>>>> +		 dev_priv
>>>>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_dvi
>>>>>>>>>>>>
>>>>>>>>>> +		 dev_priv
>>>>>>>>>> ->vbt.ddi_port_info[PORT_E].supports_hdmi);
>>>>>>>>> [Zhang, Xiong Y]  ddie_present should be ddi_e_present
>>>>>>>>>>
>>>>>>>>>>   	init_hdmi = (dev_priv
>>>>>>>>>> ->vbt.ddi_port_info[port].supports_dvi ||
>>>>>>>>>>   		     dev_priv
>>>>>>>>>> ->vbt.ddi_port_info[port].supports_hdmi);
>>>>>>>>>> @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct
>>>>>>>>>> drm_device
>>>>>>>>>> *dev, enum port port)
>>>>>>>>>>   	intel_dig_port->port = port;
>>>>>>>>>>   	intel_dig_port->saved_port_bits =
>>>>>>>>>> I915_READ(DDI_BUF_CTL(port)) &
>>>>>>>>>>
>>>>>>>>>>   (DDI_BUF_PORT_REVERSAL |
>>>>>>>>>> -
>>>>>>>>>>  DDI_A_4_LANES);
>>>>>>>>>> +
>>>>>>>>>>  ddi_e_present ? 0 :
>>>>>>>>>> DDI_A_4_LANES);
>>>>>>>>> [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 lanes
>>>>>>>>> when
>>>>>>>>> DDI-E doesn't exist, I think your patch will do nothing.
>>>>>>>>
>>>>>>>> Actually DDI_A_4_LANES is being already set
>>>>>>>> unconditionally, so
>>>>>>>> Sonika's patch has no effect.
>>>>>>> [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES under
>>>>>>> many
>>>>>>> conditions.
>>>>>>> +	if (IS_SKYLAKE(dev) && port == PORT_A
>>>>>>> +		&& !(val & DDI_BUF_CTL_ENABLE)
>>>>>>> +		&& !dev_priv->vbt.ddi_e_used)
>>>>>>> +		I915_WRITE(DDI_BUF_CTL(port), val |
>>>>>>> DDI_A_4_LANES)
>>>>>>>>
>>>>>>>> saved_port_bits goes to intel_dp->DP that goes to
>>>>>>>> DDI_BUF_CTL and
>>>>>>>> also it is used to calculate the number of lanes.
>>>>>>>>
>>>>>>>> With this patch we stop setting DDI_A_4_LANES when ddi_e is
>>>>>>>> present
>>>>>>>> so DDI-A keeps with 2 lanes and let other 2 lanes for DDI-E
>>>>>>> [Zhang, Xiong Y] Yes, this patch will clear DDI_A_4_LANES
>>>>>>> when ddi_e
>>>>>>> is present.
>>>>>>> But this patch won't set DDI_A_4_LANES under following
>>>>>>> conditions
>>>>>>> which is purpose for Sonika patch 1. Bios fail to driver eDP
>>>>>>> and
>>>>>>> doesn't enable DDI_A buffer
>>>>>>
>>>>>> If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
>>>>> [Zhang, Xiong Y] From commit message on Sonika patch, she want to
>>>>> set DDI_A_4_LANES on such case. Maybe she met such fail case on
>>>>> one high
>>>>> resolution eDP screen. Let's Sonikia explain it.
>>>>>>
>>>>>>> 2. Bios clear DDI_A_4_LANES
>>>>>>> 3. DDI_E isn't present
>>>>>>
>>>>>> I don't agree... This is already covered on current code.
>>>>>> DDI_A_4_LANES is
>>>>>> already being set when enabling DDI_A.
>>>>>>
>>>> As Zhang mentioned and as my commit message explains, my patch is
>>>> needed
>>>> when bios failed to drive edp (In my case it was an intermediate
>>>> frequency supported panel which was set to 3.24 GHz and bios didn't
>>>> have
>>>> support for intermediate frequencies), it will not enable DDIA in
>>>> which
>>>> case, it will not set DDI_BUF_CTL and DDI Lane capability will
>>>> remain 0
>>>> (which is DDIA with 2 lanes and DDIE with 2 lanes).
>>>> So, since the native resolution of that panel was high and couldn't
>>>> work
>>>> with 2 lanes.
>>>> So, ideally we should not rely on bios to set the initial value and
>>>> set
>>>> it based upon whether DDI_E is used or not.
>>>> So, my patch has some effect :)
>>>
>>> Rodrigo? Please figure out what the needed patch is, and send it.
>>
>> I've just read Sonika's patch again to see if I could convince myself
>> to stop being stubborn...
>>
>> I realized that our patches are independent. I still believe we need
>> this one here... We just need a reviewer.
>>
>> But I'm really a stubborn and I'm not convinced we need the other
>> patch. I still can't see how we would end up enabling DDI-A without
>> setting the lanes. For me if we don't call intel_ddi_init(port_A) we
>> don't need to set lanes or there is something else really wrong, and if
>> we call it this bit will be *always* set already.
> [Zhang, Xiong Y] From Sonika experience, "always" isn't true because bios fail in initialize eDP.
> In a short, if DDI-E is present, we should clear DDI_A_4_LANES, your patch will do this.
> If DDI-E isn't present, we should set DDI_A_4_LANES, Sonika's patch will do it, but your patch miss it.
> If you think your and Sonika's patch are independent, you could resend your patch with modified commit message.

If it helps with the debate, this patch caused a regression on an I+N
hybrid machine where the display remained black after booting up..


-- 
t
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes.
  2015-08-27 14:31                       ` Timo Aaltonen
@ 2015-08-27 17:59                         ` Vivi, Rodrigo
  0 siblings, 0 replies; 52+ messages in thread
From: Vivi, Rodrigo @ 2015-08-27 17:59 UTC (permalink / raw)
  To: tjaalton, Zhang, Xiong Y; +Cc: intel-gfx

On Thu, 2015-08-27 at 17:31 +0300, Timo Aaltonen wrote:
> On 27.08.2015 05:52, Zhang, Xiong Y wrote:
> > > On Wed, 2015-08-26 at 11:15 +0300, Jani Nikula wrote:
> > > > On Thu, 13 Aug 2015, "Jindal, Sonika" <sonika.jindal@intel.com>
> > > > wrote:
> > > > > On 8/13/2015 8:57 AM, Zhang, Xiong Y wrote:
> > > > > > > On Wed, 2015-08-12 at 02:20 +0000, Zhang, Xiong Y wrote:
> > > > > > > > > On Tue, 2015-08-11 at 07:05 +0000, Zhang, Xiong Y 
> > > > > > > > > wrote:
> > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > From: Vivi, Rodrigo
> > > > > > > > > > > Sent: Saturday, August 8, 2015 8:34 AM
> > > > > > > > > > > To: intel-gfx@lists.freedesktop.org
> > > > > > > > > > > Cc: Vivi, Rodrigo; Zhang, Xiong Y
> > > > > > > > > > > Subject: [PATCH 7/6] drm/i915/skl: DDI-E and DDI
> > > > > > > > > > > -A
> > > > > > > > > > > shares 4
> > > > > > > > > > > lanes.
> > > > > > > > > > > 
> > > > > > > > > > > DDI-A and DDI-E shares the 4 lanes. So when DDI-E 
> > > > > > > > > > > is
> > > > > > > > > > > present we
> > > > > > > > > > > need to configure lane count propperly for both.
> > > > > > > > > > > 
> > > > > > > > > > > This was based on Sonika's
> > > > > > > > > > > [PATCH] drm/i915/skl: Select DDIA lane capability 
> > > > > > > > > > > based
> > > > > > > > > > > upon vbt
> > > > > > > > > > > 
> > > > > > > > > > > Credits-to: Sonika Jindal <
> > > > > > > > > > > sonika.jindal@intel.com>
> > > > > > > > > > > Cc: Xiong Zhang <xiong.y.zhang@intel.com>
> > > > > > > > > > > Signed-off-by: Rodrigo Vivi <
> > > > > > > > > > > rodrigo.vivi@intel.com>
> > > > > > > > > > > ---
> > > > > > > > > > >   drivers/gpu/drm/i915/intel_ddi.c | 12 
> > > > > > > > > > > ++++++++++--
> > > > > > > > > > > drivers/gpu/drm/i915/intel_dp.c  |  8 +++++---
> > > > > > > > > > >   2 files changed, 15 insertions(+), 5 deletions(
> > > > > > > > > > > -)
> > > > > > > > > > > 
> > > > > > > > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > > > b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > > > index 110d546..557cecf 100644
> > > > > > > > > > > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > > > > > > > > > > @@ -3178,7 +3178,15 @@ void intel_ddi_init(struct
> > > > > > > > > > > drm_device
> > > > > > > > > > > *dev, enum port port)
> > > > > > > > > > >   	struct intel_digital_port 
> > > > > > > > > > > *intel_dig_port;
> > > > > > > > > > >   	struct intel_encoder *intel_encoder;
> > > > > > > > > > >   	struct drm_encoder *encoder;
> > > > > > > > > > > -	bool init_hdmi, init_dp;
> > > > > > > > > > > +	bool init_hdmi, init_dp, ddi_e_present;
> > > > > > > > > > > +
> > > > > > > > > > > +	/*
> > > > > > > > > > > +	 * On SKL we don't have a way to detect 
> > > > > > > > > > > DDI-E
> > > > > > > > > > > so we
> > > > > > > > > > > rely
> > > > > > > > > > > on VBT.
> > > > > > > > > > > +	 */
> > > > > > > > > > > +	ddie_present = IS_SKYLAKE(dev) &&
> > > > > > > > > > > +		(dev_priv
> > > > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dp
> > > > > > > > > > > > > 
> > > > > > > > > > > +		 dev_priv
> > > > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_dvi
> > > > > > > > > > > > > 
> > > > > > > > > > > +		 dev_priv
> > > > > > > > > > > ->vbt.ddi_port_info[PORT_E].supports_hdmi);
> > > > > > > > > > [Zhang, Xiong Y]  ddie_present should be 
> > > > > > > > > > ddi_e_present
> > > > > > > > > > > 
> > > > > > > > > > >   	init_hdmi = (dev_priv
> > > > > > > > > > > ->vbt.ddi_port_info[port].supports_dvi ||
> > > > > > > > > > >   		     dev_priv
> > > > > > > > > > > ->vbt.ddi_port_info[port].supports_hdmi);
> > > > > > > > > > > @@ -3210,7 +3218,7 @@ void intel_ddi_init(struct
> > > > > > > > > > > drm_device
> > > > > > > > > > > *dev, enum port port)
> > > > > > > > > > >   	intel_dig_port->port = port;
> > > > > > > > > > >   	intel_dig_port->saved_port_bits =
> > > > > > > > > > > I915_READ(DDI_BUF_CTL(port)) &
> > > > > > > > > > > 
> > > > > > > > > > >   (DDI_BUF_PORT_REVERSAL |
> > > > > > > > > > > -
> > > > > > > > > > >  DDI_A_4_LANES);
> > > > > > > > > > > +
> > > > > > > > > > >  ddi_e_present ? 0 :
> > > > > > > > > > > DDI_A_4_LANES);
> > > > > > > > > > [Zhang, Xiong Y] Sonika's patch will set DDI-A to 4 
> > > > > > > > > > lanes
> > > > > > > > > > when
> > > > > > > > > > DDI-E doesn't exist, I think your patch will do 
> > > > > > > > > > nothing.
> > > > > > > > > 
> > > > > > > > > Actually DDI_A_4_LANES is being already set
> > > > > > > > > unconditionally, so
> > > > > > > > > Sonika's patch has no effect.
> > > > > > > > [Zhang, Xiong Y] No. Sonika's patch set DDI_A_4_LANES 
> > > > > > > > under
> > > > > > > > many
> > > > > > > > conditions.
> > > > > > > > +	if (IS_SKYLAKE(dev) && port == PORT_A
> > > > > > > > +		&& !(val & DDI_BUF_CTL_ENABLE)
> > > > > > > > +		&& !dev_priv->vbt.ddi_e_used)
> > > > > > > > +		I915_WRITE(DDI_BUF_CTL(port), val |
> > > > > > > > DDI_A_4_LANES)
> > > > > > > > > 
> > > > > > > > > saved_port_bits goes to intel_dp->DP that goes to
> > > > > > > > > DDI_BUF_CTL and
> > > > > > > > > also it is used to calculate the number of lanes.
> > > > > > > > > 
> > > > > > > > > With this patch we stop setting DDI_A_4_LANES when 
> > > > > > > > > ddi_e is
> > > > > > > > > present
> > > > > > > > > so DDI-A keeps with 2 lanes and let other 2 lanes for 
> > > > > > > > > DDI-E
> > > > > > > > [Zhang, Xiong Y] Yes, this patch will clear 
> > > > > > > > DDI_A_4_LANES
> > > > > > > > when ddi_e
> > > > > > > > is present.
> > > > > > > > But this patch won't set DDI_A_4_LANES under following
> > > > > > > > conditions
> > > > > > > > which is purpose for Sonika patch 1. Bios fail to 
> > > > > > > > driver eDP
> > > > > > > > and
> > > > > > > > doesn't enable DDI_A buffer
> > > > > > > 
> > > > > > > If DDI_A isn't enabled we don't need to set DDI_A_4_LANES
> > > > > > [Zhang, Xiong Y] From commit message on Sonika patch, she 
> > > > > > want to
> > > > > > set DDI_A_4_LANES on such case. Maybe she met such fail 
> > > > > > case on
> > > > > > one high
> > > > > > resolution eDP screen. Let's Sonikia explain it.
> > > > > > > 
> > > > > > > > 2. Bios clear DDI_A_4_LANES
> > > > > > > > 3. DDI_E isn't present
> > > > > > > 
> > > > > > > I don't agree... This is already covered on current code.
> > > > > > > DDI_A_4_LANES is
> > > > > > > already being set when enabling DDI_A.
> > > > > > > 
> > > > > As Zhang mentioned and as my commit message explains, my 
> > > > > patch is
> > > > > needed
> > > > > when bios failed to drive edp (In my case it was an 
> > > > > intermediate
> > > > > frequency supported panel which was set to 3.24 GHz and bios 
> > > > > didn't
> > > > > have
> > > > > support for intermediate frequencies), it will not enable 
> > > > > DDIA in
> > > > > which
> > > > > case, it will not set DDI_BUF_CTL and DDI Lane capability 
> > > > > will
> > > > > remain 0
> > > > > (which is DDIA with 2 lanes and DDIE with 2 lanes).
> > > > > So, since the native resolution of that panel was high and 
> > > > > couldn't
> > > > > work
> > > > > with 2 lanes.
> > > > > So, ideally we should not rely on bios to set the initial 
> > > > > value and
> > > > > set
> > > > > it based upon whether DDI_E is used or not.
> > > > > So, my patch has some effect :)
> > > > 
> > > > Rodrigo? Please figure out what the needed patch is, and send 
> > > > it.
> > > 
> > > I've just read Sonika's patch again to see if I could convince 
> > > myself
> > > to stop being stubborn...
> > > 
> > > I realized that our patches are independent. I still believe we 
> > > need
> > > this one here... We just need a reviewer.
> > > 
> > > But I'm really a stubborn and I'm not convinced we need the other
> > > patch. I still can't see how we would end up enabling DDI-A 
> > > without
> > > setting the lanes. For me if we don't call intel_ddi_init(port_A) 
> > > we
> > > don't need to set lanes or there is something else really wrong, 
> > > and if
> > > we call it this bit will be *always* set already.
> > [Zhang, Xiong Y] From Sonika experience, "always" isn't true 
> > because bios fail in initialize eDP.
> > In a short, if DDI-E is present, we should clear DDI_A_4_LANES, 
> > your patch will do this.
> > If DDI-E isn't present, we should set DDI_A_4_LANES, Sonika's patch 
> > will do it, but your patch miss it.

so I believe what I still can't understand is why we need to set
DDI_A_4_LANES when not using DDI_A... 

> > If you think your and Sonika's patch are independent, you could 
> > resend your patch with modified commit message.
> 
> If it helps with the debate, this patch caused a regression on an I+N
> hybrid machine where the display remained black after booting up..

... but nevermind... Apparently my patch is wrong and causing trouble
more than helping...

Thanks Timo.

> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 4/6] drm/i915: eDP can be present on DDI-E
  2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
  2015-08-11  6:27   ` Zhang, Xiong Y
  2015-08-11  9:47   ` Daniel Vetter
@ 2015-08-31 15:47   ` Jani Nikula
  2 siblings, 0 replies; 52+ messages in thread
From: Jani Nikula @ 2015-08-31 15:47 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx; +Cc: rodrigo.vivi

On Thu, 06 Aug 2015, Xiong Zhang <xiong.y.zhang@intel.com> wrote:
> From: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> On Skylake we have eDP-to-VGA using DDI-E and another aux.
> So let's identify it properly.
>
> Also let's remove duplicated definitions to avoid later
> confusion.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Pushed to drm-intel-next-fixes with commit message rectified.

BR,
Jani.


> ---
>  drivers/gpu/drm/i915/intel_bios.h | 5 -----
>  drivers/gpu/drm/i915/intel_dp.c   | 9 +++++----
>  2 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 02255d8..a2ef0df 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -747,11 +747,6 @@ int intel_parse_bios(struct drm_device *dev);
>  #define		DVO_C		2
>  #define		DVO_D		3
>  
> -/* define the PORT for DP output type */
> -#define		PORT_IDPB	7
> -#define		PORT_IDPC	8
> -#define		PORT_IDPD	9
> -
>  /* Possible values for the "DVO Port" field for versions >= 155: */
>  #define DVO_PORT_HDMIA	0
>  #define DVO_PORT_HDMIB	1
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 7cd47bc..0643a91 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4978,16 +4978,17 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
>  	return -1;
>  }
>  
> -/* check the VBT to see whether the eDP is on DP-D port */
> +/* check the VBT to see whether the eDP is on another port */
>  bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	union child_device_config *p_child;
>  	int i;
>  	static const short port_mapping[] = {
> -		[PORT_B] = PORT_IDPB,
> -		[PORT_C] = PORT_IDPC,
> -		[PORT_D] = PORT_IDPD,
> +		[PORT_B] = DVO_PORT_DPB,
> +		[PORT_C] = DVO_PORT_DPC,
> +		[PORT_D] = DVO_PORT_DPD,
> +		[PORT_E] = DVO_PORT_DPE,
>  	};
>  
>  	if (port == PORT_A)
> -- 
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 6/6 v3] drm/i915: Enable HDMI on DDI-E
  2015-08-17  8:04             ` Xiong Zhang
@ 2015-08-31 15:47               ` Jani Nikula
  0 siblings, 0 replies; 52+ messages in thread
From: Jani Nikula @ 2015-08-31 15:47 UTC (permalink / raw)
  To: Xiong Zhang, intel-gfx

On Mon, 17 Aug 2015, Xiong Zhang <xiong.y.zhang@intel.com> wrote:
> DDI-E doesn't have the correspondent GMBUS pin.
>
> We rely on VBT to tell us which one it being used instead.
>
> The DVI/HDMI on shared port couldn't exist.
>
> This patch isn't tested without hardware wchich has HDMI
> on DDI-E.
>
> v2: fix trailing whitespace
> v3: MISSING_CASE take place of BUG()
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Pushed to drm-intel-next-fixes.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  5 +++++
>  drivers/gpu/drm/i915/intel_bios.c | 25 +++++++++++++++++++++----
>  drivers/gpu/drm/i915/intel_hdmi.c | 21 +++++++++++++++++++++
>  3 files changed, 47 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 35192d2..22e8bf0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1418,6 +1418,10 @@ enum modeset_restore {
>  #define DP_AUX_C 0x20
>  #define DP_AUX_D 0x30
>  
> +#define DDC_PIN_B  0x05
> +#define DDC_PIN_C  0x04
> +#define DDC_PIN_D  0x06
> +
>  struct ddi_vbt_port_info {
>  	/*
>  	 * This is an index in the HDMI/DVI DDI buffer translation table.
> @@ -1432,6 +1436,7 @@ struct ddi_vbt_port_info {
>  	uint8_t supports_dp:1;
>  
>  	uint8_t alternate_aux_channel;
> +	uint8_t alternate_ddc_pin;
>  
>  	uint8_t dp_boost_level;
>  	uint8_t hdmi_boost_level;
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 8e46149..a2ee347 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -905,7 +905,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	uint8_t hdmi_level_shift;
>  	int i, j;
>  	bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
> -	uint8_t aux_channel;
> +	uint8_t aux_channel, ddc_pin;
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> @@ -939,6 +939,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		return;
>  
>  	aux_channel = child->raw[25];
> +	ddc_pin = child->common.ddc_pin;
>  
>  	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
>  	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> @@ -970,11 +971,27 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  		DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
>  
>  	if (is_dvi) {
> -		if (child->common.ddc_pin == 0x05 && port != PORT_B)
> +		if (port == PORT_E) {
> +			info->alternate_ddc_pin = ddc_pin;
> +			/* if DDIE share ddc pin with other port, then
> +			 * dvi/hdmi couldn't exist on the shared port.
> +			 * Otherwise they share the same ddc bin and system
> +			 * couldn't communicate with them seperately. */
> +			if (ddc_pin == DDC_PIN_B) {
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
> +			} else if (ddc_pin == DDC_PIN_C) {
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
> +			} else if (ddc_pin == DDC_PIN_D) {
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
> +				dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
> +			}
> +		} else if (ddc_pin == DDC_PIN_B && port != PORT_B)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
> -		if (child->common.ddc_pin == 0x04 && port != PORT_C)
> +		else if (ddc_pin == DDC_PIN_C && port != PORT_C)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
> -		if (child->common.ddc_pin == 0x06 && port != PORT_D)
> +		else if (ddc_pin == DDC_PIN_D && port != PORT_D)
>  			DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 7185062..d1a7f7b 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1956,6 +1956,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  	struct drm_device *dev = intel_encoder->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	enum port port = intel_dig_port->port;
> +	uint8_t alternate_ddc_pin;
>  
>  	drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
>  			   DRM_MODE_CONNECTOR_HDMIA);
> @@ -1996,6 +1997,26 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
>  		intel_encoder->hpd_pin = HPD_PORT_D;
>  		break;
> +	case PORT_E:
> +		/* On SKL PORT E doesn't have seperate GMBUS pin
> +		 *  We rely on VBT to set a proper alternate GMBUS pin. */
> +		alternate_ddc_pin =
> +			dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin;
> +		switch (alternate_ddc_pin) {
> +		case DDC_PIN_B:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
> +			break;
> +		case DDC_PIN_C:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
> +			break;
> +		case DDC_PIN_D:
> +			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
> +			break;
> +		default:
> +			MISSING_CASE(alternate_ddc_pin);
> +		}
> +		intel_encoder->hpd_pin = HPD_PORT_E;
> +		break;
>  	case PORT_A:
>  		intel_encoder->hpd_pin = HPD_PORT_A;
>  		/* Internal port only for eDP. */
> -- 
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH 8/6] drm/i915/skl: Enable DDI-E
  2015-08-08  0:35   ` [PATCH 8/6] " Rodrigo Vivi
  2015-08-11  7:12     ` Zhang, Xiong Y
@ 2015-08-31 15:48     ` Jani Nikula
  1 sibling, 0 replies; 52+ messages in thread
From: Jani Nikula @ 2015-08-31 15:48 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

On Sat, 08 Aug 2015, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> There are OEMs using DDI-E out there,
> so let's enable it.
>
> Unfortunately there is no detection bit for DDI-E
> So we need to rely on VBT for that.
>
> I also need to give credits to Xiong since before seing
> his approach to check info->support_* I was creating an ugly
> vbt->ddie_sfuse_strap in order to propagate the ddi presence info
>
> v2: Rebased as last patch in the series. since all other patches
> in this series are needed for anything working propperly on DDI-E.
>
> Credits-to: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Cc: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Pushed to drm-intel-next-fixes.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/intel_bios.c    | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_bios.h    |  2 ++
>  drivers/gpu/drm/i915/intel_display.c |  9 +++++++++
>  3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index c417973..c5b5a59b 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -898,19 +898,19 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>  	/* Each DDI port can have more than one value on the "DVO Port" field,
>  	 * so look for all the possible values for each port and abort if more
>  	 * than one is found. */
> -	int dvo_ports[][2] = {
> -		{DVO_PORT_HDMIA, DVO_PORT_DPA},
> -		{DVO_PORT_HDMIB, DVO_PORT_DPB},
> -		{DVO_PORT_HDMIC, DVO_PORT_DPC},
> -		{DVO_PORT_HDMID, DVO_PORT_DPD},
> -		{DVO_PORT_CRT, -1 /* Port E can only be DVO_PORT_CRT */ },
> +	int dvo_ports[][3] = {
> +		{DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
> +		{DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
> +		{DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
> +		{DVO_PORT_HDMID, DVO_PORT_DPD, -1},
> +		{DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
>  	};
>  
>  	/* Find the child device to use, abort if more than one found. */
>  	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
>  		it = dev_priv->vbt.child_dev + i;
>  
> -		for (j = 0; j < 2; j++) {
> +		for (j = 0; j < 3; j++) {
>  			if (dvo_ports[port][j] == -1)
>  				break;
>  
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 77bf1dd..a2ef0df 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -759,6 +759,8 @@ int intel_parse_bios(struct drm_device *dev);
>  #define DVO_PORT_DPC	8
>  #define DVO_PORT_DPD	9
>  #define DVO_PORT_DPA	10
> +#define DVO_PORT_DPE	11
> +#define DVO_PORT_HDMIE	12
>  #define DVO_PORT_MIPIA	21
>  #define DVO_PORT_MIPIB	22
>  #define DVO_PORT_MIPIC	23
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index fcf1230..7bf6209 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13961,6 +13961,15 @@ static void intel_setup_outputs(struct drm_device *dev)
>  			intel_ddi_init(dev, PORT_C);
>  		if (found & SFUSE_STRAP_DDID_DETECTED)
>  			intel_ddi_init(dev, PORT_D);
> +		/*
> +		 * On SKL we don't have a way to detect DDI-E so we rely on VBT.
> +		 */
> +		if (IS_SKYLAKE(dev) &&
> +		    (dev_priv->vbt.ddi_port_info[PORT_E].supports_dp ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_dvi ||
> +		     dev_priv->vbt.ddi_port_info[PORT_E].supports_hdmi))
> +			intel_ddi_init(dev, PORT_E);
> +
>  	} else if (HAS_PCH_SPLIT(dev)) {
>  		int found;
>  		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
> -- 
> 2.4.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2015-08-31 15:48 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06  7:51 [PATCH 1/6] drm/i915/skl: Enable DDI-E Xiong Zhang
2015-08-06  7:51 ` [PATCH 2/6] drm/i915: Set power domain for DDI-E Xiong Zhang
2015-08-11  6:12   ` Zhang, Xiong Y
2015-08-06  7:51 ` [PATCH 3/6] drm/i915: Set alternate aux " Xiong Zhang
2015-08-08  0:01   ` [PATCH] " Rodrigo Vivi
2015-08-11  6:18     ` Zhang, Xiong Y
2015-08-13  8:40     ` shuang.he
2015-08-06  7:51 ` [PATCH 4/6] drm/i915: eDP can be present on DDI-E Xiong Zhang
2015-08-11  6:27   ` Zhang, Xiong Y
2015-08-11  9:47   ` Daniel Vetter
2015-08-11 10:09     ` Zhang, Xiong Y
2015-08-11 18:42     ` Vivi, Rodrigo
2015-08-12 10:27       ` Zhang, Xiong Y
2015-08-12 12:32         ` Daniel Vetter
2015-08-12 16:38           ` Vivi, Rodrigo
2015-08-31 15:47   ` Jani Nikula
2015-08-06  7:51 ` [PATCH 5/6] drm/i915/skl: enable DDIE hotplug Xiong Zhang
2015-08-08  0:06   ` Rodrigo Vivi
2015-08-10  6:53     ` [PATCH 5/6 v2] drm/i915/skl: enable DDI-E hotplug Xiong Zhang
2015-08-17  7:55       ` [PATCH 5/6 v3] " Xiong Zhang
2015-08-26  7:25         ` Jani Nikula
2015-08-06  7:51 ` [PATCH 6/6] drm/i915: Enable HDMI on DDI-E Xiong Zhang
2015-08-08  0:09   ` Rodrigo Vivi
2015-08-11  9:58   ` Daniel Vetter
2015-08-12 10:39     ` [PATCH 6/6 v3] " Xiong Zhang
2015-08-12 12:33       ` Daniel Vetter
2015-08-13  2:57         ` Zhang, Xiong Y
2015-08-14  8:42           ` Daniel Vetter
2015-08-14 10:38             ` Zhang, Xiong Y
2015-08-17  8:04             ` Xiong Zhang
2015-08-31 15:47               ` Jani Nikula
2015-08-12 14:19   ` [PATCH 6/6] " shuang.he
2015-08-06 13:30 ` [PATCH 1/6] drm/i915/skl: Enable DDI-E Daniel Vetter
2015-08-06 15:37   ` Vivi, Rodrigo
2015-08-08  0:35   ` [PATCH 8/6] " Rodrigo Vivi
2015-08-11  7:12     ` Zhang, Xiong Y
2015-08-31 15:48     ` Jani Nikula
2015-08-06 15:14 ` [PATCH 1/6] " Daniel Vetter
2015-08-06 15:50   ` Vivi, Rodrigo
2015-08-08  0:33   ` [PATCH 7/6] drm/i915/skl: DDI-E and DDI-A shares 4 lanes Rodrigo Vivi
2015-08-11  7:05     ` Zhang, Xiong Y
2015-08-11 18:38       ` Vivi, Rodrigo
2015-08-12  2:20         ` Zhang, Xiong Y
2015-08-12 16:51           ` Vivi, Rodrigo
2015-08-13  3:27             ` Zhang, Xiong Y
2015-08-13  5:48               ` Jindal, Sonika
2015-08-26  8:15                 ` Jani Nikula
2015-08-26 16:38                   ` Vivi, Rodrigo
2015-08-27  2:52                     ` Zhang, Xiong Y
2015-08-27 14:31                       ` Timo Aaltonen
2015-08-27 17:59                         ` Vivi, Rodrigo
2015-08-12 21:29       ` Timo Aaltonen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.