OSDN Git Service

android-x86/external-alsa-lib.git
8 years agoctl: improve documentation of APIs to add an element set
Takashi Sakamoto [Sat, 9 Jul 2016 01:44:19 +0000 (10:44 +0900)]
ctl: improve documentation of APIs to add an element set

Currently, documentation of APIs to add an element set describes causes of
errors partly. But it gives an opinion to describe them thoroughly. This
is not good for users.

This commit changes the documentation so that it partly describes the
causes.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf/ucm: chtrt5645: Add UCM config for chtrt5645
Stephen Just [Mon, 4 Jul 2016 16:51:55 +0000 (10:51 -0600)]
conf/ucm: chtrt5645: Add UCM config for chtrt5645

Add a UCM configuration for the rt5645 codec on Intel's Cherry-Trail
platform. Tested on the Microsoft Surface 3.

Signed-off-by: Stephen Just <stephenjust@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotest: add linker flag with pthread for pcm-multi-thread stress test
Takashi Sakamoto [Thu, 7 Jul 2016 21:43:51 +0000 (06:43 +0900)]
test: add linker flag with pthread for pcm-multi-thread stress test

This test program is a pthread application, while Makefile has no flags
for linker about pthread library. This can cause below error.

$ make pcm-multi-thread
  CCLD     pcm-multi-thread
/usr/bin/ld: pcm-multi-thread.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:523: recipe for target 'pcm-multi-thread' failed
make: *** [pcm-multi-thread] Error 1

This commit fixes the bug by adding a corresponding flag.

Fixes: 147093ac5b8d('test: Add pcm-multi-thread program')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add dimension validator
Takashi Sakamoto [Thu, 7 Jul 2016 21:33:17 +0000 (06:33 +0900)]
ctl: add dimension validator

Linux 4.7 or former have no validator of dimension information. This can
causes an issue related to user-defined element set. For example, When
calculated total members in multi-dimensional matrix is larger than actual
capacity of snd_ctl_elem_value_t, processes to handle the element can
cause buffer-over-run.

For backward portability of this userspace library, this commit adds a
validator of dimension information. When userspace applications give
invalid dimension information to APIs to add element set, they receive
-EINVAL.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd pcm-multi-thread to .gitignore
Takashi Iwai [Sat, 2 Jul 2016 08:03:55 +0000 (10:03 +0200)]
Add pcm-multi-thread to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotest: Add pcm-multi-thread program
Takashi Iwai [Sat, 2 Jul 2016 08:03:15 +0000 (10:03 +0200)]
test: Add pcm-multi-thread program

A simple multi-thread stress test for PCM is added to test
subdirectory.  It can perform various PCM update function in the
worker threads while reading/writing the data in the main thread.
It can help catching the unexpected error or blockage.  For example,
running the capture test with a softvol plugin will lead to the assert
due to the races.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Remove superfluous rmb() from PCM meter plugin
Takashi Iwai [Thu, 30 Jun 2016 19:56:41 +0000 (21:56 +0200)]
pcm: Remove superfluous rmb() from PCM meter plugin

rmb() is still left in the code without any actual meaning there just
before the atomic operation.  Let's clean it up.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: fix a test for user-defined element set in a point of dimension
Takashi Sakamoto [Thu, 7 Jul 2016 14:22:21 +0000 (23:22 +0900)]
ctl: fix a test for user-defined element set in a point of dimension

Currently, this test program has a bug related to dimension information.
When testing an element set with byte type, the program adds 512 members
to an element. This is a maximum number permitted for this type.

On the other hand, dimension information of the elements consists of
[8, 4, 8, 4]. Calculated members in the multi-dimensional matrix is 1024.
This should be less than 512.

This commit fixes the bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: support dimension test for user-defined element set
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:03 +0000 (22:43 +0900)]
ctl: support dimension test for user-defined element set

In former commits, APIs to add an element set are extended to support extra
fields to information structure. Currently, the fields are mainly used to
describe dimension level.

This commit adds tests to check the dimension level.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: optimize a test for user-defined element set to changes of APIs
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:02 +0000 (22:43 +0900)]
ctl: optimize a test for user-defined element set to changes of APIs

In former commits, APIs to add an element set are changed, while a test
program for user-defined element set doesn't follow them.

This commit add support the change.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: optimize a test for user-defined element set to older kernels
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:01 +0000 (22:43 +0900)]
ctl: optimize a test for user-defined element set to older kernels

In Linux 4.0 or former, call of ioctl(2) with SNDRV_CTL_IOCTL_ELEM_ADD
doesn't fill all of identical information in an argument; i.e. numid.
With the kernel, a test of user-defined element set fails.

This commit fixes the bug. The 'numid' field in identical information
is always zero when adding an element set, therefore zero check has an
effect.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add an API to set dimension levels to element information
Takashi Sakamoto [Wed, 29 Jun 2016 13:43:00 +0000 (22:43 +0900)]
ctl: add an API to set dimension levels to element information

In a former commit, 'struct snd_ctl_elem_info' is used as a 'container' to
transfer extra fields of element information for APIs to add an element
set. The extra fields should be filled in advance of call of the APIs.
Currently, dimension level is in the extra fields and no APIs to set it.

This commit adds an API to set dimension level to the information
structure. This API is expected to be used in advance of usage of APIs
to add an element set, for nothing others. When the information structure
is extended in future, then the similar APIs shall be added for the new
feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: support extra information to user-defined element set
Takashi Sakamoto [Wed, 29 Jun 2016 13:42:59 +0000 (22:42 +0900)]
ctl: support extra information to user-defined element set

