Skip to contentSkip to conversation

enable HDMI audio output for HDMI monitors V2

PATCH In review Wu Fengguang 3 participants 7 messages Nov 7, 2008 – Nov 13, 2008 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover enable HDMI audio output for HDMI monitors V2

Hello,

We can now enjoy music on HDMI monitors that are attached to Intel G35/G45 chipsets with the following X.org intel driver patches

[PATCH 1/3] introduce i830_hdmi_priv.has_hdmi_sink [PATCH 2/3] enable Intel G45 integrated HDMI audio output [PATCH 3/3] enable Intel G35 SDVO HDMI audio output

_and_ the corresponding ALSA patch posted at
http://mailman.alsa-project.org/pipermail/alsa-devel/2008-November/012158.html

The patches are tested OK on Intel DG45ID board, HP 2230s notebook and ASUS P5E-VM board.

Since the HDMI audio requires both audio and video driver support to function well, I'd like to provide an overview here.

1) driver components:
A) ALSA: audio driver (the above link)
B) Xorg: audio output enabling (this patchset)
C) Xorg: EDID/ELD information (patches to be submitted by Ma Ling)

2) summary of the feature sets:
- basic 2-channel audio:
(A) is required, (B) is mostly required, (C) is not needed
- 2+ multichannel audio:
not tested yet; in theory we need (C) to get HDMI monitor's speaker allocation configuration; there are also bandwidth constraints that should be coordinated between audio/video drivers in the future.
- non-LPCM audio:
not tested yet; need more work in ALSA code.

3) summary of the work flow:
- basic audio output: (A) and (B)
- ALSA HDMI driver: enable pin out and unmute
- ALSA HDMI driver: fill audio infoframe and enable its transmission
- Xorg intel driver: enable audio output
- ELD info for advanced audio capabilities: (A) and (C)
- Xorg xserver: get/parse/store EDID extensions
- Xorg xserver: transform EDID into ELD
- Xorg intel driver: feed ELD to hardware
- Xorg intel driver: set ELD-Valid flag to inform audio driver of new ELD
- ALSA HDMI driver: response to unsolicited response triggered by ELDV
- ALSA HDMI driver: get ELD from hardware
- ALSA HDMI driver: parse and show ELD info
- ALSA HDMI driver: update hardware capabilities/constraints according to ELD (TBD)

That describes my understandings of HDMI audio, comments and discussions are warmly welcome.

Thank you,
Fengguang
--

#1 lore raw

PATCH 1/3 introduce i830_hdmi_priv.has_hdmi_sink

HDMI is compatible with DVI, and we've seen many boards that use HDMI port for DVI output.

So Zhenyu proposed this flag: i830_hdmi_priv.has_hdmi_sink to indicate the presence of HDMI capable monitors.

---
 src/i830_hdmi.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
src/i830_hdmi.c +15 -0
@@ -38,6 +38,8 @@ struct i830_hdmi_priv {
     uint32_t output_reg;
 
     uint32_t save_SDVO;
+
+    Bool has_hdmi_sink;
 };
 
 static int
@@ -142,6 +144,8 @@ i830_hdmi_detect(xf86OutputPtr output)
     xf86OutputStatus status;
     xf86MonPtr edid_mon;
 
+    dev_priv->has_hdmi_sink = FALSE;
+
     /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written 0xd.
      * Failure to do so will result in spurious interrupts being
      * generated on the port when a cable is not attached.
@@ -180,6 +184,16 @@ i830_hdmi_detect(xf86OutputPtr output)
     edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
     if (!edid_mon || !DIGITAL(edid_mon->features.input_type))
 	status = XF86OutputStatusDisconnected;
+
+    if (xf86MonitorIsHDMI(edid_mon))
+	dev_priv->has_hdmi_sink = TRUE;
+
+    if (pI830->debug_modes)
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+			"%s monitor detected on HDMI-%d\n",
+			dev_priv->has_hdmi_sink ? "HDMI" : "DVI",
+			(dev_priv->output_reg == SDVOB) ? 1 : 2);
+
     xfree(edid_mon);
     return status;
 }
