aboutsummaryrefslogtreecommitdiff
path: root/sound/core (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'bits/200-dcp' into asahi-wipJanne Grunau2024-09-241-0/+37
|\
| * ALSA: Introduce 'snd_interval_rate_bits'Martin Povišer2024-09-241-0/+37
| | | | | | | | Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
* | ALSA: Support nonatomic dmaengine PCMsMartin Povišer2024-09-241-1/+28
| | | | | | | | | | | | *** possible v6.11 conflict: _snd_dmaengine_pcm_close Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
* | HACK: ALSA: Export 'snd_pcm_known_rates'Martin Povišer2024-09-161-0/+1
| | | | | | | | Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
* | ALSA: dmaengine: Always terminate DMA when a PCM is closedHector Martin2024-09-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When a PCM is suspended, we pause the DMA. If the PCM is then closed while in this state, it does not receive the STOP trigger (as it is not running). In this case, we fail to properly terminate the DMA, calling dmaengine_synchronize() nonetheless, which is undefined behavior. Make sure we always call dmaengine_terminate_async() on PCM close, regardless of whether it has been called previously or not in the trigger callbacks. Signed-off-by: Hector Martin <marcan@marcan.st>
* | alsa: pcm: Remove the qos request only if activeHector Martin2024-09-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes warning: [ 8.502802] ------------[ cut here ]------------ [ 8.503445] cpu_latency_qos_remove_request called for unknown object [ 8.504269] WARNING: CPU: 5 PID: 2790 at kernel/power/qos.c:322 cpu_latency_qos_remove_request+0x48/0x98 [ 8.505499] CPU: 5 PID: 2790 Comm: wireplumber Tainted: G W 6.5.0-asahi-00708-gb9b88240f7ae #2291 [ 8.506777] Hardware name: Apple MacBook Air (13-inch, M2, 2022) (DT) <snip regs> [ 8.519099] Call trace: [ 8.519402] cpu_latency_qos_remove_request+0x48/0x98 [ 8.520027] snd_pcm_ioctl+0x86c/0x182c [ 8.520519] __arm64_sys_ioctl+0xf8/0xbd0 [ 8.521020] invoke_syscall.constprop.0+0x78/0xc8 [ 8.521604] do_el0_svc+0x58/0x154 [ 8.522026] el0_svc+0x34/0xe4 [ 8.522409] el0t_64_sync_handler+0x120/0x12c [ 8.522951] el0t_64_sync+0x190/0x194 [ 8.523408] ---[ end trace 0000000000000000 ]--- Signed-off-by: Hector Martin <marcan@marcan.st>
* | ALSA: control: Add kcontrol callbacks for lock/unlockHector Martin2024-09-161-2/+14
|/ | | | | | | | | | | | | | | | This allows drivers to implement policy around locking/unlocking controls, such as enforcing that a group of controls may only be locked by the same process/file, and taking actions when the controls lock/unlock (such as granting special access on lock and resetting values on unlock). This is, in particular, useful to implement volume safety controls, such that only a particular process (that locks controls and completes a handshake) may increase volumes above a given safe limit. It also allows the volume to be automatically lowered if that process dies (which will trigger an implicit unlock). Signed-off-by: Hector Martin <marcan@marcan.st>
* ALSA: seq: Skip event type filtering for UMP eventsTakashi Iwai2024-08-191-0/+3
| | | | | | | | | | | UMP events don't use the event type field, hence it's invalid to apply the filter, which may drop the events unexpectedly. Skip the event filtering for UMP events, instead. Fixes: 46397622a3fa ("ALSA: seq: Add UMP support") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20240819084156.10286-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: timer: Relax start tick time check for slave timer elementsTakashi Iwai2024-08-101-1/+1
| | | | | | | | | | | | | | | | The recent addition of a sanity check for a too low start tick time seems breaking some applications that uses aloop with a certain slave timer setup. They may have the initial resolution 0, hence it's treated as if it were a too low value. Relax and skip the check for the slave timer instance for addressing the regression. Fixes: 4a63bd179fa8 ("ALSA: timer: Set lower bound of start tick time") Cc: <stable@vger.kernel.org> Link: https://github.com/raspberrypi/linux/issues/6294 Link: https://patch.msgid.link/20240810084833.10939-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge tag 'sound-6.11-rc2' of ↵Linus Torvalds2024-08-023-79/+127
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound fixes from Takashi Iwai: "A small collection of fixes: - Revert of FireWire changes that caused a long-time regression - Another long-time regression fix for AMD HDMI - MIDI2 UMP fixes - HD-audio Conexant codec fixes and a quirk" * tag 'sound-6.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: Conditionally use snooping for AMD HDMI ALSA: usb-audio: Correct surround channels in UAC1 channel map ALSA: seq: ump: Explicitly reset RPN with Null RPN ALSA: seq: ump: Transmit RPN/NRPN message at each MSB/LSB data reception ALSA: seq: ump: Use the common RPN/bank conversion context ALSA: ump: Explicitly reset RPN with Null RPN ALSA: ump: Transmit RPN/NRPN message at each MSB/LSB data reception Revert "ALSA: firewire-lib: operate for period elapse event in process context" Revert "ALSA: firewire-lib: obsolete workqueue for period update" ALSA: hda/realtek: Add quirk for Acer Aspire E5-574G ALSA: seq: ump: Optimize conversions from SysEx to UMP ALSA: hda/conexant: Mute speakers at suspend / shutdown ALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown ALSA: hda: conexant: Fix headset auto detect fail in the polling mode
| * ALSA: seq: ump: Explicitly reset RPN with Null RPNTakashi Iwai2024-07-311-5/+16
| | | | | | | | | | | | | | | | | | | | RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message. Link: https://patch.msgid.link/20240731130528.12600-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: seq: ump: Transmit RPN/NRPN message at each MSB/LSB data receptionTakashi Iwai2024-07-311-30/+44
| | | | | | | | | | | | | | | | | | Just like the core UMP conversion helper, we need to deal with the partially-filled RPN/NRPN data in the sequencer UMP converter as well. Link: https://patch.msgid.link/20240731130528.12600-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: seq: ump: Use the common RPN/bank conversion contextTakashi Iwai2024-07-312-17/+7
| | | | | | | | | | | | | | | | | | | | The UMP core conversion helper API already defines the context needed to record the bank and RPN/NRPN values, and we can simply re-use the same struct instead of re-defining the same content as a different name. Link: https://patch.msgid.link/20240731130528.12600-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: ump: Explicitly reset RPN with Null RPNTakashi Iwai2024-07-311-5/+14
| | | | | | | | | | | | | | | | | | | | RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message. Link: https://patch.msgid.link/20240731130528.12600-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: ump: Transmit RPN/NRPN message at each MSB/LSB data receptionTakashi Iwai2024-07-311-17/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UMP 1.1 spec says that an RPN/NRPN should be sent when one of the following occurs: * a CC 38 is received * a subsequent CC 6 is received * a CC 98, 99, 100, and 101 is received, indicating the last RPN/NRPN message has ended and a new one has started That said, we should send a partial data even if it's not fully filled. Let's change the UMP conversion helper code to follow that rule. Link: https://patch.msgid.link/20240731130528.12600-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: seq: ump: Optimize conversions from SysEx to UMPTakashi Iwai2024-07-261-14/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current conversion from the legacy SysEx event to UMP SysEx packet in the sequencer core has a couple of issues: * The first packet trims the SysEx start byte (0xf0), hence it contains only 5 bytes instead of 6. This isn't wrong, per specification, but it's strange not to fill 6 bytes. * When the SysEx end marker (0xf7) is placed at the first byte of the next packet, it'll end up with an empty data just with the END status. It can be rather folded into the previous packet with the END status. This patch tries to address those issues. The first packet may have 6 bytes even with the SysEx start, and an empty packet with the SysEx end marker is omitted. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20240726143455.3254-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge tag 'sound-fix-6.11-rc1' of ↵Linus Torvalds2024-07-261-0/+13
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound fixes from Takashi Iwai: "A collection of fixes gathered since the previous pull. We see a bit large LOCs at a HD-audio quirk, but that's only bulk COEF data, hence it's safe to take. In addition to that, there were two minor fixes for MIDI 2.0 handling for ALSA core, and the rest are all rather random small and device-specific fixes" * tag 'sound-fix-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ASoC: fsl-asoc-card: Dynamically allocate memory for snd_soc_dai_link_components ASoC: amd: yc: Support mic on Lenovo Thinkpad E16 Gen 2 ALSA: hda/realtek: Implement sound init sequence for Samsung Galaxy Book3 Pro 360 ALSA: hda/realtek: cs35l41: Fixup remaining asus strix models ASoC: SOF: ipc4-topology: Preserve the DMA Link ID for ChainDMA on unprepare ASoC: SOF: ipc4-topology: Only handle dai_config with HW_PARAMS for ChainDMA ALSA: ump: Force 1 Group for MIDI1 FBs ALSA: ump: Don't update FB name for static blocks ALSA: usb-audio: Add a quirk for Sonix HD USB Camera ASoC: TAS2781: Fix tasdev_load_calibrated_data() ASoC: tegra: select CONFIG_SND_SIMPLE_CARD_UTILS ASoC: Intel: use soc_intel_is_byt_cr() only when IOSF_MBI is reachable ALSA: usb-audio: Move HD Webcam quirk to the right place ALSA: hda: tas2781: mark const variables as __maybe_unused ALSA: usb-audio: Fix microphone sound on HD webcam. ASoC: sof: amd: fix for firmware reload failure in Vangogh platform ASoC: Intel: Fix RT5650 SSP lookup ASOC: SOF: Intel: hda-loader: only wait for HDaudio IOC for IPC4 devices ASoC: SOF: imx8m: Fix DSP control regmap retrieval
| * ALSA: ump: Force 1 Group for MIDI1 FBsTakashi Iwai2024-07-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | When a Function Block declares it being a legacy MIDI1 device, it has to be only with a single UMP Group. Correct the attribute when a device declares it wrongly. Fixes: 37e0e14128e0 ("ALSA: ump: Support UMP Endpoint and Function Block parsing") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20240722140610.10845-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: ump: Don't update FB name for static blocksTakashi Iwai2024-07-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | When a device tries to update the FB name string even if its Endpoint is declared as static, we should skip it, just already done for the FB info update reply. Fixes: 37e0e14128e0 ("ALSA: ump: Support UMP Endpoint and Function Block parsing") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20240722135929.8612-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Merge tag 'driver-core-6.11-rc1' of ↵Linus Torvalds2024-07-251-2/+2
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the big set of driver core changes for 6.11-rc1. Lots of stuff in here, with not a huge diffstat, but apis are evolving which required lots of files to be touched. Highlights of the changes in here are: - platform remove callback api final fixups (Uwe took many releases to get here, finally!) - Rust bindings for basic firmware apis and initial driver-core interactions. It's not all that useful for a "write a whole driver in rust" type of thing, but the firmware bindings do help out the phy rust drivers, and the driver core bindings give a solid base on which others can start their work. There is still a long way to go here before we have a multitude of rust drivers being added, but it's a great first step. - driver core const api changes. This reached across all bus types, and there are some fix-ups for some not-common bus types that linux-next and 0-day testing shook out. This work is being done to help make the rust bindings more safe, as well as the C code, moving toward the end-goal of allowing us to put driver structures into read-only memory. We aren't there yet, but are getting closer. - minor devres cleanups and fixes found by code inspection - arch_topology minor changes - other minor driver core cleanups All of these have been in linux-next for a very long time with no reported problems" * tag 'driver-core-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (55 commits) ARM: sa1100: make match function take a const pointer sysfs/cpu: Make crash_hotplug attribute world-readable dio: Have dio_bus_match() callback take a const * zorro: make match function take a const pointer driver core: module: make module_[add|remove]_driver take a const * driver core: make driver_find_device() take a const * driver core: make driver_[create|remove]_file take a const * firmware_loader: fix soundness issue in `request_internal` firmware_loader: annotate doctests as `no_run` devres: Correct code style for functions that return a pointer type devres: Initialize an uninitialized struct member devres: Fix memory leakage caused by driver API devm_free_percpu() devres: Fix devm_krealloc() wasting memory driver core: platform: Switch to use kmemdup_array() driver core: have match() callback in struct bus_type take a const * MAINTAINERS: add Rust device abstractions to DRIVER CORE device: rust: improve safety comments MAINTAINERS: add Danilo as FIRMWARE LOADER maintainer MAINTAINERS: add Rust FW abstractions to FIRMWARE LOADER firmware: rust: improve safety comments ...
| * driver core: have match() callback in struct bus_type take a const *Greg Kroah-Hartman2024-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the match() callback, the struct device_driver * should not be changed, so change the function callback to be a const *. This is one step of many towards making the driver core safe to have struct device_driver in read-only memory. Because the match() callback is in all busses, all busses are modified to handle this properly. This does entail switching some container_of() calls to container_of_const() to properly handle the constant *. For some busses, like PCI and USB and HV, the const * is cast away in the match callback as those busses do want to modify those structures at this point in time (they have a local lock in the driver structure.) That will have to be changed in the future if they wish to have their struct device * in read-only-memory. Cc: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Alex Elder <elder@kernel.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | ALSA: seq: ump: Skip useless ports for static blocksTakashi Iwai2024-07-171-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the UMP Endpoint is configured with static blocks, the block configuration will never change, hence the unused ports will be unchanged as well. Creating sequencer ports for those unused ports is simply useless, and it might be rather confusing for users. The idea behind the inactive ports was for allowing connections from/to ports that can become usable later, but this will never happen for inactive groups in static blocks. Let's change the sequencer UMP binding to skip those unused ports when the UMP EP is with static blocks. Fixes: 81fd444aa371 ("ALSA: seq: Bind UMP device") Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/20240717083322.25892-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: pcm_dmaengine: Don't synchronize DMA channel when DMA is pausedShengjiu Wang2024-07-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | When suspended, the DMA channel may enter PAUSE state if dmaengine_pause() is supported by DMA. At this state, dmaengine_synchronize() should not be called, otherwise the DMA channel can't be resumed successfully. Fixes: e8343410ddf0 ("ALSA: dmaengine: Synchronize dma channel after drop()") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Cc: <stable@vger.kernel.org> Link: https://patch.msgid.link/1721198693-27636-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: seq: Add tempo base unit for MIDI2 Set Tempo messagesTakashi Iwai2024-07-064-9/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MIDI2 Set Tempo message defines the tempo in 10ns unit for finer accuracy, while MIDI1 was defined in 1us unit. For adapting this different unit, introduce "tempo_base" field to snd_seq_queue_tempo struct so that user-space can pass the proper tempo base unit. The accepted value is limited, it must be either 0, 10 or 1000. The protocol version is bumped to 1.0.4 along with this. The access with the older protocol version ignores the tempo-base value in ioctls and always treats as 1000. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://patch.msgid.link/20240705160344.6481-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: pcm: Fix id copying in snd_pcm_set_sync_per_card()Jaroslav Kysela2024-07-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Avoid to use strncpy and do proper length limiting (12 bytes) to avoid out of array access. Fixes: d712c58c55d9 ("ALSA: pcm: optimize and clarify stream synchronization ID API") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202407050501.o5Z3bibi-lkp@intel.com/ Signed-off-by: Jaroslav Kysela <perex@perex.cz> Link: https://patch.msgid.link/20240705075828.19746-1-perex@perex.cz Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: pcm: Fix missing export of snd_pcm_set_sync_per-card()Takashi Iwai2024-07-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent change for the PCM sync API forgot to export a new API function that is currently used in emu10k1 driver. This patch adds the missing export. Fixes: d712c58c55d9 ("ALSA: pcm: optimize and clarify stream synchronization ID API") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202407051343.1Sz8AKFt-lkp@intel.com/ Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://patch.msgid.link/20240705063555.17220-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: pcm: optimize and clarify stream synchronization ID APIJaroslav Kysela2024-07-021-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | Optimize the memory usage in struct snd_pcm_runtime - use boolean value for the standard sync ID scheme. Introduce snd_pcm_set_sync_per_card function to build synchronization IDs. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20240625172836.589380-3-perex@perex.cz
* | ALSA: pcm: reinvent the stream synchronization ID APIJaroslav Kysela2024-07-022-4/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until the commit e11f0f90a626 ("ALSA: pcm: remove SNDRV_PCM_IOCTL1_INFO internal command"), there was a possibility to pass information about the synchronized streams to the user space. The mentioned commit removed blindly the appropriate code with an irrelevant comment. The revert may be appropriate, but since this API was lost for several years without any complains, it's time to improve it. The hardware parameters may change the used stream clock source (e.g. USB hardware) so move this synchronization ID to hw_params as read-only field. It seems that pipewire can benefit from this API (disable adaptive resampling for perfectly synchronized PCM streams) now. Note that the contents of ID is not supposed to be used for direct comparison with a specific byte sequence. The "empty" case is when all bytes are zero (driver does not offer this information) and all other cases must be only used for equal comparison among PCM streams (including different sound cards) if they are using identical hardware clock. Cc: Takashi Sakamoto <takaswie@kernel.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20240625172836.589380-2-perex@perex.cz
* | Merge branch 'for-linus' into for-nextTakashi Iwai2024-06-262-1/+11
|\ \ | | | | | | | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * \ Merge tag 'asoc-fix-v6.10-rc5' of ↵Takashi Iwai2024-06-261-0/+10
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Fixes for v6.10 A relatively large batch of updates, largely due to the long interval since I last sent fixes due to various travel and holidays. There's a lot of driver specific fixes and quirks in here, none of them too major, and also some fixes for recently introduced memory safety issues in the topology code.
| | * | ALSA: dmaengine: Synchronize dma channel after drop()Jai Luthra2024-06-111-0/+10
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the stream may be stopped due to XRUN events, in which case the userspace can call snd_pcm_drop() and snd_pcm_prepare() to stop and start the stream again. In these cases, we must wait for the DMA channel to synchronize before marking the stream as prepared for playback, as the DMA channel gets stopped by drop() without any synchronization. Make sure the ALSA core synchronizes the DMA channel by adding a sync_stop() hook. Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com> Signed-off-by: Jai Luthra <j-luthra@ti.com> Link: https://lore.kernel.org/r/20240611-asoc_next-v3-1-fcfd84b12164@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
| * | ALSA: seq: Fix missing MSB in MIDI2 SPP conversionTakashi Iwai2024-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conversion of SPP to MIDI2 UMP called a wrong function, and the secondary argument wasn't taken. As a result, MSB of SPP was always zero. Fix to call the right function. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://patch.msgid.link/20240626145141.16648-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | | ALSA: pcm_dmaengine: Unify two close functionsTakashi Iwai2024-06-251-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both snd_dmaengine_pcm_close() and snd_dmaengine_pcm_close_release_chan() are almost identical except for a call of dma_release_channel() in the latter. For code simplification, unify them internally. Just a code refactoring, and no functional changes. Link: https://patch.msgid.link/20240625113356.2123-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | | Merge branch 'for-linus' into for-nextTakashi Iwai2024-06-253-3/+19
|\| | | | | | | | | | | | | | | | | Pull 6.10-rc devel branch for further cleanups of dmaengine and others. Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * | ALSA: dmaengine_pcm: terminate dmaengine before synchronizeShengjiu Wang2024-06-251-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When dmaengine supports pause function, in suspend state, dmaengine_pause() is called instead of dmaengine_terminate_async(), In end of playback stream, the runtime->state will go to SNDRV_PCM_STATE_DRAINING, if system suspend & resume happen at this time, application will not resume playback stream, the stream will be closed directly, the dmaengine_terminate_async() will not be called before the dmaengine_synchronize(), which violates the call sequence for dmaengine_synchronize(). This behavior also happens for capture streams, but there is no SNDRV_PCM_STATE_DRAINING state for capture. So use dmaengine_tx_status() to check the DMA status if the status is DMA_PAUSED, then call dmaengine_terminate_async() to terminate dmaengine before dmaengine_synchronize(). Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://patch.msgid.link/1718851218-27803-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * | ALSA: PCM: Allow resume only for suspended streamsTakashi Iwai2024-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | snd_pcm_resume() should bail out if the stream isn't in a suspended state. Otherwise it'd allow doubly resume. Link: https://patch.msgid.link/20240624125443.27808-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * | ALSA: seq: Fix missing channel at encoding RPN/NRPN MIDI2 messagesTakashi Iwai2024-06-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The conversion from the legacy event to MIDI2 UMP for RPN and NRPN missed the setup of the channel number, resulting in always the channel 0. Fix it. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://patch.msgid.link/20240625095200.25745-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | | ALSA: control: Allow NULL passed to snd_ctl_remove()Takashi Iwai2024-06-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are lots of code checking NULL for kcontrol passed to snd_ctl_remove() in the caller side. Let's make snd_ctl_remove() accepting the NULL kcontrol instead a la free(), so that we can clean up the caller side. Link: https://lore.kernel.org/20240617100529.6667-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | | ALSA: chmap: Mark Channel Map controls as volatileTakashi Iwai2024-06-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The values returned from Playback Channel Map and Capture Channel Map controls may vary dynamically depending on the corresponding PCM stream. Mark those as volatile to indicate the values are unstable and not suitable for testing. Note that we may change the driver to return -EINVAL, but this would bring other side effects, such as "alsactl restore" would start receiving unexpected errors. So we still keep returning 0 for those invalid inputs. Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240616073454.16512-6-tiwai@suse.de
* | | ALSA: control: Apply sanity check of input values for user elementsTakashi Iwai2024-06-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although we have already a mechanism for sanity checks of input values for control writes, it's not applied unless the kconfig CONFIG_SND_CTL_INPUT_VALIDATION is set due to the performance reason. Nevertheless, it still makes sense to apply the same check for user elements despite of its cost, as that's the only way to filter out the invalid values; the user controls are handled solely in ALSA core code, and there is no corresponding driver, after all. This patch adds the same input value validation for user control elements at its put callback. The kselftest will be happier with this change, as the incorrect values will be bailed out now with errors. For other normal controls, the check is applied still only when CONFIG_SND_CTL_INPUT_VALIDATION is set. Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Reviewed-by: Jaroslav Kysela <perex@perex.cz> Reviewed-by: Mark Brown <broonie@kernel.org> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240616073454.16512-4-tiwai@suse.de
* | | ALSA: vmaster: Return error for invalid input valuesTakashi Iwai2024-06-181-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | So far the vmaster code has been tolerant about the input values and accepts any values by correcting internally. But now our own selftest starts complaining about this behavior, so let's be picky and change the behavior to return -EINVAL for invalid input values instead. Reported-by: Paul Menzel <pmenzel@molgen.mpg.de> Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/20240616073454.16512-2-tiwai@suse.de
* / ALSA: seq: ump: Fix missing System Reset message handlingTakashi Iwai2024-05-311-0/+2
|/ | | | | | | | | The conversion from System Reset event to UMP was missing. Add the entry for a conversion to a proper UMP System message. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://lore.kernel.org/r/20240531123718.13420-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: seq: ump: Fix swapped song position pointer dataTakashi Iwai2024-05-311-3/+3
| | | | | | | | | | | At converting between the legacy event and UMP, the parameters for MIDI Song Position Pointer are incorrectly stored. It should have been LSB -> MSB order while it stored in MSB -> LSB order. This patch corrects the ordering. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://lore.kernel.org/r/20240531075110.3250-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: seq: Fix yet another spot for system message conversionTakashi Iwai2024-05-301-0/+1
| | | | | | | | | | | We fixed the incorrect UMP type for system messages in the recent commit, but it missed one place in system_ev_to_ump_midi1(). Fix it now. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Fixes: c2bb79613fed ("ALSA: seq: Fix incorrect UMP type for system messages") Link: https://lore.kernel.org/r/20240530101044.17524-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: ump: Set default protocol when not given explicitlyTakashi Iwai2024-05-291-0/+8
| | | | | | | | | | | | | | When an inquiry of the current protocol via UMP Stream Configuration message fails by some reason, we may leave the current protocol undefined, which may lead to unexpected behavior. Better to assume a valid protocol found in the protocol capability bits instead. For a device that doesn't support the UMP v1.2 feature, it won't reach to this code path, and USB MIDI GTB descriptor would be used for determining the protocol, instead. Link: https://lore.kernel.org/r/20240529164723.18309-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: ump: Don't accept an invalid UMP protocol numberTakashi Iwai2024-05-291-0/+7
| | | | | | | | | | | | When a UMP Stream Configuration message is received, the driver tries to switch the protocol, but there was no sanity check of the protocol, hence it can pass an invalid value. Add the check and bail out if a wrong value is passed. Fixes: a79807683781 ("ALSA: ump: Add helper to change MIDI protocol") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20240529164723.18309-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: ump: Don't clear bank selection after sending a program changeTakashi Iwai2024-05-291-1/+0
| | | | | | | | | | | | The current code clears the bank selection MSB/LSB after sending a program change, but this can be wrong, as many apps may not send the full bank selection with both MSB and LSB but sending only one. Better to keep the previous bank set. Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20240529083823.5778-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: seq: Fix incorrect UMP type for system messagesTakashi Iwai2024-05-291-0/+2
| | | | | | | | | | | When converting a legacy system message to a UMP packet, it forgot to modify the UMP type field but keeping the default type (either type 2 or 4). Correct to the right type for system messages. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20240529083800.5742-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: seq: Don't clear bank selection at event -> UMP MIDI2 conversionTakashi Iwai2024-05-281-1/+0
| | | | | | | | | | | | | The current code to convert from a legacy sequencer event to UMP MIDI2 clears the bank selection at each time the program change is submitted. This is confusing and may lead to incorrect bank values tranmitted to the destination in the end. Drop the line to clear the bank info and keep the provided values. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://lore.kernel.org/r/20240527151852.29036-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: seq: Fix missing bank setup between MIDI1/MIDI2 UMP conversionTakashi Iwai2024-05-281-0/+38
| | | | | | | | | | | | | | | When a UMP packet is converted between MIDI1 and MIDI2 protocols, the bank selection may be lost. The conversion from MIDI1 to MIDI2 needs the encoding of the bank into UMP_MSG_STATUS_PROGRAM bits, while the conversion from MIDI2 to MIDI1 needs the extraction from that instead. This patch implements the missing bank selection mechanism in those conversions. Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") Link: https://lore.kernel.org/r/20240527151852.29036-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>