Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Nikhil Mahale <nmahale@nvidia.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.com, aplattner@nvidia.com
Subject: Re: [alsa-devel] [PATCH v1 5/5] ALSA: hda - Add DP-MST support for NVIDIA codecs
Date: Thu, 14 Nov 2019 12:02:46 +0100	[thread overview]
Message-ID: <s5hmucyn2jt.wl-tiwai@suse.de> (raw)
In-Reply-To: <20191114033704.18171-6-nmahale@nvidia.com>

On Thu, 14 Nov 2019 04:37:04 +0100,
Nikhil Mahale wrote:
> 
> @@ -3494,11 +3500,86 @@ static const struct drm_audio_component_audio_ops nvhdmi_audio_ops = {
>  	.master_unbind = generic_acomp_master_unbind,
>  };
>  
> +static int nvhdmi_find_pcm_slot(struct hdmi_spec *spec,
> +				struct hdmi_spec_per_pin *per_pin)
> +{
> +	int i;
> +
> +	/*
> +	 * generic_hdmi_build_pcms() allocates (num_nids + dev_num - 1)
> +	 * number of pcms.
> +	 *
> +	 * The per_pin of pin_nid_idx=n and dev_id=m prefers to get pcm-n if m==0.
> +	 * This guarantees that dynamic pcm assignments are compatible with the
> +	 * legacy static per_pin-pmc assignment that existed in the days before
> +	 * DP-MST.
> +	 *
> +	 * per_pin of m!=0 prefers to get pcm=(num_nids + (m - 1)).
> +	 */
> +	if (per_pin->dev_id == 0 &&
> +	    !test_bit(per_pin->pin_nid_idx, &spec->pcm_bitmap))
> +		return per_pin->pin_nid_idx;
> +
> +	if (per_pin->dev_id != 0 &&
> +	    !(test_bit(spec->num_nids + (per_pin->dev_id - 1),
> +		&spec->pcm_bitmap))) {
> +		return spec->num_nids + (per_pin->dev_id - 1);
> +	}
> +
> +	/* have a second try; check the area over num_nids */
> +	for (i = spec->num_nids; i < spec->pcm_used; i++) {
> +		if (!test_bit(i, &spec->pcm_bitmap))
> +			return i;
> +	}
> +
> +	/* the last try; check the empty slots in pins */
> +	for (i = 0; i < spec->num_nids; i++) {
> +		if (!test_bit(i, &spec->pcm_bitmap))
> +			return i;
> +	}
> +	return -EBUSY;
> +}

I think this can be applied for Intel case, too.  No need for creating
yet another indirect branch.


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-11-14 11:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14  3:36 [alsa-devel] [PATCH v1 0/5] ALSA: hda - Add DP-MST support for NVIDIA codecs Nikhil Mahale
2019-11-14  3:37 ` [alsa-devel] [PATCH v1 1/5] ALSA: hda - Rename snd_hda_pin_sense to snd_hda_jack_pin_sense Nikhil Mahale
2019-11-14  3:37 ` [alsa-devel] [PATCH v1 2/5] ALSA: hda - Add DP-MST jack support Nikhil Mahale
2019-11-14 10:46   ` Kai Vehmanen
2019-11-15  9:39     ` Nikhil Mahale
2019-11-14 10:54   ` Takashi Iwai
2019-11-15  9:46     ` Nikhil Mahale
2019-11-14  3:37 ` [alsa-devel] [PATCH v1 3/5] ALSA: hda - Add DP-MST conn list support Nikhil Mahale
2019-11-14 10:57   ` Takashi Iwai
2019-11-14 11:47     ` Nikhil Mahale
2019-11-14 13:14       ` Takashi Iwai
2019-11-15  9:52         ` Nikhil Mahale
2019-11-15 10:30           ` Takashi Iwai
2019-11-19  8:43             ` Nikhil Mahale
2019-11-14  3:37 ` [alsa-devel] [PATCH v1 4/5] ALSA: hda - Add DP-MST support for non-acomp codecs Nikhil Mahale
2019-11-14  3:37 ` [alsa-devel] [PATCH v1 5/5] ALSA: hda - Add DP-MST support for NVIDIA codecs Nikhil Mahale
2019-11-14 11:02   ` Takashi Iwai [this message]
2019-11-14 11:50     ` Nikhil Mahale
2019-11-14 13:15       ` Takashi Iwai
2019-11-14 10:38 ` [alsa-devel] [PATCH v1 0/5] " Takashi Iwai
2019-11-15  9:37   ` 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=s5hmucyn2jt.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=aplattner@nvidia.com \
    --cc=nmahale@nvidia.com \
    --cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox