From 8cc1c2e44019344a921bc2d5ef78cb832e0d02671c01519c06b48fad65112588 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 21 Oct 2015 09:12:10 +0000 Subject: [PATCH] Accepting request 340196 from home:tiwai:branches:multimedia:libs - Fix another alsa-mixer path for dock line out jack (boo#948979): 0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch - Fix the order of ports updates (boo#948979): 0004-module-alsa-card-Report-available-ports-before-unava.patch OBS-URL: https://build.opensuse.org/request/show/340196 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pulseaudio?expand=0&rev=161 --- ...ock-Line-Out-jack-handling-to-analog.patch | 30 ++++++ ...-Report-available-ports-before-unava.patch | 92 +++++++++++++++++++ pulseaudio.changes | 8 ++ pulseaudio.spec | 6 ++ 4 files changed, 136 insertions(+) create mode 100644 0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch create mode 100644 0004-module-alsa-card-Report-available-ports-before-unava.patch diff --git a/0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch b/0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch new file mode 100644 index 0000000..35a82a8 --- /dev/null +++ b/0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch @@ -0,0 +1,30 @@ +From e061f9afd2ee1a798d71b3d078725bfcea214202 Mon Sep 17 00:00:00 2001 +From: Tanu Kaskinen +Date: Fri, 18 Sep 2015 09:59:45 +0300 +Subject: [PATCH] alsa-mixer: Add "Dock Line Out" jack handling to + analog-output-speaker-always + +The jack is already in analog-output-speaker, so let's have the same +handling in analog-output-speaker-always too. +--- + src/modules/alsa/mixer/paths/analog-output-speaker-always.conf | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/modules/alsa/mixer/paths/analog-output-speaker-always.conf b/src/modules/alsa/mixer/paths/analog-output-speaker-always.conf +index 599cfc85f0d2..71f356dce00b 100644 +--- a/src/modules/alsa/mixer/paths/analog-output-speaker-always.conf ++++ b/src/modules/alsa/mixer/paths/analog-output-speaker-always.conf +@@ -49,6 +49,10 @@ state.unplugged = unknown + state.plugged = no + state.unplugged = unknown + ++[Jack Dock Line Out] ++state.plugged = no ++state.unplugged = unknown ++ + [Element Hardware Master] + switch = mute + volume = merge +-- +2.6.1 + diff --git a/0004-module-alsa-card-Report-available-ports-before-unava.patch b/0004-module-alsa-card-Report-available-ports-before-unava.patch new file mode 100644 index 0000000..90f2633 --- /dev/null +++ b/0004-module-alsa-card-Report-available-ports-before-unava.patch @@ -0,0 +1,92 @@ +From 91313e60a81e96ce976f24c522656c57b4ab94ca Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Tue, 5 May 2015 17:01:13 +0200 +Subject: [PATCH] module-alsa-card: Report available ports before unavailable + ones + +In case the same jack causes one port to become available and another +one unavailable, the available should be reported first. + +This is to avoid unnecessary changes: e g, consider a 'Headphone Jack' +making 'Headphone' available and 'Speaker' unavailable. In case the +unavailable change triggers first, and there is also a currently available +third port (e g 'Digital out'), the routing system might choose to route +to this port because neither of the 'Speaker' and 'Headphone' ports are +available. + +Signed-off-by: David Henningsson +--- + src/modules/alsa/module-alsa-card.c | 31 +++++++++++++++++++++++++------ + 1 file changed, 25 insertions(+), 6 deletions(-) + +--- a/src/modules/alsa/module-alsa-card.c ++++ b/src/modules/alsa/module-alsa-card.c +@@ -304,7 +304,7 @@ static void init_profile(struct userdata + am->source = pa_alsa_source_new(u->module, u->modargs, __FILE__, u->card, am); + } + +-static void report_port_state(pa_device_port *p, struct userdata *u) { ++static pa_available_t calc_port_state(pa_device_port *p, struct userdata *u) { + void *state; + pa_alsa_jack *jack; + pa_available_t pa = PA_AVAILABLE_UNKNOWN; +@@ -348,10 +348,14 @@ static void report_port_state(pa_device_ + pa = cpa; + } + } +- +- pa_device_port_set_available(p, pa); ++ return pa; + } + ++struct temp_port_avail { ++ pa_device_port *port; ++ pa_available_t avail; ++}; ++ + static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) { + struct userdata *u = snd_mixer_elem_get_callback_private(melem); + snd_hctl_elem_t *elem = snd_mixer_elem_get_private(melem); +@@ -359,7 +363,7 @@ static int report_jack_state(snd_mixer_e + bool plugged_in; + void *state; + pa_alsa_jack *jack; +- pa_device_port *port; ++ struct temp_port_avail *tp, *tports; + + pa_assert(u); + +@@ -376,6 +380,8 @@ static int report_jack_state(snd_mixer_e + + pa_log_debug("Jack '%s' is now %s", pa_strnull(snd_hctl_elem_get_name(elem)), plugged_in ? "plugged in" : "unplugged"); + ++ tports = tp = pa_xnew0(struct temp_port_avail, pa_hashmap_size(u->jacks)+1); ++ + PA_HASHMAP_FOREACH(jack, u->jacks, state) + if (jack->melem == melem) { + pa_alsa_jack_set_plugged_in(jack, plugged_in); +@@ -388,9 +394,22 @@ static int report_jack_state(snd_mixer_e + + /* When not using UCM, we have to do the jack state -> port + * availability mapping ourselves. */ +- pa_assert_se(port = jack->path->port); +- report_port_state(port, u); ++ pa_assert_se(tp->port = jack->path->port); ++ tp->avail = calc_port_state(tp->port, u); ++ tp++; + } ++ ++ /* Report available ports before unavailable ones: in case port 1 becomes available when port 2 becomes unavailable, ++ this prevents an unnecessary switch port 1 -> port 3 -> port 2 */ ++ ++ for (tp = tports; tp->port; tp++) ++ if (tp->avail != PA_AVAILABLE_NO) ++ pa_device_port_set_available(tp->port, tp->avail); ++ for (tp = tports; tp->port; tp++) ++ if (tp->avail == PA_AVAILABLE_NO) ++ pa_device_port_set_available(tp->port, tp->avail); ++ ++ pa_xfree(tports); + return 0; + } + diff --git a/pulseaudio.changes b/pulseaudio.changes index 700bcc5..8762a24 100644 --- a/pulseaudio.changes +++ b/pulseaudio.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Oct 20 14:44:13 CEST 2015 - tiwai@suse.de + +- Fix another alsa-mixer path for dock line out jack (boo#948979): + 0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch +- Fix the order of ports updates (boo#948979): + 0004-module-alsa-card-Report-available-ports-before-unava.patch + ------------------------------------------------------------------- Sat Oct 17 09:21:39 CEST 2015 - tiwai@suse.de diff --git a/pulseaudio.spec b/pulseaudio.spec index 8be41fa..4703377 100644 --- a/pulseaudio.spec +++ b/pulseaudio.spec @@ -50,6 +50,10 @@ Patch3: disable-srbchannel.patch Patch4: pstream-Fix-use-after-free-in-srb_callback.patch # PATCH-FIX-UPSTREAM 0002-alsa-mixer-Recognize-Dock-Line-Out-jack.patch boo#934850 Patch102: 0002-alsa-mixer-Recognize-Dock-Line-Out-jack.patch +# PATCH-FIX-UPSTREAM 0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch boo#948979 +Patch103: 0003-alsa-mixer-Add-Dock-Line-Out-jack-handling-to-analog.patch +# PATCH-FIX-UPSTREAM 0004-module-alsa-card-Report-available-ports-before-unava.patch boo#948979 +Patch104: 0004-module-alsa-card-Report-available-ports-before-unava.patch BuildRequires: alsa-devel >= 1.0.19 # require only minimal bluez, if we are on bluez 5 we will determine in build phase BuildRequires: bluez-devel >= 4.99 @@ -334,6 +338,8 @@ Optional dependency offering zsh completion for various PulseAudio utilities %endif %patch4 -p1 %patch102 -p1 +%patch103 -p1 +%patch104 -p1 %build echo 'HTML_TIMESTAMP=NO' >> doxygen/doxygen.conf.in