From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 3/3] ALSA: hda - hdmi: Notify userspace when ELD control changes Date: Mon, 18 Feb 2013 15:55:55 +0100 Message-ID: References: <1361193073-7199-1-git-send-email-david.henningsson@canonical.com> <1361193073-7199-4-git-send-email-david.henningsson@canonical.com> <51223EAC.3010409@canonical.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8B900261603 for ; Mon, 18 Feb 2013 15:55:59 +0100 (CET) In-Reply-To: <51223EAC.3010409@canonical.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: David Henningsson Cc: alsa-devel@alsa-project.org, fengguang.wu@intel.com, pierre-louis.bossart@linux.intel.com List-Id: alsa-devel@alsa-project.org At Mon, 18 Feb 2013 15:46:04 +0100, David Henningsson wrote: > > On 02/18/2013 03:41 PM, Takashi Iwai wrote: > > At Mon, 18 Feb 2013 14:11:13 +0100, > > David Henningsson wrote: > >> > >> Since ELD sometimes becomes available a while after we have detected > >> presence, we need to be able to listen for changes on the ELD control. > >> > >> Signed-off-by: David Henningsson > >> --- > >> sound/pci/hda/patch_hdmi.c | 10 ++++++++++ > >> 1 file changed, 10 insertions(+) > >> > >> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > >> index 9236cdb..d3b1a93 100644 > >> --- a/sound/pci/hda/patch_hdmi.c > >> +++ b/sound/pci/hda/patch_hdmi.c > >> @@ -74,6 +74,7 @@ struct hdmi_spec_per_pin { > >> > >> struct hda_codec *codec; > >> struct hdmi_eld sink_eld; > >> + struct snd_kcontrol *eld_ctl; > >> struct delayed_work work; > >> int repoll_count; > >> bool non_pcm; > >> @@ -406,6 +407,7 @@ static int hdmi_create_eld_ctl(struct hda_codec *codec, int pin_idx, > >> if (err < 0) > >> return err; > >> > >> + spec->pins[pin_idx].eld_ctl = kctl; > >> return 0; > >> } > >> > >> @@ -1175,6 +1177,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) > >> */ > >> int present = snd_hda_pin_sense(codec, pin_nid); > >> bool eld_valid = false; > >> + bool old_eld_valid = eld->eld_valid; > >> > >> memset(eld, 0, offsetof(struct hdmi_eld, eld_buffer)); > >> > >> @@ -1196,6 +1199,13 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) > >> msecs_to_jiffies(300)); > >> } > >> } > >> + > >> + if (eld->eld_valid != old_eld_valid && per_pin->eld_ctl) { > >> + snd_ctl_notify(codec->bus->card, > >> + SNDRV_CTL_EVENT_MASK_VALUE | SNDRV_CTL_EVENT_MASK_INFO, > >> + &per_pin->eld_ctl->id); > >> + } > > > > This notification should be skipped when the pin sensing is requeued. > > I don't understand this comment. Are you referring to repolling the ELD? Yes. > eld->eld_valid is never set to TRUE when repoll happens. But old_eld_valid might be TRUE, and you cleared eld->eld_valid to FALSE now before the actual probe result. Thus the check above passes and sends a notification although the actual probe isn't done. Takashi