Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Takashi Iwai <tiwai@suse.de>, Shane W <shane-alsa@csy.ca>
Cc: alsa-devel@alsa-project.org, Wu Fengguang <fengguang.wu@intel.com>
Subject: [PATCH 2/4] hda - enable HDMI audio pin out at module loading time
Date: Wed, 11 Feb 2009 15:22:29 +0800	[thread overview]
Message-ID: <20090211073402.680690787@intel.com> (raw)
In-Reply-To: 20090211072227.760779741@intel.com

[-- Attachment #1: intel-hdmi-oneshot-enable.patch --]
[-- Type: text/plain, Size: 3519 bytes --]

We found that enabling/disabling HDMI audio pin out at stream start/stop
time will kill the leading 500ms or so sound samples. Avoid this by enabling
pin out once and for ever at module loading time.

The leading ~500ms audio samples will still be lost when switching from
X-channel playback to Y-channel playback where X != Y. However there's no
much we can do about it: the audio infoframe has to change and it looks like
either G45 or YAMAHA requires some time to switch the configuration.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 sound/pci/hda/patch_intelhdmi.c |   42 +++++++++++++-----------------
 1 file changed, 19 insertions(+), 23 deletions(-)

--- mm.orig/sound/pci/hda/patch_intelhdmi.c
+++ mm/sound/pci/hda/patch_intelhdmi.c
@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_ver
 	{} /* terminator */
 };
 
-static struct hda_verb pinout_disable_verb[] = {
-	{PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00},
-	{}
-};
-
 static struct hda_verb unsolicited_response_verb[] = {
 	{PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
 						  INTEL_HDMI_EVENT_TAG},
@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct h
 
 static void hdmi_enable_output(struct hda_codec *codec)
 {
-	/* Enable Audio InfoFrame Transmission */
-	hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
-	snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
-						AC_DIPXMIT_BEST);
 	/* Unmute */
 	if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
 		snd_hda_codec_write(codec, PIN_NID, 0,
@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hd
 	snd_hda_sequence_write(codec, pinout_enable_verb);
 }
 
-static void hdmi_disable_output(struct hda_codec *codec)
+/*
+ * Enable Audio InfoFrame Transmission
+ */
+static void hdmi_start_infoframe_trans(struct hda_codec *codec)
 {
-	snd_hda_sequence_write(codec, pinout_disable_verb);
-	if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
-		snd_hda_codec_write(codec, PIN_NID, 0,
-				AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+	hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
+	snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
+						AC_DIPXMIT_BEST);
+}
 
-	/*
-	 * FIXME: noises may arise when playing music after reloading the
-	 * kernel module, until the next X restart or monitor repower.
-	 */
+/*
+ * Disable Audio InfoFrame Transmission
+ */
+static void hdmi_stop_infoframe_trans(struct hda_codec *codec)
+{
+	hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
+	snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
+						AC_DIPXMIT_DISABLE);
 }
 
 static int hdmi_get_channel_count(struct hda_codec *codec)
@@ -489,6 +487,7 @@ static void hdmi_setup_audio_infoframe(s
 	hdmi_setup_channel_mapping(codec, &ai);
 
 	hdmi_fill_audio_infoframe(codec, &ai);
+	hdmi_start_infoframe_trans(codec);
 }
 
 
@@ -566,7 +565,7 @@ static int intel_hdmi_playback_pcm_close
 {
 	struct intel_hdmi_spec *spec = codec->spec;
 
-	hdmi_disable_output(codec);
+	hdmi_stop_infoframe_trans(codec);
 
 	return snd_hda_multi_out_dig_close(codec, &spec->multiout);
 }
@@ -586,8 +585,6 @@ static int intel_hdmi_playback_pcm_prepa
 
 	hdmi_setup_audio_infoframe(codec, substream);
 
-	hdmi_enable_output(codec);
-
 	return 0;
 }
 
@@ -632,8 +629,7 @@ static int intel_hdmi_build_controls(str
 
 static int intel_hdmi_init(struct hda_codec *codec)
 {
-	/* disable audio output as early as possible */
-	hdmi_disable_output(codec);
+	hdmi_enable_output(codec);
 
 	snd_hda_sequence_write(codec, unsolicited_response_verb);
 

-- 

  parent reply	other threads:[~2009-02-11  7:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-11  7:22 [PATCH 0/4] Intel HDMI audio fixes Wu Fengguang
2009-02-11  7:22 ` [PATCH 1/4] hda - allow multi-channel HDMI audio playback when ELD is not present Wu Fengguang
2009-02-11  7:22 ` Wu Fengguang [this message]
2009-02-11  7:22 ` [PATCH 3/4] hda - compute checksum in HDMI audio infoframe Wu Fengguang
2009-02-11  7:22 ` [PATCH 4/4] hda - add id for Intel IbexPeak integrated HDMI codec Wu Fengguang
2009-02-11  8:10 ` [PATCH 0/4] Intel HDMI audio fixes Takashi Iwai
2009-02-11  8:20   ` Wu Fengguang
     [not found] ` <20090211223241.GA31322@csy.ca>
2009-02-11 22:42   ` Takashi Iwai
     [not found]     ` <20090211225448.GA32203@csy.ca>
2009-02-11 23:02       ` Takashi Iwai
2009-02-12  4:41         ` Wu Fengguang
     [not found]           ` <20090213172821.GA843@csy.ca>
2009-02-14 10:28             ` Takashi Iwai
2009-02-12  1:25     ` Wu Fengguang
2009-02-12  7:54       ` Takashi Iwai
2009-02-12  7:58         ` Wu Fengguang
2009-02-20 13:05         ` [PATCH] speaker-test.c - add readability comments to speaker channels Wu Fengguang
2009-02-20 17:07           ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090211073402.680690787@intel.com \
    --to=fengguang.wu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=shane-alsa@csy.ca \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox