linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] HDMI ELD fixes for 3.2
@ 2011-11-16 13:20 Wu Fengguang
  2011-11-16 13:20 ` [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge Wu Fengguang
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:20 UTC (permalink / raw)
  To: Keith Packard; +Cc: Takashi Iwai, dri-devel, intel-gfx, Wu Fengguang, LKML

Keith,

Here are 3 fixes on HDMI/ELD audio.

The third one adds a ->hot_remove hook to drm_connector_funcs. Please review.

[PATCH 1/3] drm/i915: fix ELD writing for SandyBridge
[PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD
[PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver

Thanks,
Fengguang


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

* [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge
  2011-11-16 13:20 [PATCH 0/3] HDMI ELD fixes for 3.2 Wu Fengguang
@ 2011-11-16 13:20 ` Wu Fengguang
  2011-11-16 13:20 ` [PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD Wu Fengguang
  2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
  2 siblings, 0 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:20 UTC (permalink / raw)
  To: Keith Packard; +Cc: Takashi Iwai, Wu Fengguang, dri-devel, intel-gfx, LKML

[-- Attachment #1: sandybridge-eld-fix --]
[-- Type: text/plain, Size: 1570 bytes --]

SandyBridge should be using the same register addresses as IvyBridge.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h      |    6 +++---
 drivers/gpu/drm/i915/intel_display.c |   10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

--- linux.orig/drivers/gpu/drm/i915/i915_reg.h	2011-11-09 13:17:19.000000000 +0800
+++ linux/drivers/gpu/drm/i915/i915_reg.h	2011-11-09 13:18:39.000000000 +0800
@@ -3543,8 +3543,8 @@
 #define GEN5_ELD_VALIDB			(1 << 0)
 #define GEN5_CP_READYB			(1 << 1)
 
-#define GEN7_HDMIW_HDMIEDID_A		0xE5050
-#define GEN7_AUD_CNTRL_ST_A		0xE50B4
-#define GEN7_AUD_CNTRL_ST2		0xE50C0
+#define GEN6_HDMIW_HDMIEDID_A		0xE5050
+#define GEN6_AUD_CNTL_ST_A		0xE50B4
+#define GEN6_AUD_CNTRL_ST2		0xE50C0
 
 #endif /* _I915_REG_H_ */
--- linux.orig/drivers/gpu/drm/i915/intel_display.c	2011-11-09 13:19:28.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_display.c	2011-11-09 13:20:02.000000000 +0800
@@ -5857,14 +5857,14 @@ static void ironlake_write_eld(struct dr
 	int aud_cntl_st;
 	int aud_cntrl_st2;
 
-	if (IS_IVYBRIDGE(connector->dev)) {
-		hdmiw_hdmiedid = GEN7_HDMIW_HDMIEDID_A;
-		aud_cntl_st = GEN7_AUD_CNTRL_ST_A;
-		aud_cntrl_st2 = GEN7_AUD_CNTRL_ST2;
-	} else {
+	if (IS_GEN5(connector->dev)) {
 		hdmiw_hdmiedid = GEN5_HDMIW_HDMIEDID_A;
 		aud_cntl_st = GEN5_AUD_CNTL_ST_A;
 		aud_cntrl_st2 = GEN5_AUD_CNTL_ST2;
+	} else {
+		hdmiw_hdmiedid = GEN6_HDMIW_HDMIEDID_A;
+		aud_cntl_st = GEN6_AUD_CNTL_ST_A;
+		aud_cntrl_st2 = GEN6_AUD_CNTRL_ST2;
 	}
 
 	i = to_intel_crtc(crtc)->pipe;



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

* [PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD
  2011-11-16 13:20 [PATCH 0/3] HDMI ELD fixes for 3.2 Wu Fengguang
  2011-11-16 13:20 ` [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge Wu Fengguang
@ 2011-11-16 13:20 ` Wu Fengguang
  2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
  2 siblings, 0 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:20 UTC (permalink / raw)
  To: Keith Packard; +Cc: Takashi Iwai, Wu Fengguang, dri-devel, intel-gfx, LKML

[-- Attachment #1: no-extra-eld-passing --]
[-- Type: text/plain, Size: 2614 bytes --]

The ELD may or may not change when switching the video mode.
If unchanged, don't trigger hot plug events to HDMI audio driver.

This avoids disturbing the user with repeated printks.

Reported-by: Nick Bowler <nbowler@elliptictech.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |   51 ++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 5 deletions(-)

--- linux.orig/drivers/gpu/drm/i915/intel_display.c	2011-11-10 17:23:04.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_display.c	2011-11-10 17:59:25.000000000 +0800
@@ -5811,6 +5811,35 @@ static int intel_crtc_mode_set(struct dr
 	return ret;
 }
 
+static bool intel_eld_uptodate(struct drm_connector *connector,
+			       int reg_eldv, uint32_t bits_eldv,
+			       int reg_elda, uint32_t bits_elda,
+			       int reg_edid)
+{
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	uint8_t *eld = connector->eld;
+	uint32_t i;
+
+	i = I915_READ(reg_eldv);
+	i &= bits_eldv;
+
+	if (!eld[0])
+		return !i;
+
+	if (!i)
+		return false;
+
+	i = I915_READ(reg_elda);
+	i &= ~bits_elda;
+	I915_WRITE(reg_elda, i);
+
+	for (i = 0; i < eld[2]; i++)
+		if (I915_READ(reg_edid) != *((uint32_t *)eld + i))
+			return false;
+
+	return true;
+}
+
 static void g4x_write_eld(struct drm_connector *connector,
 			  struct drm_crtc *crtc)
 {
@@ -5827,6 +5856,12 @@ static void g4x_write_eld(struct drm_con
 	else
 		eldv = G4X_ELDV_DEVCTG;
 
+	if (intel_eld_uptodate(connector,
+			       G4X_AUD_CNTL_ST, eldv,
+			       G4X_AUD_CNTL_ST, G4X_ELD_ADDR,
+			       G4X_HDMIW_HDMIEDID))
+		return;
+
 	i = I915_READ(G4X_AUD_CNTL_ST);
 	i &= ~(eldv | G4X_ELD_ADDR);
 	len = (i >> 9) & 0x1f;		/* ELD buffer size */
@@ -5886,6 +5921,17 @@ static void ironlake_write_eld(struct dr
 		eldv = GEN5_ELD_VALIDB << ((i - 1) * 4);
 	}
 
+	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+		DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
+		eld[5] |= (1 << 2);	/* Conn_Type, 0x1 = DisplayPort */
+	}
+
+	if (intel_eld_uptodate(connector,
+			       aud_cntrl_st2, eldv,
+			       aud_cntl_st, GEN5_ELD_ADDRESS,
+			       hdmiw_hdmiedid))
+		return;
+
 	i = I915_READ(aud_cntrl_st2);
 	i &= ~eldv;
 	I915_WRITE(aud_cntrl_st2, i);
@@ -5893,11 +5939,6 @@ static void ironlake_write_eld(struct dr
 	if (!eld[0])
 		return;
 
-	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
-		DRM_DEBUG_DRIVER("ELD: DisplayPort detected\n");
-		eld[5] |= (1 << 2);	/* Conn_Type, 0x1 = DisplayPort */
-	}
-
 	i = I915_READ(aud_cntl_st);
 	i &= ~GEN5_ELD_ADDRESS;
 	I915_WRITE(aud_cntl_st, i);



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

* [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-16 13:20 [PATCH 0/3] HDMI ELD fixes for 3.2 Wu Fengguang
  2011-11-16 13:20 ` [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge Wu Fengguang
  2011-11-16 13:20 ` [PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD Wu Fengguang
@ 2011-11-16 13:20 ` Wu Fengguang
  2011-11-16 13:35   ` Wu Fengguang
  2011-11-16 13:37   ` [PATCH 3/3 v2] " Wu Fengguang
  2 siblings, 2 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:20 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang Zhenyu, Wu Fengguang, dri-devel, intel-gfx,
	LKML

[-- Attachment #1: eld-hot-removal --]
[-- Type: text/plain, Size: 4724 bytes --]

On monitor hot removal:

1) clear SDVO_AUDIO_ENABLE or DP_AUDIO_OUTPUT_ENABLE
2) clear ELD Valid bit

So that the audio driver will receive hot plug events and take action to
refresh its device state and ELD contents.

cc: Wang Zhenyu <zhenyu.z.wang@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c |    4 ++++
 drivers/gpu/drm/i915/intel_dp.c   |   17 +++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h  |    4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c |   17 +++++++++++++++++
 include/drm/drm_crtc.h            |    1 +
 5 files changed, 43 insertions(+)

--- linux.orig/drivers/gpu/drm/i915/intel_dp.c	2011-11-16 20:54:28.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_dp.c	2011-11-16 21:19:42.000000000 +0800
@@ -1984,6 +1984,22 @@ intel_dp_detect(struct drm_connector *co
 	return connector_status_connected;
 }
 
+static void intel_dp_hot_remove(struct drm_connector *connector)
+{
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
+	struct drm_device *dev = intel_dp->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc = intel_dp->base.base.crtc;
+
+	intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
+	I915_WRITE(intel_dp->output_reg, intel_dp->DP);
+	POSTING_READ(intel_dp->output_reg);
+
+	connector->eld[0] = 0;
+	if (dev_priv->display.write_eld)
+		dev_priv->display.write_eld(connector, crtc);
+}
+
 static int intel_dp_get_modes(struct drm_connector *connector)
 {
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
@@ -2143,6 +2159,7 @@ static const struct drm_connector_funcs 
 	.detect = intel_dp_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_set_property,
+	.hot_remove = intel_dp_hot_remove,
 	.destroy = intel_dp_destroy,
 };
 
--- linux.orig/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 20:54:27.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 21:19:42.000000000 +0800
@@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
 extern void intel_init_clock_gating(struct drm_device *dev);
 extern void intel_write_eld(struct drm_encoder *encoder,
 			    struct drm_display_mode *mode);
+extern void intel_hotplug_status(struct drm_device *dev,
+			  struct drm_connector *connector,
+			  struct drm_crtc *crtc,
+			  enum drm_connector_status status);
 extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
 
 #endif /* __INTEL_DRV_H__ */
--- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c	2011-11-16 20:55:13.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_hdmi.c	2011-11-16 21:19:42.000000000 +0800
@@ -350,6 +350,22 @@ intel_hdmi_detect(struct drm_connector *
 	return status;
 }
 
+static void intel_hdmi_hot_remove(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	u32 temp;
+
+	temp = I915_READ(intel_hdmi->sdvox_reg);
+	I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_AUDIO_ENABLE);
+	POSTING_READ(intel_hdmi->sdvox_reg);
+
+	connector->eld[0] = 0;
+	if (dev_priv->display.write_eld)
+		dev_priv->display.write_eld(connector,
+					    intel_hdmi->base.base.crtc);
+}
+
 static int intel_hdmi_get_modes(struct drm_connector *connector)
 {
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
@@ -459,6 +475,7 @@ static const struct drm_connector_funcs 
 	.detect = intel_hdmi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_hdmi_set_property,
+	.hot_remove = intel_hdmi_hot_remove,
 	.destroy = intel_hdmi_destroy,
 };
 