In ALSA control feature, information of an element includes extra fields
to type-specific parameters; i.e. dimension. The fields can be extended in
future.

Meanwhile, current APIs to add user-defined element set can not support
such an extended fields. This may cause inconveniences in future.

This commit supports the fields, by changing APIs for element set.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: use consistent name for second argument of snd_ctl_elem_read/write
Takashi Sakamoto [Tue, 28 Jun 2016 13:39:50 +0000 (22:39 +0900)]
ctl: use consistent name for second argument of snd_ctl_elem_read/write

Second argument of these functions has three different names in
documentation/header/code (obj/control/value). This easily causes users'
confusion.

This commit applies consistent names for the arguments.

Fixes: 90020c05f886 ('ctl: improve comments for handling element data')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: use automatic variable instead of call of alloca(3)
Takashi Sakamoto [Mon, 27 Jun 2016 14:37:36 +0000 (23:37 +0900)]
ctl: use automatic variable instead of call of alloca(3)

Inner this library, layouts of all structures are public. At a compilation
time, each size of the structures can be calculated. It means that we can
use automatic variable instead of calling alloca(3) to program this
library because in both ways storages are kept on stack frame of process
VMA. Besides, the usage of automatic variables requires less instructions
than calls of alloca(3). Furthermore, alloca(3) is not described in any
C language standards.

This commit replaces calls of alloca(3) just for structures with automatic
variables, for control features.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: fix returning zero for dimension level 4
Takashi Sakamoto [Mon, 27 Jun 2016 13:02:57 +0000 (22:02 +0900)]
ctl: fix returning zero for dimension level 4

In ALSA kernel/userspace interfaces, 'struct snd_ctl_elem_info' has a
'dimension' parameter. This parameter consists of an array with four
elements. Each element represents the number of members in corresponding
dimension level to construct matrix.

In current implementation, a get function, 'snd_ctl_elem_info_get_dimension()'
is hardcoded to return zero to level 4, against actual value. This commit fixes
the bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agodoxygen: Suppress timestamp
Takashi Iwai [Thu, 23 Jun 2016 14:29:07 +0000 (16:29 +0200)]
doxygen: Suppress timestamp

The build timestamp in the doc is bad for packaging in general, so
let's disable it as default.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoINSTALL: update text and drop reference to Hg
Henrik Austad [Tue, 21 Jun 2016 12:19:26 +0000 (14:19 +0200)]
INSTALL: update text and drop reference to Hg

This is really just nitpick, but it annoyed me for a few seconds, so I thought
I'd just fix it.

In d7534b2ceec7 (hgcompile -> gitcompile) the filename was updated but
INSTALL was not, leaving outdated docs.

Signed-off-by: Henrik Austad <henrik@austad.us>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add test program for control element set
Takashi Sakamoto [Fri, 17 Jun 2016 12:26:42 +0000 (21:26 +0900)]
ctl: add test program for control element set

The feature of control element set has been abandoned for a long time since
firstly introduced in 2003. Furthermore, there's few applications to utilize
this feature. These situations bring a hard work to persons who need the
feature. Especially, a lack of test program make it harder to fix much bugs
in this feature.

This commit adds a test program as a sample of the feature. This program
adds element sets of each element type to 'hw:0' in this order; boolean,
integer, enumerated, bytes, IEC958 and integer64. Each iteration includes
below scheme:

1. add an element set with 900 elements. Each of them has maximum number
   of members allowed by ALSA ctl core.
2. check all of events generated by above operation.
3. retrieve information of each element, then validate it.
4. unlock each member of all elements because they're initially locked.
5. write to all of members in all elements and read.
6. check all of events generated by above operation.
7. write information for threshold level to the element set and read it.
8. check all of events generated by above operation.
9. remove the element set.
10.check all of events generated by above operation.

When any of these operations fail, it means regression occurs. Then, added
elements still remain in a certain sound card. In this case, unloading
drivers corresponding to the card is an easy way to recover.

Besides, this program doesn't perform below element operations of ALSA ctl
feature:
 - list
 - lock
 - replace

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: improve API documentation for threshold level operations
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:44 +0000 (23:57 +0900)]
ctl: improve API documentation for threshold level operations

In alsa-lib, threshold level operations require an array of unsigned-int
members, while there's little explanation about how to fill it. To usual
developers such as me, they're quite hard to understand.

This commit adds a few comment for easy understanding about how to use
the APIs.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add explanation about threshold level feature
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:43 +0000 (23:57 +0900)]
ctl: add explanation about threshold level feature

ALSA ctl feature includes threshold level feature. This is introduced in
2006, and there's little resources about it.

This commit adds a simple explanation about the feature.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: use new APIs to add a control element set for softvol plugin
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:42 +0000 (23:57 +0900)]
pcm: use new APIs to add a control element set for softvol plugin

In previous commit, some APIs to add a single element are discouraged to
continue using.

This commit replaces usage of the old APIs with new APIs.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: change former APIs as wrapper functions of element set APIs
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:41 +0000 (23:57 +0900)]
ctl: change former APIs as wrapper functions of element set APIs

In former commit, userspace library gets some APIs for element set. Some
existed functions can be simple wrappers of them.

This commit changes these APIs as wrapper functions. Additionally, this
commit also adds local variables for identical information of elements.
This modification is important to keep API consistency.

Some old APIs to add an element have id variables with const type
qualifier, while some new APIs to add element set changes the content of
given parameters. This comes from a change in Linux kernel 4.1.

In this commit [1], in-kernel implementation fills all fields of identical
data in userspace. As a result, when adding a new element set, userspace
applications can get an identical data for the first element in the set.
This lost the semantics of const type qualifier in userspace.

[1] http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/core?id=cab2ed7474bffafd2a68a885e03b85526194abcd

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: improve comments for API to add an element of IEC958 type
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:40 +0000 (23:57 +0900)]
ctl: improve comments for API to add an element of IEC958 type

In ALSA control core, it's not allowed to an element set of IEC 958 type
to have several elements. Therefore, consecutive patchset doesn't touch an
API to add an element of IEC958 type. However, it's better to supplement
comments for the API.

This commit do it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add functions to add an element set
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:39 +0000 (23:57 +0900)]
ctl: add functions to add an element set

ALSA control core allows userspace applications to add an element set.
However, in ALSA userspace library, there's no APIs enough to utilize
the feature. The library has APIs just to add an element set with a single
element.

This commit adds functions to add an element set with several elements.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: improve comments for handling element data
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:38 +0000 (23:57 +0900)]
ctl: improve comments for handling element data

Some parts of control API documentation are described with core-developer
friendly explanations. To usual developer such as me, they're quite hard
to understand.

This commit improves such comments for a part of APIs to handle data of
each element.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoctl: add an overview for design of ALSA control interface
Takashi Sakamoto [Wed, 15 Jun 2016 14:57:37 +0000 (23:57 +0900)]
ctl: add an overview for design of ALSA control interface

This commit adds a description about the design of ALSA control interface
for  developers to understand a few components of low level.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf/ucm: ROCKCHIP-I2S: rename to VEYRON-I2S
Heiko Stübner [Wed, 8 Jun 2016 23:17:15 +0000 (01:17 +0200)]
conf/ucm: ROCKCHIP-I2S: rename to VEYRON-I2S

Commit a192f52fc63a introduced an ucm profile for Rockchip Veyron-
Chromebooks by taking the ucm profile from the ChromeOS userspace.

But similarly to DAISY-I2S, PAZ00 and most other profiles, the audio
setup is pretty specific to a board type, so hogging the Rockchip name
will make it harder for future Rockchip based boards to fit in nicely.

And while Veyron also is a family of boards, all of them share the
same audio setup. The ucm profile was not released with any official
alsa release and the audio setup also isn't in the mainline kernel yet,
so such a rename should be easily possible.

Fixes: a192f52fc63a ("conf/ucm: ROCKCHIP-I2S: add Rockchip I2S UCM config.")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoasync: Handle previously installed signal handler
Eliot Miranda [Wed, 1 Jun 2016 06:16:31 +0000 (08:16 +0200)]
async: Handle previously installed signal handler

The issue is with the signal handler installed and deinstalled in
alsa-lib async handler.  This code makes no attempt to remember any
previously installed signal handlers for SIGIO, if SIGIO is used.
Consequently it does not call any previous handlers from its own
handler once installed, and does not reinstall any previous handler
when deinstalling its handler.  Consequently, use of also-lib within
applications that depend on SIGIO will break those applications,
rendering them inoperative once alsa-lib is running because their
signal handlers are no longer called.

This patch does remember and restore any previous handler, and chains
calls to the handler if it exists.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: dmix: Return error when slave is in OPEN or DISCONNECTED
Takashi Iwai [Tue, 31 May 2016 10:48:40 +0000 (12:48 +0200)]
pcm: dmix: Return error when slave is in OPEN or DISCONNECTED

A slave PCM in OPEN or DISCONNECTED state can't be used properly at
all, so the best option is to return -EBADFD error.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: dmix: Prepare slave when it's in SETUP, too
Takashi Iwai [Tue, 31 May 2016 10:46:03 +0000 (12:46 +0200)]
pcm: dmix: Prepare slave when it's in SETUP, too

SETUP is an unusual state, but it's still possible.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: dmix: resume workaround for buggy driver
Takashi Iwai [Wed, 25 May 2016 13:03:51 +0000 (15:03 +0200)]
pcm: dmix: resume workaround for buggy driver

The previous commit removed the whole handling of resume in dmix, but
this seems causing another regression; some buggy drivers assume that
the device-resume needs to be triggered before transitioning to
PREPARED state.  As an ugly workaround, in this patch, when the slave
PCM supports resume, snd_pcm_direct_resume() does resume of the slave
PCM but immediately drop the stream after that.  In that way, the
device is brought to the sane active state, then the apps can prepare
and restart the stream properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Fix secondary retry in dsnoop and dshare
Takashi Iwai [Sat, 28 May 2016 08:37:26 +0000 (10:37 +0200)]
pcm: Fix secondary retry in dsnoop and dshare

The commit [fdba9e1bad8f: pcm: Fallback open as the first instance for
dmix & co] introduced a mechanism to retry the open of slave PCM for
the secondary streams, but this also introduced a regression in dsnoop
and dshare plugins: since the retry goto-tag was placed at a wrong
position, it retries to re-fetch the shm unnecessarily and eventually
leads to the fatal error.

The bug can be easily reproduced by starting arecord and killing it
via SIGKILL, then starting arecord again.  The second arecord fails.

The fix is obviously to move the wrong retry goto-tags to the right
positions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Remove resume support from dmix & co
Takashi Iwai [Wed, 18 May 2016 08:38:27 +0000 (10:38 +0200)]
pcm: Remove resume support from dmix & co

