On Mon, 2015-10-26 at 15:08 +0100, David Henningsson wrote: > > On 2015-10-23 12:56, Tanu Kaskinen wrote: > > The alsa card hasn't so far set any availability for profiles. That > > caused an issue with some HDMI hardware: the sound card has two HDMI > > outputs, but only the second of them is actually usable. The > > unavailable port is marked as unavailable and the available port is > > marked as available, but this information isn't propagated to the > > profile availability. Without profile availability information, the > > initial profile policy picks the unavailable one, since it has a > > higher priority value. > > > > This patch adds simple logic for marking some profiles unavailable: > > if the profile only contains unavailable ports, the profile is > > unavailable too. This can be improved in the future so that if a > > profile contains sinks or sources that only contain unavailable ports, > > the profile should be marked as unavailable. Implementing that > > requires adding more information about the sinks and sources to > > pa_card_profile, however. > > In general ack for the idea; exposing profile availability information > is certainly not bad, and might become useful for more things in future. > > > > > BugLink: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8448 > > --- > > Â src/modules/alsa/module-alsa-card.c | 24 ++++++++++++++++++++++++ > > Â 1 file changed, 24 insertions(+) > > > > diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c > > index ad463ec..fd6b6aa 100644 > > --- a/src/modules/alsa/module-alsa-card.c > > +++ b/src/modules/alsa/module-alsa-card.c > > @@ -364,6 +364,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) { > > Â Â Â Â Â Â void *state; > > Â Â Â Â Â Â pa_alsa_jack *jack; > > Â Â Â Â Â Â struct temp_port_avail *tp, *tports; > > +Â Â Â Â pa_card_profile *profile; > > > > Â Â Â Â Â Â pa_assert(u); > > > > @@ -409,6 +410,29 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) { > > Â Â Â Â Â Â Â Â Â Â if (tp->avail == PA_AVAILABLE_NO) > > Â Â Â Â Â Â Â Â Â Â Â Â Â pa_device_port_set_available(tp->port, tp->avail); > > > > +Â Â Â Â /* Update profile availabilities. The logic could be improved; for now we > > +Â Â Â Â Â * only set obviously unavailable profiles (those that contain only > > +Â Â Â Â Â * unavailable ports) to PA_AVAILABLE_NO and all others to > > +Â Â Â Â Â * PA_AVAILABLE_UNKNOWN. */ > > I do have a comment about the implementation though. Shouldn't we follow > the same "workaround" for profile availability as we do for profiles, i > e, go to available first and unavailable later? Well, the workaround for ports is a solution to an existing problem, but the workaround for profiles would be a solution to a speculative and unspecified future problem. So I wouldn't say that we "should" apply the workaround to profiles too. But I also don't mind doing that. --Â Tanu