--- linux.orig/drivers/gpu/drm/drm_crtc_helper.c	2011-11-16 20:55:13.000000000 +0800
+++ linux/drivers/gpu/drm/drm_crtc_helper.c	2011-11-16 21:19:42.000000000 +0800
@@ -905,6 +905,10 @@ static void output_poll_execute(struct w
 			      old_status, connector->status);
 		if (old_status != connector->status)
 			changed = true;
+		if (old_status == connector_status_connected &&
+		    connector->status == connector_status_disconnected)
+			connector->funcs->hot_remove(connector);
+
 	}
 
 	mutex_unlock(&dev->mode_config.mutex);
--- linux.orig/include/drm/drm_crtc.h	2011-11-16 20:54:28.000000000 +0800
+++ linux/include/drm/drm_crtc.h	2011-11-16 21:19:42.000000000 +0800
@@ -419,6 +419,7 @@ struct drm_connector_funcs {
 	int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
 	int (*set_property)(struct drm_connector *connector, struct drm_property *property,
 			     uint64_t val);
+	void (*hot_remove)(struct drm_connector *connector);
 	void (*destroy)(struct drm_connector *connector);
 	void (*force)(struct drm_connector *connector);
 };



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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
@ 2011-11-16 13:35   ` Wu Fengguang
  2011-11-18  9:37     ` Wu Fengguang
  2011-11-16 13:37   ` [PATCH 3/3 v2] " Wu Fengguang
  1 sibling, 1 reply; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:35 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

Sorry forgot to remove this left over chunk...

Note that I've not yet got the hardware to test the DisplayPort part
of this patch, but should be able to do so this week.

> --- linux.orig/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 20:54:27.000000000 +0800
> +++ linux/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 21:19:42.000000000 +0800
> @@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
>  extern void intel_init_clock_gating(struct drm_device *dev);
>  extern void intel_write_eld(struct drm_encoder *encoder,
>  			    struct drm_display_mode *mode);
> +extern void intel_hotplug_status(struct drm_device *dev,
> +			  struct drm_connector *connector,
> +			  struct drm_crtc *crtc,
> +			  enum drm_connector_status status);
>  extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
>  
>  #endif /* __INTEL_DRV_H__ */

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

* [PATCH 3/3 v2] drm/i915: hot removal notification to HDMI audio driver
  2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
  2011-11-16 13:35   ` Wu Fengguang