PCM dmix and other plugins inherit the resume behavior from the slave
PCM.  However, the resume on dmix can't work reliably even if the
slave PCM may do resume.  The running state of each dmix stream is
individual and may be PREPARED or RUN_PENDING while the slave PCM is
already in RUNNING.  And, when the slave PCM is resumed, the whole
samples that have been already mapped are also played back, even if
the corresponding dmix stream is still in SUSPENDED.  Such
inconsistencies can't be avoided as long as we manage each stream
individually.

That said, dmix & co can't provide the proper resume support "by
design".  For aligning with it, we should drop the whole resume code
and clear the PCM SND_PCM_INFO_RESUME flag.

Reported-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf: Add thread-safe global tree reference
Takashi Iwai [Tue, 17 May 2016 13:39:07 +0000 (15:39 +0200)]
conf: Add thread-safe global tree reference

Most of open functions in alsa-lib have the call pattern:
  snd_config_update();
  return snd_xxx_open(x, snd_config, ...);

This means that the toplevel config gets updated, and passed to a
local open function.  Although snd_config_update() itself has a
pthread mutex to be thread safe, the whole procedure above isn't
thread safe.  Namely, the global snd_config tree may be deleted and
recreated at any time while the open function is being processed.
This may lead to a data corruption and crash of the program.

For avoiding the corruption, this patch introduces a refcount to
config tree object.  A few new helper functions are introduced as
well:
- snd_config_update_ref() does update and take the refcount of the
  toplevel tree.   The obtained config tree has to be freed via
  snd_config_unref() below.
- snd_config_ref() and snd_config_unref() manage the refcount of the
  config object.  The latter eventually deletes the object when all
  references are gone.

Along with these additions, the caller of snd_config_update() and
snd_config global tree in alsa-lib are replaced with the new helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Define namehint for single directional PCM types
Takashi Iwai [Thu, 12 May 2016 14:33:19 +0000 (16:33 +0200)]
pcm: Define namehint for single directional PCM types

The PCM namehint for some PCM types like dmix, dsnoop and surround51
should be defined as single directional.

Reported-by: Trent Reed <treed0803@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agonamehint: Don't enumerate as duplex if only a single direction is defined
Takashi Iwai [Thu, 12 May 2016 14:30:44 +0000 (16:30 +0200)]
namehint: Don't enumerate as duplex if only a single direction is defined

When a hint description has only either device_input or device_output,
we shouldn't handle it as a full duplex but rather a single
direction.  In that way, we can avoid to list up a playback stream
like dmix or surround51 as a capture stream in the namehint.

Reported-by: Trent Reed <treed0803@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: dmix: Fix doubly resume of slave PCM
Takashi Iwai [Wed, 11 May 2016 11:06:25 +0000 (13:06 +0200)]
pcm: dmix: Fix doubly resume of slave PCM

The dmix plugin and co may trigger the resume for each instance in
snd_pcm_direct_resume().  It means that the slave PCM gets resumed or
re-prepared/started by each opened dmix stream, and this may end up
with the doubly triggers even though the slave PCM has been already
resumed by another dmix stream.

For avoiding this conflicts, check the slave PCM state and resume only
when it's still in the suspended state.  Meanwhile we keep the shadow
state updated no matter whether the slave was triggered or not.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Fix suspend/resume regression with dmix & co
Takashi Iwai [Wed, 11 May 2016 07:06:47 +0000 (09:06 +0200)]
pcm: Fix suspend/resume regression with dmix & co

The recent fix commit [8985742d91db: pcm: dmix: Handle slave PCM xrun
and unexpected states properly] caused a regression in dmix and other
plugins regarding suspend/resume.  For example, aplay endlessly prints
"Suspended. Trying resume. Done." message if suspend and resume are
performed in the middle of playback.

The reason is that the commit above changed the shadow PCM state
(dmix->state) to SUSPENDED when the slave PCM is in suspend, while it
doesn't restore the shadow state upon resume.  Thus it appears as if
it's always suspended even after the resume is invoked.

The fix is just to add the proper update of the shadow state in
snd_pcm_direct_resume().

Reported-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf/ucm: ROCKCHIP-I2S: add Rockchip I2S UCM config.
Enric Balletbo i Serra [Thu, 5 May 2016 06:32:06 +0000 (08:32 +0200)]
conf/ucm: ROCKCHIP-I2S: add Rockchip I2S UCM config.

Taken from the ChromeOS sources, this configuration was tested on Veyron
Jerry based Chromebook from Google.

[Added missing Makefile changes by tiwai]

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: softvol: fix conversion of TLVs min_db and max_dB value
Jörg Krause [Sun, 8 May 2016 18:48:42 +0000 (20:48 +0200)]
pcm: softvol: fix conversion of TLVs min_db and max_dB value

Both, min_dB and max_dB, are floating type whereas the TLV is (always)
unsigned.

The problem with the conversion of a negative floating-point number into an
unsigned integer is, that the behavior is undefined. This may, depending on
the platform, result in a wrong TLV, i.e. for the default values of min_dB
(-51dB) and max_dB (0dB), alsactl generates the following state on an ARM
cpu build with GCC:

control.1 {
                iface MIXER
                name Master
                value.0 255
                value.1 255
                comment {
                        access 'read write user'
                        type INTEGER
                        count 2
                        range '0 - 255'
                        tlv '00000001000000080000000000000014'
                        dbmin 0
                        dbmax 5100
                        dbvalue.0 5100
                        dbvalue.1 5100
                }
        }

With the fix applied, alsactl stores the correct TLV:

control.1 {
                iface MIXER
                name Master
                value.0 255
                value.1 255
                comment {
                        access 'read write user'
                        type INTEGER
                        count 2
                        range '0 - 255'
                        tlv '0000000100000008ffffec1400000014'
                        dbmin -5100
                        dbmax 0
                        dbvalue.0 0
                        dbvalue.1 0
                }
        }

Also tested for different combinations of min_dB and max_dB other than the
default values.

Replaces:
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107733.html

Fixes:
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107628.html

Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Update PCM configurations in Broadwell text conf file
Mengdong Lin [Fri, 29 Apr 2016 03:03:45 +0000 (11:03 +0800)]
topology: Update PCM configurations in Broadwell text conf file

To make this conf file a better example, update the name & ID of PCMs
(front-end DAI link) and their cpu DAI (front-end DAI), same as those
defined by Broadwell upstream driver.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Parse front-end DAI name and ID for the PCM
Mengdong Lin [Fri, 29 Apr 2016 03:03:37 +0000 (11:03 +0800)]
topology: Parse front-end DAI name and ID for the PCM

These two fields are necessary to create the front-end DAIs
in kernel but the support is missing in text conf previously.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Fix pcm ID & name parsing
Mengdong Lin [Fri, 29 Apr 2016 03:03:30 +0000 (11:03 +0800)]
topology: Fix pcm ID & name parsing

The name and ID of SectionPCM should be set to pcm_name and pcm_id,
for a front-end DAI link in the kernel, not for the front-end DAI
of the link.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Use generic pointer to realloc buffer for private data
Mengdong Lin [Fri, 29 Apr 2016 03:03:22 +0000 (11:03 +0800)]
topology: Use generic pointer to realloc buffer for private data

Many element types have private data. So use the generic obj pointer
instead of the type-specific pointer when reallocating the object to
accommodate the private data.

Empty private data will be overlooked.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Refactor functions to parse and build streams
Mengdong Lin [Fri, 29 Apr 2016 03:03:04 +0000 (11:03 +0800)]
topology: Refactor functions to parse and build streams

Previously these functions are only used by pcm elements (front-end DAI
& DAI link) to parse stream capablities. Now refactor them to be reused
by back-end DAI elements later.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Set manifest size for ABI
Mengdong Lin [Fri, 29 Apr 2016 03:02:57 +0000 (11:02 +0800)]
topology: Set manifest size for ABI

The topology kernel driver will check the size of manifest struct, and
will stop loading topology info if size mismatch is detected.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd src/conf/topology/sklrt286/data/pvt_data to .gitignore
Takashi Iwai [Thu, 28 Apr 2016 14:16:08 +0000 (16:16 +0200)]
Add src/conf/topology/sklrt286/data/pvt_data to .gitignore

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf: topology: Generate Private data binary blobs
Shreyas NC [Thu, 28 Apr 2016 05:37:58 +0000 (11:07 +0530)]
conf: topology: Generate Private data binary blobs

The DSP modules need private data and that is provided as binary
blob. These blobs are compiled from C structures which specify module
configuration.

Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd u8 in type_compat.h
Shreyas NC [Thu, 28 Apr 2016 05:37:57 +0000 (11:07 +0530)]
Add u8 in type_compat.h

Skylake headers use u8 data types which were not present in
type_compat so add them.

Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoconf: topology: Add Skylake i2s conf
Shreyas NC [Thu, 28 Apr 2016 05:37:56 +0000 (11:07 +0530)]
conf: topology: Add Skylake i2s conf

The Skylake topology configuration for simple topology graph is
provided. This exposes the PCM capabilities of the DSP.

Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Fallback open as the first instance for dmix & co
Takashi Iwai [Thu, 14 Apr 2016 15:33:03 +0000 (17:33 +0200)]
pcm: Fallback open as the first instance for dmix & co

dmix and other PCM plugins tries to open a secondary stream with
O_APPEND flag when the shmem was already attached by another.
However, when another streams have been already closed after the
shmem check, this open may return the error EBADFD, since the kernel
accepts O_APPEND only for the secondary streams.

This patch adds a workaround for such a case.  It just retries opening
the stream as the first instance (i.e. without O_APPEND flag).
This is basically safe behavior (the kernel takes care of races), even
we may do this even unconditionally.  But it's bad from the
performance POV, so we do it only when really needed.

Reported-by: Lars Lindqvist <lars.lindqvist@yandex.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoucm: add cset-tlv
Hsin-Yu Chao [Wed, 13 Apr 2016 10:53:09 +0000 (18:53 +0800)]
ucm: add cset-tlv

This patch enables UCM to set a file in TLV format to kcontrol by:
cset-tlv "name='<kcontrol-name>' <path-to-file>"
This new 'cset-tlv' command will be used to write audio DSP to
specific alsa control, where the driver expectes a file in TLV
format.
The TLV file to set to kcontrol will be checked first by file size
not larger than 16 MB, and then examine if the length field reports
correct number of bytes in the TLV file.

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Build data objects with tuples
Mengdong Lin [Thu, 7 Apr 2016 07:29:49 +0000 (15:29 +0800)]
topology: Build data objects with tuples

