Commit graph

4231 commits

Author SHA1 Message Date
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
Takashi Iwai
bcc762f99a pcm: null: Pass appl_ptr and hw_ptr in snd_pcm_status()
Just like the previous fix for ioplug, the null plugin also misses the
appl_ptr and hw_ptr updates for snd_pcm_status().  Fix it as well.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-22 17:58:07 +01:00
Takashi Iwai
26fdcb98e6 pcm: ioplug: Pass appl_ptr and hw_ptr in snd_pcm_status()
The snd_pcm_status() of the ioplug doesn't return the current
positions of hw_ptr and appl_ptr as advertised.  Fix it by copying the
current values stored in the plugin data.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-22 17:58:07 +01:00
Takashi Iwai
f2c1a9f327 pcm: direct: Fix the missing appl_ptr update
A snd_pcm_status() call for the direct plugins receives the status
from the slave PCM, but this doesn't contain a valid appl_ptr, since
the slave PCM for the direct plugins is in a free-wheel mode, hence
the appl_ptr is always zero.  This result in the inconsistent
status->appl_ptr and pcm->appl.ptr, hitting the recently introduced
assert() call.

Fix it by transferring the plugin's appl_ptr to the upper caller.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1181194
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-22 17:58:07 +01:00
Jaroslav Kysela
ae7362c996 topology: fix 'parse_tuple_set() - remove dead condition code'
The whole SND_SOC_TPLG_TUPLE_TYPE_WORD condition part must be
commented out, otherwise the condition is always true.

Fixes: 51e1d486ce ("topology: parse_tuple_set() - remove dead condition code")
BugLink: https://github.com/alsa-project/alsa-lib/issues/114
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-20 17:05:01 +01:00
Jaroslav Kysela
0de72e63d7 pcm: dmix/dshare - delay calculation fixes and cleanups
Unfortunately, we cannot use status->avail from slave, because this value
does not wrap to the buffer size and it may even overflow slave boundary
(endless run). We can use only hw_ptr from slave.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-20 17:05:00 +01:00
Jaroslav Kysela
644514e85d pcm_plugin: set the initial hw_ptr/appl_ptr from the child pcm
The direct plugins (dmix & etc.) sets own initial
hw_ptr and appl_ptr. Use this initial settings
to export correct values in snd_pcm_status().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-20 17:04:49 +01:00
Jaroslav Kysela
93752fb4de conf: USB - add "Xonar U7 MKII" to USB-Audio.pcm.iec958_device
BugLink: https://github.com/alsa-project/alsa-lib/issues/100
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:49:27 +01:00
Jaroslav Kysela
45f503632a topology: sort_config() cleanups - use goto for the error path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:45:27 +01:00
Jaroslav Kysela
3f63dc2644 ucm: uc_mgr_substitute_tree() fix use after free
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:41:38 +01:00
Jaroslav Kysela
51e1d486ce topology: parse_tuple_set() - remove dead condition code
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:40:42 +01:00
Jaroslav Kysela
0dbaba95f4 topology: tplg_decode_pcm() - add missing log argument (compress)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:38:50 +01:00
Jaroslav Kysela
b8764a061b topology: tplg_add_widget_object() - do not use invalid elem_ctl
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:36:04 +01:00
Jaroslav Kysela
d0bb8f84c9 topology: tplg_pprint_integer() fix coverity uninitalized variable error
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:34:00 +01:00
Jaroslav Kysela
437b5b3aae ucm: fix possible memory leak in parse_verb_file()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:32:11 +01:00
Jaroslav Kysela
b62f66442b pcm: rate - fix the capture delay values
Use the correct snd_pcm_mmap_capture_delay() function instead
snd_pcm_mmap_capture_hw_avail().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 17:27:37 +01:00
Jaroslav Kysela
ac520b2ed1 pcm: rate - use pcm_frame_diff() on related places
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 17:14:42 +01:00
Jaroslav Kysela
da5b70d3fa pcm: plugin - fix status code for capture
The recent updates do not take in account the possible
calls for the capture stream. Fix the avail and delay
inconsistencies (and assert).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 12:32:27 +01:00
Jaroslav Kysela
fc0f7af9ee pcm: rate - use pcm_frame_diff() in snd_pcm_rate_playback_internal_delay()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 12:31:52 +01:00
Jaroslav Kysela
6cee452eab pcm: ioplug - fix the delay calculation for old plugins
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:16:11 +01:00
Jaroslav Kysela
5988bb3ff4 pcm: rate - tidy up snd_pcm_rate_avail_update()
No functional change - just move the capture code to
a separate function for the better readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:16:11 +01:00
Jaroslav Kysela
6ca01c07ee pcm: ioplug - fix the delay calculation in the status callback
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:15:53 +01:00
Jaroslav Kysela
21549e6583 Revert "pcm_plugin: fix delay"
This reverts commit aba87e5098.

