Commit graph

367 commits

Author SHA1 Message Date
David Henningsson
5905094889 alsa-mixer: When selecting an input, turn off boosts of other inputs
Just like we turn off the "Front Mic" element when we select "Rear Mic",
we should also turn off the "Front Mic Boost" element. And the same for
the other inputs.

Reported-by: Len Owens <len@ovenwerks.net>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-01-05 19:19:56 +05:30
Tanu Kaskinen
ba33ae4790 alsa-mixer: Remove unused pa_alsa_path_set_probe() declaration. 2011-12-05 20:42:44 +02:00
David Henningsson
c1f3f7709f Fixup a few things in the new path probing
* If mapping_probe_paths() fails to open the mixer, all paths are now
removed from the mapping's path sets.
 * pa_path_set.probed isn't really used for anything (removed).
 * If profile probing is configured to be skipped, mapping_paths_probe()
should still be called.

Thanks to Tanu for spotting.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-12-02 17:51:11 +02:00
David Henningsson
426daaf6bb alsa: add card ports and path probe cache
To be able to add ports to all profiles, we need to probe all
profiles at startup. To speed this up, we now have a cache of
probes paths which is owned by the profile set. Since paths
are now owned by the profile set, the path set must now have
a hashmap of paths instead of a linked list.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-12-01 21:49:17 +02:00
David Henningsson
078a39af88 alsa: Ignore the virtual "thinkpad-acpi" card
The thinkpad ACPI driver sometimes creates a virtual sound card,
which at best exposes a volume control. Save some startup time, and
unnecessary error messages in the log, by ignoring it.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-11-30 12:02:03 +00:00
David Henningsson
47f28a5843 Notify port available status changes, and update protocol version
The recommended way of setting available status is to call
pa_device_port_set_available, which will send a subscription event
to the relevant card. It will also fire a hook.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-11-26 16:58:37 +02:00
Arun Raghavan
d320ae029b alsa: Minor debug code cleanup
Remove a trap on underrun and uncomment a couple of useful debug prints
(still enabled only when DEBUG_TIMING is defined).
2011-11-14 10:54:18 +05:30
Lars R. Damerow
1e6eda8eda alsa: fixed_latency_range modarg for module-alsa-card 2011-11-03 21:31:48 +01:00
Lars R. Damerow
7a387fed36 alsa: support fixed latency range in alsa modules
This adds a boolean module parameter to disable automatic dynamic
latency readjustments on underruns, but leaves automatic dynamic
watermark readjustments untouched.
2011-11-03 21:17:54 +01:00
Dylan Reid
77a68b56ab alsa: Set return code before printing it.
The error message for snd_pcm_hw_params_set_period_wakeup was
printing "ret", but "ret" wasn't being set.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
2011-10-26 16:19:45 +02:00
Tanu Kaskinen
12fe756993 alsa: Handle the "profile" modarg in module-alsa-card 2011-10-20 09:28:44 +05:30
Pierre-Louis Bossart
72377fcad5 alsa: fix list of sampling rates
add all standard audio rates

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2011-10-18 09:00:58 +05:30
Arun Raghavan
e67440e220 alsa: Probe sink/source sample rates
This probes sink and source sample rates and uses this information to
validate rate changes and check incoming passthrough formats.
2011-10-17 22:52:47 +05:30
Arun Raghavan
3555634e6e alsa: Remove unused variable 2011-10-17 21:16:23 +05:30
Arun Raghavan
ac469a25c0 sink,source: Add the ability to disable alternat sample rate switching
Setting the alternate sample rate to 0 in config disables this feature.
2011-10-17 20:16:37 +05:30
Pierre-Louis Bossart
b232fbd8f8 alsa: support for alternate sampling rate
This is where the actual changes happen.
Some additional checks would be required to make sure the
rate is actually supported
Tested with both PCM and passthrough streams

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2011-10-17 20:09:50 +05:30
Tanu Kaskinen
a88b1d5cd4 alsa: New modarg "paths_dir" for module-alsa-card
The new module argument can be used to provide a custom
directory for loading alsa path configuration files. This is
useful for testing: no need to be root to create test
configuration files.
2011-10-17 12:54:23 +05:30
David Henningsson
ca6057316d Fix deferred volume not being applied if sink is closed
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-10-17 09:50:16 +05:30
Pierre-Louis Bossart
a103e82029 alsa: reset watermark to initial values on resume
Watermark level and latency values are not restored when
resuming, the values used prior to suspending are reused.
This leads to side effects when underruns happen and buffer
sizes are updated, PulseAudio can never meet lower latency
requirements.

Solution: keep track of watermark and latency values on sink or
source creation, and reapply them on resume to start with
a clean slate.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2011-10-08 14:51:50 +05:30
Arun Raghavan
42d056593d alsa: Make mixer error handling more robust still
Instead of relying on the snd_mixer_* functions failing, we check for
POLLERR and POLLNVAL first. After this, any errors in handling the mixer
events are deemed fatal (that is we cause the ALSA source/sink thread to
terminate).

The case where POLLERR is set but POLLNVAL is not does not actually
occur, but we're making this a soft failure (stop polling the mixer, but
don't kill the I/O thread). If other conditions where POLLERR occurs
turn up, we need to handle them explicitly.

Thanks to Linus Torvalds for helping get this right.
2011-10-05 01:55:15 +05:30
Arun Raghavan
d086f15c91 alsa: Better error handling in mixer rtpoll callback
This improves the error handling in the mixer rtpoll callback. It avoids
a crash if an error occurs (the rtpoll_item is freed but still
referenced), and specifically makes sure we don't continue trying to
poll the device if the card is disconnected.
2011-10-04 12:29:46 +05:30
Arun Raghavan
fc8702ee81 alsa: Give compressed formats preference over PCM
This makes set_formats() put PCM formats lower down the list than
compressed formats since we negotiate by picking the first format in
this list that is also in the client-provided list of possible formats
during sink input creation.

This will be incorrect if we ever decide to do encoding in PA (for
things like AC3/DTS encoding for multichannel output over S/PDIF).
2011-10-04 12:29:32 +05:30
David Henningsson
f8624a7876 sink,source: Avoid crash by not updating volume on shutdown
Sometimes the ALSA mixer can be modified during a point at shutdown
which causes a race condition trying to update the volume of an
unlinked sink.

Includes typo fix by our Chief Typo Spotter, Colin, and a clarifying
comment by me.

BugLink: http://bugs.launchpad.net/bugs/841968
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-09-14 15:47:17 +05:30
Colin Guthrie
aa3142ab20 volume: Rename 'sync volume' to 'deferred volume'.
This just covers Lennart's concern over the terminology used.

The majority of this change is simply the following command:
 grep -rli sync[-_]volume . | xargs sed -i 's/sync_volume/deferred_volume/g;s/PA_SINK_SYNC_VOLUME/PA_SINK_DEFERRED_VOLUME/g;s/PA_SOURCE_SYNC_VOLUME/PA_SOURCE_DEFERRED_VOLUME/g;s/sync-volume/deferred-volume/g'

Some minor tweaks were added on top to tidy up formatting and
a couple of phrases were clarified too.
2011-09-13 21:15:49 +01:00
Antonio Ospite
e93b32744c alsa-mixer: Add support for the Microsoft Kinect Sensor device
The Kinect shows up as a UAC device after the firmware has been loaded,
but in order to be detected by pulseaudio a 4-channels input only
mapping is needed. Provide a new profile for that and set it with a udev
rule.

fdo#39664
2011-09-09 19:48:03 +01:00
Colin Guthrie
db704130d6 alsa: Tidy up argument descriptions 2011-09-07 21:16:03 +01:00
David Henningsson
96369919e5 alsa-mixer: Set "Front" control to 0 dB on headphone path
I've seen more than one system where the volume control named
"Front" is a part of audio path for headphones. This is somewhat
of a compromise: While we don't merge it into the path, as that
would be regressing machines where "Front" isn't a part of the
audio path, it would still enable sound on these machines.

BugLink: http://bugs.launchpad.net/bugs/804178
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-09-03 12:14:54 +02:00
David Henningsson
c862c5caa4 Set better priorities on input paths
The priorities should be set in the approximately likeliness that someone
would like to use them. This is hard to guess of course, but this is
a better guess compared to the existing configuration.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-08-29 10:05:24 +01:00
Maarten Bosmans
c5dca7cf2b More spelling fixes 2011-08-25 11:27:47 +01:00
Arun Raghavan
3179ed71c5 alsa: Fix bad function name
I've no idea how that slipped by.
2011-08-18 10:23:55 +05:30
Arun Raghavan
814c0371a4 alsa: Open iec958 device with NONAUDIO bit set in passthrough mode
This is required for E-AC3 streams, as well as to let receivers we're
sending non-PCM data (which avoids playing noise if the data is
incorrect for some reason).
2011-08-17 23:08:45 +05:30
Arun Raghavan
dde09c7fac alsa: Don't always suspend/unsuspend on sink-input removal
If the sink was already suspended, this avoids and assert when calling
suspend() again, and prevents an unnecessary unsuspend.
2011-08-17 13:33:50 +05:30
David Henningsson
5c86d76554 alsa-mixer: Add "Line HP Swap" element
The "Line HP Swap" element needs to be set correctly for some Dove
boards to work correctly. Thanks to Daniel T Chen for the patch.

BugLink: http://bugs.launchpad.net/bugs/451635
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-08-16 11:59:02 +01:00
David Henningsson
838672974e alsa-mixer: Mute IEC958 optical raw for several Audigy models
This switch needs to be off for analog output to work on several
Audigy cards.

Thanks to Daniel T Chen for the patch.

