Commit graph

367 commits

Author SHA1 Message Date
Feng Wei
dae4b83dd0 alsa: Add UCM jack detection
Jack in UCM is decided by UCM device name, although in fact
not all UCM devices have "jacks". Because port is also mapped
to UCM device, we can always find target port when some jack
event happens.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
2012-07-16 17:08:28 +05:30
Feng Wei
c19d108219 alsa: Integrate UCM basic functions
UCM basic functions will provide another way to handle the alsa mixer
and controls. That means alsa card module will make use of alsa ucm
configurations provided by various audio systems instead of mixer and
paths configurations provided by PA. PA profiles come from UCM verb, PA
sinks/sources and ports come from UCM devices.

In case the proper UCM configurations are found, ucm branches are
activated, or we will still fall through to the original way.

Signed-off-by: Feng Wei <wei.feng@freescale.com>
2012-07-16 17:08:28 +05:30
David Henningsson
7369a53ab5 alsa-mixer: Add "Headphone Mic" support for 3-pin ASUS netbooks
Some ASUS netbooks, such as the 1015 CX, have only one 3.5 mm jack,
but it can be used either as a headphone or as a mic (but not both
simultaneously).

This patch adds support for the "Headphone Mic" path that is used
on these devices, so that we can use the jack as an external mic, and
doing so without muting the speaker.

BugLink: https://bugs.launchpad.net/bugs/1018262
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-13 11:29:48 +02:00
Jarkko Nikula
079569753e alsa: Merge pa_alsa_setting_select with pa_alsa_path_select
As these functions are called together and are related, we might merge
them and call setting_select from pa_alsa_path_select by passing
optional pa_alsa_setting argument.

Make also the setting_select static as it is not called outside of
alsa-mixer.c after this change.

[Additional note from Tanu Kaskinen: this change improves the
mute-during-activation feature, because now the mixer changes related
to selecting the setting happen while the hw is muted.]
2012-07-06 20:38:10 +03:00
Jarkko Nikula
fbb13a0dc6 alsa: move pa_alsa_setting_select close to pa_alsa_path_select
Move pa_alsa_setting_select call just after the pa_alsa_path_select in
[sink | source]_set_port_cb functions as there is no dependency to volume
calculations that are done between these two calls. Idea here is to make
possible to merge these two functions since they are called together from
other places too.
2012-07-06 20:38:10 +03:00
Tanu Kaskinen
8417cac4f6 alsa-mixer: Implement a new path option: "mute-during-activation". 2012-07-06 20:38:03 +03:00
David Henningsson
47b31ce6ad alsa-mixer: Add "Front Headphone Jack" (fixup)
I forgot half of the front headphone patch, i e, to hide the
speaker output when the front headphone is connected. Thanks to
Shih-Yuan Lee for noticing.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-03 10:31:30 +02:00
David Henningsson
270b1a7d74 alsa-mixer: Document "state.plugged" and "state.unplugged"
Put explanation of state.plugged and state.unplugged in
analog-output.conf.common.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-02 12:22:49 +02:00
David Henningsson
12a53524b3 alsa-mixer: Add "Front Headphone" jack
Many desktops have headphone on the front and line outs on the back.
Sometimes this means that the headphone is labelled "Front Headphone Jack",
but the volume controls are only "Headphone Playback Volume", i e,
without the "Front" prefix.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-02 12:22:48 +02:00
David Henningsson
004934ecaf alsa-mixer: Always turn "Inverted Internal Mic" off
Some devices have inverted right channel, so when you add left and right,
the result is silence, or very faint sound. In recent kernels (3.5,
perhaps also 3.4) these are starting to be marked with a special
"Inverted Internal Mic" capture switch.

While we might want to add some reverse summing mechanism in the
future, for now, we just turn the thing off to avoid the problem of
recording silence.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-02 12:21:16 +02:00
David Henningsson
0621b1f99c alsa-mixer: Add Phantom Jack support
For kernel 3.6, "phantom jack" kctls have been added. They serve as
a marker that a particular port exist. They were made so we can detect
that there actually are speakers and internal mic on a laptop, even if
there are no other indications (volume controls etc).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-02 12:21:16 +02:00
David Henningsson
16e4ef5df2 alsa-mixer: Add special profiles for some laptops missing speaker and/or internal mic
Several laptops have speaker ports, and/or internal mic ports, but we have
no way of detecting that. So we make the port(s) always show up for these
devices.

