OSDN Git Service
Takashi Iwai [Tue, 30 May 2017 21:08:51 +0000 (23:08 +0200)]
pcm: dmix: Fix the inconsistent PCM state
The commit
38a2d2eda880 ("pcm: dmix: Do not discard slave reported
delay in...") changed the handling in snd_pcm_dmix_status() for taking
the actual delay from the slave PCM status. Along with it, the commit
removed the line to update its own state altogether, as it had been
done originally in the dshare patch (commit
faf53c197cab "pcm_dshare:
Do not discard slave reported delay..."), supposing that the slave PCM
keeps this same state. However, for dmix/dshare, the PCM state may
differ from the slave, thus these changes resulted in the inconsistent
PCM state.
For dshare, the issue was already addressed by commit
ad6957c61867
("plugin:dshare: wrong state reporting"), while the fix for dmix was
forgotten until now.
This patch restores the code to set the proper dmix PCM state again
like in the previous versions.
Fixes:
38a2d2eda880 ("pcm: dmix: Do not discard slave reported delay in...")
Reported-by: Cheng Sun <chengsun9@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 30 May 2017 15:33:17 +0000 (17:33 +0200)]
pcm: dshare: Call snd_pcm_dshare_state() directly
... otherwise it may be a deadlock if recursive lock isn't available.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 26 May 2017 12:37:59 +0000 (14:37 +0200)]
pcm: dmix: Workaround for binary incompatibility
The commit
1a9bd0f04481 ("pcm: direct: Fix for sync issue on xrun
recover") introduced a new field "recoveries" in
snd_pcm_direct_share_t. Unfortunately this caused two issues:
- It changed the size of the struct which is used as the magic key
- The struct size differs between 32bit and 64bit due to alignment
The former brought the incompatibility with the older alsa-lib,
e.g. when you run an app with an older alsa-lib via LD_PRELOAD, it
doesn't work any longer.
The latter is more serious, it disallows running 32bit apps dmix with
64bit together.
As a workaround, put recoveries field to the unused field
"s.xfer_align", so that the struct is in an old form. This makes the
dmix again binary-compatible with 1.1.3 and older versions, and also
fix the incompatibility between 32/64 bits.
This is a one-time workaround, and we may need to reconsider more
about a breakage in future...
Fixes:
1a9bd0f04481 ("pcm: direct: Fix for sync issue on xrun recover")
Reported-and-tested-by: Cheng Sun <chengsun9@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Wed, 24 May 2017 14:34:14 +0000 (23:34 +0900)]
test: add a test for list operation to user-defined element sets
Current implementation of test for user-defined element doesn't perform
list operation. This commit adds easy test for the operation.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 16 May 2017 14:02:59 +0000 (16:02 +0200)]
conf: Check the availability of PTHREAD_MUTEX_RECURSIVE
Check the availability of PTHREAD_MUTEX_RECURSIVE in configure script
and use it only when possible. A fairly old version of glibc still
seems working, but just to be sure.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 16 May 2017 14:17:57 +0000 (16:17 +0200)]
build: Define __USE_UNIX98 for old glibc
Otherwise PTHREAD_MUTEX_RECURSIVE isn't defined and we get an error
with old glibc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Fri, 12 May 2017 08:01:45 +0000 (10:01 +0200)]
Release v1.1.4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Subhransu S. Prusty [Wed, 10 May 2017 08:16:53 +0000 (13:46 +0530)]
conf: topology: Fix index mismatch for skl and bxt
The topology index in the conf is set to 1, where the driver expects index
set to 0. Fix the inconsistency.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fuwei Tang [Fri, 5 May 2017 07:57:20 +0000 (15:57 +0800)]
topology: Fix issue in parsing routes when generating topology binary
We missed parsing the index value, which is used as a use case indicator, when
processing the route objects.
This patch fixes the bug.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Tested-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 2 May 2017 22:09:28 +0000 (00:09 +0200)]
conf: Allow dynamic top-level config directory
Currently the top-level config directory is specified only via
configure script option, and is fixed after that. It's inconvenient
when the library is moved to another base directory, or if you want to
use a library code (e.g. with $LD_PRELOAD) with the incompatible
config setups.
This patch allows user to override the top-level config path via the
environment varialbe, $ALSA_CONFIG_DIR. For that, a new helper
function, snd_config_topdir(), was introduced, and the codes referring
to the top config dir have been modified to handle it dynamically.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Wed, 3 May 2017 07:42:02 +0000 (09:42 +0200)]
conf: Remove dmix.direct_memory_access setup
The commit [
22eca6468b4a: pcm: dmix: Allow disabling x86
optimizations] introduced the new flag for dmix & co,
direct_memory_access. However, it turned out that such an addition of
the new flag in the default pcm definition causes an error when it's
used with old alsa-lib codes. Although the code added here is
correct, per se, and it works as expected, it's not wise to break the
configuration with old stuff -- even if the usage is somehow incorrect
and should be avoided.
Since the usage of the new flag is only for HDMI LPE audio, and the
usage of dmix itself should be limited with that hardware, this patch
removes the setup so that it works with the old alsa-lib again. We
may introduce the dmix behavior change in a smarter way, e.g. passing
some flag from the hardware driver so that it works more generically
without the manual fiddling of config files.
Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=
1037021
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 27 Apr 2017 06:46:00 +0000 (14:46 +0800)]
topology: Allow a data section to contain multiple tuples objects
It's easy to use a vendor tuples object to define a C structure instance as
vendor specific parameter for kernel drivers. And sometimes the kernel drivers
may want a group of structures. So this patch will allow user to define multiple
vendor tuples objects in a data section, to avoid defining multiple data
sections and each data section only has 1 vendor tuples object.
There is no ABI change in this patch.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 21 Apr 2017 18:36:40 +0000 (20:36 +0200)]
ALSA: pcm: Use recursive mutex
The recent thread-safety pthread implementation caused deadlocks in
some situations, e.g. when an external plugin calls snd_pcm_state() in
its callback. One can avoid the deadlock by carefully using the
unlocked version, but it's often error-prone, and it might be still
problem with the old binaries.
In this patch, we initialize the pthread mutex as recursive for fixing
such a problem.
Suggested-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Fri, 21 Apr 2017 15:28:01 +0000 (00:28 +0900)]
hwdep: add support for MOTU FireWire series and RME Fireface series
Drivers for MOTU FireWire series and RME Fireface series were newly added
to v4.12 kernel. Like the other drivers in ALSA firewire stack, they also
support HwDep interface.
This commit add entries for the drivers.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Fri, 21 Apr 2017 15:28:00 +0000 (00:28 +0900)]
hwdep: add Line6 USB series support
Drivers for Line6 USB series was firstly added to staging directory at
development period of v2.6.30 kernel. At v4.9 kernel development, they
were moved to sound directory. The drivers include HwDep interface, while
header in user space library has never been updated for an entry
corresponding to the drivers.
This commit adds the entry.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Fri, 21 Apr 2017 15:27:59 +0000 (00:27 +0900)]
timer: obsolete legacy rtctimer instance
At v4.7 development, ALSA timer interface dropped device instance based on
legacy rtctimer implementation. User space applications should not use the
device instance.
This commit adds comments to notify a corresponding macro should not be
used anymore.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fuwei Tang [Thu, 13 Apr 2017 06:52:47 +0000 (14:52 +0800)]
topology: Group elements with the same index value into a block
Topology objects(widgets,controls) with different index value should be grouped
into different blocks and the block headers contain the index value.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fuwei Tang [Thu, 13 Apr 2017 06:52:46 +0000 (14:52 +0800)]
topology: Look up references for an object based on its index
We can distinguish different use cases by the object index value, the default
value is 0, meaning applicable for all use cases, defined by macro "SND_TOLG_INDEX_ALL".
An element can only refer to other elements for "all" use cases or the same use
cases, i.e. it can only refer to elements with index value "SND_TOLG_INDEX_ALL"
or the same index value as itself.
The object list has been sorted in ascending order of index, so when we look up
a reference for an object, we traverse the object list it depends on, if we have
not found the reference until index of the object list is greater than index of
the object, we give up and return an error.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fuwei Tang [Thu, 13 Apr 2017 06:52:45 +0000 (14:52 +0800)]
topology: Remove code parsing index value in paring each object
We insert a new element into the object list based on its index value, so we parse
index value in "tplg_elem_new_common" before insert it, and then remove code
parsing index value in parsing each object.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fuwei Tang [Thu, 13 Apr 2017 06:52:44 +0000 (14:52 +0800)]
topology: Insert new element based on its index value
When creating a new element, insert it into the list in the ascending order of
index value.
Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 10 Apr 2017 09:47:02 +0000 (11:47 +0200)]
pcm: dmix: Disable var_periodsize as default
The recently added variable period-size feature for dmix & co seems
causing a regression on some old applications; e.g. Audacious aborts
with an error:
ALSA error: snd_pcm_hw_params_set_buffer_time_near failed: Invalid argument.
As a quick fix, disable the feature as default. One can still enable
it via asoundrc.
Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=
1033179
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Timo Wischer [Tue, 4 Apr 2017 06:30:18 +0000 (12:00 +0530)]
pcm:plugin: Fix sound capture via MMAP access
Distorted sound is heard if the capture device of an ioplug plugin is used,
which is accessed through any ALSA plugin (like copy, linear, ...) via MMAP access.
E.g. aplay -> loop -> copy -> arecord -M -> aplay -> hw:0
As mentioned in the ALSA API (see pcm/pcm.c:942):
The function #snd_pcm_avail_update() have to be called
before any mmap begin+commit operation.
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Tue, 4 Apr 2017 06:29:52 +0000 (11:59 +0530)]
plugin:dshare: wrong state reporting
If plugin dshare detects underrun, it reports this to the user
via return value -EPIPE and setting dshare state to 'xrun' which is correct.
But, if user after this wants to check the stream state, it is misleadingly
reported as 'running' instead of 'xrun'.
With this behavior aplay e.g. will not do a proper underrun handling
(restarting stream) but terminates streaming.
This is due to plugin dshare always returns state of the slave pcm,
in pcm_ops->state() which is not correct.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Thu, 23 Mar 2017 11:40:45 +0000 (17:10 +0530)]
pcm:file: delegate htimestamping to slave instead of always getting real_htimestamp
purpose of this fix, is to read most accurate timestamps.
From documentation of /src/pcm/pcm.c, we can see:
"""" \par Timestamp mode
The timestamp mode specifies, if timestamps are activated. Currently, only #SND_PCM_TSTAMP_NONE and #SND_PCM_TSTAMP_MMAP modes are known.
The mmap mode means that timestamp is taken on every period time boundary. Corresponding position in the ring buffer assigned to timestamp can be obtained using #snd_pcm_htimestamp() function. """"
As snd_pcm_generic_htimestamp() internally calls snd_pcm_htimestamp() to read time, so accurate timestamp can be read from snd_pcm_generic_htimestamp().
Also, in case of pcm_file, if the underlying slave is hardware, then we would wish to read elapsed hardware time, as it will be the most accurate, as opposed to the elapsed wall time.
This will provide pcm_file with the most accurate timestamps.
Following are the timesamps read with timestamp enabled, for with fix and without fix scenarios:
1> With fix:
:~#time aplay --enable-tstamp -Dhtstamp_test --period-time=5000 -v -fdat /dev/urandom
Playing raw data '/dev/urandom' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
File PCM (file=/tmp/swarate_out.wav)
Final file PCM (file=/tmp/swarate_out.wav)
..
Slave: Hardware PCM card 0 'imx6q-sabresd-wm8962' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 240
period_time : 5000
tstamp_mode : ENABLE
.
.
Before sleep = 142:409.807623
After sleep = 142:409.807623
Before sleep = 142:414.806016 (calling snd_pcm_htimestamp(handle, &avail, &tstamp_before))
sleep of 2 milisec
After sleep = 142:414.806016 (calling snd_pcm_htimestamp(handle, &avail, &tstamp_after)
From the above timestamps, we can see that slave has returned the same timestamps, as --period-time choosen is 5msec.
2> Without this fix:
The timestamps are returned with realtime value.
:~# time aplay --enable-tstamp -Dhtstamp_test --period-time=5000 -v -fdat /dev/urandom
Playing raw data '/dev/urandom' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
File PCM (file=/tmp/swarate_out.wav)
Final file PCM (file=/tmp/swarate_out.wav)
.
.
Slave: Hardware PCM card 0 'imx6q-sabresd-wm8962' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 240
period_time : 5000
tstamp_mode : ENABLE
.
.
Before sleep = 241:136.875845 (calling snd_pcm_htimestamp(handle, &avail, &tstamp_before))
sleep of 2 milisec
After sleep = 241:139.076376 (calling snd_pcm_htimestamp(handle, &avail, &tstamp_after)
We can observe here, the timestamps shows time diff of ~2ms, which is the time gap of sleep duration.
Before sleep = 241:139.617588
After sleep = 241:141.746845
Before sleep = 241:142.291618
After sleep = 241:144.406406
Before sleep = 241:144.951421
After sleep = 241:147.066118
Before sleep = 241:147.623421
After sleep = 241:149.740573
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Tue, 21 Mar 2017 12:58:18 +0000 (18:28 +0530)]
pcm:plug: save converter config
Passed config is freed after call to open, thus it is invalid when
trying to extract the converter name. So config entry is saved
for later usage.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Boris Brezillon [Thu, 2 Mar 2017 10:49:33 +0000 (11:49 +0100)]
conf/cards: add VC4-HDMI card
Add a conf file for the VC4-HDMI sound card.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clemens Ladisch [Sat, 18 Mar 2017 22:10:33 +0000 (23:10 +0100)]
rawmidi: virtual: fix reading into a small buffer
In the special case for handling partial messages, the pointer
calculations were wrong, which would result in data corruption.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Mon, 20 Mar 2017 07:41:53 +0000 (08:41 +0100)]
dmix plugin: drain - quickfix for the previous patch
Jaroslav Kysela [Mon, 20 Mar 2017 07:34:33 +0000 (08:34 +0100)]
dmix plugin: fix drain for nonblock mode
Jaroslav Kysela [Mon, 27 Feb 2017 08:53:26 +0000 (09:53 +0100)]
ucm parser: fix possible string overflow in uc_mgr_import_master_config()
Jaroslav Kysela [Mon, 27 Feb 2017 08:46:18 +0000 (09:46 +0100)]
topology: coverity - remove dead code
Jaroslav Kysela [Mon, 27 Feb 2017 08:29:18 +0000 (09:29 +0100)]
pcm file plugin: handle snd_pcm_mmap_begin() error path in snd_pcm_file_mmap_commit()
Jaroslav Kysela [Mon, 27 Feb 2017 08:26:33 +0000 (09:26 +0100)]
always handle return value from snd_config_get_id() (coverity)
Jaroslav Kysela [Mon, 27 Feb 2017 08:25:24 +0000 (09:25 +0100)]
pcm_plugin: unify the snd_pcm_mmap_begin result value checking
Breno Leitao [Wed, 22 Feb 2017 19:45:00 +0000 (16:45 -0300)]
Drop ppc64-specific workaround for versioned symbols
Currently aserver fails to build when using parameter
--without-versioned, due to an workaround for ppc64
(
06221f86d207cb33ddd4867ca5301eeb247c4400). This workaround is
not required anymore on the ppc64 ABI v2, and, in fact is breaking the
compilation. Reverting this commit
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alan Young [Thu, 7 Apr 2016 08:15:04 +0000 (09:15 +0100)]
pcm: rate: Add capability to pass configuration node to plugins
If a rate plugin uses a node (compound) instead of a plain string for
its "converter", and that compound is not a simple string array, then
the compound will be passed as an additional parameter to the new plugin
open() function (SND_PCM_RATE_PLUGIN_CONF_ENTRY(XXX)). The previous
open() function (SND_PCM_RATE_PLUGIN_ENTRY(XXX)) will be called if the
CONF version is not found. It is up to the plugin to determine whether
the presence of the conf parameter is mandatory.
Signed-off-by: Alan Young <consult.awy@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Awais Belal [Fri, 17 Feb 2017 07:17:49 +0000 (12:47 +0530)]
pcm: extplug: refinement of masks in extplug
It should be possible to use empty mask format with extplug.
The refinement of mask via extplug is now modified,
to accept empty masks as well to work properly.
Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Fri, 17 Feb 2017 07:17:36 +0000 (12:47 +0530)]
pcm: status dump fix timestamp formatting
nanosecond part formatted with %06 will give incorrect/confusing results:
trigger_time: 154.
9748287
trigger_time: 154.
60109090
trigger_time: 154.
110425257
time seems to run backwards...
This patch converts to us before printing
which gives the correct/expected result:
trigger_time: 154.009748
trigger_time: 154.060109
trigger_time: 154.110425
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Timo Wischer [Fri, 17 Feb 2017 07:17:17 +0000 (12:47 +0530)]
pcm: file: Enable file writing for capture path
This commit reverts parts of commit
4081be0b87ab9fa53a8906e66bc240f18a7a9a54,
because it is realy useful to use the file plugin in a capture path for
debugging. Also it fixes the truncate issue mentioned in above commit.
Additionally following MMAP access issue is considered:
$ arecord -D teeraw -M -d5 arecord.wav
Recording WAVE 'arecord.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
ALSA lib pcm/pcm_file.c:358:(snd_pcm_file_write_bytes)
write failed: Bad file descriptor
ALSA lib pcm/pcm_file.c:358:(snd_pcm_file_write_bytes)
write failed: Bad file descriptor
arecord: pcm/pcm_file.c:397: snd_pcm_file_add_frames:
Assertion `file->wbuf_used_bytes < file->wbuf_size_bytes' failed.
Aborted by signal Aborted...
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Fri, 17 Feb 2017 07:15:56 +0000 (12:45 +0530)]
pcm: direct: fix race on clearing timer events
snd_timer handling is racy: plugins clear timer queue if avail_min
is not reached to force a sleep on timer. The race can happen if
the expected event arrives in between the avail check and the
clearing of pending events. If this race happens, the user will
unnecessarily wait for one more timer event. On low latency/realtime
streams this can lead to xruns and must be avoided.
As a fix we recheck avail after having cleared poll events.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Timo Wischer [Fri, 17 Feb 2017 07:15:36 +0000 (12:45 +0530)]
pcm: dmix_rewind corrupts application pointer fix
sometimes pulseaudio stops with the following assertion in libasound.so:
alsa-lib-1.0.29/src/pcm/pcm.c:2761:
snd_pcm_area_copy: Assertion `dst < src || dst >= src + bytes' failed.
Application pointer is handled properly, in cases of rewind operations.
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Ravikiran Polepalli <ravikiran_polepalli@mentor.com>
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 10 Feb 2017 11:16:12 +0000 (12:16 +0100)]
pcm: dmix: Allow disabling x86 optimizations
The dmix plugin has some optimized implementations for x86 using the
direct memory accesses, which was rather the original version, in
addition to the "generic" implementation using the semaphore
blocking. The x86 implementation relies on the memory coherency *and*
the fast read/write on it.
For other architectures, this has been always disabled just because of
memory coherency. But, the recent LPE audio development revealed
that, even on x86 platforms, the read/write performance might become
extremely bad when the buffer is marked as uncached. Some drivers
already know the buffer is uncached, we need to switch to the generic
mode in such a case.
This patch introduces yet another flag to dmix configuration,
direct_memory_access, that indicates whether the x86-specific
optimization can be used or not. Each driver can set the flag in its
cards config namespace, and the default dmix config refers to it.
As of this patch, only HDMI LPE Audio driver sets it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 9 Feb 2017 16:29:21 +0000 (17:29 +0100)]
pcm: Disable locking in async mode
When PCM is operated in async mode and an async handler calls some PCM
functions with lock during other PCM operations, we may hit a
deadlock.
Although async mode is rarely used, it's still a possible use case.
Disable the locking when the stream is opened in async mode or it's
set to async mode via snd_pcm_async().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Thu, 9 Feb 2017 16:23:22 +0000 (17:23 +0100)]
pcm: Avoid lock for snd_pcm_nonblock()
snd_pcm_nonblock() is called as snd_pcm_abort(). Since
snd_pcm_abort() is called often from a signal handler to clean things
up (e.g. aplay does it), we may face a deadlock if the signal is
raised during the locked operation.
There can be some way to check the deadlock state, but they would cost
much. Since the race condition of snd_pcm_nonblock() is quite small,
let's just drop the locking inside snd_pcm_nonblock() as a
workaround.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 7 Feb 2017 13:25:17 +0000 (14:25 +0100)]
conf: Add card config for Intel HDMI/DP LPE audio
It's a playback-only device with a single PCM dedicated for HDMI/DP
output. The dmix is working with the latest driver code, so enable it
for default, while providing the hdmi PCM dev for the accesses with
AES bits.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Fri, 27 Jan 2017 11:01:51 +0000 (12:01 +0100)]
pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open()
slave_map[] in snd_pcm_multi_open() is a fixed size array and
obviously we have no overflow check, and eventually the program gets
an error when more than 64 channels are used.
Although we can modify the code to allocate the array dynamically, it
turned out that we can drop the whole slave_map[] thingy in this
function when looking at the code closely. In the past, it was used
to identify the one-to-many mapping. But the check was dropped, and
now it's nothing more than a sanity check.
Reported-by: Jörg Müller <joerg.mueller7744@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Manohar Narkhede [Wed, 25 Jan 2017 21:14:15 +0000 (22:14 +0100)]
conf/cards: add support for pistachio-card.
The data sheet of the chip and technical reference manual can be found at https://docs.creatordev.io/ci40/guides/hardwaredocs/cXT200_datasheet2.pdf
and https://docs.creatordev.io/ci40/guides/hardwaredocs/MIPS_Creator_cXT200_Technical_Reference_Manual_1.0.112.pdf.
The additional information about the cards can be found in src/conf/cards/pistachio-card.conf file.
Signed-off-by: Manohar Narkhede <Manohar.Narkhede@imgtec.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Liam Girdwood [Tue, 24 Jan 2017 14:59:08 +0000 (14:59 +0000)]
topology: Fix incorrect license in source comments.
The topology source files had the wrong licence specified in the
comments when initially upstreamed. The topology source files are all
licensed under the LGPL-2.1 and not the GPLv2.
All earlier versions of the alsa-lib topology source files must be
considered LGPL-2.1 like the other source files in alsa-lib and also
as specified in the alsa-lib COPYING file.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Jan 2017 03:53:42 +0000 (11:53 +0800)]
ucm: Add command 'get _file' to get the config file name of the opened card
After opening a card, this command can show the name of the actually
loaded configuration file, either matches the card name or card long name.
So developers can check if there is a device-sepcific configuration file
available for a given card.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Jan 2017 03:53:35 +0000 (11:53 +0800)]
ucm: Load device-specific configuration file based on the card long name
Intel DSP platform drivers are used by many different devices. For user
space to differentiate them, ASoC machine drivers may use the DMI info
(vendor-product-version-board) as card long name. Possible card long names
are:
DellInc.-XPS139343-01-0310JH
ASUSTeKCOMPUTERINC.-T100TA-1.0-T100TA
Circuitco-MinnowboardMaxD0PLATFORM-D0-MinnowBoardMAX
...
If we want to define a device-specific UCM config file for a card, we
need to use the card long name as the name of both the directory that
contains the UCM config file and the UCM config file itself, like
longname/longname.conf
When being asked to load configuration file of a card, UCM will try to
find the card in the local machine and get its long name. If the card
long name is available, try to load the file longname/longname.conf to
get the best device-specific configuration; if this file is not available,
fall back to load the default configuration file shortname/shortname.conf
as before.
This update is backward compatible, because if ASoC machine drivers don't
explicity use DMI or other means to set the card long name, ASoC core
will use the card short name as the long name. And so UCM will load the
config file that matches both the card short name and the long name.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 18 Jan 2017 03:52:35 +0000 (11:52 +0800)]
ucm: Assure the user input card name not to exceed max size of card long name
Users can load a card's UCM configuration file by giving the card short
name or long name, which should not exceed the maximum card long name
defined by the kernel. The kernel uses an 80-character buffer to store
the card long name.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 16 Jan 2017 15:21:52 +0000 (16:21 +0100)]
pcm: direct: Fix deadlock in poll_descriptors
The recent change in PCM direct plugins to check XRUN in
poll_descriptors callback caused a regression; as consequence, the
whole playback hangs up.
The culprit is a mutex dead lock by the call in snd_pcm_state() inside
the new snd_pcm_direct_poll_descriptors(). The poll_descriptors code
path is protected with pcm mutex, thus an unlocked version
(__snd_pcm_state()) has to be used inside the callback instead.
Fixes:
789ee39727a1 ("pcm: direct: check state before enter poll on timer")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Vinod Koul [Thu, 12 Jan 2017 09:20:28 +0000 (14:50 +0530)]
conf/ucm: broxton: add broxton-rt298 conf files
This adds the UCM conf files for broxton enabling with rt298 codec on
I2S audio, HDMI and DMIC ports.
Signed-off-by: Nishit Sharma <nishitx.sharma@intel.com>
Signed-off-by: G Kranthi <gudishax.kranthikumar@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Tue, 10 Jan 2017 06:34:09 +0000 (12:04 +0530)]
pcm: direct: don't return bogus buffer levels in xrun state
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <mounesh_sutar@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Tue, 10 Jan 2017 06:33:54 +0000 (12:03 +0530)]
pcm: direct: check state before enter poll on timer
To avoid the chances of timeout, we need to check the enter poll
in state xrun.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Mounesh Sutar <mounesh_sutar@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Tue, 10 Jan 2017 06:33:36 +0000 (12:03 +0530)]
pcm: direct: Fix for sync issue on xrun recover
If using very short periods, DSHARE/DSNOOP/DMIX may report underruns while in
status 'prepared'. This prohibits correct recovery. Now slave xrun conditions
for DSHARE/DSNOOP/DMIX are being handled properly.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: Mounesh Sutar <mounesh_sutar@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mounesh Sutar [Tue, 10 Jan 2017 06:33:17 +0000 (12:03 +0530)]
pcm: direct: returning semop error code for semaphore up/down failures
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adam Goode [Tue, 3 Jan 2017 13:33:42 +0000 (08:33 -0500)]
seq: improve documentation about new get pid/card functions
Document the technique for determining if the running kernel supports
the new snd_seq_client_info_get_pid and snd_seq_client_info_get_card
functions. Also add a little information about how to use these
functions and add some cross references.
Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Tue, 29 Nov 2016 15:44:32 +0000 (00:44 +0900)]
topology: fix unused-const-variable warning
Last year, unused static const variable was added, then compiler generates
a below warning.
dapm.c:43:30: warning: ‘widget_control_map’ defined but not used [-Wunused-const-variable=]
static const struct map_elem widget_control_map[] = {
^~~~~~~~~~~~~~~~~~
This commit removes it.
Fixes:
01a0e1a1c219 ("topology: Add DAPM object parser")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Mon, 19 Dec 2016 03:37:51 +0000 (12:37 +0900)]
rate: dynamic update avail_min on slave
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Mon, 19 Dec 2016 03:37:50 +0000 (12:37 +0900)]
plugin: dynamically update avail_min on slave
mmapped capture access on some plugins can fetch data from
slave in the 'background'. A subsequent snd_pcm_wait waits
for too long time to reach avail_min threshold again.
Waiting too long leads to xruns on other devices waiting for
the capture data.
As a fix the avail_min on slave is recalculated dynamically.
V2: updated patch to fix within 80 characters per line
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
mahendran.k [Fri, 30 Dec 2016 06:29:27 +0000 (11:59 +0530)]
pcm: rate: fix the hw_ptr update until the boundary available
For long time test case, the slave_hw_ptr will exceed the boundary
and wraparound the slave_hw_ptr. This slave boundary wraparound will
cause the rate->hw_ptr to wraparound irrespective of the
rate->boundary availability and due to that the available size goes
wrong.
Hence, to get the correct available size,
- Its necessary to increment the rate->hw_ptr upto the rate->boundary
and then wraparound the rate->hw_ptr.
- While handling fraction part of slave period, rounded value will be
introduced by input_frames(). To eliminate rounding issue on
rate->hw_ptr, subtract last rounded value from rate->hw_ptr and add
new rounded value of present slave_hw_ptr fraction part to
rate->hw_ptr.
Signed-off-by: mahendran.k <mahendran.kuppusamy@in.bosch.com>
Signed-off-by: Mounesh Sutar <mounesh_sutar@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alexander Jahn [Fri, 30 Dec 2016 06:29:11 +0000 (11:59 +0530)]
pcm: dshare: enable silence
This issue depends on system load - if the process using dshare is
scheduled fast enough, then there is no noise. A delay of e.g >~2ms
produces hearable noise.
Reproduction with instrumented aplay(sleep every 100th period for a
given time):
During the sleep time of 2000000us (2s) the hardware plays old samples
in a loop before xrun is detected and recovered after the sleep.
This is resolved by placing it in silence, in case of dshare plugin.
Signed-off-by: Alexander Jahn <ajahn@de.adit-jv.com>
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Joshua Frkuska [Fri, 30 Dec 2016 06:26:15 +0000 (11:56 +0530)]
pcm: direct: allow users to configure different period sizes
This patch allows the effective period size to be a multiple of the
slave-pcm period size.
Allowing only exact multiple of original period size is achieved by
borrowing code from the kernel hwrules implementation.
This patch is intended to save cpu workload when for example, the
slave operates with very small periods but a user does not need that
small periods.
This feature is enabled by default and can be disabled by adding
config option 'var_periodsize 0'.
Signed-off-by: Alexander Jahn <ajahn@de.adit-jv.com>
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Gustavo Zacarias [Wed, 21 Dec 2016 22:46:34 +0000 (19:46 -0300)]
ucm: parser needs limits.h
It's using PATH_MAX which is defined there, otherwise the build fails on
musl libc.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Tue, 27 Dec 2016 10:08:58 +0000 (18:08 +0800)]
ucm: Add ATTRIBUTE_UNUSED for unused parameters of execute_component_seq()
To fix the following warnings:
main.c: In function ‘execute_component_seq’:
main.c:489:24: warning: unused parameter ‘value_list1’ [-Wunused-parameter]
struct list_head *value_list1,
^
main.c:490:24: warning: unused parameter ‘value_list2’ [-Wunused-parameter]
struct list_head *value_list2,
^
main.c:491:24: warning: unused parameter ‘value_list3’ [-Wunused-parameter]
struct list_head *value_list3,
^
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Tue, 20 Dec 2016 14:43:20 +0000 (15:43 +0100)]
Release v1.1.3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela [Tue, 20 Dec 2016 14:41:25 +0000 (15:41 +0100)]
conf: don't install smixer.conf when python is not available
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Rene Rebe [Tue, 13 Dec 2016 12:54:26 +0000 (13:54 +0100)]
pcm: fix get_stop_threshold alsa-lib 0.9 alias
resurrecting some decade old code I got some crashes and noticed a typo in
an old 0.9 legacy symver alias.
Signed-off-by: René Rebe <rene@exactcode.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Fri, 25 Nov 2016 10:25:05 +0000 (15:55 +0530)]
pcm: file: update linked hw_ptr and appl_ptr
Plugin file provides no private hw_ptr and appl_ptr but instead links
them to the slave pcm. If the slave pcm itself changes its hw_ptr or
app_prt this needs to be done in file plugin, too.
Plugin 'plug' is such a candidate changing the hw_ptr and app_ptr in
hw_params call dependent on the automatically inserted plugins. ALSA
unfortunately has no support for automatically updating chained
pointers.
A notification on pointer change seems to be prepared inside the
snd_pcm_set_ptr() routine via rbptr->changed(), but it is not (yet)
implemented so that we need to care for it manually.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alan Young [Tue, 14 Jun 2016 09:15:01 +0000 (10:15 +0100)]
pcm_rate: Do not discard slave reported delay in status result.
snd_pcm_rate_status() gets the underlying status from the slave PCM.
This may contain a delay value that includes elements such as codec and
other transfer delays. Use this as the base for the returned delay
value, adjusted for any frames buffered locally (within the rate
plugin).
Also update snd_pcm_rate_delay() similarly.
[fixed some comments by tiwai]
Signed-off-by: Alan Young <consult.awy@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Tue, 29 Nov 2016 15:42:01 +0000 (00:42 +0900)]
topology: fix unused-variable warnings introduced to build_link()
A function with unused automatic variables was recently introduced to this
library, then compiler generates below warnings.
pcm.c: In function ‘build_link’:
pcm.c:213:6: warning: unused variable ‘i’ [-Wunused-variable]
int i, num_hw_configs = 0, err = 0;
^
pcm.c:210:43: warning: unused variable ‘cmpnt’ [-Wunused-variable]
struct snd_soc_tplg_link_cmpnt *codec, *cmpnt;
^~~~~
pcm.c:210:35: warning: unused variable ‘codec’ [-Wunused-variable]
struct snd_soc_tplg_link_cmpnt *codec, *cmpnt;
^~~~~
pcm.c:209:20: warning: unused variable ‘ref_elem’ [-Wunused-variable]
struct tplg_elem *ref_elem = NULL;
This commit removes them.
Fixes:
53f7711769d4("topology: Define a function to build a single physical DAI link")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 11 Dec 2016 11:31:38 +0000 (20:31 +0900)]
pcm: fix wrong document references to PCM APIs which perform direct memory access with frame copying
In a design of ALSA PCM interface, for PCM frame transmission to/from
kernel space, applications can select from two options; direct memory access
or ioctl(2). Available options are decided depending on device capacity and
machine architecture. Applications can get available options by the first
entry of 'struct snd_pcm_hw_params.masks'.
When the mask includes 'SNDRV_PCM_ACCESS_MMAP_xxx', applications can use
direct memory access. For this use case, userspace library has two types
of PCM API. One is to expose a pointer over the memory to start
reading/writing PCM frames. Another is to copy PCM frames between the
memory and a given buffer.
Current documentation includes wrong references to these APIs to describe
their advantages/disadvantages. This confuses application developers
because the references indicate PCM APIs to execute ioctl(2) operation to
read/write PCM frames.
This commit fixes the bug.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Mon, 28 Nov 2016 05:34:21 +0000 (13:34 +0800)]
ucm: Execute sequence of component devices
A machine device's sequence can enable or disable a component device. So
when executing a machine device's sequence, the enable or disable sequence
of its component devices will also be excecuted.
Components don't define card device cdev in their sequences. So before
executing a component device sequence, UCM manager will
- store cdev defined by the sequence of its parent, the machine device;
- mark itself entering 'component domain'.
Then this cdev will be used to excute the sequence of the component
device.
When UCM manager completes executing the sequence of the component device,
it will leave 'compnent domain' and reset the saved cdev to NULL.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Mon, 28 Nov 2016 05:33:54 +0000 (13:33 +0800)]
ucm: Parse sequence of component devices
A machine device's sequence can enable or disable a component device by
keyword 'enadev' and 'disdev' followed the name of the component device.
UCM sequence parser will find the component device and mark if its enable
or disable sequence is needed by the parent, the machine device.
New element type and struct are defined for the sequence of a component
device. Component devices will be removed from the machine device list
'device_list' of a verb, since we don't want to expose them to audio
servers with original API to list devices for backward compatibility.
A new list 'cmpt_device_list' is used for the component devices of a verb.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Mon, 28 Nov 2016 05:33:34 +0000 (13:33 +0800)]
ucm: Skip component directories when scanning sound card configuration files
Cards are defined by machines. DSPs embedded in SoC and off-soc codecs
can be taken as components for machines, and can be reused by different
machines/cards. Codec and SoC vendors can define their own UCM config
files. If a codec or DSP is used by a machine, the card configuration file
can include the conf file of the codec and DSP. Later patches will
complete support for this feature.
Two new directories will be used to store the UCM configuration files for
a specific codec or DSP firmware:
- /usr/share/alsa/ucm/dsps ... for DSP embedded in SoC
- /usr/share/alsa/ucm/codecs ... for off-soc codecs
These two directories will be skipped when UCM manager scans the card
directories under /usr/share/alsa/ucm.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 29 Nov 2016 13:53:53 +0000 (14:53 +0100)]
pcm: dmix: Do not discard slave reported delay in status result
Like the change done for dshare plugin, we can calculate the delay
more precisely from the slave PCM.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 29 Nov 2016 13:31:20 +0000 (14:31 +0100)]
pcm: Add the PCM state checks to plugins
I noticed that some plugin codes have no proper PCM state checks and
it results in expected outcomes. For example, when snd_pcm_drain() is
called for a dmix PCM after calling snd_pcm_drop(), it stalls
unexpectedly. It's just because its drain callback doesn't expect the
SND_PCM_SETUP state.
We can fix such a bug in each place one by one, but a safer way would
be to filter out all such cases commonly in the PCM API functions
themselves. This patch adds the PCM state sanity checks to major API
functions so that they return -EBADFD when called in the unexpected
PCM states.
As well as for the thread-safety extension, it'd be a question of the
performance; again at this time, the hw PCM is considered as an
exception, and it has pcm->own_state_check flag set, which means that
the common PCM state checks are skipped.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 29 Nov 2016 15:19:26 +0000 (16:19 +0100)]
Revert "pcm: file: Add htimestamp operation in plugin file"
This reverts commit
f8d07a7354a3fee1e30073aa7ac2efb89ef4e782.
The htimestamp field was already intiailized. It was just overlooked,
sorry.
Suggested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Fri, 25 Nov 2016 11:36:37 +0000 (17:06 +0530)]
pcm: file: Add htimestamp operation in plugin file
PCM operation htimestamp is not implemented in plugin file.
Calling snd_pcm_htimestamp() on a plugin file crashes. This scenario
is considered now.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Anant Agrawal [Fri, 25 Nov 2016 11:13:34 +0000 (16:43 +0530)]
pcm: dshare: Fix endless playback of buffer
On snd_pcm_drain() the slave PCM driven via plugin DSHARE is not filled with
silence. Result is endless playback of buffer content until pcm is closed.
In ALSA pcm dshare plugin, called do_silence method to fix the issue.
Signed-off-by: Anant Agrawal <Anant_Agrawal@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Joshua Frkuska [Fri, 25 Nov 2016 10:13:40 +0000 (15:43 +0530)]
pcm: direct: Protect from freeing semaphore when already in use
In the case of dshare, dsnoop, and dmix when a device is opened twice
and fails the second time, the semaphore is completely discarded. This
creates dangling semaphore data.
This patch removes the possibility for the semaphore to be destroyed during
a typical open failure by first checking if the shared memory can be destroyed
or not. If the shared memory cannot be released it means both it and the
semaphore are still in use and therefore the semaphore is just released.
Signed-off-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Fri, 25 Nov 2016 05:20:02 +0000 (13:20 +0800)]
topology: Update physical link configurations in Broadwell text conf file
To make this conf file a better example, add configurations for the
physical link "Codec", same as that defined by Intel Broadwell upstream
machine driver.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 24 Nov 2016 01:34:00 +0000 (09:34 +0800)]
topology: Store number of strings of a text section
Enum controls may use text elements and need the number of strings.
This patch adds a text child object for a generic element. When parsing
a text section from the configuation file, store the text strings and
number of strings (num_items) in the text child object of the element.
Reported-by: G Kranthi <gudishax.kranthikumar@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 24 Nov 2016 01:33:52 +0000 (09:33 +0800)]
topology: Merge private data before embedded controls of a widget
For a widget ABI object, its private data sits before the embedded
controls, so we should merge the private data blocks at first, and
then the embedded controls.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Nov 2016 06:43:07 +0000 (14:43 +0800)]
topology: Revise document and comments for ABI v5
Revise the obsolete content in document and comments.
Here are the major changes in implementation from early phase design:
- PCM object is used to configure front end DAI & DAI links, not used by
physical DAI or DAI links.
- No longer use separate object for backend or codec<->codec links, but
use physical links to cover them.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Nov 2016 06:42:58 +0000 (14:42 +0800)]
topology: ABI - Add voice wake up flag for DAI links
Add a new flag bit SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP to link flags.
If a link is used for voice wake up, users can set this flag bit and
topology will set the link's 'ignore_suspend' to true.
This ABI update is backward compatible and applied in kernel. We may
rename this flag when we find a better name for this.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Guneshwor Singh [Wed, 16 Nov 2016 06:42:49 +0000 (14:42 +0800)]
topology: Export physical DAIs to the binary for kernel
Export the physical DAI objects to the binary output file for kernel.
For physical DAIs defined by the text conf file, find and merge their
stream capablities and private data before exporting.
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Guneshwor Singh [Wed, 16 Nov 2016 06:42:41 +0000 (14:42 +0800)]
topology: Support configuring physical DAIs by C API
In addition to text conf file, physical DAIs can also be configured
by C API. This patch defines the template to add physical DAI
configurations from C API.
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Nov 2016 06:42:33 +0000 (14:42 +0800)]
topology: Parse physical DAIs in text conf file
Add support for parsing physical DAIs in the text configuration file.
The syntax of physical DAIs is described in document in topology.h
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Guneshwor Singh [Wed, 16 Nov 2016 06:42:25 +0000 (14:42 +0800)]
topology: ABI - Define new types for physical DAI
Define the type and ABI struct for physical DAIs (e.g. backend DAIs).
They are new to ABI and so no backward compatibility risk.
Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Nov 2016 06:42:15 +0000 (14:42 +0800)]
topology: ABI - Update manifest and pump ABI version to 5
Pump ABI version to 5.
To support physical DAIs and furture extension, add the following fields
to manifest:
- the count of physical DAIs. Later patches will add new ABI types for
physical DAIs.
- some reserved fields for new ABI objects in the future.
Kerel will handle this ABI update in a backward compatible way, via patch
'ASoC: topology: Make manifest backward compatible from ABI v4'.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alan Young [Wed, 2 Nov 2016 17:40:32 +0000 (17:40 +0000)]
pcm_dshare: Do not discard slave reported delay in status result.
snd_pcm_dshare_status() gets the underlying status from the slave PCM.
This may contain a delay value that includes elements such as codec and
other transfer delays. Use this as the base for the returned delay
value, adjusted for any frames buffered locally (within the dshare
plugin).
Note: snd_pcm_dshare_delay() is not updated.
Signed-off-by: Alan Young <consult.awy@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Mon, 14 Nov 2016 10:46:05 +0000 (11:46 +0100)]
mixer: Don't install smixer modules unless python is enabled
Currently the whole smixer stuff depends on python, so it doesn't make
sense to install plugins partially when the python support is
disabled.
This patch changes Makefile.am not to install the smixer stuff at all
when the python support is disabled via configure script.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:43 +0000 (13:14 +0800)]
topology: Remove BE or CC in comments of physical links C API template
No longer use BE or CC in comments of C API template for physical links.
This template can be used by Backend or Codec-to-Codec DAI links but not
only for them.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:34 +0000 (13:14 +0800)]
topology: Parse name and stream name of physical DAI links
Parse name and stream name of physical links defined by text conf file
or C API. Add name and stream name to C API template of physical DAI
links.
These two fields will help topology kernel driver to find an existing
physical link to configure, since the id of links are often the default
value ZERO and useless for match.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:25 +0000 (13:14 +0800)]
topology: Parse and build private data of physical links
Users can define private data for physical links by C API or text conf
file. Private data pointer is added to C API template for physical links.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:15 +0000 (13:14 +0800)]
topology: Parse link flags of physical DAI links
Parse physical DAI link flags defined by text conf file or C API.
The flag mask and flags are added to C API template for physical DAI
links.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:04 +0000 (13:14 +0800)]
topology: Parse HW configurations of physical DAI links in text conf file
Users can configure the runtime supported HW configurations of a physical
link by SectionHWConfig. A physical link can refer multiple HW config
sections in SectionLink.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:13:46 +0000 (13:13 +0800)]
topology: Parse HW configurations of physical DAI links defined by C API
Add HW configurations to C API template of physical link configuration.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>