Commit graph

4216 commits

Author SHA1 Message Date
Jaroslav Kysela
3e0140088c output: Add snd_output_buffer_steal() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
4870358b2f conf: add snd_config_merge() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
62a51c1da1 ucm: add ${ConfLibDir} substitution
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:06 +02:00
Jaroslav Kysela
bb6bf8d22d conf: add /var/lib/alsa/conf.d directory lookup
It may be handy to put the configurations or symlinks
to the global runtime directory.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:23:00 +02:00
Jaroslav Kysela
2e4aee23b9 conf: add /var/lib/alsa/card<NUMBER>.conf.d directory lookups
It may be handy to put extra configurations or symlinks to
the global runtime directory. The configurations may be
created at boot / hotplug event by udev or other scripts.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-13 09:18:56 +02:00
Jaroslav Kysela
619cf45cb9 conf: extend hook load_for_all_cards
Pass also card integer number.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:25:23 +02:00
Jaroslav Kysela
c132509a86 include: add SND_LIB_VER() macro
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:25:15 +02:00
Jaroslav Kysela
42fe3e40ff conf: make ctl.default and sysdefault devices more universal
It may be handy to add hw specific configs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:44 +02:00
Jaroslav Kysela
adce5f7b65 control: add empty plugin
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:20 +02:00
Jaroslav Kysela
493a41bcad control: remap plugin - add docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:09 +02:00
Jaroslav Kysela
7371ac9aad control: doc - create controls plugin page
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:24:05 +02:00
Jaroslav Kysela
a64391a428 control: remap plugin - initial version
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:50 +02:00
Jaroslav Kysela
7db7e18bbb control: add _snd_ctl_open_child()
To support internal plugins, add internal _snd_ctl_open_child()
function like _snd_pcm_open_slave().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:45 +02:00
Jaroslav Kysela
bb646ecb47 pcm: empty plugin - fix the docs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-04-07 16:22:34 +02:00
Jaroslav Kysela
10e2490023 control: shm - add missing continue to _snd_ctl_shm_open()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:41:26 +02:00
Jaroslav Kysela
3cfbacdc34 ucm: add ctl-remove sequence command to delete controls from UCM
Syntax:

   ctl-remove "name='ABCD'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:31:08 +02:00
Jaroslav Kysela
02423dc970 ucm: add cset-new sequence command to create new controls from UCM
This command create a new control using ID, description and value.

Syntax:

    cset-new "name='ABCD',index=2 type=boolean,count=2 on,on"
    cset-new "name='Enum' type=enum,labels='L1;L2;L3' 'L2'"

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-29 11:00:25 +02:00
Jaroslav Kysela
b0b9e4b88d ucm: move __snd_ctl_ascii_elem_id_parse prototype to control_local.h
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-25 20:40:22 +01:00
Jaroslav Kysela
03cb988179 control: add __snd_ctl_add_elem_set() helper
It simplifies the add_elem_set functions and we need it for UCM.
It's an internal function.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-25 20:36:39 +01:00
Jaroslav Kysela
83e4c1ab77 control: add snd_ctl_elem_id_compare_numid() function
Idea for the function prototype by Takashi Sakamoto.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:48:30 +01:00
Jaroslav Kysela
6f4b96ecc9 control: rename snd_ctl_elem_id_compare() to snd_ctl_elem_id_compare_set()
- add asserts to check if the unsigned integers are in the valid range
- replace tuple with set in the id description
- add const prefix for id1

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:31:30 +01:00
Jaroslav Kysela
2f57b404b1 ucm: add Path condition type
Check for a file presence and mode.

Modes: exists, read, write, exec

Example:

	If.0 {
		Condition {
			Type Path
			Mode read
			Path "/etc/alsa/something"
			True {
				...
			}
		}
	}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 17:16:14 +01:00
Jaroslav Kysela
0afa61e8f0 ucm: rename sysset to sysw
Fixes: 1c6fb202 ("ucm: implement sysset sequence command")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-23 11:40:30 +01:00
Takashi Iwai
7bf1dd543b conf: Fix invalid free at parse_args()
The previous fix for memory leaks introduced a few regression.
The major one is the assert hit in the error path reaching with NULL
or uninitialized sub object.  Also, in other code paths, it's possible
that an already released sub object gets freed again.

Fix those bugs by initializing the sub object properly and add a NULL
check before calling snd_config_delete().

Fixes: ad5f255b47 ("conf: fix memory leak on the error path in parse_args()")
Reported-and-tested-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-18 17:43:58 +01:00
Jaroslav Kysela
74422643ee control: fix the subdevice fields comparison in snd_ctl_elem_id_compare() 2021-03-18 12:33:16 +01:00
Jaroslav Kysela
ad5f255b47 conf: fix memory leak on the error path in parse_args()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
56c11293e3 ucm: warn about unknown sequence commands
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
1c6fb20232 ucm: implement sysset sequence command
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
2b418648cf ucm: ucm_main.c - cosmetic tab cleanups
This file is problematic for the git's tab checker.
The unexpand tool is used to convert initial spaces
to tabs.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:26:07 +01:00
Jaroslav Kysela
9c194a0ba7 ucm: add _fboot / FixedBootSequence
Actually, the BootSequence is executed only when the driver controls
(identifiers or value types) are changed. It may be handy to have
also a sequence which is executed at _each_ boot without any condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:25:52 +01:00
Jaroslav Kysela
266618088a control: better docs for snd_ctl_elem_id_compare()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-08 15:24:31 +01:00
Jaroslav Kysela
8bd9e7897d conf: snd_config_save() - print arrays as [] not the internal representation
The internal represention of an array is:

{
	0 value1
	1 value2
	2 value2
	...
}

which is identicatal to shorter:

[
	value1
	value2
	value3
]

Always print the short format. It's more optimized and readable.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 21:02:20 +01:00
Jaroslav Kysela
5766e54fbe conf: improve the tabulator level prints
Do not use per char loop, but compose a string.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:57:28 +01:00
Jaroslav Kysela
829fbf5065 mixer: simple - use for loop in base_len()
... reduce the code a bit

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-07 20:28:03 +01:00
Hans de Goede
86b9c67774 mixer: simple - Unify simple_none: base_len() exception handling
Unify simple_none: base_len() exception handling:

1. In the "Input Source" and "3D Control" cases the base-name is the same
   as the full-name and base_len() simply returns strlen(name).
   Instead of returning 0 when the type is unknown, set the type to
   CTL_SINGLE and return strlen(name). This allows removing the special
   case for base_len() returning 0 in simple_event_add().

2. Move the special handling for "Capture Volume" and "Capture Switch"
   from simple_event_add() to base_len(), so that we handle all exceptions
   inside base_len(). Instead of handling some special cases in base_len()
   and other special cases in simple_event_add().

[jk - moved the "Capture Volume" and "Capture Switch" to "Input Source"
exceptions]

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 21:11:19 +01:00
Jaroslav Kysela
33ddf2e1c7 configure: bumb version to 1.2.5pre1 (for CI tests)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-05 18:36:01 +01:00
Jaroslav Kysela
058299bff3 pcm: softvol - improve TLV data check for new configs
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:10:59 +01:00
Jaroslav Kysela
2cfe6addae control: add snd_ctl_elem_id_compare() function
Compare two control element identifiers like strcmp().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
7a1402cddc control: snd_ctl_ascii_elem_id_get() - do not show unset numid
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
1d1062d920 pcm: fix snd_pcm_plugin_status()
The appl_ptr difference must be computed before
the appl_ptr in the status structure is updated.

Fixes: da5b70d3f ("pcm: plugin - fix status code for capture")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
19ad9bdc49 conf: introduce snd_config_get_card() function
It's helper for the "card" entries parsing. It reduces
the code in most of open_hw functions.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
b9a4997e92 pcm: softvol - make snd_pcm_parse_control_id private
The function is not used externally (it's not exported in headers).
Make it private.

Use snd_config_get_ctl_iface() for the interface value parsing.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:28 +01:00
Jaroslav Kysela
24db585dd1 pcm: softvol - do not set TLV access flags for the switch
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 21:08:25 +01:00
Jaroslav Kysela
174592280d control: improve snd_ctl_add_*_elem_set functions (access flags)
The access flags are useful for the user space elements
with the custom access flags.

Introduce snd_ctl_elem_info_set_*() functions to set those flags
in the info structure.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-26 20:32:20 +01:00
Jaroslav Kysela
7da208173f control: fix iformation -> information typos
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-24 11:06:25 +01:00
Hui Wang
dfbac0e769 conf: HDA-Intel: increase the max number of HDMI/DP output to 11
Intel TGL HDMI/DP codec provides 9 pins (Linux kernel, 9a11ba7388f16:
ALSA: hda: hdmi - add Tigerlake support), and with the DP MST enabled,
the linux kernel will build 11 output devices (3, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16), and current alsa-lib only maps the first 8 output
devices, if users plug the HDMI/DP monitor to the last 3 ports, the
users will not see the output device from pulseaudio or gnome.

We have experienced this issue on a dell TGL machine with a dock, we
plugged 2 HDMP/DP monitors on the dock, but we could only see 1
HDMI/DP output device from pulseaudio or gnome, through investigation,
we found one monitor is plugged in the 2nd port from last.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
BugLink: https://github.com/alsa-project/alsa-lib/pull/118
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-02-24 10:09:47 +01:00
Jaroslav Kysela
0d232d714a ucm: fix two error messages
- add missing argument to error msg in if_eval_regex_match()
- print correct error value in uc_mgr_config_load_file()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-03 11:57:49 +01:00
Jaroslav Kysela
296b067fc7 ucm: add ${find-card} and ${find-device} substitutions
It may be useful to find a correct card or device through
control API information fields.

Increase the syntax version to 4.

Examples:

  ${find-card:field=name,regex='HDA Intel'}
  ${find-device:type=pcm,field=id,regex='HDMI 1$'}
  ${find-device:ctl=hw:acp,type=pcm,field=id,regex=DMIC}

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-02-03 11:42:56 +01:00
Jaroslav Kysela
00eafe98ee pcm: pcm_ioplug - fix the avail_update mmap capture copy issue
It seems that the commit "pcm: ioplug: Transfer all available data"
introduced new regressions (wrong memory access). The second issue
is that the avail_update in ioplug does not move appl_ptr nor hw_ptr,
so it's possible that the transfers may be repetitive.

This patch moves the transfer calls to mmap_begin callback where it
should be. The pointer wraps are handled by design now.

Fixes: 1714332719 ("pcm: ioplug: Transfer all available data")
BugLink: https://github.com/alsa-project/alsa-lib/pull/103
Tested-by: Andreas Pape <apape@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-27 11:39:15 +01:00
Takashi Iwai
55d59821ff pcm: share: Pass appl_ptr and hw_ptr in snd_pcm_status()
This one also has the same problem as others; the appl_ptr and hw_ptr
of share plugin aren't updated in snd_pcm_status() call.  Fix it.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-22 17:58:07 +01:00