BugLink: https://bugs.launchpad.net/bugs/946232
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-07-02 12:21:16 +02:00
Paul Menzel
86996b4cc8 Fix spelling of separated: s, sepera, separa, g
The used command for fixing the script is the following.

    $ git grep sepera | cut --delimiter=: --fields=1 | xargs sed -i s,sepera,separa,g

This patch is motivated by a patch in Debian from Martin-Éric Racine [1].

[1] http://anonscm.debian.org/gitweb/?p=pkg-pulseaudio/pulseaudio.git;a=commitdiff;h=70e7261a615141908c0cf366fd49e0fc0f550fbf
2012-06-30 13:53:58 +03:00
Tanu Kaskinen
12af302ac7 card: Ensure that there's always at least one profile.
In practice there is always at least one profile, and I
don't think there will ever be cards without profiles.
Therefore, I added assertions to pa_card_new() stating that
the card new data must always contain at least one profile.
Now a lot of code can be simplified, because it's guaranteed
that the profiles hashmap and the active_profile field are
always non-NULL.
2012-06-29 14:24:43 +03:00
Tanu Kaskinen
1a6da64b16 sink, source: Always create a hashmap for ports.
Having the hashmap sometimes NULL requires a lot of checking
here and there, so ensuring that the hashmap is always
non-NULL simplifies the code.
2012-06-29 14:24:43 +03:00
Tanu Kaskinen
88052dbdb9 alsa-mixer: Add support for defining port property lists in the path configuration files. 2012-06-29 13:24:52 +03:00
Tanu Kaskinen
d3bced8bee conf-parser: Add support for parsing property lists. 2012-06-29 13:23:07 +03:00
Tanu Kaskinen
7449f6d9e5 conf-parser: Pass parser state in a struct also for parse callbacks.
As suggested by Maarten Bosmans:
http://article.gmane.org/gmane.comp.audio.pulseaudio.general/12079
2012-06-29 13:23:07 +03:00
Arti Trivedi Bora
e5954aca8e modules: Use pa_streq instead of strcmp. 2012-06-09 16:21:41 +03:00
Tanu Kaskinen
de95e1c0c8 device-port: Create the profiles hashmap at initialization.
I doesn't make sense to require all callers of
pa_device_port_new() to create the hashmap themselves. There
are and there will be no cases where a port without any
profiles would be desired.
2012-06-08 16:28:22 +03:00
Eero Nurkkala
fdfea553fd alsa-source: add missing header 'signal.h'
Compilation with -DDEBUG_TIMING fails due to a missing header:

modules/alsa/alsa-source.c: In function 'check_left_to_record':
modules/alsa/alsa-source.c:426:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
modules/alsa/alsa-source.c:426:9: error: 'SIGTRAP' undeclared (first use in this function)

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2012-05-31 14:25:27 +02:00
Eero Nurkkala
79c0d52a39 alsa-sink: add missing header 'signal.h'
Compilation with -DDEBUG_TIMING fails due to a missing header:

modules/alsa/alsa-sink.c: In function 'check_left_to_play':
modules/alsa/alsa-sink.c:453:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
modules/alsa/alsa-sink.c:453:9: error: 'SIGTRAP' undeclared (first use in this function)

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2012-05-31 14:25:23 +02:00
Lennart Poettering
77c5901df2 build-sys: remove HAL support, it's obsolete since years 2012-05-15 16:06:42 +02:00
Paul Menzel
e54b0fa6c9 Correct spelling of PulseAudio
• s,Pulseaudio,PulseAudio,
• One last occurence of this “error” is in the French translation.
2012-05-11 18:25:36 +05:30
Tanu Kaskinen
7bb8442c11 alsa: Add support for sound cards with 4-channel input.
Changes in v2:
 - Call the mapping a generic 4-channel input mapping
   instead of a 4-channel mic array mapping. The mapping
   will be used also by sound cards that have two stereo
   input jacks, so in those cases talking about mic arrays
   is wrong.
 - Added a comment about using the "hw" device name.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=45813
2012-05-11 16:55:29 +05:30
Colin Guthrie
e1d551f364 alsa: Add the DTS/DCA mapping to extra-hdmi.conf too.
This is needed for 0b421f on Intel/NVidia hardware.
2012-04-15 13:43:14 +01:00
David Henningsson
6961d3e1c7 alsa-sink/source: Make sure volumes are synchronised after fast user switching
Log in as user A, fast user switch to user B, let user B change
port, volume or mute status, then switch back to user A.

