Commit graph

515 commits

Author SHA1 Message Date
Tanu Kaskinen
d2bed5332a ucm: Create only one jack object per kcontrol
Previously the UCM code created one jack object per device name (which
is not the same thing as creating one jack object per device, because
the UCM device namespace is scoped on per-verb basis, so devices in
different verbs may have the same name). I think it's conceptually
cleaner to create one jack object per alsa kcontrol. I plan to do
similar refactoring on the traditional mixer code later.
2015-08-21 14:33:11 +03:00
Tanu Kaskinen
c9557e6969 alsa: Move UCM port availability updating to the mixer code
Previously module-alsa-card assigned to pa_alsa_jack.plugged_in
directly, and then did the port availability updating manually. The
idea of pa_alsa_jack_set_plugged_in() is to move the availability
updating to the mixer infrastructure, where it really belongs.

Similarly, pa_alsa_jack.has_control was previously modified directly
from several places. The has_control field affects the port
availability, and pa_alsa_jack_set_has_control() takes care of
updating the availability.

For now, pa_alsa_jack_set_plugged_in() and
pa_alsa_jack_set_has_control() only update the port availability
when using UCM. My plan is to adapt the traditional mixer code later.
2015-08-21 14:33:11 +03:00
Tanu Kaskinen
40714b6bcc alsa: Add associations between jacks, UCM devices and UCM ports
These associations will be used by subsequent UCM jack detection
refactoring work.
2015-08-21 14:33:10 +03:00
Tanu Kaskinen
d7ce78b234 ucm: Don't create separate input and output jacks
The UCM spec doesn't support separate input and output jacks, so it's
redundant to have separate input and output jacks in
pa_alsa_ucm_device.
2015-08-21 14:33:10 +03:00
Tanu Kaskinen
f5fecff0b4 alsa: Add pa_alsa_jack_new() and pa_alsa_jack_free()
This reduces code duplication in alsa-mixer.c and alsa-ucm.c. No
functional changes.
2015-08-21 14:33:10 +03:00
David Henningsson
c50766b52a alsa-mixer: Add "Front Line Out" and "Rear Line Out"
"Front Line Out" was found in the wild on one of the machines we enable.
I figured I could just as well add "Rear Line Out" too, because that's
just as likely to show up.

As a reminder, "Front Line Out" means "a line out jack physically located
on the front side", where as "Line Out Front" means "a line out jack
playing back front left and front right channels in a channel map".

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-08-21 13:28:32 +02:00
Tanu Kaskinen
74b0fb45e5 alsa-mixer: Add descriptions for analog-stereo-input and analog-stereo-output mappings
These mapping names are used in sb-omni-surround-5.1.conf, which needs
to use separate mappings for input and output, since they are
associated with different alsa devices.
2015-08-21 11:25:26 +03:00
Deepak Srivastava
a3bf429efd Removed exclamation marks from user-visible messages.
<EP-E358F00C1D9A449EAE69225B9D2530F8>
According to rationale-"http://techbase.kde.org/Projects/Usability/HIG/Exclamation_points" as suggested in reported bug.
Component: misc

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=78563

Signed-off-by: Deepak Srivastava <srivastava.d@samsung.com>
2015-08-14 12:17:02 +03:00
David Henningsson
5598923b8e alsa-mixer: Make line out path unavailable when "Front Headphone" is plugged in
This case was apparently overlooked.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-05-05 16:48:11 +02:00
David Henningsson
6db74fc3c7 alsa-mixer: Add paths/ports for multichannel profile
This makes the GUIs (e g gnome/unity-control-center) look more consistent
with other inputs/outputs that also have ports.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-04-10 16:08:24 +02:00
David Henningsson
02dc6d84ed alsa-mixer: Use separate profiles for Multichannel Input/Output
This works around bug 80850: a mapping can only have one channel map,
and in case of a 6-out 10-in device, the mapping will be adjusted to
have both 10 and 6 channels, which does not work.

Reported-by: Benjamin Tegge <benjaminosm@googlemail.com>
Suggested-by: Raymond Yau <superquad.vortex2@gmail.com>
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=80850
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-04-10 16:08:24 +02:00
David Henningsson
6eae0d4bf4 module-alsa-card: use pa_module_hook_connect
Refactoring, no functional change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-04-10 09:26:45 +02:00
Tanu Kaskinen
85f5d93306 ucm: Add support for "JackControl"
JackControl is used to indicate the kcontrol name for jack detection.
2015-03-23 19:26:03 +02:00
Tanu Kaskinen
006bf0fb34 alsa: Don't access pa_sink/source_new_data after done() has been called
This change doesn't affect behaviour, because accessing boolean fields
in the new data was safe even after the done() call, but it was still
bad style.
2015-02-23 20:11:26 +02:00
Peter Meerwald
2dca000215 alsa: Fix spelling of officially
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-23 16:37:52 +01:00
David Henningsson
838742b06e alsa-util: Make two of the warnings "debug" instead of "error"
...because we will later try with plug:* which will probably succeed,
so this is not an error.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-02-16 10:41:54 +01:00
Peter Meerwald
55a25246ee alsa-util: No logging when sound card only supports non-interleaved sample format
as suggested by
https://bugs.freedesktop.org/show_bug.cgi?id=84804

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2015-02-16 10:35:45 +01:00
Tanu Kaskinen
82ec47898e alsa: Don't try to use ELD controls with UCM
This fixes a crash that occurred when trying to access non-existent
port data. Doing this:

    pa_alsa_port_data *data = PA_DEVICE_PORT_DATA(port);

