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.
Alexander Jahn [Fri, 30 Dec 2016 06:29:11 +0000 (11:59 +0530)]
pcm: dshare: enable silence
This issue depends on system load - if the process using dshare is
scheduled fast enough, then there is no noise. A delay of e.g >~2ms
produces hearable noise.
Reproduction with instrumented aplay(sleep every 100th period for a
given time):
During the sleep time of 2000000us (2s) the hardware plays old samples
in a loop before xrun is detected and recovered after the sleep.
This is resolved by placing it in silence, in case of dshare plugin.
Signed-off-by: Alexander Jahn <ajahn@de.adit-jv.com> Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Joshua Frkuska [Fri, 30 Dec 2016 06:26:15 +0000 (11:56 +0530)]
pcm: direct: allow users to configure different period sizes
This patch allows the effective period size to be a multiple of the
slave-pcm period size.
Allowing only exact multiple of original period size is achieved by
borrowing code from the kernel hwrules implementation.
This patch is intended to save cpu workload when for example, the
slave operates with very small periods but a user does not need that
small periods.
This feature is enabled by default and can be disabled by adding
config option 'var_periodsize 0'.
Signed-off-by: Alexander Jahn <ajahn@de.adit-jv.com> Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Pape [Fri, 25 Nov 2016 10:25:05 +0000 (15:55 +0530)]
pcm: file: update linked hw_ptr and appl_ptr
Plugin file provides no private hw_ptr and appl_ptr but instead links
them to the slave pcm. If the slave pcm itself changes its hw_ptr or
app_prt this needs to be done in file plugin, too.
Plugin 'plug' is such a candidate changing the hw_ptr and app_ptr in
hw_params call dependent on the automatically inserted plugins. ALSA
unfortunately has no support for automatically updating chained
pointers.
A notification on pointer change seems to be prepared inside the
snd_pcm_set_ptr() routine via rbptr->changed(), but it is not (yet)
implemented so that we need to care for it manually.
Signed-off-by: Andreas Pape <apape@de.adit-jv.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alan Young [Tue, 14 Jun 2016 09:15:01 +0000 (10:15 +0100)]
pcm_rate: Do not discard slave reported delay in status result.
snd_pcm_rate_status() gets the underlying status from the slave PCM.
This may contain a delay value that includes elements such as codec and
other transfer delays. Use this as the base for the returned delay
value, adjusted for any frames buffered locally (within the rate
plugin).
Also update snd_pcm_rate_delay() similarly.
[fixed some comments by tiwai]
Signed-off-by: Alan Young <consult.awy@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fixes: 53f7711769d4("topology: Define a function to build a single physical DAI link") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Sakamoto [Sun, 11 Dec 2016 11:31:38 +0000 (20:31 +0900)]
pcm: fix wrong document references to PCM APIs which perform direct memory access with frame copying
In a design of ALSA PCM interface, for PCM frame transmission to/from
kernel space, applications can select from two options; direct memory access
or ioctl(2). Available options are decided depending on device capacity and
machine architecture. Applications can get available options by the first
entry of 'struct snd_pcm_hw_params.masks'.
When the mask includes 'SNDRV_PCM_ACCESS_MMAP_xxx', applications can use
direct memory access. For this use case, userspace library has two types
of PCM API. One is to expose a pointer over the memory to start
reading/writing PCM frames. Another is to copy PCM frames between the
memory and a given buffer.
Current documentation includes wrong references to these APIs to describe
their advantages/disadvantages. This confuses application developers
because the references indicate PCM APIs to execute ioctl(2) operation to
read/write PCM frames.
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.
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.
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.
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.
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.
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.
Mengdong Lin [Fri, 25 Nov 2016 05:20:02 +0000 (13:20 +0800)]
topology: Update physical link configurations in Broadwell text conf file
To make this conf file a better example, add configurations for the
physical link "Codec", same as that defined by Intel Broadwell upstream
machine driver.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 24 Nov 2016 01:34:00 +0000 (09:34 +0800)]
topology: Store number of strings of a text section
Enum controls may use text elements and need the number of strings.
This patch adds a text child object for a generic element. When parsing
a text section from the configuation file, store the text strings and
number of strings (num_items) in the text child object of the element.
Reported-by: G Kranthi <gudishax.kranthikumar@intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Thu, 24 Nov 2016 01:33:52 +0000 (09:33 +0800)]
topology: Merge private data before embedded controls of a widget
For a widget ABI object, its private data sits before the embedded
controls, so we should merge the private data blocks at first, and
then the embedded controls.
Mengdong Lin [Wed, 16 Nov 2016 06:43:07 +0000 (14:43 +0800)]
topology: Revise document and comments for ABI v5
Revise the obsolete content in document and comments.
Here are the major changes in implementation from early phase design:
- PCM object is used to configure front end DAI & DAI links, not used by
physical DAI or DAI links.
- No longer use separate object for backend or codec<->codec links, but
use physical links to cover them.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Wed, 16 Nov 2016 06:42:58 +0000 (14:42 +0800)]
topology: ABI - Add voice wake up flag for DAI links
Add a new flag bit SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP to link flags.
If a link is used for voice wake up, users can set this flag bit and
topology will set the link's 'ignore_suspend' to true.
This ABI update is backward compatible and applied in kernel. We may
rename this flag when we find a better name for this.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Guneshwor Singh [Wed, 16 Nov 2016 06:42:49 +0000 (14:42 +0800)]
topology: Export physical DAIs to the binary for kernel
Export the physical DAI objects to the binary output file for kernel.
For physical DAIs defined by the text conf file, find and merge their
stream capablities and private data before exporting.
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.
Mengdong Lin [Wed, 16 Nov 2016 06:42:15 +0000 (14:42 +0800)]
topology: ABI - Update manifest and pump ABI version to 5
Pump ABI version to 5.
To support physical DAIs and furture extension, add the following fields
to manifest:
- the count of physical DAIs. Later patches will add new ABI types for
physical DAIs.
- some reserved fields for new ABI objects in the future.
Kerel will handle this ABI update in a backward compatible way, via patch
'ASoC: topology: Make manifest backward compatible from ABI v4'.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Alan Young [Wed, 2 Nov 2016 17:40:32 +0000 (17:40 +0000)]
pcm_dshare: Do not discard slave reported delay in status result.
snd_pcm_dshare_status() gets the underlying status from the slave PCM.
This may contain a delay value that includes elements such as codec and
other transfer delays. Use this as the base for the returned delay
value, adjusted for any frames buffered locally (within the dshare
plugin).
Note: snd_pcm_dshare_delay() is not updated.
Signed-off-by: Alan Young <consult.awy@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:43 +0000 (13:14 +0800)]
topology: Remove BE or CC in comments of physical links C API template
No longer use BE or CC in comments of C API template for physical links.
This template can be used by Backend or Codec-to-Codec DAI links but not
only for them.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:34 +0000 (13:14 +0800)]
topology: Parse name and stream name of physical DAI links
Parse name and stream name of physical links defined by text conf file
or C API. Add name and stream name to C API template of physical DAI
links.
These two fields will help topology kernel driver to find an existing
physical link to configure, since the id of links are often the default
value ZERO and useless for match.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:14:04 +0000 (13:14 +0800)]
topology: Parse HW configurations of physical DAI links in text conf file
Users can configure the runtime supported HW configurations of a physical
link by SectionHWConfig. A physical link can refer multiple HW config
sections in SectionLink.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mengdong Lin [Sun, 6 Nov 2016 05:13: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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The newly added locking code seems to have confused quite a few
people, as "thread_safe=1" may be considered as if the thread-safety
lock has to be turned on. (It meant that the plugin _is_ thread-safe,
i.e. it needs no extra locking.)
For avoiding such a misunderstanding, this commit renames the relevant
pcm fields and give more comments to explain what is for what.
The former single pcm->thread_safe flag is now split to two boolean
flags, pcm->need_lock and pcm->lock_enabled. It consumes a few more
bytes, but this would be (hopefully) better understandable.
Shreyas NC [Tue, 23 Aug 2016 04:08:34 +0000 (09:38 +0530)]
conf: sklrt286: define module private data through tuples in skylake
In the conf file, module private data can be described through
tuples instead of blobs defined by vendor defined structures.
This patch defines the tuple section and the token list. The
tokens are then used to build the tuple array.
The module data may have both driver data and firmware data. The
driver data is passed using the tuple array and the firmware data
using byte data. A descriptor tuple array is defined to describe
the succeeding data block.
The documentation specifies three different rounding modes, but this
is wrong, because they all end up calling snd_tlv_convert_from_dB,
which only has two rounding modes.
Signed-off-by: David Henningsson <diwic@ubuntu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
DB410c board has support for both Digital and Analog audio. Digital
audio is over HDMI and analog is over codec chip integrated inside the
APQ8016 SOC.
It can support:
- 3 Microphones: Primary Mic(Handset mic), Headset Mic and Secondary
- 2 Digital Microphones.
- Earpiece.
- Headset.
- Loud Speaker.
- HDMI.
[Riku: squashed Srinivas's patches together and converted spaces to tabs]
Mengdong Lin [Fri, 22 Jul 2016 05:12:54 +0000 (13:12 +0800)]
topology: Fix the missing referenced elem ptr when merging private data
tplg_copy_data() should set the valid referenced data element pointer
on success. The caller will double check this pointer for all kinds of
references, including controls and data.
Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
ctl: use condition statements instead of assert() for new APIs to add an element set
Usage of assert() is not better practice of programming as shared library
APIs. They should return appropriate error code to promote applications to
handle error state.
This commit applies condition statements with return value of -EINVAL,
instead of assert(). As a backward compatibility for existent applications,
old APIs still call assert().
Mengdong Lin [Wed, 20 Jul 2016 01:53:12 +0000 (09:53 +0800)]
topology: Check address and length before string copy
elem_copy_text() is widely used for string copy in topology. Because some
name fields are not mandatory for users, sometimes the source can be
invalid and we should not do the copy. So we add check here.
Mengdong Lin [Wed, 20 Jul 2016 01:53:03 +0000 (09:53 +0800)]
topology: Add ATTRIBUTE_UNUSED for unused parameters to fix compiler warning
This commit adds ATTRIBUTE_UNUSED to the unused parameter 'tplg' for
function tplg_parse_streams() and tplg_parse_fe_dai(). These two functions
need to keep 'tplg' as ops for tplg_parse_compound().
The compiler warnings below are fixed:
pcm.c: In function 'tplg_parse_streams':
pcm.c:262:43: warning: unused parameter 'tplg' [-Wunused-parameter]
static int tplg_parse_streams(snd_tplg_t *tplg, snd_config_t *cfg,
^
pcm.c: In function 'tplg_parse_fe_dai':
pcm.c:324:42: warning: unused parameter 'tplg' [-Wunused-parameter]
static int tplg_parse_fe_dai(snd_tplg_t *tplg, snd_config_t *cfg,
Mengdong Lin [Wed, 20 Jul 2016 01:52:52 +0000 (09:52 +0800)]
topology: Remove support for control flag SNDRV_CTL_ELEM_ACCESS_USER
This access flag is used to add controls from user space by ioctl.
But topology only configures controls in user space and these controls
will eventually be created by ASoC in kernel, so topology should not
support this flag.
ctl: rename APIs to add an element set so that their names are appropriate
In this development period, some APIs have already been added. Most of
them are to add an element set, while their names are not so appropriate
against their feature. This is due to following to names of old APIs.
Mengdong Lin [Fri, 15 Jul 2016 12:19:58 +0000 (20:19 +0800)]
topology: Tuple type can have an extenstion
After the type specific string ("uuid", "string", "byte", "short" and
"word"), users may append a string, like "uuidxxx". The topology parser
will check the first few characters to get the tuple type.
This can allow users to put multiple tuples of the same type into one
vendor tuple section (SectionVendorTuples), e.g. parameters of multiple
firmware modules.
Mengdong Lin [Fri, 15 Jul 2016 12:18:59 +0000 (20:18 +0800)]
topology: Change uuid value to 16 separate characters in text conf file
Previously in text conf file, the uuid value of vendor tuples is a
16-characer string. Now change it to 16 characters separated by commas,
easier for users to edit it manually.
Mengdong Lin [Fri, 15 Jul 2016 12:17:43 +0000 (20:17 +0800)]
topology: An element can refer to multipe data sections in text conf file
Previously in text conf file, an element can only refer to one data
section (SectionData). Now it can also refer to a list of data sections.
Thus users can split groups of firmware parameters to multiple data
sections, and put them all in the reference list.
Finally, data of these data sections will be merged, in the same order as
they are in the reference list, as the element's private data for kernel.
We still support the original syntax of reference to a single data
section. The doc is updated for the syntax extension.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.
Both of alloca() and automatic variables keep storages on stack, while
the former generates more instructions than the latter. It's better to use
the latter if the size of storage is computable at pre-compile or compile
time; i.e. just for structures.
This commit obsolete usages of alloca() with automatic variables.