For data objects with tuples, the parser will bind the vendor tuples
and tokens, copy the tuples to the private buffer of its parent data
object. Then later the builder will export the vendor tuples as private
binary data for the control or widgets objects.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add support for parsing vendor tuples
Mengdong Lin [Thu, 7 Apr 2016 07:29:43 +0000 (15:29 +0800)]
topology: Add support for parsing vendor tuples

Vendor can define several tuple arrays in 'SectionVendorTuples', as
well as the reference to a vendor token list object.

A later patche will copy vendor tuples in ABI format to the private
buffer of its parent data object in the building phase.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add support for vendor tokens
Mengdong Lin [Thu, 7 Apr 2016 07:29:36 +0000 (15:29 +0800)]
topology: Add support for vendor tokens

Vendor can define a token list in SectionVendorTokens. Each token element
is a pair of string ID and integer value. And both the ID and value are
vendor-specific.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: ABI - Define types for vendor tuples
Mengdong Lin [Thu, 7 Apr 2016 07:29:27 +0000 (15:29 +0800)]
topology: ABI - Define types for vendor tuples

Tuples, a pair of token and value, can be used to define vendor specific
data, for controls and widgets. This can avoid importing binary data blob
from other files.

Vendor specific tuple arrays will be embeded in the private data buffer
of a control or widget object. To be backward compatible, union is used
to define the tuple arrays in the existing private data ABI object
'struct snd_soc_tplg_private'.

Vendors need to make sure the token values defined by the topology conf
file match those defined by their driver.

Now supported tuple types are uuid, string, bool, byte, short and word.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add doc for vendor tuples
Mengdong Lin [Thu, 7 Apr 2016 07:29:15 +0000 (15:29 +0800)]
topology: Add doc for vendor tuples

Describe how to define vendor tokens and tuples in the text conf file.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Define a free handler for the element
Mengdong Lin [Thu, 7 Apr 2016 07:29:01 +0000 (15:29 +0800)]
topology: Define a free handler for the element

This handler is defined for type-specific destruction of an element.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Use the generic pointer to free an element's object
Mengdong Lin [Thu, 7 Apr 2016 07:28:42 +0000 (15:28 +0800)]
topology: Use the generic pointer to free an element's object

The element is a wrapper for different types of objects.So use the
generic pointer 'obj' instead of the type-specific pointer to free
the object.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: Clean up error paths in snd_pcm_plugin_*() helpers
Takashi Iwai [Thu, 7 Apr 2016 14:29:41 +0000 (16:29 +0200)]
pcm: Clean up error paths in snd_pcm_plugin_*() helpers

Minor code refactoring to unify the error return paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm_plugin: fix appl pointer not correct when mmap_commit() return error
Shengjiu Wang [Wed, 6 Apr 2016 11:02:12 +0000 (19:02 +0800)]
pcm_plugin: fix appl pointer not correct when mmap_commit() return error

When snd_pcm_mmap_commit() return error, the appl pointer is also updated.
which cause the avail_update()'s result wrong.
This patch move the snd_pcm_mmap_appl_forward() to the place when
snd_pcm_mmap_commit() is successfully returned.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoRelease v1.1.1
Jaroslav Kysela [Thu, 31 Mar 2016 13:10:39 +0000 (15:10 +0200)]
Release v1.1.1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agotopology: Add support for widget byte controls
Liam Girdwood [Mon, 14 Mar 2016 08:07:38 +0000 (08:07 +0000)]
topology: Add support for widget byte controls

Add support for DAPM widgets to include bytes controls.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: add support for CTL access flags to config file
Liam Girdwood [Mon, 14 Mar 2016 08:07:37 +0000 (08:07 +0000)]
topology: add support for CTL access flags to config file

Allow the config files to define CTL access flags.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: add support for pasring external ops in conf files
Liam Girdwood [Mon, 14 Mar 2016 08:07:36 +0000 (08:07 +0000)]
topology: add support for pasring external ops in conf files

Parsing external ops was missing from the conf files but was in the
C API. Fix this now by making sure we also check for external ops.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add ops to bytes control.
Liam Girdwood [Mon, 14 Mar 2016 08:07:35 +0000 (08:07 +0000)]
topology: Add ops to bytes control.

Byte controls can also support ops. Add them to the parser.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: fix 'unable to create IPC shm instance' caused by fork from a thread
Qing Cai [Thu, 10 Mar 2016 12:40:51 +0000 (07:40 -0500)]
pcm: fix 'unable to create IPC shm instance' caused by fork from a thread

As stated in manpage SHMCTL(2), shm_nattch is "No. of current attaches"
(i.e., number of processes attached to the shared memeory). If an
application uses alsa-lib and invokes fork() from a thread of the
application, there may be the following execution sequence:
 1. execute the following statement:
      pcm_direct.c:110: dmix->shmptr = shmat(dmix->shmid, 0, 0)
    (shm_nattch becomes 1)
 2. invoke fork() in some thread.
    (shm_nattch becomes 2)
 3. execute the following statement:
      pcm_direct.c:122: if (buf.shm_nattch == 1)
 4. execute the following statement:
      pcm_direct.c:131: if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC)
    (As stated in manpage SHMGET(2), "When a new shared memory segment
     is created, its contents are initialized to zero values", so
     dmix->shmptr->magic is 0)
 5. execute the following statements:
      pcm_direct.c:132: snd_pcm_direct_shm_discard(dmix)
      pcm_direct.c:133: return -EINVAL
The above execution sequence will cause the following error:
  unable to create IPC shm instance