@@ -232,6 +246,7 @@ i830_hdmi_init(ScrnInfoPtr pScrn, int ou
 
     dev_priv = (struct i830_hdmi_priv *)(intel_output + 1);
     dev_priv->output_reg = output_reg;
+    dev_priv->has_hdmi_sink = FALSE;
 
     intel_output->dev_priv = dev_priv;
     intel_output->type = I830_OUTPUT_HDMI;

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Re: [PATCH 1/3] introduce i830_hdmi_priv.has_hdmi_sink

Quoted 12 lines · Zhenyu Z
Quoted 7 lines · Wu Fengguang

HDMI is compatible with DVI, and we've seen many boards that use HDMI port for DVI output.

So Zhenyu proposed this flag: i830_hdmi_priv.has_hdmi_sink to indicate the presence of HDMI capable monitors.

We should check if the symbol is available for xserver compatiblity. So below is updated patch for check this.

src/i830_hdmi.c i830_hdmi_detect(xf86OutputPtr output) · line 189

Quoted 4 lines
src/i830_hdmi.c +4 -0
+
+    if (xf86LoaderCheckSymbol("xf86MonitorIsHDMI") &&
+	    xf86MonitorIsHDMI(edid_mon))
+	dev_priv->has_hdmi_sink = TRUE;

I'm OK with the backward compatibility check.
The side effect is that audio output won't be enabled for old xservers.

Thanks,
Fengguang

#4 lore raw

PATCH 2/3 enable Intel G45 integrated HDMI audio output

In reply to Wu Fengguang

Enable audio output for the integrated HDMI of Intel G45 chipset by introducing the SDVO_AUDIO_ENABLE bit.

---
 src/i810_reg.h  |    1 +
 src/i830_hdmi.c |    4 ++++
 2 files changed, 5 insertions(+)
src/i810_reg.h +1 -0
@@ -1296,6 +1296,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN
 /** Requird for HDMI operation */
 #define SDVO_NULL_PACKETS_DURING_VSYNC		(1 << 9)
 #define SDVO_BORDER_ENABLE			(1 << 7)
+#define SDVO_AUDIO_ENABLE			(1 << 6)
 /** New with 965, default is to be set */
 #define SDVO_VSYNC_ACTIVE_HIGH			(1 << 4)
 /** New with 965, default is to be set */
src/i830_hdmi.c +4 -0
@@ -80,6 +80,10 @@ i830_hdmi_mode_set(xf86OutputPtr output,
 	SDVO_BORDER_ENABLE |
 	SDVO_VSYNC_ACTIVE_HIGH |
 	SDVO_HSYNC_ACTIVE_HIGH;
+
+    if (dev_priv->has_hdmi_sink)
+	    sdvox |= SDVO_AUDIO_ENABLE;
+
     if (intel_crtc->pipe == 1)
 	sdvox |= SDVO_PIPE_B_SELECT;
 
#5 lore raw

PATCH 3/3 enable Intel G35 SDVO HDMI audio output

In reply to Wu Fengguang

From: Ma Ling <[email protected]>

Set the SDVO_AUDIO_ENABLE bit to enable SDVO HDMI audio output of the Intel G35 chipset.

---
 src/i830_sdvo.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
src/i830_sdvo.c +6 -4
@@ -1019,7 +1019,7 @@ i830_sdvo_mode_set(xf86OutputPtr output,
     struct i830_sdvo_priv   *dev_priv = intel_output->dev_priv;
     xf86CrtcPtr	    crtc = output->crtc;
     I830CrtcPrivatePtr	    intel_crtc = crtc->driver_private;
-    uint32_t sdvox;
+    uint32_t sdvox = 0;
     int sdvo_pixel_multiply;
     struct i830_sdvo_in_out_map in_out;
     struct i830_sdvo_dtd input_dtd;
@@ -1041,8 +1041,10 @@ i830_sdvo_mode_set(xf86OutputPtr output,
 			&in_out, sizeof(in_out));
     status = i830_sdvo_read_response(output, NULL, 0);
 
-    if (dev_priv->is_hdmi)
+    if (dev_priv->is_hdmi) {
 	i830_sdvo_set_avi_infoframe(output, mode);
+	sdvox |= SDVO_AUDIO_ENABLE;
+    }
 
     i830_sdvo_get_dtd_from_mode(&input_dtd, mode);
 
@@ -1090,11 +1092,11 @@ i830_sdvo_mode_set(xf86OutputPtr output,
 
     /* Set the SDVO control regs. */
     if (IS_I965G(pI830)) {
-	sdvox = SDVO_BORDER_ENABLE |
+	sdvox |= SDVO_BORDER_ENABLE |
 		SDVO_VSYNC_ACTIVE_HIGH |
 		SDVO_HSYNC_ACTIVE_HIGH;
     } else {
-	sdvox = INREG(dev_priv->output_device);
+	sdvox |= INREG(dev_priv->output_device);
 	switch (dev_priv->output_device) {
 	case SDVOB:
 	    sdvox &= SDVOB_PRESERVE_MASK;
#6 lore raw
In reply to Wu Fengguang
Quoted 9 lines · Wu Fengguang

Hello,

We can now enjoy music on HDMI monitors that are attached to Intel G35/G45 chipsets with the following X.org intel driver patches

[PATCH 1/3] introduce i830_hdmi_priv.has_hdmi_sink [PATCH 2/3] enable Intel G45 integrated HDMI audio output [PATCH 3/3] enable Intel G35 SDVO HDMI audio output

Quoted 5 lines

_and_ the corresponding ALSA patch posted at
http://mailman.alsa-project.org/pipermail/alsa-devel/2008-November/012158.html

The patches are tested OK on Intel DG45ID board, HP 2230s notebook and ASUS P5E-VM board.

Patch series looks good to me.

- ajax

_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

#7 lore raw
In reply to Wu Fengguang
Quoted 9 lines · Wu Fengguang

Hello,

We can now enjoy music on HDMI monitors that are attached to Intel G35/G45 chipsets with the following X.org intel driver patches

[PATCH 1/3] introduce i830_hdmi_priv.has_hdmi_sink [PATCH 2/3] enable Intel G45 integrated HDMI audio output [PATCH 3/3] enable Intel G35 SDVO HDMI audio output

Quoted 5 lines

_and_ the corresponding ALSA patch posted at
http://mailman.alsa-project.org/pipermail/alsa-devel/2008-November/012158.html

The patches are tested OK on Intel DG45ID board, HP 2230s notebook and ASUS P5E-VM board.

Pushed xf86-video-intel patches. Thanks!

If you have HDMI output with intel graphics chips, you can test this now.

- alsa patch is within above mail, or get it from
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git

- after loading snd_hda_intel, 'aplay -l' should give you a list of devices that contains Intel HDMI device. Use that device for PCM. Current supports G35/G45/GM45.

- build xf86-video-intel git master to enable HDMI audio within video driver.

Quoted 42 lines

Since the HDMI audio requires both audio and video driver support to function well, I'd like to provide an overview here.

1) driver components:
A) ALSA: audio driver (the above link)
B) Xorg: audio output enabling (this patchset)
C) Xorg: EDID/ELD information (patches to be submitted by Ma Ling)

2) summary of the feature sets:
- basic 2-channel audio:
(A) is required, (B) is mostly required, (C) is not needed
- 2+ multichannel audio:
not tested yet; in theory we need (C) to get HDMI monitor's speaker allocation configuration; there are also bandwidth constraints that should be coordinated between audio/video drivers in the future.
- non-LPCM audio:
not tested yet; need more work in ALSA code.

3) summary of the work flow:
- basic audio output: (A) and (B)
- ALSA HDMI driver: enable pin out and unmute
- ALSA HDMI driver: fill audio infoframe and enable its transmission
- Xorg intel driver: enable audio output
- ELD info for advanced audio capabilities: (A) and (C)
- Xorg xserver: get/parse/store EDID extensions
- Xorg xserver: transform EDID into ELD
- Xorg intel driver: feed ELD to hardware
- Xorg intel driver: set ELD-Valid flag to inform audio driver of new ELD
- ALSA HDMI driver: response to unsolicited response triggered by ELDV
- ALSA HDMI driver: get ELD from hardware
- ALSA HDMI driver: parse and show ELD info
- ALSA HDMI driver: update hardware capabilities/constraints according to ELD (TBD)

That describes my understandings of HDMI audio, comments and discussions are warmly welcome.

Thank you,
Fengguang
--

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg