Commit graph

4112 commits

Author SHA1 Message Date
Jaroslav Kysela
8d26f25ad3 ucm: substitute Comment in Transition and Device
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 15:04:31 +02:00
Jaroslav Kysela
8d90c4746b ucm: substitute verb name and file field
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:47:08 +02:00
Jaroslav Kysela
df498d89c7 ucm: substitute component sequence string
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:12:12 +02:00
Jaroslav Kysela
991990cdf2 ucm: substitute device strings in the device lists
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 14:04:13 +02:00
Jaroslav Kysela
529154fe7f ucm: substitute device / modifier names, too
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 13:53:10 +02:00
Jaroslav Kysela
1b0e77909d ucm: implement the toplevel ucm configuration file parser
There is a big issue to validate all possible configuration paths.
Let create ucm2/ucm.conf file which describe the lookups. It may
be also customized later to follow the kernel-side development.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 12:24:46 +02:00
Jaroslav Kysela
61986c02b0 ucm: substitute ${CardNumber}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-27 11:12:19 +02:00
Jaroslav Kysela
72b35bff02 ucm: substitute ${OpenName}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
690cdab6b4 ucm: Define/DefineRegex is supported in Syntax 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
a53a104f79 ucm: String condition - implement Empty
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:34 +02:00
Jaroslav Kysela
f688817e2c ucm: handle strict: prefix correctly for the UCM card name
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 16:11:32 +02:00
Jaroslav Kysela
efe2469ac3 ucm: substitute also value strings
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-26 15:14:15 +02:00
Jaroslav Kysela
bf83baa8fc ucm: allow to specify the toplevel directory using '/' as first character in File path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
f33e596fa6 ucm: config - change the in-place include evaluation order
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
9c88ead1bb ucm: allow syntax version 3
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
04c77aa7f4 ucm: substitute arguments in sequences
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
63c4b49cff ucm: configuration - add DefineRegex
Syntax:

  DefineRegex.VariableName {
    String "something to match"
    Regex "(me)thi(ng)"
  }

Result:

- configuration variable "VariableName" is equal to "mething"
- configuration variable "VariableName1" is equal to "me"
- configuration variable "VariableName2" is equal to "ng"

Notes:

The "Flags" string in the DefineRegex compound may specify
the compilation flags (e = extended, i = ignore case,
s = no substitutes, n = newline). See 'man 3 regex' for
more details.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
ed4567d1c9 ucm: configuration - allow to define the configuration variables
It may be useful for the library files to use the runtime configuration
variables.

Example:

 Define.Var1 "hw:${CardId},2"
 Value.PlaybackPCM "${var:Var1}"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
6cc6024ac5 ucm: config - substitute File string to allow variables in include
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
8a36b43e03 ucm: configuration - substitute ${ConfDir} and ${ConfTopDir}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
3edfebc522 ucm: configuration - implement in-place Include
An example:

	Include {
		File "Inc.conf"
		Before.SectionDevice "Mic"
	}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:53 +02:00
Jaroslav Kysela
14636be4a8 ucm: rename _once command to _boot command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:20:18 +02:00
Jaroslav Kysela
d05bd80593 ucm: rename SectionOnce to BootSequence
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-25 19:07:12 +02:00
Jaroslav Kysela
2d6eff3927 ucm: fix compilation error in set_defaults_user()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 10:55:35 +02:00
Jaroslav Kysela
3cab9018cf ucm: fix SectionOnce comment
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-19 08:31:39 +02:00
root
449bf7e191 ucm: initialize mgr->once_list
BugLink: https://github.com/alsa-project/alsa-lib/pull/50

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-16 15:48:35 +02:00
Jaroslav Kysela
0c3776a354 ucm: handle 'set _defaults' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:32:05 +02:00
Jaroslav Kysela
a570634a22 ucm: handle 'set _once' command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:25:58 +02:00
Jaroslav Kysela
afb5a9cf61 ucm: execute SectionDefaults lately (when the first verb is set)
We need a way to set the SectionOnce at first before SectionDefaults.
It also does not make sense to run SectionDefaults when the API is
used only to query for values or so.

Execute the SectionDefaults commands only when the first verb
is set (before the verb specific commands).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 18:24:39 +02:00
Jaroslav Kysela
e0da1d2a2a ucm: parse SectionOnce section in the master UCM configuration file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-14 16:04:38 +02:00
Takashi Iwai
750a3d9fd8 topology: Add missing ATTRIBUTE_UNUSED
... to shut up the compiler warnings.

Fixes: b6c9afb4f5 ("topology: implement snd_tplg_decode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:38:27 +02:00
Takashi Iwai
fa2f20b71e pcm: rate: Fix uninitialized variable warning
The recent gcc warning indicates the uninitialized variable commit_err:
  pcm_rate.c:1104:6: warning: ‘commit_err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (commit_err < 0)
         ^

Add a proper initialization to commit_err.

Fixes: 29041c5220 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:34:05 +02:00
Takashi Iwai
c04d7bbd6c pcm: rate: Fix compile warning wrt bit ops and comparison
We've got a gcc warning:
  pcm_rate.c: In function ‘snd_pcm_rate_drain’:
  pcm_rate.c:1090:19: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
     if (pcm->mode & SND_PCM_NONBLOCK != 0) {
                   ^

Drop the zero comparison for fixing the warning and for simplicity.

Fixes: 29041c5220 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-11 16:33:46 +02:00
Jaroslav Kysela
76c098bf6e ucm: merge the array items from the condition blocks
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-09 21:51:55 +02:00
Jaroslav Kysela
822f0c443b topology: use snd_config_is_array() function
... instead the own array test.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:04:41 +02:00
Jaroslav Kysela
0c99c073d3 conf: add snd_config_is_array() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 12:00:42 +02:00
Jaroslav Kysela
05a6effd8d conf: use bool type for the join member in the config structure
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-08 11:23:38 +02:00
Jaroslav Kysela
ee29d2a0b6 conf: change namehint for pcm.front
It seems that we have regressions for pcm.front (some
applications are using this device also for the default
raw input). Change the description and allow both
directions.

Fixes: https://github.com/alsa-project/alsa-lib/issues/39

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-07 16:39:57 +02:00
Takashi Iwai
bb43546c7a header: Fix build error with old kernel headers
Old development environment doesn't necessarily contain the headers
defining __kernel_long_t that is recently used for y2038 timespec
conditional.  Define it explicitly in such a case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:40:16 +02:00
Frédéric Recoules
abc9f32cf4 pcm: dmix: assembly: give more freedom over the constraints
Minor changes that could help the compiler to produce a
better (smaller/faster) code.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:27:40 +02:00
Frédéric Recoules
79c6ba99c4 pcm: dmix: assembly: refactor the PIC mode
Newer versions of GCC (> 5.0) accept that ebx is declared
in the clobber list even in PIC mode. Meanwhile, even
unlikely, the compiler may use ebx as base address of
one of the memory entry, making subsequent access to
them unreliable ('size', 'dst_step', 'src_step', 'sum_step').

Adding ebx in the clobber solves the problem.
By the way, the entry 'old_ebx' is no longer required.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:27:11 +02:00
Frédéric Recoules
0fd7f0cdc5 pcm: dmix: assembly: fix the interface for safety (mmx)
- add mm0 in the clobber list if the compiler
  is aware of the mmx technology;
- otherwise, add the mmx aliased x87 floating point
  registers in the clobbers;
- the configure now checks if the compiler is aware of
  the MMX technology.

  The compiler assumes none of the mmx or x87 registers are used
  by the function. If it chooses to store some data in them, they
  will be overwritten by the chunk.
  Recall that any mmx instruction invalidate the whole set of
  x87 floating point registers.

  Note: currently does not impact the binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:26:04 +02:00
Frédéric Recoules
01d8a6e03a pcm: dmix: assembly: fix the interface for safety
- move 'size' and 'old_ebx' in the output section
  since they are clobbered;
- add the "memory" clobber since input pointers
  are accessed;
- (minor) add the "cc" clobber since flags are
  clobbered.

  The compiler is missing some dataflow information
  about the execution of the assembly chunks.
  For instance, it assumes that 'size' remains unchanged
  and that no input pointer is accessed.
  The compiler optimizer may take advantage of these
  assumption and produce a wrong code.

Note: currently produces the same binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:25:15 +02:00
Frédéric Recoules
b315f21bf7 pcm: dmix: assembly: change the token by symbolic names
It eases the refactoring of assembly chunk since we can now
add/remove/move entries without worrying about maintaining
the token numbering in the template.

Note: does not impact the binary output.

Signed-off-by: Frédéric Recoules <frederic.recoules@orange.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 22:24:48 +02:00
Jaroslav Kysela
21e2fc3857 test: pcm_min - add snd_pcm_drain() call and indentation fixes
Fixes: https://github.com/alsa-project/alsa-lib/issues/46
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-05-03 20:07:55 +02:00
sylvain.bertrand@gmail.com
29041c5220 fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode
The draining function of the rate plugin does not handle properly the
SND_PCM_NONBLOCK case. It can write data to the slave plugin each time the
function is called, but does not update its internal state in order to
reach a stopping condition. Use a last_commit_ptr workaround to reach such
condition.

Signed-off-by: Sylvain BERTRAND <sylvain.bertrand@legeek.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-30 14:25:10 +02:00
Amadeusz Sławiński
496e239e65 topology: Use bool parser to parse boolean value
It should be safe to change this as correct values with int would be 0
or 1 and bool parser handles them correctly.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-30 14:21:29 +02:00
Jaroslav Kysela
4327660c71 use-case.h: add USB as allowed device name
Some USB devices are really generic where the
PCM stream can be routed to different paths.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-28 12:59:13 +02:00
Jaroslav Kysela
a43074ba17 pcm: rate - fix the remaining size calculation in snd_pcm_rate_drain()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-23 13:43:32 +02:00
Ivan Mironov
c996c9f52c conf: USB-Audio: Fix S/PDIF output of ASUS Xonar AE
ASUS Xonar AE is a PCI-Express card containing USB controller:

	USB controller [0c03]: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller [1b21:1142]

and the actual USB sound card:

	ID 0b05:180f ASUSTek Computer, Inc. XONAR SOUND CARD

As other Xonar USB sound cards, it uses second device for digital
output.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-04-17 14:03:35 +02:00