All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Yang, Libin" <libin.yang@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Vetter, Daniel" <daniel.vetter@intel.com>,
	"libin.yang@linux.intel.com" <libin.yang@linux.intel.com>
Subject: Re: [PATCH] drm/i915: intel_audio clear eld buf when disconnecting monitor
Date: Mon, 21 Mar 2016 16:19:31 +0100	[thread overview]
Message-ID: <s5htwjz270c.wl-tiwai@suse.de> (raw)
In-Reply-To: <s5hy49b27cq.wl-tiwai@suse.de>

On Mon, 21 Mar 2016 16:12:05 +0100,
Takashi Iwai wrote:
> 
> On Mon, 21 Mar 2016 16:00:21 +0100,
> Takashi Iwai wrote:
> > 
> > On Mon, 21 Mar 2016 15:17:37 +0100,
> > Yang, Libin wrote:
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > > Sent: Monday, March 21, 2016 6:45 PM
> > > > To: libin.yang@linux.intel.com
> > > > Cc: intel-gfx@lists.freedesktop.org; conselvan2@gmail.com;
> > > > jani.nikula@linux.intel.com; ville.syrjala@linux.intel.com; Vetter, Daniel;
> > > > tiwai@suse.de; Yang, Libin
> > > > Subject: Re: [PATCH] drm/i915: intel_audio clear eld buf when
> > > > disconnecting monitor
> > > > 
> > > > On Mon, 21 Mar 2016 06:03:29 +0100,
> > > > libin.yang@linux.intel.com wrote:
> > > > >
> > > > > From: Libin Yang <libin.yang@linux.intel.com>
> > > > >
> > > > > When disconnecting monitor, dev_priv->dig_port_map[port]
> > > > > will be set NULL, which causes eld will not be updated in
> > > > > i915_audio_component_get_eld().
> > > > >
> > > > > This patch clears the eld buf when dev_priv->dig_port_map[port]
> > > > > is NULL.
> > > > >
> > > > > Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> > > > 
> > > > While this isn't certainly bad, I don't think it's mandatory.  The
> > > > function returns zero, i.e. no data is copied.  So the caller
> > > > shouldn't expect that the buffer is cleared in this case.
> > > 
> > > Without the patch, we find when unplug the monitor, the eld info
> > > will not be updated. The means the eld info in the procfs still remains
> > > the old info after the monitor is disconnected.
> > 
> > Well, it's not about zero-clear but rather because the function
> > returns an error (-EINVAL), and the caller takes it too seriously.
> > Upon receiving an error code, the HDA driver doesn't read ELD at all,
> > so it won't help even if you do zero-clear there.
> > 
> > The alternative fix patch is below.
> 
> ... or we can fix it in HDA side like below, too.

This patch won't be applied cleanly on the upstream tree as I wrote it
on the my working tree, sorry.  Below is the revised one that is
applicable to upstream tree.


Takashi

-- 8< --
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH v2] ALSA: hda - Fix missing ELD update at unplugging

i915 get_eld ops may return an error when no encoder is connected, and
currently we regard the error as fatal and skip the whole ELD
handling.  This ended up with the missing ELD update at unplugging.

This patch fixes the issue by treating the error as the unplugged
state, instead of skipping the rest.

Reported-by: Libin Yang <libin.yang@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.5
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_hdmi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 7ae614d27954..d9a557ea7a5b 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1484,11 +1484,10 @@ static void sync_eld_via_acomp(struct hda_codec *codec,
 	int size;
 
 	mutex_lock(&per_pin->lock);
+	*eld->monitor_present = false;
 	size = snd_hdac_acomp_get_eld(&codec->bus->core, per_pin->pin_nid,
 				      &eld->monitor_present, eld->eld_buffer,
 				      ELD_MAX_SIZE);
-	if (size < 0)
-		goto unlock;
 	if (size > 0) {
 		size = min(size, ELD_MAX_SIZE);
 		if (snd_hdmi_parse_eld(codec, &eld->info,
-- 
2.7.4

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

  reply	other threads:[~2016-03-21 15:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-21  5:03 [PATCH] drm/i915: intel_audio clear eld buf when disconnecting monitor libin.yang
2016-03-21 10:44 ` Takashi Iwai
2016-03-21 14:17   ` Yang, Libin
2016-03-21 15:00     ` Takashi Iwai
2016-03-21 15:12       ` Takashi Iwai
2016-03-21 15:19         ` Takashi Iwai [this message]
2016-03-21 15:29           ` Takashi Iwai
2016-03-22  1:47             ` Yang, Libin
2016-03-22  7:15               ` Takashi Iwai
2016-03-22 10:59                 ` Daniel Vetter
2016-03-21 23:23           ` [PATCH v2] ALSA: hda - Fix missing ELD update at unplugging kbuild test robot
2016-03-21 12:35 ` ✗ Fi.CI.BAT: warning for drm/i915: intel_audio clear eld buf when disconnecting monitor Patchwork

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=s5htwjz270c.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=libin.yang@intel.com \
    --cc=libin.yang@linux.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.