All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Cc: "Vetter, Daniel" <daniel.vetter@intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	David Henningsson <david.henningsson@canonical.com>
Subject: Re: [PATCH 4/4] ALSA: hda - Wake the codec up on pin/ELD notify events
Date: Fri, 27 Nov 2015 14:38:27 +0100	[thread overview]
Message-ID: <s5hpoyvsgto.wl-tiwai@suse.de> (raw)
In-Reply-To: <8082FF9BCB2B054996454E47167FF4EC0B0F2EE7@SHSMSX104.ccr.corp.intel.com>

On Fri, 27 Nov 2015 03:55:28 +0100,
Zhang, Xiong Y wrote:
> 
> > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> > index bdb6f226d006..0cd7bb30b045 100644
> > --- a/sound/pci/hda/patch_hdmi.c
> > +++ b/sound/pci/hda/patch_hdmi.c
> > @@ -2352,6 +2352,10 @@ static void intel_pin_eld_notify(void *audio_ptr, int
> > port)
> >  	struct hda_codec *codec = audio_ptr;
> >  	int pin_nid = port + 0x04;
> > 
> > +	/* skip notification during suspend */
> > +	if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0)
> > +		return;
> > +
> >  	check_presence_and_report(codec, pin_nid);
> >  }
> > 
> [Zhang, Xiong Y] yes, this patch could remove the error message.

Alright, then it's indeed a failure in the sound driver side.
Below is the official patch I'm going to merge.

thanks,

Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Skip ELD notification during system suspend

The recent addition of ELD notifier for Intel HDMI/DP codec may lead
the bad codec connection found as kernel messages like below:
 Suspending console(s) (use no_console_suspend to debug)
 hdmi_present_sense: snd_hda_codec_hdmi hdaudioC0D2: HDMI status: Codec=2 Pin=6 Presence_Detect=1 ELD_Valid=1
 snd_hda_intel 0000:00:1f.3: spurious response 0x0:0x2, last cmd=0x206f2e08
 snd_hda_intel 0000:00:1f.3: spurious response 0x0:0x2, last cmd=0x206f2e08
 ....
  snd_hda_codec_hdmi hdaudioC0D2: HDMI: ELD buf size is 0, force 128
  snd_hda_intel 0000:00:1f.3: azx_get_response timeout, switching to polling mode: last cmd=0x206f2f00
 snd_hda_intel 0000:00:1f.3: No response from codec, disabling MSI: last cmd=0x206f2f00
 snd_hda_intel 0000:00:1f.3: azx_get_response timeout, switching to single_cmd mode: last cmd=0x206f2f00
 azx_single_wait_for_response: 42 callbacks suppressed

This seems appearing when the sound driver went to suspend before i915
driver.  Then i915 driver disables HDMI/DP audio bit and calls the
registered notifier, and the HDA codec tries to handle it as a
hot(un)plug.  But since the driver is already in the suspended state,
it fails miserably.

As this is a sort of spurious wakeup, it can be ignored safely, as
long as it's delivered during the system suspend.  OTOH, if a
notification comes during the runtime suspend, the situation is
different: we need to wake up.  But during the system suspend, such a
notification can't be the reason for a wakeup.

This patch addresses it by a simple check of the current sound card
status.  The skipped notification doesn't matter because the HDA
driver will check the plugged status forcibly at the resume in
return.

Then, why the card status, not a runtime PM status or else?  The HDA
controller driver is supposed to set the card status to D3 at the
system suspend but not at the runtime suspend.  So we can see it as a
flag that is set only for the system suspend.  Admittedly, it's a bit
ugly, but it should work well for now.

Reported-and-tested-by: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Fixes: 25adc137c546 ('ALSA: hda - Wake the codec up on pin/ELD notify events')
Cc: <stable@vger.kernel.org> # v4.3+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index bdb6f226d006..4b6fb668c91c 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2352,6 +2352,12 @@ static void intel_pin_eld_notify(void *audio_ptr, int port)
 	struct hda_codec *codec = audio_ptr;
 	int pin_nid = port + 0x04;
 
+	/* skip notification during system suspend (but not in runtime PM);
+	 * the state will be updated at resume
+	 */
+	if (snd_power_get_state(codec->card) != SNDRV_CTL_POWER_D0)
+		return;
+
 	check_presence_and_report(codec, pin_nid);
 }
 
-- 
2.6.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-27 13:38 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 17:02 [PATCH 0/4 v5] i915 to call hda driver on HDMI plug/unplug David Henningsson
2015-08-28 17:02 ` [PATCH 1/4] drm/i915: Add audio pin sense / ELD callback David Henningsson
2015-09-02 11:44   ` Daniel Vetter
2015-08-28 17:02 ` [PATCH 2/4] drm/i915: Call audio pin/ELD notify function David Henningsson
2015-08-28 17:02 ` [PATCH 3/4] ALSA: hda - allow codecs to access the i915 pin/ELD callback David Henningsson
2015-08-28 17:02 ` [PATCH 4/4] ALSA: hda - Wake the codec up on pin/ELD notify events David Henningsson
2015-11-25  9:56   ` Zhang, Xiong Y
2015-11-25 10:07     ` Takashi Iwai
2015-11-25 10:57       ` Zhang, Xiong Y
2015-11-25 11:17         ` Takashi Iwai
2015-11-26  6:06           ` Zhang, Xiong Y
2015-11-26  6:25             ` Takashi Iwai
2015-11-26  7:57               ` Zhang, Xiong Y
2015-11-26  8:07                 ` [Intel-gfx] " Takashi Iwai
2015-11-26  9:16                   ` Zhang, Xiong Y
2015-11-26  9:24                     ` Takashi Iwai
2015-11-26 15:08                       ` David Henningsson
2015-11-26 15:23                         ` Takashi Iwai
2015-11-26 15:29                           ` David Henningsson
2015-11-26 15:37                             ` Imre Deak
2015-11-26 15:43                             ` Ville Syrjälä
2015-11-26 15:51                               ` Takashi Iwai
2015-11-26 15:58                                 ` Ville Syrjälä
2015-11-26 16:16                                   ` Takashi Iwai
2015-11-27  2:55                                     ` Zhang, Xiong Y
2015-11-27 13:38                                       ` Takashi Iwai [this message]
2015-11-27 13:45                                         ` David Henningsson
2015-11-27 13:50                                           ` Takashi Iwai
2015-11-26 15:47                             ` Takashi Iwai
2015-11-26 15:48                           ` Daniel Vetter
2015-08-28 17:14 ` [PATCH 0/4 v5] i915 to call hda driver on HDMI plug/unplug Jani Nikula
2015-09-02 11:45   ` Daniel Vetter
2015-09-02 11:59     ` Takashi Iwai
2015-09-02 12:14       ` Daniel Vetter
2015-09-03  7:52 ` David Henningsson
2015-09-03  8:31   ` Takashi Iwai
2015-09-03  9:53     ` David Henningsson
2015-09-03 10:29     ` Jani Nikula
  -- strict thread matches above, loose matches on Subject: below --
2015-08-19  8:48 [PATCH v4 0/4] " David Henningsson
2015-08-19  8:48 ` [PATCH 4/4] ALSA: hda - Wake the codec up on pin/ELD notify events David Henningsson
2015-08-20  9:28   ` Takashi Iwai
2015-08-20  9:41     ` David Henningsson
2015-08-20  9:46       ` Takashi Iwai
2015-08-28 13:10         ` Jani Nikula
2015-09-02  8:00           ` Daniel Vetter
2015-09-02  8:03             ` Takashi Iwai
2015-09-02  8:32               ` Daniel Vetter
2015-09-02  9:39                 ` 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=s5hpoyvsgto.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=daniel.vetter@intel.com \
    --cc=david.henningsson@canonical.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=xiong.y.zhang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.