This error causes multimedia application has no sound. This error rarely
occurs, probability is about 1%.

More notes about this patch:
this patch tries to address the race above by changing the condition
to identify "the first user".  Until now, the first user was
identified by checking shm_nattch.  But this is racy, as stated in the
above.

In this version, we try to assign a shm at first without IPC_CREAT.
If this succeeds, we are not alone, so we must not be the first user.
Only when this fails, try to get a shmem with IPC_CREAT and IPC_EXCL.
If this succeeds, we are the first user.  And, one more notable point
is that the race of this function call itself is protected by
semaphore in the caller side.  The only point to avoid is the race
after shmget() and the first initialization, and this method should
work around that.

Signed-off-by: Qing Cai <bsiice@msn.com>
Signed-off-by: Qing Cai <caiqing@neusoft.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoseq: Provide sequencer sound card number / PID via alsa-lib
Martin Koegler [Thu, 3 Mar 2016 21:39:37 +0000 (22:39 +0100)]
seq: Provide sequencer sound card number / PID via alsa-lib

rawmidi devices expose the card number via IOCTLs, which allows to
find the corresponding device in sysfs.

The sequencer provides no identifing data. Chromium works around this
issue by scanning rawmidi as well as sequencer devices and matching
them by using assumtions, how the kernel register sequencer devices.

This changes adds support for exposing the card number for kernel clients
as well as the PID for user client.

It supports kernels with and without the required support.

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoUpdate include/sound/asequencer.h from 4.6-pre kernel uapi
Takashi Iwai [Fri, 4 Mar 2016 09:57:32 +0000 (10:57 +0100)]
Update include/sound/asequencer.h from 4.6-pre kernel uapi

A few unimplemented ioctl definitions have been removed.  Also
<sound/asound.h> is included locally, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoUpdate include/sound/asound.h from 4.6-pre kernel uapi
Takashi Iwai [Fri, 4 Mar 2016 09:52:18 +0000 (10:52 +0100)]
Update include/sound/asound.h from 4.6-pre kernel uapi

