[alsa-devel] [PATCH v2 2/5] ALSA: hda - Add DP-MST jack support
Takashi Iwai
tiwai at suse.de
Fri Nov 15 14:12:55 CET 2019
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.
thanks,
Takashi
More information about the Alsa-devel
mailing list