BugLink: http://bugs.launchpad.net/bugs/408370
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-08-16 11:58:49 +01:00
Arun Raghavan
e25e31fc80 alsa: Set SET_FORMATS flag when appropriate 2011-08-16 11:11:46 +05:30
Arun Raghavan
51fcee8902 alsa: Implement get/set_formats()
This implements the sink get_formats() and set_formats() API in
alsa-sink. Modules can use this to allow users to specify what formats
their receivers support.
2011-08-15 11:51:34 +05:30
Wang Xingchao
be3879e04e alsa: resets POLLOUT event
revents marked as POLLOUT|POLLERR|POLLWRNORM in "underrun" case that will
trigger unexpected log "ALSA woke us up to write new data to the device, but
there was acturally nothing to write...".

This patch avoids this log message.
2011-08-11 15:31:48 +02:00
Wang Xingchao
e564129b8f alsa: Update process_usec before going to sleep
During check_left_to_play/record(), the watermark may increase/decrease. So before
sleeping, update the actural sleep time based on latest watermark.
2011-08-11 15:30:27 +02:00
Maarten Bosmans
b4e938e194 Move i18n.[ch] to src/pulsecore
The header is used in files troughout the tree and is not included in the public api,
so it belongs in pulsecore, not in pulse.
2011-08-11 13:23:42 +02:00
Colin Guthrie
6b1d9b8d6a alsa: Ensure that volumes are written to the h/w at startup.
If the device support SYNC_VOLUMES then we need to do an additional push
to get the actual change on to the h/w.
2011-08-11 10:36:11 +02:00
Colin Guthrie
0b5a181e1b alsa-mixer: Fix rounding direction on mixer initialisation 2011-08-10 10:28:50 +02:00
David Henningsson
5bfcb5d8a0 Fix crash in path subset elimination
As reported in http://kpaste.net/04f1f3f
it is possible to call enumeration_is_subset with null pointers.
Handle that case instead of crashing. (It is also possible that
Tanuk's pending element_is_subset patch solves the issue, but this
nevertheless gives some extra security.)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-08-04 17:23:37 +01:00
Colin Guthrie
906e99b792 alsa-mixer: Remove workaround for USB head/handsets
Now that subset mixer paths are removed, this workaround is no longer needed.

This effectively reverts 1c38b5d478 but due
to me forgetting to add files and adding a couple extra workarounds after,
it's easier to just do this manually rather than run git-revert.
2011-07-20 22:23:11 +01:00
Colin Guthrie
c0470fd8c4 alsa: No need to go via sink/source to get the core. 2011-07-20 22:23:11 +01:00
Colin Guthrie
5c832a5b8a alsa-mixer: Detect and then drop pointless paths in the path set.
In order to try and avoid 'spamming' the user with port choices,
attempt to detect and remove any pointless paths in a path set. That is
any paths which are subsets of other paths.

This should solve a problem case with some USB Headsets which result in
two paths both involving the 'Speaker' element. When no 'Master' element
exists (which is quite common on head/handsets), then the first path
(analog-output) will contain the 'Speaker' in a way that completely fits
with in the use of the 'Speaker' element in the other path
(analog-output-speaker).
2011-07-20 22:23:11 +01:00
Colin Guthrie
85834107a0 alsa-mixer: Do not 'unify' mixer paths.
Unification is really just a 'lowest common denominator' system. If any
paths do not support volume, mute or decibels, then mark them all as not
having them.

This was originally done this way because the flags set on sinks that
dictate if it supports h/w volume, mute etc. could not be changed after
the sink was created.

The fact that these flags could not change has now been change in the
previous commits, and thus there is now no need to use this 'lowest
common denominator' approach as we can fully support the various
different combinations, even if they change after initial creation
of the sinks/source.
2011-07-20 22:23:10 +01:00
Colin Guthrie
6c6b50d6a8 alsa: Reinitialise the mixer on port change.
This allows us to flip from software to hardware volume control as the port's
mixer path dictates.
2011-07-20 22:23:10 +01:00
Colin Guthrie
a9cf320bc1 devices: Set certain sink/source flags automatically.
Some sink flags are really just a product of what callbacks
are set on the device. We still enforce a degree of sanity
that the flags match the callbacks set, but we also set the
flags automatically in our callback setter functions to
help ensure that a) people use them and b) flags & callbacks
are kept in sync.
2011-07-20 22:20:37 +01:00
Colin Guthrie
ded07a5898 devices: Use wrapper functions to set the *_volume and *_mute callbacks.
This is not currently useful but future commits will make further
changes concerning automatic setting of flags and event delivery
that makes this structure necessary.
2011-07-19 19:50:43 +01:00
Wu Fengguang
226ddb1d39 alsa-sink: fix mmap_write() work_done
mmap_write() work_done is wrongly initilized to TRUE. It ends up never
being FALSE. Fix it to reduce the costly update_smoother() calls.
2011-06-28 09:57:33 -07:00