is not a good idea when using UCM, because in the UCM mode ports don't
have any data, so the data pointer points to some random memory.
2015-02-12 15:06:59 +02:00
David Henningsson
5cc3d4aa9d alsa-mixer: Make speaker unavailable when Line Out is plugged in
ALSA mutes speaker when Line Out is plugged in by default, so
we should follow that convention.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-01-29 10:24:35 -05:00
Tanu Kaskinen
f75335f25c alsa-mixer: Add lineout to surround21 mappings
This makes the analog-surround-21 mapping consistent with other
surround mappings. I'm not sure if this makes any practical
difference, though.
2015-01-29 10:18:41 -05:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
David Henningsson
9d0a5b5cb7 alsa-mixer: Mute headphones and speakers on line out path
When line out path is active, we want to mute speakers for obvious
reasons, and headphones to avoid volume spikes.

Reported-by: TienFu Chen <tienfu.chen@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-01-13 13:58:01 +01:00
Boris Egorov
3e6ce485f0 alsa-util: fix parenthesis position in err assignment
Issue detected by CppCheck and PVS Studio
2015-01-13 11:27:46 +01:00
Peter Meerwald
275ffb3657 alsa-mixer: Use pa_assert_not_reached()
get rid of the following warning when compiling with NDEBUG:

modules/alsa/alsa-mixer.c: In function 'element_is_subset':
modules/alsa/alsa-mixer.c:3125:18: warning: 'a_limit' may be used uninitialized in this function [-Wmaybe-uninitialized]
             long a_limit;

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-17 13:25:15 +01:00
Peter Meerwald
a058a4b7a3 alsa-util: Finish description of pa_alsa_set_hw_params()
... which stops mid-sentence and logging cleanup

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-17 13:12:59 +01:00
Sjoerd Simons
d5fec4ca7a Alsa: Correct port availability with multiple jacks
In case there are two independent jacks for one port (e.g. Dock
Headphone Jack and Headphone Jack), the availability ends up being
incorrect if the first one was _NO (not plugged) and the second gets
_YES (plugged). Also pulse complains about the state being inconsistent
which isn't true.

Fix this by preferring more precise states (yes/no) over unknown and yes
over others. However in case a plugged jack makes the port unavailable
let that overrule everything else.
2014-11-17 13:00:22 +01:00
Peter Meerwald
fa092af59c rtpoll: Drop extra wait_op argument to pa_rtpoll_run()
is always true, not used

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-09 22:53:06 +01:00
Peter Meerwald
8bbdae0ae8 alsa: Precompute maximum frames per block
frames_per_block is the mempool's maximum block size in frames

v2 (thanks David Henningson)
* rename max_frames to frames_per_block

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-09 22:36:39 +01:00
David Henningsson
aec811798c alsa-mixer: Add support for "Headphone+LO" and "Speaker+LO"
These two control names are currently being added to the HDA driver,
so let's support them in PulseAudio as well.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-11-06 16:29:48 +01:00
Sjoerd Simons
66f97c35bd alsa-mixer: Disable line-out if headphone jack is plugged
Line-out gets muted when headphones are plugged in on HDA cards, encode
this in the line-out path so pulse can match that state.
2014-11-03 08:52:09 +01:00
Tanu Kaskinen
717834086c alsa-mixer: Ignore some elements in the analog-output path
The analog-output path should be suppressed when there are more
specific paths available. Currently that usually doesn't happen. The
suppression can be done with the path subset detection, and this patch
makes that work (another approach would be to mark the elements as
required-absent, like analog-input does, but I like the subset
suppression more, because it requires less stuff in the configuration
files). The problem with listing the now-removed elements in
analog-output.conf was that if the sound card had e.g. a Speaker
element, then the switch behaviour was different between analog-output
and analog-output-speakers, so analog-output was not considered a
subset of analog-output-speakers.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=74609
2014-10-31 14:30:22 +02:00
Peter Meerwald
b7e763bab4 alsa-sink: Check for after-avail is redundant
after-avail is always false at this point

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
e798969fd5 modules: Fix )== typos
add a space between ) and ==

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Tanu Kaskinen
052316e419 alsa-mixer: Merge analog-output-desktop-speaker with analog-output-speaker(-always)
According to David[1], it's unlikely that there are any sound cards
that would have separate "speaker" and "desktop speaker" paths, so
let's remove the unnecessary distinction.

