summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* pcm: hw - prevent divide by zero for broken appsJaroslav Kysela2023-05-161-0/+3
| | | | | Fixes: https://github.com/alsa-project/alsa-lib/issues/318 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: fix the silence size setup in drainJaroslav Kysela2023-05-031-2/+2
| | | | | | | | | The silence size cannot exceed the silence threshold. Move the check from the manual condition to the common code. This may happen for small ring buffers (where the 1/10th second is too large). Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf/emu10k1: remove compat with two decades old driversOswald Buddenhagen2023-05-033-192/+0
| | | | | | | There really isn't much of a point to clutter the files with this. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: remove duplicate SND_PCM_HW_PARAM_{FIRST,LAST}_* #definesOswald Buddenhagen2023-05-031-4/+0
| | | | | Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: add SND_CTL_EINTR open modeJaroslav Kysela2023-05-037-8/+10
| | | | | | | | Add possibility to return -EINTR instead waiting for the event. The applications may want to handle -EINTR condition themselves. BugLink: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: add SND_PCM_EINTR open modeJaroslav Kysela2023-05-031-1/+1
| | | | | | | | Add possibility to return -EINTR instead waiting for the event. The applications may want to handle -EINTR condition themselves. BugLink: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: improve handling for snd_pcm_wait()Jaroslav Kysela2023-05-038-10/+48
| | | | | | | | | | | | | The snd_pcm_wait() function is called also internally from the various plugins to wait for the drain with -1 and from i/o routines in pcm.c. Define two special negative timeout values to distinguish the drain and i/o wait and calculate the maximal timeout according the wait place. Fixes: https://github.com/alsa-project/alsa-lib/issues/228 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: add new symbols to Versions.inJaroslav Kysela2023-05-031-0/+8
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: introduce SNDRV_PCM_HW_PARAMS_DRAIN_SILENCEJaroslav Kysela2023-05-033-1/+40
| | | | | | | | | | The application may not require to touch the playback sample stream for the drain operation at all. In this case, the application is responsible to setup a silencing mechanism for the playback or another graceful stop (like using the rewind operation). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: introduce SNDRV_PCM_INFO_PERFECT_DRAINJaroslav Kysela2023-05-033-1/+28
| | | | | | | | | Handle the driver informing us that it is not necessary to set up silencing upon playback draining. This will be the case for drivers which are guaranteed to not read any samples beyond the application pointer. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: add drain_silence configuration keywordJaroslav Kysela2023-05-031-2/+24
| | | | | | | # Add silence in drain (-1 = auto /default/, 0 = off, > 0 milliseconds) [drain_silence INT] Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw: setup explicit silencing for snd_pcm_drain by defaultJaroslav Kysela2023-05-033-13/+71
| | | | | | | | | | | | | Some applications may not alignt transfers to the period size and also the driver developers may not follow the consequeces of the access beyond valid samples in the playback DMA buffer. To avoid clicks, fill a little silence at the end of the playback ring buffer when snd_pcm_drain() is called. Related: https://lore.kernel.org/alsa-devel/20230420113324.877164-2-oswald.buddenhagen@gmx.de/ Related: https://lore.kernel.org/alsa-devel/20230405201219.2197789-2-oswald.buddenhagen@gmx.de/ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* compilation: fix ANDROID -> __ANDROID__ define detectionMaxython2023-05-023-3/+3
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/301/ Signed-off-by: Maxython <mixython@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: avoid endless loop in snd_pcm_sw_params_default()Jaroslav Kysela2023-02-251-1/+6
| | | | | BugLink: https://lore.kernel.org/alsa-devel/167734349294.22.1388671545195719262@mailman-web.alsa-project.org/ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw - fix return code checking in snd_pcm_hw_hw_refineGunnar Dibbern2023-01-291-1/+1
| | | | | | | | | | The isse was introduced in commit 7f2d6c3 Fixes: 7f2d6c3a ("pcm: hw: change rate range syntax") Fixes: https://github.com/alsa-project/alsa-lib/issues/271 Fixes: https://github.com/alsa-project/alsa-lib/pull/293 Signed-off-by: Gunnar Dibbern <gunnar.dibbern@lht.dlh.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: Parse ignore_suspend property for dapm widgetAmadeusz Sławiński2023-01-291-0/+14
| | | | | | | | | | snd_soc_tplg_dapm_widget has ignore_suspend field, but there is no way to set value for it, because we don't parse topology field for it. Fix this by adding parsing code. Fixes: https://github.com/alsa-project/alsa-lib/pull/230 Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: Add decompilation support for ignore_suspendAmadeusz Sławiński2023-01-291-2/+4
| | | | | | | | | Previous patch added build support for ignore_suspend, however it should be also possible to decompile binary back to human readable form and not lose data. Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: Parse ignore_suspend flagCezary Rojewski2023-01-291-0/+27
| | | | | | | | | | | | XXX_VOICE_WAKEUP also known as 'ignore_suspend' is already processed by kernel in soc-topology, but there is no way of setting it via topology file like it's the case for other flags. Fix this by adding it to pcm, dai and link parsing mechanism. Signed-off-by: Piotr Maziarz <piotrx.maziarz@intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: fix geti() macro - return zero on successJaroslav Kysela2023-01-151-0/+1
| | | | | Fixes: c083417b ("ucm: simplify and fix the previous patch (geti)") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: simplify and fix the previous patch (geti)Jaroslav Kysela2023-01-151-70/+20
| | | | | | | | | | | Use macro to maintain only one code. The status may be 0 or 1 - handle both values correctly. Also, fix the possible memory leak in snd_use_case_geti() - string str should be freed even when the error is returned. Fixes: 436cd5b6 ("ucm: add existence checks to geti calls") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: add existence checks to geti callsCurtis Malainey2023-01-151-16/+67
| | | | | | | | | | | | | | Right now in snd_use_case_geti you cannot tell if the item being queried exists or not when being checked. This also means the only way to check for the existence of something in the client of the library is to iterate over the list of mods/devs even if we know exactly the name we are looking for. We have functions that do exactly this internally so lets return this information in a logical fashion through geti. Also clean up some trailing white space nearby. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: fix possible memory leak in execute_sysw()Jaroslav Kysela2023-01-051-0/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: rate: fix last_commit_ptr boundary wrappingAlan Young2022-12-301-2/+2
| | | | | | | | | | | | Wrap last_commit_ptr using boundary. Was just wrapped to 0, which is correct only if the buffer size, and hence the boundary, is an integer multiple of the period size. Fixes: 467d69c5bc1 ("Fix CPU hog with combination of rate plugin") Fixes: 29041c52207 ("fix infinite draining of the rate plugin in SND_PCM_NONBLOCK mode") Link: https://lore.kernel.org/alsa-devel/20221230164814.901457-1-consult.awy@gmail.com/ Signed-off-by: Alan Young <consult.awy@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: route/softvol use snd_config_get_ireal vs get_real to handle also integersJaroslav Kysela2022-12-132-10/+5
| | | | | Link: https://lore.kernel.org/alsa-devel/f9a7ad6a256d4ad7a31642dcf875d436@axis.com/ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* alsa-lib: conf - fix possible use-after-free in get_char_skip_commentsJaroslav Kysela2022-12-071-1/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: execute_sysw - fix possible use-after-freeJaroslav Kysela2022-12-071-2/+3
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* topology: ctl - remove the wrong (debug) codeJaroslav Kysela2022-11-291-6/+1
| | | | | | | | | | This code was commited by mistake. It was used for testing of ALSA_PCM_OLD_HW/SW_PARAMS_API. BugLink: https://github.com/thesofproject/sof/issues/6667 Related-to: 78b20e3c ("test: latency - use snd_pcm_format_physical_width()") Reported-by: Jaska Uimonen <jaska.uimonen@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: handle empty string also for ${env:} substitutionJaroslav Kysela2022-11-221-1/+7
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: clarify set_defaults callsJaroslav Kysela2022-11-151-11/+25
| | | | | | - do full reset in snd_use_case_mgr_reload Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: fix the fast_ops pcm argument for fast_opsJaroslav Kysela2022-11-144-6/+7
| | | | | | | The fast_ops callback invocation must always pass the fast_op_arg as the pcm argument. Plugins expect that. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - use snd_pcm_format_physical_width()Jaroslav Kysela2022-11-141-1/+6
| | | | | | | We need to allocate frames using the physical size not the sample bit size. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: rate - correct the previous fix for snd_pcm_rate_may_wait_for_avail_min()Jaroslav Kysela2022-11-092-4/+8
| | | | | | | | | | The previous fix in aa4f56c3 was not correct. The root of the cause is implementation in snd_pcm_may_wait_for_avail_min() inline function where the improper pcm argument is passed to the fast_ops function. Fixes: aa4f56c3 ("pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()") Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: rate - fix the crash in snd_pcm_rate_may_wait_for_avail_min()Jaroslav Kysela2022-11-091-1/+1
| | | | | | | | | | | | | | | The pcm argument passed to the conversion function in snd_pcm_plugin_may_wait_for_avail_min_conv() should be pcm->fast_op_arg. Test command: arecord -Dplughw:x -r12000 -c2 -fS16_LE -M temp.wav Fixes: d9dbb57b ("pcm: rate - rewrite the may_wait_for_avail_min callback for the rate plugin") BugLink: https://lore.kernel.org/alsa-devel/1667793912-18957-1-git-send-email-shengjiu.wang@nxp.com/ Fixes: https://github.com/alsa-project/alsa-lib/issues/282 Reported-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: fix enhanced ID parsing in snd_use_case_parse_ctl_elem_id()Jaroslav Kysela2022-11-021-1/+1
| | | | | Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* control: namehint - do not support 'card' devicesJaroslav Kysela2022-10-241-3/+1
| | | | | | | | The card: devices do not exist. Do not return -ENOENT, but -EINVAL in this case. Fixes: https://github.com/alsa-project/alsa-lib/issues/277 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: do not handle multiple Syntax field updatesJaroslav Kysela2022-10-201-34/+42
| | | | | | | | | | It is useful to include a toplevel configuration file from another toplevel configuration file. Ignore the further Syntax updates (assuming the that the parent knows what to do). Also, parse the Syntax field in own function. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* control: eld - skip trailing spacesJaroslav Kysela2022-10-181-3/+6
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: rate: fix the crash for the partial period copyJaroslav Kysela2022-10-171-2/+2
| | | | | | | | | | The size argument in snd_pcm_rate_commit_area can be smaller than cont in drain. Return the original code. It should not make things worse. Perhaps, we can fill the rest of the period with silence in this case. Fixes: https://github.com/alsa-project/alsa-lib/issues/274 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Remove non existent SPDIF output on ThinkPad USB-C Dock Gen2Swapnil Devesh2022-10-171-0/+1
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/268 Signed-off-by: Swapnil Devesh <sid.swapnildevesh@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add DragonFlyBSD build support (except test/)SASANO Takayoshi2022-10-174-4/+8
| | | | | | | | due to undefined reference to 'environ' error, ucm_exec.c uses workaround. Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add FreeBSD build support (except test/)SASANO Takayoshi2022-10-171-1/+1
| | | | | | | | Note: NetBSD and OpenBSD has both <endian.h> and <sys/endian.h> Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* add NetBSD/OpenBSD build support (except test/)SASANO Takayoshi2022-10-179-2/+30
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/250 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* doc: ucm - more volume notesJaroslav Kysela2022-10-171-13/+24
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* doc: ucm - add sequence graphsJaroslav Kysela2022-09-161-0/+7
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: hw_params - copy periods and buffer_time to the local variableJaroslav Kysela2022-08-181-0/+2
| | | | | | | | | It is expected to return the correct numbers for get_periods and get_buffer_time requests. Copy the appropriate fields in the hw_params call. Fixes: https://github.com/alsa-project/alsa-lib/issues/258 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: fix the dshare delay reportingJaroslav Kysela2022-08-162-2/+2
| | | | | | | Pulseaudio uses full ring buffer when the incorrect delay is reported. BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/198 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: add NULL check for card_name in openJaroslav Kysela2022-07-081-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: fix few memory-leaks in the error pathsJaroslav Kysela2022-07-082-6/+6
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* pcm: direct plugins: make three more symbols private to libraryJaroslav Kysela2022-07-081-0/+6
| | | | | | | | | Those symbols should not be exported: snd_pcm_direct_poll_descriptors snd_pcm_direct_check_xrun snd_pcm_direct_slave_recover Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ucm: fix st_mode check for symbolic linksStephan Gerhold2022-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The file type in the st_mode field is not encoded as unique bits but as an enumerator. Checking if some bits of S_IFLNK are set does not work correctly because it happens to evaluate to true for regular files as well. The POSIX man page suggests using the following approach to check the file type: if ((sb.st_mode & S_IFMT) == S_IFLNK) Alternatively, there is a S_ISLNK() macro to check this more easily. Make use of the latter so that readlink() is only called on actual symbolic links and not regular files. This makes audio work again with slightly older alsa-ucm-conf versions or alternative top-level ucm.conf configurations that do not make use of symlinks. Fixes: d6adde0e ("ucm: top-level path - set directory from symlink") Fixes: https://github.com/alsa-project/alsa-lib/pull/249 Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Signed-off-by: Jaroslav Kysela <perex@perex.cz>