Skip to contentSkip to conversation

drm/i915: HDMI - Clear Audio Enable bit for Hot Plug unconditionally

PATCH Superseded Wang Xingchao 2 participants 4 messages Sep 13, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: HDMI - Clear Audio Enable bit for Hot Plug unconditionally

Clear Audio Enable bit to trigger unsolicated event to notify Audio Driver part the HDMI hot plug change. The patch fixed the bug when remove HDMI cable the bit was not cleared correctly.

In intel_enable_hdmi(), if intel_hdmi->has_audio been true, the "Audio enable bit" will be set to trigger unsolicated event to notify Alsa driver the change.

intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after remove the hdmi cable, here's debug log:

[  187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2
[  187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0

so when comes back to intel_disable_hdmi(), the "Audio enable bit" will not be cleared. And this cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.

This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:

[  187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1
[  187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
---
 drivers/gpu/drm/i915/intel_hdmi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -2
index 5d02aad..d39ed58 100644
@@ -676,8 +676,7 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
 	u32 temp;
 	u32 enable_bits = SDVO_ENABLE;
 
-	if (intel_hdmi->has_audio)
-		enable_bits |= SDVO_AUDIO_ENABLE;
+	enable_bits |= SDVO_AUDIO_ENABLE;
 
 	temp = I915_READ(intel_hdmi->sdvox_reg);
 
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Daniel,

I tested this patch with drm-intel-next branch under ubuntu 12.04, the HDMI hot plug could work correctly.

thanks
--xingchao

Quoted 43 lines · Wang Xingchao

Clear Audio Enable bit to trigger unsolicated event to notify Audio Driver part the HDMI hot plug change. The patch fixed the bug when remove HDMI cable the bit was not cleared correctly.

In intel_enable_hdmi(), if intel_hdmi->has_audio been true, the "Audio enable bit" will be set to trigger unsolicated event to notify Alsa driver the change.

intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after remove the hdmi cable, here's debug log:

[  187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2
[  187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0

so when comes back to intel_disable_hdmi(), the "Audio enable bit" will not be cleared. And this cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.

This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:

[  187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1
[  187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
---
 drivers/gpu/drm/i915/intel_hdmi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -2
index 5d02aad..d39ed58 100644
@@ -676,8 +676,7 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
 	u32 temp;
 	u32 enable_bits = SDVO_ENABLE;
 
-	if (intel_hdmi->has_audio)
-		enable_bits |= SDVO_AUDIO_ENABLE;
+	enable_bits |= SDVO_AUDIO_ENABLE;
 
 	temp = I915_READ(intel_hdmi->sdvox_reg);
 
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Wang Xingchao

drivers/gpu/drm/i915/intel_hdmi.c static void intel_disable_hdmi(struct intel_encoder *encoder) · line 679

Quoted 5 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -2
 	u32 enable_bits = SDVO_ENABLE;
 
-	if (intel_hdmi->has_audio)
-		enable_bits |= SDVO_AUDIO_ENABLE;
+	enable_bits |= SDVO_AUDIO_ENABLE;

The two lines can be combined:

  	u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;

Thanks,
Fengguang

#3 lore raw
Quoted 13 lines

-----Original Message-----
From: Wu, Fengguang
Sent: Thursday, September 13, 2012 11:14 AM
To: Wang, Xingchao
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Zhao, Yakui; Fu, Michael
Subject: Re: [PATCH] drm/i915: HDMI - Clear Audio Enable bit for Hot Plug unconditionally

Quoted 2 lines

u32 enable_bits = SDVO_ENABLE;

Quoted 7 lines

drivers/gpu/drm/i915/intel_hdmi.c static void intel_disable_hdmi(struct intel_encoder *encoder) · line 679

Quoted 3 lines
drivers/gpu/drm/i915/intel_hdmi.c +1 -2
-	if (intel_hdmi->has_audio)
-		enable_bits |= SDVO_AUDIO_ENABLE;
+	enable_bits |= SDVO_AUDIO_ENABLE;

The two lines can be combined:

  	u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;

Looks better, I send out V2 patch for Daniel.

-- Xingchao