[1] http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/20915/focus=21193
2014-10-28 12:29:43 +02:00
David Henningsson
300a5e3ed7 alsa: Remove unnecessary hctl handles being passed around
Now that we have switched to using the mixer handle only,
there is no use for sending hctl handles around.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
David Henningsson
f2120fc2b6 alsa-mixer/card: Move to use the new mixer interface
Use the new mixer API to get callbacks, instead of using the hctl
API. Using the hctl API caused a memory leak, because alsa-lib itself
used the hctl callbacks, which we were previously overriding.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
David Henningsson
1fd8848e64 alsa-util: Add functions for accessing mixer elements through mixer class
Instead of using the hctl interface, we can find controls belonging
to other iface types than "mixer". We do this by introducing a new
mixer class "SND_MIXER_ELEM_PULSEAUDIO" and create snd_mixer_elem's
for all PCM and CARD iface types (as Jacks are of the CARD type and
ELD controls are of the PCM type).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
Sjoerd Simons
594da41d07 alsa-mixer: recognize Dock headphone jack
Recognize the Dock headphone jack in the same way the normal & front
headphone jacks are detected.

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
2014-09-10 09:59:00 +02:00
David Henningsson
b8656afe4a alsa-mixer: Improve workaround for Valgrind's false warnings
Valgrind is not correctly handling ALSA TLV syscalls, which leads
to false warnings, looking like this:
 "Conditional jump or move depends on uninitialised value(s)"

Unfortunately, alsa-lib itself also uses these values which valgrind
falsely believe are uninitialized, so not all warnings are removed,
but this is what we can do from PA until the valgrind bug is fixed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-08 13:05:10 +02:00
Tanu Kaskinen
610704d225 alsa-mixer: Mark "Line HP Swap" as required-any
In the (theoretical) case that no other elements exists but
"Line HP Swap", the presence of that element signals that there are
headphone and line-out outputs, otherwise there would be nothing to
swap.
2014-09-08 11:26:00 +03:00
David Henningsson
2575b102b9 alsa: Remove four channel input profile
With the new multichannel profile, we can remove this one and
handle the four channel input as a generic multichannel fallback.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-23 15:54:13 +02:00
Tanu Kaskinen
facfd3a664 alsa-mixer: Fix path subset detection
The old logic assumed that if path A was a subset of path B, the
element list in B would have all elements of A in the beginning of
B's list, in the same order as A. This assumption was invalid, causing
some subset cases to not get detected. We need to search through the
full element list of B every time before we can conclude that B
doesn't have the element that we're inspecting.
2014-08-18 13:44:44 +03:00
David Henningsson
48edd0a00f alsa: Add a multichannel fallback mapping
In case all other profiles fail, try this fallback mapping as well.
It allows the device to specify the channel count, so it can be used
for devices that only supports being opened in multichannel mode.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
David Henningsson
c15107eaf6 alsa: Allow "fallback" configuration for mappings and profiles
A fallback mapping or profile will only be considered for probing
if all non-fallback profiles fail.

If auto-profiles are used, a profile made up of one non-fallback
mapping and one fallback mapping will be considered a fallback profile.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
David Henningsson
be8311417c alsa: Add "exact-channels" mapping configurability
Allow a mapping to relax the exact channel restriction:

exact-channels = yes | no # If no, and the exact number of channels is not supported,
                          # allow device to be opened with another channel count

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
Alexander E. Patrakov
afbe9605c6 alsa: Add extra HDMI mappings
Remove extra-hdmi.conf, as the performance reasons behind it are invalid
Add 7.1 profiles
Add extra HDMI devices, for a total of 8
Add DTS-encoded profiles (they need dcaenc from git)

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2014-08-01 11:01:02 +02:00
David Henningsson
3f140f9022 alsa-mixer: Add surround 2.1 profile
Surround 2.1 is one of the more common surround profiles these days,
so it's about time we support it.

The "surround21" was added to alsa-lib a few months ago, and there
hasn't yet been an alsa-lib release since, but I doubt it will change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-05-27 12:02:31 +02:00
Tanu Kaskinen
e4a7625ba8 sink, source: Assign to s->muted from only one place
Forcing all mute changes to go through set_mute() makes it easier to
check where the muted field is changed, and it also allows us to have
only one place where notifications for changed mute are sent.
2014-05-02 16:00:49 +03:00
Tanu Kaskinen
eca082a93f Use pa_hashmap_remove_and_free() where appropriate 2014-04-17 10:06:23 +03:00
Alexander E. Patrakov
a5ba31bf96 Name HDMI outputs uniquely
On Haswell hardware, there are multiple HDMI outputs capable of
digital sound output. As they were identically named, KDE's control
center was unable to distinguish them, restored the wrong profile and
thus routed sound to the wrong HDMI monitor.

Also, having identically-named menu items in other mixer applications
looks like a bug.
2014-04-15 09:03:55 +02:00