The inclusion of <linux/*.h> is done conditionally for Linux in order
to improve portability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Remove unnecessary includes
Thomas Klausner [Thu, 3 Mar 2016 14:08:04 +0000 (15:08 +0100)]
topology: Remove unnecessary includes

Headers are already included in local.h.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoUse alphasort where versionsort is not available.
Thomas Klausner [Thu, 3 Mar 2016 11:58:07 +0000 (12:58 +0100)]
Use alphasort where versionsort is not available.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoOnly use F_SETSIG fcntl where it exists.
Thomas Klausner [Thu, 3 Mar 2016 11:57:34 +0000 (12:57 +0100)]
Only use F_SETSIG fcntl where it exists.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoAdd more compatibility defines.
Thomas Klausner [Thu, 3 Mar 2016 11:56:58 +0000 (12:56 +0100)]
Add more compatibility defines.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoIntroduce bswap.h for portable definitions of byte swap macros.
Thomas Klausner [Thu, 3 Mar 2016 11:16:57 +0000 (12:16 +0100)]
Introduce bswap.h for portable definitions of byte swap macros.

Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoDefine some types if missing
Thomas Klausner [Wed, 2 Mar 2016 22:11:54 +0000 (23:11 +0100)]
Define some types if missing

Include Linux headers on Linux only.
For portability with non-Linux.

Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoDefine EBADFD in terms of EBADF if it doesn't exist.
Thomas Klausner [Wed, 24 Feb 2016 13:15:10 +0000 (14:15 +0100)]
Define EBADFD in terms of EBADF if it doesn't exist.

For portability on FreeBSD, NetBSD and probably others.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agocontrol: keep consistent usage of assertion
Takashi Sakamoto [Mon, 22 Feb 2016 13:13:31 +0000 (22:13 +0900)]
control: keep consistent usage of assertion

In most codes for control APIs, assertions are used to check given
arguments from applications. If the arguments are not expected, the
application is forced to abort. When NDEBUG is defined in the beginning
of the codes, no checks are performed.

Although, in snd_ctl_elem_set_bytes(), assertion is used with condition
statement. There's an intention to check the arguments regardless of
NDEBUG. However, this is not the same fashion in the codes.

This commit applies the same fashion to the function, to keep consistent
usage of assertion.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agocontrol: initialize element channel values according to identification number at...
Takashi Sakamoto [Sun, 21 Feb 2016 16:54:28 +0000 (01:54 +0900)]
control: initialize element channel values according to identification number at adding a new element

In ALSA control core, there're two ways to identify elements. One is by
numid. Another is by name/index. The former way is lighter than the latter
way.

In control API, after adding elements by snd_ctl_elem_add_integer() and
snd_ctl_elem_add_integer64(), these functions initialize value of each
channel. When executing this operation, used ID information is still given
by applications. Although, in this time, the element can be identified
according to numid.

This commit uses the numid instead of name/index pair.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agocontrol: fulfill a description about element type with integer64
Takashi Sakamoto [Sun, 21 Feb 2016 16:54:19 +0000 (01:54 +0900)]
control: fulfill a description about element type with integer64

In UAPI of asound.h, there're 6 types of control element; boolean, integer,
enumerated, bytes, iec958 and integer64 (The none type seems to be added to
start the value at non-zero). Although, current description in alsa-lib
has a lack of integer64 type.

This commit fulfil the type.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: fix debug output to print correct "max" value.
Liam Girdwood [Mon, 1 Feb 2016 14:20:44 +0000 (14:20 +0000)]
topology: fix debug output to print correct "max" value.

Debug log is printing num_regs instead of max in the max section.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agocoverity fixes
Jaroslav Kysela [Tue, 12 Jan 2016 15:25:42 +0000 (16:25 +0100)]
coverity fixes

8 years agopcm_hw: fix possible memory leak (coverity)
Jaroslav Kysela [Tue, 12 Jan 2016 15:07:16 +0000 (16:07 +0100)]
pcm_hw: fix possible memory leak (coverity)

8 years agocontrol: add missing asserts to ctl_elem_set functions
Jaroslav Kysela [Tue, 12 Jan 2016 14:58:25 +0000 (15:58 +0100)]
control: add missing asserts to ctl_elem_set functions

8 years agoconfig files - do not include ucm/topology configuration when not requested
Jaroslav Kysela [Tue, 12 Jan 2016 13:56:18 +0000 (14:56 +0100)]
config files - do not include ucm/topology configuration when not requested

8 years agotopology: Quit and show error message on big-endian machines
Mengdong Lin [Thu, 19 Nov 2015 08:33:12 +0000 (03:33 -0500)]
topology: Quit and show error message on big-endian machines

This tool can only support little-endian machines atm.
Many codes directly refer to  __le32/__le64 variables of ABI objects,
so will be broken on big-endian machines.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Not compare a for loop iterator with ABI __le32 variables
Mengdong Lin [Thu, 19 Nov 2015 08:33:05 +0000 (03:33 -0500)]
topology: Not compare a for loop iterator with ABI __le32 variables

The iterator 'i' in a loop is a usually a integer. But ABI variables use
type _le32, which is converted to host unsigned integer. Comparing them
can cause gcc warning: comparison between signed and unsigned integer
expressions[-Wsign-compare].

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Fix comparison of unsigned expression < 0
Mengdong Lin [Wed, 18 Nov 2015 07:23:59 +0000 (02:23 -0500)]
topology: Fix comparison of unsigned expression < 0

Fix gcc warning: comparison of unsigned expression < 0 is always false
[-Wtype-limits]

The ABI object channel->id is _le32 and is converted to host unsigned
integer. It cannot be < 0.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Remove unused variables
Mengdong Lin [Wed, 18 Nov 2015 07:23:19 +0000 (02:23 -0500)]
topology: Remove unused variables

Fix gcc warning when -Wunused-variable is set.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Remove unused function write_data_block()
Mengdong Lin [Wed, 18 Nov 2015 07:22:59 +0000 (02:22 -0500)]
topology: Remove unused function write_data_block()

Fix gcc warning: 'write_data_block' defined but not used
[-Wunused-function].

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: open topology files with O_TRUNC
Vinod Koul [Wed, 18 Nov 2015 13:42:46 +0000 (19:12 +0530)]
topology: open topology files with O_TRUNC

The topology file if exists needs to rewritten, so we need to open these
files with O_TRUNC flag as well

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agopcm: simple: Fix asserts
Peter Rosin [Wed, 11 Nov 2015 15:11:10 +0000 (16:11 +0100)]
pcm: simple: Fix asserts

Do not error out on the boundaries.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agotopology: Add missing include sys/stat.h
Takashi Iwai [Mon, 9 Nov 2015 12:37:26 +0000 (13:37 +0100)]
topology: Add missing include sys/stat.h

Necessary for proper definitions of S_IRUSR & co.  Otherwise it
results in compile errors with old glibc:
  parser.c: In function 'snd_tplg_build_file':
  parser.c:262: error: 'S_IRUSR' undeclared (first use in this function)
  parser.c:262: error: (Each undeclared identifier is reported only once
  parser.c:262: error: for each function it appears in.)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agoRelease v1.1.0
Jaroslav Kysela [Mon, 9 Nov 2015 07:39:18 +0000 (08:39 +0100)]
Release v1.1.0

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agotopology: Add missing prototypes for new functions
Takashi Iwai [Sat, 7 Nov 2015 10:29:13 +0000 (11:29 +0100)]
topology: Add missing prototypes for new functions

The prototypes for some functions that have been added in the recent
changes are missing, which leads to compile warnings.  Let's fix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: remove little endian type from userspace header
Liam Girdwood [Fri, 6 Nov 2015 14:57:17 +0000 (14:57 +0000)]
topology: remove little endian type from userspace header

Use a generic uint64_t for formats instead of an ABI endian specific
__le64 type.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
8 years agotopology: Add C API support for PCM
Mengdong Lin [Thu, 5 Nov 2015 12:49:36 +0000 (20:49 +0800)]
topology: Add C API support for PCM

PCM objects can be added by C API. And this is used to create FE DAIs
and DAI links in kernel.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agotopology: Add C API support for BE and CC Links.
Vedang Patel [Thu, 5 Nov 2015 12:49:23 +0000 (20:49 +0800)]
topology: Add C API support for BE and CC Links.

Adding BE and CC Link support for C API reference. This will be used
to populate the .hw_params element for BE and .params for CC, enabling
us to update already existing DAI Links created by the kernel.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
8 years agotopology: ABI - Rename dai_elems to pcm_elems in manifest
Mengdong Lin [Thu, 5 Nov 2015 12:49:10 +0000 (20:49 +0800)]
topology: ABI - Rename dai_elems to pcm_elems in manifest

This field is the number of PCM objects (a pair of FE DAI and DAI link).

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>