At this point we must make sure that the ALSA and PA volumes are
synchronised by writing to the ALSA mixer when the ALSA device
becomes available.

BugLink: https://bugs.launchpad.net/bugs/915035
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-04-12 00:13:11 +02:00
David Henningsson
87edc1ccb0 alsa-sink/source: Really set volumes on port change
If deferred volumes were activated, set_volume does not really set
the volume, and is probably only meant to be called from the main
thread.
As we're currently really setting the port and the mute here (i e
modifying ALSA), we should really modify the volume as well.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-04-04 14:36:43 +02:00
Tanu Kaskinen
5a26404f12 alsa: Fix SND_MIXER_SCHN_LAST related stuff.
Valid channel id range is from 0 to SND_MIXER_SCHN_LAST,
inclusive, so the size of the masks array in pa_alsa_element
has to be SND_MIXER_SCHN_LAST + 1. Similar "too small"
arrays were also in alsa-sink's and alsa-source's userdata,
but actually those arrays were not used at all so they were
removed.

element_is_subset() in alsa-mixer.c skipped the last channel
id when iterating the element masks array; that's now fixed
as well.

Thanks to David Henningsson for spotting the too small
arrays in alsa-sink and alsa-source and the
element_is_subset() problem.
2012-03-28 17:32:04 +03:00
David Henningsson
6e449eca9a Fix input device for M-audio fasttrack pro
Some M-audio fasttrack pro devices, the input device is at index 1 instead of index 0.
According to
http://mailman.alsa-project.org/pipermail/alsa-devel/2012-March/050701.html
the reason for this is probably that the device has mutually exclusive
analog and digital input. With this patch we can catch the input regardless
of state.

BugLink: https://bugs.launchpad.net/bugs/569932
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-28 13:19:46 +02:00
David Henningsson
f1a36e84a7 alsa-mixer: Fix a small issue when detecting required-any
If somebody writes the line "required-any=ignore", that shouldn't
mean a required-any element needs to be present for the path to
succeed probing.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-26 10:45:52 +02:00
David Henningsson
2577cc81b3 alsa-mixer: Show HDMI ports for older Nvidia cards
Some older cards do not have jack detection. This patch makes the
port still show up.
An implementation detail: the "required = ignore" line has in itself
no effect, but we have to write *something* there, or else the entire
jack detection section will be ignored by the parser.

BugLink: https://bugs.launchpad.net/bugs/961286
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-26 10:31:47 +02:00
Deng Zhenrong
737a6180d4 fix compilation warning via PRI prefix
modules/alsa/alsa-mixer.c:3110:21:
    warning: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'pa_channel_position_mask_t' [-Wformat]
modules/alsa/alsa-mixer.c:3110:21:
    warning: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'pa_channel_position_mask_t' [-Wformat]

pa_channel_position_mask_t is type defined to uint64_t, and to display
uint64_t, it's better to use PRIx64 primitives.

Signed-off-by: Deng Zhenrong <dzrongg@gmail.com>
2012-03-23 10:37:23 +01:00
David Henningsson
fa80315b2c alsa-mixer: Don't remove paths if jacks state.(un)plugged differ
If the jack state differs, they are not the same path, so don't
remove them.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-12 10:49:50 +00:00
David Henningsson
e02cb7fb2e alsa-mixer: Make speaker get available=no when headphones are plugged in
While developing the new UI we had to ask ourselves the question of whether
"speakers" should be considered available when headphones are plugged in.
In most cases, they are not available and therefore we should list them
as such.

OTOH, we don't want unplugging the headphones to be considered an act of
wanting to use the speakers (the user might prefer HDMI), and there might
be line-outs that keeps the speakers from unmuting anyway. So, at this point,
I think the most reasonable would be to make the speakers have
PA_PORT_AVAILABLE_NO when headphones are plugged in and
PA_PORT_AVAILABLE_UNKNOWN when they are not. But we might want to revisit
this decision once we have the priority lists up and running.

