OSDN Git Service

android-x86/external-alsa-lib.git
7 years agoconf/cards: add VC4-HDMI card
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>
7 years agorawmidi: virtual: fix reading into a small buffer
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>
7 years agodmix plugin: drain - quickfix for the previous patch
Jaroslav Kysela [Mon, 20 Mar 2017 07:41:53 +0000 (08:41 +0100)]
dmix plugin: drain - quickfix for the previous patch

7 years agodmix plugin: fix drain for nonblock mode
Jaroslav Kysela [Mon, 20 Mar 2017 07:34:33 +0000 (08:34 +0100)]
dmix plugin: fix drain for nonblock mode

7 years agoucm parser: fix possible string overflow in uc_mgr_import_master_config()
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()

7 years agotopology: coverity - remove dead code
Jaroslav Kysela [Mon, 27 Feb 2017 08:46:18 +0000 (09:46 +0100)]
topology: coverity - remove dead code

7 years agopcm file plugin: handle snd_pcm_mmap_begin() error path in snd_pcm_file_mmap_commit()
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()

7 years agoalways handle return value from snd_config_get_id() (coverity)
Jaroslav Kysela [Mon, 27 Feb 2017 08:26:33 +0000 (09:26 +0100)]
always handle return value from snd_config_get_id() (coverity)

7 years agopcm_plugin: unify the snd_pcm_mmap_begin result value checking
Jaroslav Kysela [Mon, 27 Feb 2017 08:25:24 +0000 (09:25 +0100)]
pcm_plugin: unify the snd_pcm_mmap_begin result value checking

7 years agoDrop ppc64-specific workaround for versioned symbols
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>
7 years agopcm: rate: Add capability to pass configuration node to plugins
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>
7 years agopcm: extplug: refinement of masks in extplug
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>
7 years agopcm: status dump fix timestamp formatting
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>
7 years agopcm: file: Enable file writing for capture path
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>
7 years agopcm: direct: fix race on clearing timer events
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>
7 years agopcm: dmix_rewind corrupts application pointer fix
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>
7 years agopcm: dmix: Allow disabling x86 optimizations
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>
7 years agopcm: Disable locking in async mode
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>
7 years agopcm: Avoid lock for snd_pcm_nonblock()
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>
7 years agoconf: Add card config for Intel HDMI/DP LPE audio
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>
7 years agopcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open()
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>
7 years agoconf/cards: add support for pistachio-card.
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>
7 years agotopology: Fix incorrect license in source comments.
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>
7 years agoucm: Add command 'get _file' to get the config file name of the opened card
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>
7 years agoucm: Load device-specific configuration file based on the card long name
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>
7 years agoucm: Assure the user input card name not to exceed max size of card long name
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>
7 years agopcm: direct: Fix deadlock in poll_descriptors
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>
7 years agoconf/ucm: broxton: add broxton-rt298 conf files
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>
7 years agopcm: direct: don't return bogus buffer levels in xrun state
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>
7 years agopcm: direct: check state before enter poll on timer
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>
7 years agopcm: direct: Fix for sync issue on xrun recover
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>
7 years agopcm: direct: returning semop error code for semaphore up/down failures
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>
7 years agoseq: improve documentation about new get pid/card functions
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>
7 years agotopology: fix unused-const-variable warning
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>
7 years agorate: dynamic update avail_min on slave
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>
7 years agoplugin: dynamically update avail_min on slave
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>
7 years agopcm: rate: fix the hw_ptr update until the boundary available
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>
7 years agopcm: dshare: enable silence
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>
7 years agopcm: direct: allow users to configure different period sizes
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>
7 years agoucm: parser needs limits.h
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>
7 years agoucm: Add ATTRIBUTE_UNUSED for unused parameters of execute_component_seq()
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>
7 years agoRelease v1.1.3
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>
7 years agoconf: don't install smixer.conf when python is not available
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>
7 years agopcm: fix get_stop_threshold alsa-lib 0.9 alias
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>
7 years agopcm: file: update linked hw_ptr and appl_ptr
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>
7 years agopcm_rate: Do not discard slave reported delay in status result.
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>
7 years agotopology: fix unused-variable warnings introduced to build_link()
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>
7 years agopcm: fix wrong document references to PCM APIs which perform direct memory access...
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>
7 years agoucm: Execute sequence of component devices
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>
7 years agoucm: Parse sequence of component devices
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>
7 years agoucm: Skip component directories when scanning sound card configuration files
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>
7 years agopcm: dmix: Do not discard slave reported delay in status result
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>
7 years agopcm: Add the PCM state checks to plugins
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>
7 years agoRevert "pcm: file: Add htimestamp operation in plugin file"
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>
7 years agopcm: file: Add htimestamp operation in plugin file
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>
7 years agopcm: dshare: Fix endless playback of buffer
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>
7 years agopcm: direct: Protect from freeing semaphore when already in use
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>
7 years agotopology: Update physical link configurations in Broadwell text conf file
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>
7 years agotopology: Store number of strings of a text section
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>
7 years agotopology: Merge private data before embedded controls of a widget
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>
7 years agotopology: Revise document and comments for ABI v5
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>
7 years agotopology: ABI - Add voice wake up flag for DAI links
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>
7 years agotopology: Export physical DAIs to the binary for kernel
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>
7 years agotopology: Support configuring physical DAIs by C API
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>
7 years agotopology: Parse physical DAIs in text conf file
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>
7 years agotopology: ABI - Define new types for physical DAI
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>
7 years agotopology: ABI - Update manifest and pump ABI version to 5
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>
7 years agopcm_dshare: Do not discard slave reported delay in status result.
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>
7 years agomixer: Don't install smixer modules unless python is enabled
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>
7 years agotopology: Remove BE or CC in comments of physical links C API template
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>
7 years agotopology: Parse name and stream name of physical DAI links
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>
7 years agotopology: Parse and build private data of physical links
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>
7 years agotopology: Parse link flags of physical DAI links
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>
7 years agotopology: Parse HW configurations of physical DAI links in text conf file
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>
7 years agotopology: Parse HW configurations of physical DAI links defined by C API
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>
7 years agotopology: Define new type and section name to configure physical links
Mengdong Lin [Sun, 6 Nov 2016 05:13:36 +0000 (13:13 +0800)]
topology: Define new type and section name to configure physical links

Users may not use DPCM but still need to configure the physical links.
So we should not only consider backend links for DPCM.

- SND_TPLG_TYPE_LINK is defined to configure physical links by C API.
  And SND_TPLG_TYPE_BE is still supported to configure Backend links for
  DPCM cases.

- SectionLink can be used to configure physical links in text conf file.
  And SectionBE is still supported to config Backend links for DPCM cases.

Actually, users can use SND_TPLG_TYPE_LINK and SectionLink to configure
backend links for DPCM cases, because BE links are also physical links.
The parsing is same and we rename the function from tplg_parse_be to
tplg_parse_link.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Rename varaibles for add physical links by C API
Mengdong Lin [Sun, 6 Nov 2016 05:13:19 +0000 (13:13 +0800)]
topology: Rename varaibles for add physical links by C API

Code refactoring. When adding a physical link element from C API:
- Rename "link" to "link_tpl" for physical link config template for
  C API users.
- Rename "lk" to "link" for physical link elements created by topology
  internally.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: ABI - Update physical DAI link configurations to ABI v5
Mengdong Lin [Sun, 6 Nov 2016 05:13:08 +0000 (13:13 +0800)]
topology: ABI - Update physical DAI link configurations to ABI v5

This patch update physicals DAI link config to ABI v5:

- Define the types and ABI struct for runtime supported hardware configs
  e.g. audio hardware formats. The default HW config ID will help topology
  to find the DAI format to set on init. Topology provides this as a
  fallback if such HW settings are not available in ACPI or device tree,
  to avoid hard code in drivers. It's only for config items that can be
  programmed by SW or FW, not for physical things like link connections
  or GPIO used for HP etc.

- Add flags. The flags will be used to configure an existing physical
  links.

- Add private data. The private data is reserved for future extension.

- Add name and stream name to physical DAI links. Kernel can also use name
  and stream name to find an existing physical link and configure it.

Kernel can handle the ABI update in a backward compatible way via patch
'ASoC: topology: Add support to configure existing physical DAI links'.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: ABI - Define DAI physical PCM data formats
Mengdong Lin [Sun, 6 Nov 2016 05:12:57 +0000 (13:12 +0800)]
topology: ABI - Define DAI physical PCM data formats

Define DAI physical PCM data formats for user space, so users can specify
the formats of backends by topology (e.g. the DAI format to set on backend
link init).

The kernel will also refer to these formats.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Define a function to build a single physical DAI link
Mengdong Lin [Sun, 6 Nov 2016 05:12:40 +0000 (13:12 +0800)]
topology: Define a function to build a single physical DAI link

Code refactoring. Rename the function to build all physical links from
tplg_build_link_config() to tplg_build_links(). And define a new function
build_link() to build a single physical DAI link element.

The function build_link() will be extended to handle more properties
of a physical DAI link (e.g. backend or codec-codec link).

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Merge an element's be & cc pointer to one link pointer
Mengdong Lin [Sun, 6 Nov 2016 05:11:49 +0000 (13:11 +0800)]
topology: Merge an element's be & cc pointer to one link pointer

Code refactoring. Previously an element has two pointers, 'be' and 'cc',
for BE (Back End) and CC (Codec-Codec) link respectively. But actually
the topology tool processes BE and CC links in the same way, so these
two pointers can be merged into one 'link' pointer, which can be used
configure any physical links.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Use snd_config_get_bool to simplify boolean flag parsing
Mengdong Lin [Sun, 6 Nov 2016 05:11:04 +0000 (13:11 +0800)]
topology: Use snd_config_get_bool to simplify boolean flag parsing

The link flags in the text conf file are boolean, so this patch uses
snd_config_get_bool() to simplify the code.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: tplg_elem_lookup() checks parameter before searching
Mengdong Lin [Thu, 3 Nov 2016 23:08:27 +0000 (07:08 +0800)]
topology: tplg_elem_lookup() checks parameter before searching

Check the parameters at first in case of misuse.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Parse and build private data for PCM
Mengdong Lin [Thu, 3 Nov 2016 23:08:12 +0000 (07:08 +0800)]
topology: Parse and build private data for PCM

Users can define private for PCM (FE DAI & DAI links) elements by both
text conf file and C API:

- Text conf file may define multiple data blocks for a PCM and they will
  be merged in building phase;

- Add private data to C API template of PCM object.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Define a function to build a single PCM element
Mengdong Lin [Thu, 3 Nov 2016 23:07:58 +0000 (07:07 +0800)]
topology: Define a function to build a single PCM element

Code refactoring. Rename tplg_build_pcm() to tplg_build_pcms() to build
all PCM (FE DAI & DAI link) elements. It will call a new function
build_pcm() to build a single PCM elemement.

build_pcm() will be extended to handle more properties of a PCM.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Parse flags for PCM
Mengdong Lin [Thu, 3 Nov 2016 23:07:06 +0000 (07:07 +0800)]
topology: Parse flags for PCM

Users can define flags by both text conf file and C API.
Add flags and flag_mask to C API template of PCM object.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Parse sig_bits of stream caps
Mengdong Lin [Thu, 3 Nov 2016 23:06:53 +0000 (07:06 +0800)]
topology: Parse sig_bits of stream caps

Add sig_bits to stream caps template of C API and parse it.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: ABI - Update stream caps and PCM objects to ABI v5
Mengdong Lin [Thu, 3 Nov 2016 23:05:53 +0000 (07:05 +0800)]
topology: ABI - Update stream caps and PCM objects to ABI v5

Here are the ABI updates for PCM (Front DAI & DAI link) objects:

- add sig_bits to stream caps.
- add flags and private data to PCM.

The kernel can handle the ABI update in a backward compatible way with
the patch "ASoC: topology: Make PCM backward compatible from ABI v4".

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Add doc for including other files in the text conf file
Mengdong Lin [Mon, 24 Oct 2016 13:22:19 +0000 (21:22 +0800)]
topology: Add doc for including other files in the text conf file

This patch adds document about how to include other files in the text
configuration files, by alsaconf syntax <xxx> and <searchdir:xxx>.

Users may define common info in separate files (e.g. vendor tokens,
tuples) and share them for different platforms, by including them via
syntax <path/to/configuration-file>. This can save the total size of
files. Users can also specifiy additional configuraiton directories
relative to "/usr/share/alsa/" to search the included files, via syntax
<searchdir:relative-path/to/usr/share/alsa>.

The alsaconf will search and open an included file in the following order
of priority:
1. directly open the file by its name;
2. search for the file name in "/usr/share/alsa";
3. search for the file name in user specified subdirectories under
   "/usr/share/alsa".

The order of the included files need not to be same as their dependencies,
because the toplogy library will load all of them before parsing their
dependencies.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoconf: Search included files under user specified configuration directories
Mengdong Lin [Mon, 24 Oct 2016 13:22:11 +0000 (21:22 +0800)]
conf: Search included files under user specified configuration directories

Users can include file by giving a relative path or just a file name via
alsaconf syntax <xxx>. ALSA conf will search the file in top configuration
directory and additional configuration directories defined by users via
alsaconf syntax <searchdir:xxx>.

ALSA conf will search and open an included file in the following order
of priority:

1. directly open the file by its name;
2. search for the file name in top config direcotry "/usr/share/alsa/";
3. search for the file name in additional configuration directories
   specified by users, via alsaconf syntax
   <searchdir:relative-path/to/user/share/alsa>;
   These directories will be searched in the same order as their
   definition.

The configuration directories defined by a file will only be used to
search the files included by this file.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotopology: Fix missing stream name of widgets in text conf file
Mengdong Lin [Mon, 24 Oct 2016 13:22:02 +0000 (21:22 +0800)]
topology: Fix missing stream name of widgets in text conf file

User can define the stream name of an input/output widget in the text conf
file, by setting "stream_name" of a SectionWidget.

Topology C API and kernel already have support for configuring a widget's
stream name. This patch just adds the missing part of the text conf file.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agopcm_plug: Clear plugins on all error conditions
Michael Forney [Thu, 20 Oct 2016 01:22:56 +0000 (18:22 -0700)]
pcm_plug: Clear plugins on all error conditions

Otherwise, they will linger after the error is returned (but pcm->setup == 0).
Then, if the caller tries to clean up and call snd_pcm_close(), the assertion
plug->gen.slave == plug->req_slave will fail.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoconf/ucm: skylake: add skylake-rt286 conf files
Vinod Koul [Fri, 7 Oct 2016 10:58:23 +0000 (16:28 +0530)]
conf/ucm: skylake: add skylake-rt286 conf files

This add the UCM conf files for skylake enabling I2S audio, HDMI and DMIC
ports.

Signed-off-by: Karthik D M <karthik.d.m@intel.com>
Signed-off-by: Nishit Sharma <nishitx.sharma@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoctl: correct documentation about TLV feature
Takashi Sakamoto [Wed, 28 Sep 2016 23:57:24 +0000 (08:57 +0900)]
ctl: correct documentation about TLV feature

From my misunderstanding, some explanations are wrong. This commit
corrects them.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoctl: improve documentation about TLV-related APIs
Takashi Sakamoto [Wed, 28 Sep 2016 23:57:23 +0000 (08:57 +0900)]
ctl: improve documentation about TLV-related APIs

The documentation gives no hints to users about format of TLV data.

This commit add hints to construct/parse the information.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoctl: improve API documentation for TLV operation
Takashi Sakamoto [Wed, 28 Sep 2016 23:57:22 +0000 (08:57 +0900)]
ctl: improve API documentation for TLV operation

A commit fe1b08803db6 ("ctl: improve API documentation for threshold level
operations") changes documentations for some TLV-related APIs with wrong
explanations.

This commit fix it with better explanations.

Fixes: fe1b08803db6 ("ctl: improve API documentation for threshold level operations")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agotest: use actual information for TLV operation
Takashi Sakamoto [Wed, 28 Sep 2016 23:57:21 +0000 (08:57 +0900)]
test: use actual information for TLV operation

Currently, this test program uses undefined type of TLV data. This can
bring confusions to userspace applications.

This commit replaces the array with valid information, constructed by newly
exported TLV macros from kernel land.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoUpdate include/sound/tlv.h from 4.9-pre kernel uapi
Takashi Sakamoto [Wed, 28 Sep 2016 23:57:20 +0000 (08:57 +0900)]
Update include/sound/tlv.h from 4.9-pre kernel uapi

The UAPI header in 4.9-pre kernel newly includes existent macros related
to tlv operation, mainly for layout of TLV packet payload.

This commit updates corresponding backport header in this library.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoucm: docs: typeset lists of identifiers explicitly
Antonio Ospite [Fri, 23 Sep 2016 16:18:57 +0000 (18:18 +0200)]
ucm: docs: typeset lists of identifiers explicitly

Doxygen doesn't preserve formatting that relies only on indentation,
typeset lists of identifiers explicitly.

This makes the HTML docs a lot more readable.

This change comes along the lines of commit 72aa0f8332fb ("ucm: reformat
snd_use_case_get() doc").

Some TABs has been added too in order to preserve the aligned look when
reading the source code.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 years agoucm: fix crash when calling snd_use_case_geti() with no device or modifier
Antonio Ospite [Fri, 23 Sep 2016 16:11:16 +0000 (18:11 +0200)]
ucm: fix crash when calling snd_use_case_geti() with no device or modifier

When calling snd_use_case_geti(uc_mgr, "_devstatus", &lvalue) the code
ends up calling device_status(uc_mgr, NULL), which result in a crash in
strcmp(dev->name, NULL), when there are enabled devices.

This happens because snd_use_case_geti() allows a "_devstatus"
identifier even if it's only supposed to allow the form
"_devstatus/{device}".

So check that the device name is not null.

The same issue occurs with "_modstatus", this change fixes that as well.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>