[alsa-devel] [PATCH 0/3] 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.ht...
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 --
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.
Signed-off-by: Wu Fengguang wfg@linux.intel.com --- src/i830_hdmi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
--- xf86-video-intel.orig/src/i830_hdmi.c +++ xf86-video-intel/src/i830_hdmi.c @@ -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;
--
Enable audio output for the integrated HDMI of Intel G45 chipset by introducing the SDVO_AUDIO_ENABLE bit.
Signed-off-by: Wu Fengguang wfg@linux.intel.com --- src/i810_reg.h | 1 + src/i830_hdmi.c | 4 ++++ 2 files changed, 5 insertions(+)
--- xf86-video-intel.orig/src/i810_reg.h +++ xf86-video-intel/src/i810_reg.h @@ -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 */ --- xf86-video-intel.orig/src/i830_hdmi.c +++ xf86-video-intel/src/i830_hdmi.c @@ -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;
--
From: Ma Ling ling.ma@intel.com
Set the SDVO_AUDIO_ENABLE bit to enable SDVO HDMI audio output of the Intel G35 chipset.
Signed-off-by: Ma Ling ling.ma@intel.com Signed-off-by: Wu Fengguang wfg@linux.intel.com --- src/i830_sdvo.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
--- xf86-video-intel.orig/src/i830_sdvo.c +++ xf86-video-intel/src/i830_sdvo.c @@ -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;
--
On Fri, 2008-11-07 at 14:23 +0800, Wu Fengguang wrote:
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.ht...
The patches are tested OK on Intel DG45ID board, HP 2230s notebook and ASUS P5E-VM board.
Patch series looks good to me.
- ajax
On 2008.11.07 14:23:38 +0800, Wu Fengguang wrote:
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.ht...
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.
Since the HDMI audio requires both audio and video driver support to function well, I'd like to provide an overview here.
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)
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.
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 --
participants (3)
-
Adam Jackson
-
Wang, Zhenyu Z
-
Wu Fengguang