@ 2011-11-16 13:37   ` Wu Fengguang
  1 sibling, 0 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-16 13:37 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

On monitor hot removal:

1) clear SDVO_AUDIO_ENABLE or DP_AUDIO_OUTPUT_ENABLE
2) clear ELD Valid bit

So that the audio driver will receive hot plug events and take action to
refresh its device state and ELD contents.

cc: Wang Zhenyu <zhenyu.z.wang@intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 drivers/gpu/drm/drm_crtc_helper.c |    4 ++++
 drivers/gpu/drm/i915/intel_dp.c   |   17 +++++++++++++++++
 drivers/gpu/drm/i915/intel_hdmi.c |   17 +++++++++++++++++
 include/drm/drm_crtc.h            |    1 +
 4 files changed, 39 insertions(+)

--- linux.orig/drivers/gpu/drm/i915/intel_dp.c	2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_dp.c	2011-11-16 21:37:00.000000000 +0800
@@ -1984,6 +1984,22 @@ intel_dp_detect(struct drm_connector *co
 	return connector_status_connected;
 }
 
+static void intel_dp_hot_remove(struct drm_connector *connector)
+{
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
+	struct drm_device *dev = intel_dp->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc = intel_dp->base.base.crtc;
+
+	intel_dp->DP &= ~DP_AUDIO_OUTPUT_ENABLE;
+	I915_WRITE(intel_dp->output_reg, intel_dp->DP);
+	POSTING_READ(intel_dp->output_reg);
+
+	connector->eld[0] = 0;
+	if (dev_priv->display.write_eld)
+		dev_priv->display.write_eld(connector, crtc);
+}
+
 static int intel_dp_get_modes(struct drm_connector *connector)
 {
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
@@ -2143,6 +2159,7 @@ static const struct drm_connector_funcs 
 	.detect = intel_dp_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_dp_set_property,
+	.hot_remove = intel_dp_hot_remove,
 	.destroy = intel_dp_destroy,
 };
 
--- linux.orig/drivers/gpu/drm/i915/intel_hdmi.c	2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/i915/intel_hdmi.c	2011-11-16 21:37:00.000000000 +0800
@@ -350,6 +350,22 @@ intel_hdmi_detect(struct drm_connector *
 	return status;
 }
 
+static void intel_hdmi_hot_remove(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct drm_i915_private *dev_priv = connector->dev->dev_private;
+	u32 temp;
+
+	temp = I915_READ(intel_hdmi->sdvox_reg);
+	I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_AUDIO_ENABLE);
+	POSTING_READ(intel_hdmi->sdvox_reg);
+
+	connector->eld[0] = 0;
+	if (dev_priv->display.write_eld)
+		dev_priv->display.write_eld(connector,
+					    intel_hdmi->base.base.crtc);
+}
+
 static int intel_hdmi_get_modes(struct drm_connector *connector)
 {
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
@@ -459,6 +475,7 @@ static const struct drm_connector_funcs 
 	.detect = intel_hdmi_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.set_property = intel_hdmi_set_property,
+	.hot_remove = intel_hdmi_hot_remove,
 	.destroy = intel_hdmi_destroy,
 };
 
--- linux.orig/drivers/gpu/drm/drm_crtc_helper.c	2011-11-16 21:36:58.000000000 +0800
+++ linux/drivers/gpu/drm/drm_crtc_helper.c	2011-11-16 21:37:00.000000000 +0800
@@ -905,6 +905,10 @@ static void output_poll_execute(struct w
 			      old_status, connector->status);
 		if (old_status != connector->status)
 			changed = true;
+		if (old_status == connector_status_connected &&
+		    connector->status == connector_status_disconnected)
+			connector->funcs->hot_remove(connector);
+
 	}
 
 	mutex_unlock(&dev->mode_config.mutex);
--- linux.orig/include/drm/drm_crtc.h	2011-11-16 21:36:58.000000000 +0800
+++ linux/include/drm/drm_crtc.h	2011-11-16 21:37:00.000000000 +0800
@@ -419,6 +419,7 @@ struct drm_connector_funcs {
 	int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
 	int (*set_property)(struct drm_connector *connector, struct drm_property *property,
 			     uint64_t val);
+	void (*hot_remove)(struct drm_connector *connector);
 	void (*destroy)(struct drm_connector *connector);
 	void (*force)(struct drm_connector *connector);
 };

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-16 13:35   ` Wu Fengguang
@ 2011-11-18  9:37     ` Wu Fengguang
  2011-11-18 17:46       ` Keith Packard
  0 siblings, 1 reply; 13+ messages in thread
From: Wu Fengguang @ 2011-11-18  9:37 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

Update: Just tested DP and its working!

However, it's found that hot plug under X won't work...

The previous hot plug tests are done in KMS console which are all
fine: on re-inserting the monitor, ->mode_set will be called and
HDMI/DP audio will be re-enabled and ELD be transfered.

However when in X, ->mode_set won't be called at all.  Only
->get_modes and ->detect are called...

Thanks,
Fengguang

On Wed, Nov 16, 2011 at 09:35:48PM +0800, Wu Fengguang wrote:
> Sorry forgot to remove this left over chunk...
> 
> Note that I've not yet got the hardware to test the DisplayPort part
> of this patch, but should be able to do so this week.
> 
> > --- linux.orig/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 20:54:27.000000000 +0800
> > +++ linux/drivers/gpu/drm/i915/intel_drv.h	2011-11-16 21:19:42.000000000 +0800
> > @@ -382,6 +382,10 @@ extern void intel_fb_restore_mode(struct
> >  extern void intel_init_clock_gating(struct drm_device *dev);
> >  extern void intel_write_eld(struct drm_encoder *encoder,
> >  			    struct drm_display_mode *mode);
> > +extern void intel_hotplug_status(struct drm_device *dev,
> > +			  struct drm_connector *connector,
> > +			  struct drm_crtc *crtc,
> > +			  enum drm_connector_status status);
> >  extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
> >  
> >  #endif /* __INTEL_DRV_H__ */

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-18  9:37     ` Wu Fengguang
@ 2011-11-18 17:46       ` Keith Packard
  2011-11-19  2:10         ` Wu Fengguang
  2011-11-21  1:58         ` Wu Fengguang
  0 siblings, 2 replies; 13+ messages in thread
From: Keith Packard @ 2011-11-18 17:46 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

On Fri, 18 Nov 2011 17:37:40 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:

> However when in X, ->mode_set won't be called at all.  Only
> ->get_modes and ->detect are called...

The desktop software will call mode_set when it configures the
monitor. Otherwise, it's not being used (and so shouldn't have audio
routed to it by default).

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-18 17:46       ` Keith Packard
@ 2011-11-19  2:10         ` Wu Fengguang
  2011-11-21  1:58         ` Wu Fengguang
  1 sibling, 0 replies; 13+ messages in thread
From: Wu Fengguang @ 2011-11-19  2:10 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

On Sat, Nov 19, 2011 at 01:46:44AM +0800, Keith Packard wrote:
> On Fri, 18 Nov 2011 17:37:40 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> 
> > However when in X, ->mode_set won't be called at all.  Only
> > ->get_modes and ->detect are called...
> 
> The desktop software will call mode_set when it configures the
> monitor. Otherwise, it's not being used (and so shouldn't have audio
> routed to it by default).

Thanks for the info! I'll (borrow some monitor and) double check next week.

Anyway, the first two patches are good and may be taken first.

Thanks,
Fengguang

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-18 17:46       ` Keith Packard
  2011-11-19  2:10         ` Wu Fengguang
@ 2011-11-21  1:58         ` Wu Fengguang
  2011-11-21  8:47           ` Takashi Iwai
  1 sibling, 1 reply; 13+ messages in thread
From: Wu Fengguang @ 2011-11-21  1:58 UTC (permalink / raw)
  To: Keith Packard
  Cc: Takashi Iwai, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

On Sat, Nov 19, 2011 at 01:46:44AM +0800, Keith Packard wrote:
> On Fri, 18 Nov 2011 17:37:40 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> 
> > However when in X, ->mode_set won't be called at all.  Only
> > ->get_modes and ->detect are called...
> 
> The desktop software will call mode_set when it configures the
> monitor. Otherwise, it's not being used (and so shouldn't have audio
> routed to it by default).

Keith, I experimented playing HDMI audio in X, and during the time
unplug and plug the monitor. The HDMI audio/graphics all continue to
work when plugged in the monitor again. Here is the dmesg showed for
the plug event, no ->mode_set is called at all...

[ 1296.469103] [drm:drm_mode_getconnector], [CONNECTOR:5:?]
[ 1296.475442] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:5:VGA-1]
[ 1296.483649] [drm:intel_ironlake_crt_detect_hotplug], ironlake hotplug adpa=0x83f40000, result 1
[ 1296.493417] [drm:intel_crt_detect], CRT detected via hotplug
[ 1296.562579] [drm:drm_edid_to_eld], ELD: no CEA Extension found
[ 1296.564700] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:5:VGA-1] probed modes :
[ 1296.567609] [drm:drm_mode_debug_printmodeline], Modeline 24:"1024x768" 60 65000 1024 1048 1184 1344 768 771 777 806 0x48 0xa
[ 1296.572112] [drm:drm_mode_debug_printmodeline], Modeline 23:"1024x768" 75 78800 1024 1040 1136 1312 768 769 772 800 0x40 0x5
[ 1296.576561] [drm:drm_mode_debug_printmodeline], Modeline 25:"800x600" 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[ 1296.579109] [drm:drm_mode_debug_printmodeline], Modeline 19:"800x600" 60 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[ 1296.581403] [drm:drm_mode_debug_printmodeline], Modeline 20:"640x480" 75 31500 640 656 720 840 480 481 484 500 0x40 0xa
[ 1296.584027] [drm:drm_mode_debug_printmodeline], Modeline 21:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[ 1296.587294] [drm:drm_mode_debug_printmodeline], Modeline 22:"720x400" 70 28320 720 738 846 900 400 412 414 449 0x40 0x6
[ 1296.589849] [drm:drm_mode_getconnector], [CONNECTOR:5:?]
[ 1296.593635] [drm:drm_mode_getconnector], [CONNECTOR:8:?]
[ 1296.595157] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:8:HDMI-A-1]
[ 1296.608219] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:8:HDMI-A-1] disconnected
[ 1296.610732] [drm:drm_mode_getconnector], [CONNECTOR:8:?]
[ 1296.611939] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:8:HDMI-A-1]
[ 1296.624882] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:8:HDMI-A-1] disconnected
[ 1296.627445] [drm:drm_mode_getconnector], [CONNECTOR:12:?]
[ 1296.628814] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:12:HDMI-A-2]
[ 1296.750591] [drm:drm_detect_monitor_audio], Monitor has basic audio support
[ 1296.873062] [drm:drm_edid_to_eld], ELD monitor SONY TV
[ 1296.874819] HDMI: DVI dual 0, max TMDS clock 5, latency present 0 0, video latency 0 81, audio latency 114 208
[ 1296.877018] [drm:drm_edid_to_eld], ELD size 8, SAD count 1
[ 1296.878468] [drm:drm_mode_debug_printmodeline], Modeline 45:"1920x1080i" 0 74250 1920 2448 2492 2640 1080 1084 1094 1125 0x40 0x15
[ 1296.880862] [drm:drm_mode_prune_invalid], Not using 1920x1080i mode 7
[ 1296.882454] [drm:drm_mode_debug_printmodeline], Modeline 44:"1920x1080i" 0 74250 1920 2008 2052 2200 1080 1084 1094 1125 0x40 0x15
[ 1296.885996] [drm:drm_mode_prune_invalid], Not using 1920x1080i mode 7
[ 1296.887573] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:12:HDMI-A-2] probed modes :
[ 1296.889507] [drm:drm_mode_debug_printmodeline], Modeline 37:"1920x1080" 50 148500 1920 2448 2492 2640 1080 1084 1089 1125 0x48 0x5
[ 1296.892084] [drm:drm_mode_debug_printmodeline], Modeline 43:"1280x720" 50 74250 1280 1720 1760 1980 720 725 730 750 0x40 0x5
[ 1296.894657] [drm:drm_mode_debug_printmodeline], Modeline 41:"1280x720" 60 74250 1280 1390 1430 1650 720 725 730 750 0x40 0x5
[ 1296.897053] [drm:drm_mode_debug_printmodeline], Modeline 32:"720x576" 50 27000 720 732 796 864 576 581 586 625 0x40 0xa
[ 1296.899603] [drm:drm_mode_debug_printmodeline], Modeline 29:"720x480" 60 27000 720 736 798 858 480 489 495 525 0x40 0xa
[ 1296.901979] [drm:drm_mode_getconnector], [CONNECTOR:12:?]
[ 1296.906084] [drm:drm_mode_getconnector], [CONNECTOR:13:?]
[ 1296.907545] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1]
[ 1296.909659] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.913429] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.917418] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.920908] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1296.922663] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1] disconnected
[ 1296.924543] [drm:drm_mode_getconnector], [CONNECTOR:13:?]
[ 1296.925793] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1]
[ 1296.927920] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.931393] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.935459] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.939854] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1296.942038] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:13:DP-1] disconnected
[ 1296.944160] [drm:drm_mode_getconnector], [CONNECTOR:15:?]
[ 1296.946124] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:15:DP-2]
[ 1296.948244] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.952332] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.956331] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.959803] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1296.961384] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:15:DP-2] disconnected
[ 1296.963332] [drm:drm_mode_getconnector], [CONNECTOR:15:?]
[ 1296.965527] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:15:DP-2]
[ 1296.968584] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.972279] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.976273] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1296.980756] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1296.982903] [drm:drm_helper_probe_single_connector_modes], [CONNECTOR:15:DP-2] disconnected
[ 1306.496011] [drm:intel_ironlake_crt_detect_hotplug], ironlake hotplug adpa=0x83f40000, result 1
[ 1306.506271] [drm:intel_crt_detect], CRT detected via hotplug
[ 1306.512689] [drm:output_poll_execute], [CONNECTOR:5:VGA-1] status updated from 1 to 1
[ 1306.533016] [drm:output_poll_execute], [CONNECTOR:8:HDMI-A-1] status updated from 2 to 2
[ 1306.663751] [drm:drm_detect_monitor_audio], Monitor has basic audio support
[ 1306.666181] [drm:output_poll_execute], [CONNECTOR:12:HDMI-A-2] status updated from 1 to 1
[ 1306.669486] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.673966] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.677959] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.681436] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1306.682760] [drm:output_poll_execute], [CONNECTOR:13:DP-1] status updated from 2 to 2
[ 1306.684946] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.688926] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.692914] [drm:intel_dp_aux_ch], dp_aux_ch timeout status 0x5145003e
[ 1306.696399] [drm:intel_dp_detect], DPCD: 0000000000000000
[ 1306.698091] [drm:output_poll_execute], [CONNECTOR:15:DP-2] status updated from 2 to 2

Thanks,
Fengguang

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-21  1:58         ` Wu Fengguang
@ 2011-11-21  8:47           ` Takashi Iwai
  2011-11-21 11:05             ` Wu Fengguang
  0 siblings, 1 reply; 13+ messages in thread