The same reasoning applies for "Internal Mic", which should become unavailable
when any other mic is plugged in.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-11 12:23:46 +05:30
David Henningsson
56018683b1 alsa: Add port information to HDMI profiles
For Nvidia and Intel, support probing of up to four HDMI devices.
Also add port information to all HDMI profiles.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-11 12:23:46 +05:30
David Henningsson
dedf1340c6 alsa: Jack detection kcontrol implementation
Support the new jack detection interface implemented in Linux 3.3
(and Ubuntu's 3.2 kernel).

Jacks are probed and detected using the snd_hctl_* commands, which
means we need to listen to them using fdlists. As this detection
needs to be active even if there is currently no sink for the jack,
so this polling is done on the card level.

Also add configuration support in paths, like this:
[Jack Headphone]
required-any = any

...where 'Jack Headphone' should match 'Headphone Jack' as given by
ALSA (as seen in e g 'amixer controls').
"Required", "required-any" and "required-absent" is supported. Using
required-any, one can have several ports even though there is no
other indication in the mixer that this path exists.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-11 12:23:46 +05:30
Alexander E. Patrakov
0b421f0d93 alsa: add DTS profile
Hi. Could you please apply the attached trivial patch so that I could drop
the corresponding instructions from dcaenc's README file in the future? It
adds a profile for on-the-fly DTS encoding, similar to the existing AC3
profile.

--
Alexander E. Patrakov
>From 22310a1c28385acc7ce883e020b9eb2e5b0813b7 Mon Sep 17 00:00:00 2001
From: "Alexander E. Patrakov" <patrakov@gmail.com>
Date: Sun, 12 Feb 2012 17:19:48 +0600
Subject: [PATCH] alsa: add DTS profile

This requires dcaenc from http://aepatrakov.narod.ru/dcaenc/
2012-02-21 08:52:13 +05:30
David Henningsson
13a84d0747 alsa-mixer: Don't use dangling pointers as port hashmap keys
If alsa settings/options were used, the string to construct the
name was freed, leading to dangling pointers to strings inside
the hashmap.

BugLink: https://bugs.launchpad.net/bugs/932804
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-02-19 22:45:41 +05:30
Peter Meerwald
db8fa449e4 alsa: fix comment 2012-02-10 17:21:31 +05:30
David Henningsson
91b2500597 alsa-mixer: Take override-maps into account in subset elimination
The practical problem is that some users were left with only one
"LFE on Mono" port, as analog-output was considered a subset of
analog-output-lfe-on-mono. Which was not what they wanted.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=40910
BugLink: https://bugs.launchpad.net/bugs/922656
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-02-02 12:41:51 +00:00
David Henningsson
43a705ae18 alsa-mixer: Make sure unsupported paths are removed after probing
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-30 11:17:08 +00:00
Colin Guthrie
0e1f1d6444 i18n: Do not translate strings that cannot have any sensible translations. 2012-01-30 11:17:07 +00:00
David Henningsson
13e1c4bdee alsa: Improve "well known descriptions" for ports
* If we don't have "Digital Speakers", we should say "Speakers"
   instead of "Analog Speakers", and similar for other ports.
 * Change "IEC958" to "S/PDIF" (more well known name)
 * Add new ports and mappings for HDMI
 * Change "Internal" to "Built-in" for the card name

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-30 11:17:07 +00:00
David Henningsson
6c5eba6914 alsa-mixer: Allow speaker port to control "Front Speaker"
"Front Speaker", "Surround Speaker" seems to be a common enough name
to make it into alsa-utils, so we should probably care about it as
well. In this case, there was a macbook pro whose speakers didn't work
without these controls.

BugLink: http://bugs.launchpad.net/bugs/551441
Reported-by: Jeroen T. Vermeulen <jtv@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-30 11:17:07 +00:00
David Henningsson
c5dcf5723b alsa: Fix log message "synchronous volume" -> "deferred volume"
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-17 16:58:40 +05:30
Arun Raghavan
413adcf964 alsa-mixer: Fix mixer path for AC3 profiles
The recent change to turn off the IEC958 element for analog paths
exposed a bug in AC3 profiles. These were inheriting the analog output
path instead of explicitly selecting the iec958 path.

Thanks to David Henningsson for pointing this out.
2012-01-17 16:58:40 +05:30
Arun Raghavan
42ebc01ee9 alsa-mixer: Turn off the IEC958 element for analog outputs
This is needed for the Creative Audigy CA0106 to work. Also makes sure
that the LED for optical out is shut down in analog modes on MacBooks
(these share a port for analog and digital output).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=44741
2012-01-14 10:19:17 +05:30
Peter Meerwald
7ea740b2c8 alsa: Mention correct ALSA function in debug log 2012-01-11 22:09:26 +05:30
David Henningsson
45262959e2 alsa-mixer: Refactor pa_alsa_profile_set_probe().
Increase readability of the pa_alsa_profile_set_probe function of
alsa-mixer.c

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-06 12:10:13 +02:00