All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyungwon Hwang <hyungwon.hwang7@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: hda - Update HDMI monitor_present from a temporary structure
Date: Wed, 13 Apr 2016 23:53:59 +0900	[thread overview]
Message-ID: <570E5D87.4070905@gmail.com> (raw)
In-Reply-To: <s5hr3eagdy6.wl-tiwai@suse.de>

2016년 04월 13일 16:33에 Takashi Iwai 이(가) 쓴 글:
> On Wed, 13 Apr 2016 02:27:39 +0200,
> Hyungwon Hwang wrote:
>>
>> pin_eld is a temporary structure. So before calling update_eld(),
>> eld should be updated from pin_eld.
>>
>> Signed-off-by: Hyungwon Hwang <hyungwon.hwang7@gmail.com>
> 
> It's not clear what you're trying to solve only by the description
> above alone.  It's about the inconsistent "monitor present" appearance
> in eld proc file, right?  You need to write "why your patch is
> necessary" in your patch description.
> 
> Now back to the code change:
> 
>> ---
>>  sound/pci/hda/patch_hdmi.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
>> index 5af372d..9de114d 100644
>> --- a/sound/pci/hda/patch_hdmi.c
>> +++ b/sound/pci/hda/patch_hdmi.c
>> @@ -1414,6 +1414,8 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>>  
>>  	mutex_lock(&per_pin->lock);
>>  	pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
>> +	eld->monitor_present = pin_eld->monitor_present;
>> +
>>  	if (pin_eld->monitor_present)
>>  		eld->eld_valid  = !!(present & AC_PINSENSE_ELDV);
>>  	else
> 
> OK, this would work, but the fundamental problem is that pin_eld is
> modified in this function.  This used to work in the past casually due
> to a bug, but I plugged it in the commit bd48128539ab
>     ALSA: hda - Fix forgotten HDMI monitor_present update
> but overlooked the regression in non-component side.  My bad.
> 
> So, the real fix is to replace the all pin_eld with eld in this
> function.  The untested patch is below.  Could you check whether this
> works for you?

Your code works well in my case, and seems more reasonable even to me.
Thanks for your review and work.

Thanks,
Hyungwon Hwang


> 
> Though, as a stable fix, maybe applying your oneliner patch would be
> safer.  It restores to the old behavior, at least.  Then we can apply
> the patch below on the top.
> 
> 
> thanks,
> 
> Takashi
> 
> ---
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 5af372d01834..c83c1a8d9742 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -1396,7 +1396,6 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>  	struct hda_codec *codec = per_pin->codec;
>  	struct hdmi_spec *spec = codec->spec;
>  	struct hdmi_eld *eld = &spec->temp_eld;
> -	struct hdmi_eld *pin_eld = &per_pin->sink_eld;
>  	hda_nid_t pin_nid = per_pin->pin_nid;
>  	/*
>  	 * Always execute a GetPinSense verb here, even when called from
> @@ -1413,15 +1412,15 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>  	present = snd_hda_pin_sense(codec, pin_nid);
>  
>  	mutex_lock(&per_pin->lock);
> -	pin_eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
> -	if (pin_eld->monitor_present)
> +	eld->monitor_present = !!(present & AC_PINSENSE_PRESENCE);
> +	if (eld->monitor_present)
>  		eld->eld_valid  = !!(present & AC_PINSENSE_ELDV);
>  	else
>  		eld->eld_valid = false;
>  
>  	codec_dbg(codec,
>  		"HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
> -		codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
> +		codec->addr, pin_nid, eld->monitor_present, eld->eld_valid);
>  
>  	if (eld->eld_valid) {
>  		if (spec->ops.pin_get_eld(codec, pin_nid, eld->eld_buffer,
> @@ -1441,7 +1440,7 @@ static bool hdmi_present_sense_via_verbs(struct hdmi_spec_per_pin *per_pin,
>  	else
>  		update_eld(codec, per_pin, eld);
>  
> -	ret = !repoll || !pin_eld->monitor_present || pin_eld->eld_valid;
> +	ret = !repoll || !eld->monitor_present || eld->eld_valid;
>  
>  	jack = snd_hda_jack_tbl_get(codec, pin_nid);
>  	if (jack)
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2016-04-13 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13  0:27 [PATCH] ALSA: hda - Update HDMI monitor_present from a temporary structure Hyungwon Hwang
2016-04-13  7:33 ` Takashi Iwai
2016-04-13 14:53   ` Hyungwon Hwang [this message]
2016-04-13 15:01     ` 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=570E5D87.4070905@gmail.com \
    --to=hyungwon.hwang7@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --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 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.