The commit does not look good. The plugins must handle
the delay value correctly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:43:30 +01:00
Jaroslav Kysela
28cc099d9e pcm: plugin - optimize sync in snd_pcm_plugin_status()
Do hw_ptr sync only once after the status call. This avoids
double update.

Also, the application pointer must not change when
the status is called. Add assert() call for this condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:41:32 +01:00
Jaroslav Kysela
fa1895aa2b pcm: plugin - tidy snd_pcm_plugin_avail_update()
No functional changes - move the code to snd_pcm_plugin_sync_hw_ptr()
and put the mmap capture updates to separate function for readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:34:07 +01:00
Jaroslav Kysela
49eea5d7bc pcm: plugin status - revert the recent changes
It's no reason to sync the avail/delay fields using the mirrored
buffer pointers. The slave information must be valid.

The original report probably tries to fix something for
the specific plugin. Revert all changes.

Fixes: afe6ff3b33 ("pcm: plugin status - fix the return value (regression)")
Fixes: 4f90392f07 ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:16:44 +01:00
Jaroslav Kysela
afe6ff3b33 pcm: plugin status - fix the return value (regression)
The snd_pcm_plugin_avail_update() error code in snd_pcm_plugin_status()
should not be reported to the caller. The state errors can be determined
using the state member in the status structure.

Fixes: 4f90392f07 ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
BugLink: https://github.com/alsa-project/alsa-lib/issues/107
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-30 09:38:04 +01:00
Jaroslav Kysela
6c24cd2e60 conf: fix return code in _snd_config_load_with_include
Fixes: 5275d170e0 ("conf: fix use after free in _snd_config_load_with_include")
BugLink: https://github.com/alsa-project/alsa-lib/issues/108
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-29 11:17:58 +01:00
Alex Henrie
a92ad2fea4 confmisc: fix memory leak in snd_func_concat
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-29 09:23:07 +01:00
Jaroslav Kysela
36aff79747 pcm: fix __snd_pcm_state() return value
The __snd_pcm_state() must return a valid state, not an error value
when the plugin callback is not defined. Use the first state
SND_PCM_STATE_OPEN - the other functions will return the error
code depending on this state.

Link: https://lore.kernel.org/alsa-devel/20201226213547.175071-10-alexhenrie24@gmail.com/
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-27 13:31:57 +01:00
Jaroslav Kysela
9ebd29d2d3 conf: fix get_hexachar() return value
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-27 13:17:48 +01:00
Alex Henrie
fc719bfe4e pcm_multi: remove dead assignment from _snd_pcm_multi_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:28:24 +01:00
Alex Henrie
2e470d59d8 pcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period)
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:27:26 +01:00
Alex Henrie
aa28847248 timer: fix sizeof operator mismatch in snd_timer_query_hw_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:27:04 +01:00
Alex Henrie
c56278cfda rawmidi: fix memory leak in snd_rawmidi_virtual_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:23:20 +01:00
Alex Henrie
0f4821ec17 ucm: fix bad frees in get_list0 and get_list20
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:21:55 +01:00