From: Takashi Iwai @ 2011-11-21  8:47 UTC (permalink / raw)
  To: Wu Fengguang
  Cc: Keith Packard, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

At Mon, 21 Nov 2011 09:58:09 +0800,
Wu Fengguang wrote:
> 
> On Sat, Nov 19, 2011 at 01:46:44AM +0800, Keith Packard wrote:
> > On Fri, 18 Nov 2011 17:37:40 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> > 
> > > However when in X, ->mode_set won't be called at all.  Only
> > > ->get_modes and ->detect are called...
> > 
> > The desktop software will call mode_set when it configures the
> > monitor. Otherwise, it's not being used (and so shouldn't have audio
> > routed to it by default).
> 
> Keith, I experimented playing HDMI audio in X, and during the time
> unplug and plug the monitor. The HDMI audio/graphics all continue to
> work when plugged in the monitor again. Here is the dmesg showed for
> the plug event, no ->mode_set is called at all...

Which desktop system are you using?  At hotplug/unplugging, the kernel
drm issues a udev event, X Intel driver receives it and updates
Xrandr.  Then it's supposed that a daemon like gnome-settings-daemon
receives Xrandr notification and changes the modes appropriately.
Without such a background task, there will be no mode change.


Takashi

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-21  8:47           ` Takashi Iwai
@ 2011-11-21 11:05             ` Wu Fengguang
  2011-11-21 16:56               ` Keith Packard
  0 siblings, 1 reply; 13+ messages in thread
From: Wu Fengguang @ 2011-11-21 11:05 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Keith Packard, Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

On Mon, Nov 21, 2011 at 04:47:38PM +0800, Takashi Iwai wrote:
> At Mon, 21 Nov 2011 09:58:09 +0800,
> Wu Fengguang wrote:
> > 
> > On Sat, Nov 19, 2011 at 01:46:44AM +0800, Keith Packard wrote:
> > > On Fri, 18 Nov 2011 17:37:40 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:
> > > 
> > > > However when in X, ->mode_set won't be called at all.  Only
> > > > ->get_modes and ->detect are called...
> > > 
> > > The desktop software will call mode_set when it configures the
> > > monitor. Otherwise, it's not being used (and so shouldn't have audio
> > > routed to it by default).
> > 
> > Keith, I experimented playing HDMI audio in X, and during the time
> > unplug and plug the monitor. The HDMI audio/graphics all continue to
> > work when plugged in the monitor again. Here is the dmesg showed for
> > the plug event, no ->mode_set is called at all...
> 
> Which desktop system are you using?  At hotplug/unplugging, the kernel
> drm issues a udev event, X Intel driver receives it and updates
> Xrandr.  Then it's supposed that a daemon like gnome-settings-daemon
> receives Xrandr notification and changes the modes appropriately.
> Without such a background task, there will be no mode change.

Ah I got it. I'm running debian+fluxbox w/o those fancy features...

Thanks,
Fengguang

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

* Re: [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver
  2011-11-21 11:05             ` Wu Fengguang
