Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nikhil Mahale <nmahale@nvidia.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, tiwai@suse.com, aplattner@nvidia.com
Subject: Re: [alsa-devel] [PATCH v2 2/5] ALSA: hda - Add DP-MST jack support
Date: Tue, 19 Nov 2019 10:15:26 +0530	[thread overview]
Message-ID: <6e8b6415-bad3-3530-4543-3ab3569b69fc@nvidia.com> (raw)
In-Reply-To: <s5hd0dtjnag.wl-tiwai@suse.de>

On 11/15/19 6:42 PM, Takashi Iwai wrote:
> On Fri, 15 Nov 2019 10:56:03 +0100,
> Nikhil Mahale wrote:
>>
>>  static struct hda_jack_tbl *
>> -snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid)
>> +snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid, int dev_id)
>>  {
>> -	struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
>> +	struct hda_jack_tbl *jack =
>> +		snd_hda_jack_tbl_get_mst(codec, nid, dev_id);
>> +	struct hda_jack_tbl *existing_nid_jack =
>> +		any_jack_tbl_get_from_nid(codec, nid);
>> +
>> +	WARN_ON(dev_id != 0 && !codec->dp_mst);
>> +
>>  	if (jack)
>>  		return jack;
>>  	jack = snd_array_new(&codec->jacktbl);
>>  	if (!jack)
>>  		return NULL;
>>  	jack->nid = nid;
>> +	jack->dev_id = dev_id;
>>  	jack->jack_dirty = 1;
>> -	jack->tag = codec->jacktbl.used;
>> +	if (!existing_nid_jack)
>> +		jack->tag = codec->jacktbl.used;
>> +	else
>> +		jack->tag = existing_nid_jack->tag;
>> +
>>  	return jack;
>>  }
> 
> In this logic, we assign the same tag to multiple jack objects, and
> this will lead to the multiple calls of SET_UNSOLICITED_ENABLE on the
> same pin.  But this should be only once at parsing, and the rest
> resume init will be done from the codec regmap cache, so it's not too
> bad, I guess.
> 
> Alternatively we can set 0 to jack->tag when existing_nid_jack!=NULL,
> too, and skip SET_UNSOLICITED_ENABLE for tag==0.  But this will make
> *_get_from_tag() won't work as you intended, hence the step will be
> - get the jack once via snd_hda_jack_tbl_get_from_tag(tag)
> - get the jack again with snd_hda_jack_tbl_get_mst(jack->nid, dev_id)
> But it's more complex, and not better, either.

I am bit skeptical over this idea. One can build hypothetical case like - you create 2 jack objects, first one for (nid=1, dev_id=0) with jack->tag!=0 and second one for (nid=1, dev_id=1) with jack->tag==0. If you want free first jack object and continue working with second one then that would create problem because you lose tag with destruction of first object?

If objective is not to make multiple calls of SET_UNSOLICITED_ENABLE on the same pin, then just like jack->tag we can inherit jack->jack_detect from  existing_nid_jack. That can make sure snd_hda_jack_detect_enable_callback_mst() not to do multiple calls of SET_UNSOLICITED_ENABLE on the same pin, right?

I am suggesting code change like -

...
snd_hda_jack_tbl_new(...)
{
    [...]
    if (!existing_nid_jack) {
        jack->tag = codec->jacktbl.used;
    } else {
        jack->tag = existing_nid_jack->tag;
        jack->jack_detect = existing_nid_jack->jack_detect;
    }
    [...]
}

Thanks,
Nikhil Mahale

> thanks,
> 
> Takashi
> 

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-11-19  4:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15  9:56 [alsa-devel] [PATCH v2 0/5] ALSA: hda - Add DP-MST support for NVIDIA codecs Nikhil Mahale
2019-11-15  9:56 ` [alsa-devel] [PATCH v2 1/5] ALSA: hda - Rename snd_hda_pin_sense to snd_hda_jack_pin_sense Nikhil Mahale
2019-11-15  9:56 ` [alsa-devel] [PATCH v2 2/5] ALSA: hda - Add DP-MST jack support Nikhil Mahale
2019-11-15 13:12   ` Takashi Iwai
2019-11-19  4:45     ` Nikhil Mahale [this message]
2019-11-19  6:47       ` Takashi Iwai
2019-11-15  9:56 ` [alsa-devel] [PATCH v2 3/5] ALSA: hda - Add DP-MST conn list support Nikhil Mahale
2019-11-15  9:56 ` [alsa-devel] [PATCH v2 4/5] ALSA: hda - Add DP-MST support for non-acomp codecs Nikhil Mahale
2019-11-15  9:56 ` [alsa-devel] [PATCH v2 5/5] ALSA: hda - Add DP-MST support for NVIDIA codecs Nikhil Mahale
2019-11-15 13:15   ` Takashi Iwai
2019-11-19  8:44     ` Nikhil Mahale

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=6e8b6415-bad3-3530-4543-3ab3569b69fc@nvidia.com \
    --to=nmahale@nvidia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=aplattner@nvidia.com \
    --cc=tiwai@suse.com \
    --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