diff options
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch')
-rw-r--r-- | meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch new file mode 100644 index 0000000000..5563d2c352 --- /dev/null +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0005-alsa-set-availability-for-some-unavailable-profiles.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From ae6a01ba204b480bda6a5b4431be3d22e53a7006 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tanu Kaskinen <tanuk@iki.fi> | ||
3 | Date: Fri, 23 Oct 2015 13:37:11 +0300 | ||
4 | Subject: [PATCH 5/5] alsa: set availability for (some) unavailable profiles | ||
5 | |||
6 | The alsa card hasn't so far set any availability for profiles. That | ||
7 | caused an issue with some HDMI hardware: the sound card has two HDMI | ||
8 | outputs, but only the second of them is actually usable. The | ||
9 | unavailable port is marked as unavailable and the available port is | ||
10 | marked as available, but this information isn't propagated to the | ||
11 | profile availability. Without profile availability information, the | ||
12 | initial profile policy picks the unavailable one, since it has a | ||
13 | higher priority value. | ||
14 | |||
15 | This patch adds simple logic for marking some profiles unavailable: | ||
16 | if the profile only contains unavailable ports, the profile is | ||
17 | unavailable too. This can be improved in the future so that if a | ||
18 | profile contains sinks or sources that only contain unavailable ports, | ||
19 | the profile should be marked as unavailable. Implementing that | ||
20 | requires adding more information about the sinks and sources to | ||
21 | pa_card_profile, however. | ||
22 | |||
23 | BugLink: https://bugzilla.yoctoproject.org/show_bug.cgi?id=8448 | ||
24 | |||
25 | Upstream-Status: Accepted [expected in 10.0] | ||
26 | |||
27 | Signed-off-by: Tanu Kaskinen <tanuk@iki.fi> | ||
28 | --- | ||
29 | src/modules/alsa/module-alsa-card.c | 27 +++++++++++++++++++++++++++ | ||
30 | 1 file changed, 27 insertions(+) | ||
31 | |||
32 | diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c | ||
33 | index 1976230..323e08a 100644 | ||
34 | --- a/src/modules/alsa/module-alsa-card.c | ||
35 | +++ b/src/modules/alsa/module-alsa-card.c | ||
36 | @@ -366,6 +366,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) { | ||
37 | void *state; | ||
38 | pa_alsa_jack *jack; | ||
39 | struct temp_port_avail *tp, *tports; | ||
40 | + pa_card_profile *profile; | ||
41 | |||
42 | pa_assert(u); | ||
43 | |||
44 | @@ -426,6 +427,32 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) { | ||
45 | if (tp->avail == PA_AVAILABLE_NO) | ||
46 | pa_device_port_set_available(tp->port, tp->avail); | ||
47 | |||
48 | + /* Update profile availabilities. The logic could be improved; for now we | ||
49 | + * only set obviously unavailable profiles (those that contain only | ||
50 | + * unavailable ports) to PA_AVAILABLE_NO and all others to | ||
51 | + * PA_AVAILABLE_UNKNOWN. */ | ||
52 | + PA_HASHMAP_FOREACH(profile, u->card->profiles, state) { | ||
53 | + pa_device_port *port; | ||
54 | + void *state2; | ||
55 | + pa_available_t available = PA_AVAILABLE_NO; | ||
56 | + | ||
57 | + /* Don't touch the "off" profile. */ | ||
58 | + if (profile->n_sources == 0 && profile->n_sinks == 0) | ||
59 | + continue; | ||
60 | + | ||
61 | + PA_HASHMAP_FOREACH(port, u->card->ports, state2) { | ||
62 | + if (!pa_hashmap_get(port->profiles, profile->name)) | ||
63 | + continue; | ||
64 | + | ||
65 | + if (port->available != PA_AVAILABLE_NO) { | ||
66 | + available = PA_AVAILABLE_UNKNOWN; | ||
67 | + break; | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | + pa_card_profile_set_available(profile, available); | ||
72 | + } | ||
73 | + | ||
74 | pa_xfree(tports); | ||
75 | return 0; | ||
76 | } | ||
77 | -- | ||
78 | 2.8.1 | ||
79 | |||