Commit graph

3403 commits

Author SHA1 Message Date
Jaroslav Kysela
5bcf449df5 Release v1.1.4.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-06-01 08:27:36 +02:00
Takashi Iwai
3752e6b873 pcm: dmix: Fix the inconsistent PCM state
The commit 38a2d2eda8 ("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 faf53c197c "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 ad6957c618
("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: 38a2d2eda8 ("pcm: dmix: Do not discard slave reported delay in...")
Reported-by: Cheng Sun <chengsun9@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-05-31 12:47:31 +02:00
Takashi Iwai
bb862e3bb1 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>
2017-05-30 17:33:17 +02:00
Takashi Iwai
eae572ef5e pcm: dmix: Workaround for binary incompatibility
The commit 1a9bd0f044 ("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: 1a9bd0f044 ("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>
2017-05-26 14:38:55 +02:00
Takashi Sakamoto
79f735fbc1 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>
2017-05-25 18:45:41 +02:00
Takashi Iwai
e757a95fc9 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>
2017-05-16 16:26:20 +02:00
Takashi Iwai
3cf3fbebdd 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>
2017-05-16 16:17:57 +02:00
Jaroslav Kysela
e7bf93f7e9 Release v1.1.4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2017-05-12 10:01:45 +02:00
Subhransu S. Prusty
87b305d6ce 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>
2017-05-10 10:40:04 +02:00
Fuwei Tang
88fd41aef4 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>
2017-05-05 10:09:16 +02:00
Takashi Iwai
516bf057b0 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>
2017-05-03 09:54:16 +02:00
Takashi Iwai
f3d2f4046e conf: Remove dmix.direct_memory_access setup
The commit [22eca6468b: 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>
2017-05-03 09:48:15 +02:00
Mengdong Lin
0b8b6bb7d8 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>
2017-04-27 08:48:45 +02:00
Takashi Iwai
1cb217ead9 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>
2017-04-21 20:36:40 +02:00
Takashi Sakamoto
fbc18ec771 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>
2017-04-21 17:57:57 +02:00
Takashi Sakamoto
9307575d14 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>
2017-04-21 17:57:56 +02:00
Takashi Sakamoto
d1777a503d 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>
2017-04-21 17:57:56 +02:00
Fuwei Tang
bfd712fe32 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>
2017-04-21 12:57:59 +02:00
Fuwei Tang
a3b4bd2c8c 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>
2017-04-21 12:57:48 +02:00
Fuwei Tang
af231ea1db 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>
2017-04-21 12:56:08 +02:00
Fuwei Tang
dfd5ebd33f 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>
2017-04-21 12:55:54 +02:00
Takashi Iwai
e736715a8e 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>
2017-04-10 11:50:18 +02:00
Timo Wischer
cb6e96bce1 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>
2017-04-05 21:39:35 +02:00
Andreas Pape
ad6957c618 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>
2017-04-05 21:39:17 +02:00
Andreas Pape
01bc7475c3 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>
2017-03-29 09:47:36 +02:00
Andreas Pape
653faa8991 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>
2017-03-21 16:38:12 +01:00
Boris Brezillon
7c2093b1c1 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>
2017-03-20 12:05:36 +01:00
Clemens Ladisch
d71f294566 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>
2017-03-20 10:34:21 +01:00
Jaroslav Kysela
e4377b1645 dmix plugin: drain - quickfix for the previous patch 2017-03-20 08:41:53 +01:00
Jaroslav Kysela
fdc898d411 dmix plugin: fix drain for nonblock mode 2017-03-20 08:34:33 +01:00
Jaroslav Kysela
ad188bbf78 ucm parser: fix possible string overflow in uc_mgr_import_master_config() 2017-02-27 09:53:26 +01:00
Jaroslav Kysela
db0e1dcfc2 topology: coverity - remove dead code 2017-02-27 09:46:18 +01:00
Jaroslav Kysela
b96f6f4785 pcm file plugin: handle snd_pcm_mmap_begin() error path in snd_pcm_file_mmap_commit() 2017-02-27 09:29:18 +01:00
Jaroslav Kysela
8a38461fac always handle return value from snd_config_get_id() (coverity) 2017-02-27 09:26:33 +01:00
Jaroslav Kysela
b0e4652881 pcm_plugin: unify the snd_pcm_mmap_begin result value checking 2017-02-27 09:25:24 +01:00
Breno Leitao
3bad0a21b4 Drop ppc64-specific workaround for versioned symbols
Currently aserver fails to build when using parameter
--without-versioned, due to an workaround for ppc64
(06221f86d2).  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>
2017-02-23 12:37:47 +01:00
Alan Young
97be19cf6f 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>
2017-02-21 22:29:44 +01:00
Awais Belal
fbb9571381 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>
2017-02-17 18:41:48 +01:00
Andreas Pape
a50496346f 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>
2017-02-17 18:40:48 +01:00
Timo Wischer
fe65b00f33 pcm: file: Enable file writing for capture path
This commit reverts parts of commit 4081be0b87,
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>
2017-02-17 18:39:03 +01:00
Andreas Pape
9219034301 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>
2017-02-17 18:38:08 +01:00
Timo Wischer
df7694d80c 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>
2017-02-17 18:35:03 +01:00
Takashi Iwai
22eca6468b 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>
2017-02-10 12:16:12 +01:00
Takashi Iwai
e31a3273df 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>
2017-02-09 17:29:21 +01:00
Takashi Iwai
b5a2c06f6c 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>
2017-02-09 17:26:52 +01:00
Takashi Iwai
53dc36f1f4 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>
2017-02-07 14:29:50 +01:00
Takashi Iwai
e1143dd9ba 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>
2017-01-27 12:05:32 +01:00
Manohar Narkhede
4dfa8f08fb 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>
2017-01-25 22:14:15 +01:00
Liam Girdwood
ec40aafa43 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>
2017-01-24 18:19:03 +01:00
Mengdong Lin
e93d93a8cd 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>
2017-01-18 11:55:25 +01:00