@ 2011-11-21 16:56               ` Keith Packard
  0 siblings, 0 replies; 13+ messages in thread
From: Keith Packard @ 2011-11-21 16:56 UTC (permalink / raw)
  To: Wu Fengguang, Takashi Iwai
  Cc: Wang, Zhenyu Z, dri-devel@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, LKML

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

On Mon, 21 Nov 2011 19:05:38 +0800, Wu Fengguang <fengguang.wu@intel.com> wrote:

> Ah I got it. I'm running debian+fluxbox w/o those fancy features...

Then you can manually run the 'xrandr' command to configure the new
monitor as desired, at which point the kernel mode_set function will be
called.

-- 
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

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

end of thread, other threads:[~2011-11-21 16:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-16 13:20 [PATCH 0/3] HDMI ELD fixes for 3.2 Wu Fengguang
2011-11-16 13:20 ` [PATCH 1/3] drm/i915: fix ELD writing for SandyBridge Wu Fengguang
2011-11-16 13:20 ` [PATCH 2/3] drm/i915: dont trigger hotplug events on unchanged ELD Wu Fengguang
2011-11-16 13:20 ` [PATCH 3/3] drm/i915: hot removal notification to HDMI audio driver Wu Fengguang
2011-11-16 13:35   ` Wu Fengguang
2011-11-18  9:37     ` Wu Fengguang
2011-11-18 17:46       ` Keith Packard
2011-11-19  2:10         ` Wu Fengguang
2011-11-21  1:58         ` Wu Fengguang
2011-11-21  8:47           ` Takashi Iwai
2011-11-21 11:05             ` Wu Fengguang
2011-11-21 16:56               ` Keith Packard
2011-11-16 13:37   ` [PATCH 3/3 v2] " Wu Fengguang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).