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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>