Commit Graph

1382618 Commits

Author SHA1 Message Date
Takashi Iwai
1f9fc89cbb ALSA: seq: Fix KCSAN data-race warning at snd_seq_fifo_poll_wait()
snd_seq_fifo_poll_wait() evaluates f->cells without locking after
poll_wait(), and KCSAN doesn't like it as it appears to be a
data-race.  Although this doesn't matter much in practice as the value
is volatile, it's still better to address it for the mind piece.

Wrap it with f->lock spinlock for avoiding the potential data race.

Reported-by: syzbot+c3dbc239259940ededba@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=c3dbc239259940ededba
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-17 14:14:12 +02:00
Takashi Iwai
7e18682bdb ALSA: spi/at73c213: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-17 14:07:02 +02:00
Sebastian Andrzej Siewior
9fc4a3da9a ALSA: pcm: Disable bottom softirqs as part of spin_lock_irq() on PREEMPT_RT
snd_pcm_group_lock_irq() acquires a spinlock_t and disables interrupts
via spin_lock_irq(). This also implicitly disables the handling of
softirqs such as TIMER_SOFTIRQ.
On PREEMPT_RT softirqs are preemptible and spin_lock_irq() does not
disable them. That means a timer can be invoked during spin_lock_irq()
on the same CPU. Due to synchronisations reasons local_bh_disable() has
a per-CPU lock named softirq_ctrl.lock which synchronizes individual
softirq against each other.
syz-bot managed to trigger a lockdep report where softirq_ctrl.lock is
acquired in hrtimer_cancel() in addition to hrtimer_run_softirq(). This
is a possible deadlock.

The softirq_ctrl.lock can not be made part of spin_lock_irq() as this
would lead to too much synchronisation against individual threads on the
system. To avoid the possible deadlock, softirqs must be manually
disabled before the lock is acquired.

Disable softirqs before the lock is acquired on PREEMPT_RT.

Reported-by: syzbot+10b4363fb0f46527f3f3@syzkaller.appspotmail.com
Fixes: d2d6422f8b ("x86: Allow to enable PREEMPT_RT.")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-16 11:35:21 +02:00
John Keeping
8497324901 ALSA: serial-generic: remove shared static buffer
If multiple instances of this driver are instantiated and try to send
concurrently then the single static buffer snd_serial_generic_tx_work()
will cause corruption in the data output.

Move the buffer into the per-instance driver data to avoid this.

Signed-off-by: John Keeping <jkeeping@inmusicbrands.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-15 12:33:53 +02:00
Jihed Chaibi
c29287bb32 ALSA: asihpi: Simplify error handling in PCM substream setup
Refactor error handling in the PCM substream setup to combine redundant
checks and improve code readability. Free the dpcm structure and return
appropriate error codes (-EBUSY for HPI_ERROR_OBJ_ALREADY_OPEN, -EIO
for other errors) in a single block.

Signed-off-by: Jihed Chaibi <jihed.chaibi.dev@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-15 09:25:47 +02:00
Thorsten Blum
e135eeef0b ALSA: aoa: Remove redundant size arguments from strscpy()
The size parameter of strscpy() is optional if the destination buffer
has a fixed length and strscpy() can automatically determine its size
using sizeof(). This makes many explicit size arguments redundant.

Remove them to shorten and simplify the code.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-12 07:54:40 +02:00
Takashi Iwai
3c30d57544 ALSA: sparc/dbri: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
4baca4bf86 ALSA: sparc/cs4231: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
4c680628ad ALSA: sparc/amd7930: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
02d0aba676 ALSA: usb-audio: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
d532322732 ALSA: usb: fcp: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
bdcdb4e7aa ALSA: line6: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
d20cce1ca5 ALSA: ppc: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
97bffca637 ALSA: snd_ps3: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
f1998e16b2 ALSA: parisc: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
b10b93d193 ALSA: snd-n64: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
f5bf18b076 ALSA: sgio2audio: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
2d7d8e0fa5 ALSA: arm: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
56100eed4f ALSA: aoa: Don't split string across lines
We shouldn't split a quoted string, as it worsens the grep-ability.
Put back to the single line, which also makes checkpatch.pl happier.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:01 +02:00
Takashi Iwai
207cd1de01 ALSA: aoa: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-10 13:20:00 +02:00
Baojun Xu
7095d688de ASoC: tas2781: Add tas2118, tas2x20, tas5825 support
Update ti,tas2781.yaml for adding tas2118, tas2x20, tas257x and tas582x.

Signed-off-by: Baojun Xu <baojun.xu@ti.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-09 08:42:50 +02:00
Baojun Xu
7ceb69ca82 ASoC: tas2781: Add tas2118, tas2x20, tas5825 support
Add tas2020, tas2118, tas2120, tas2320, tas2570, tas2572, tas5825
tas5827 support in tas2781 driver.
Tas2118, tas2x20, tas257x have no on-chip DSP, tas582x have on-chip
DSP but have no calibration required stereo smart amplifier.

Signed-off-by: Baojun Xu <baojun.xu@ti.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-09 08:42:50 +02:00
Joris Verhaegen
86eec88c5b ALSA: compress_offload: Add SNDRV_COMPRESS_AVAIL64 ioctl
The previous patch introduced a 64-bit timestamp ioctl
(SNDRV_COMPRESS_TSTAMP64). To provide a consistent API, this patch
adds a corresponding 64-bit version of the SNDRV_COMPRESS_AVAIL ioctl.

A new struct snd_compr_avail64 is added to the UAPI, which includes
the 64-bit timestamp. The existing ioctl implementation is refactored
to handle both the 32-bit and 64-bit variants.

Reviewed-by: Miller Liang <millerliang@google.com>
Tested-by: Joris Verhaegen <verhaegen@google.com>
Signed-off-by: Joris Verhaegen <verhaegen@google.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250905091301.2711705-4-verhaegen@google.com
2025-09-08 09:33:24 +02:00
Joris Verhaegen
f20a53974f ALSA: compress_offload: Add SNDRV_COMPRESS_TSTAMP64 ioctl
The previous patch introduced the internal infrastructure for handling
64-bit timestamps. This patch exposes this capability to user-space.

Define the new ioctl command SNDRV_COMPRESS_TSTAMP64, which allows
applications to fetch the overflow-safe struct snd_compr_tstamp64.

The ioctl dispatch table is updated to handle the new command by
calling a new snd_compr_tstamp64 handler, while the legacy path is
renamed to snd_compr_tstamp32 for clarity.

This patch bumps the SNDRV_COMPRESS_VERSION to 0.4.0.

Reviewed-by: Miller Liang <millerliang@google.com>
Tested-by: Joris Verhaegen <verhaegen@google.com>
Signed-off-by: Joris Verhaegen <verhaegen@google.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250905091301.2711705-3-verhaegen@google.com
2025-09-08 09:33:24 +02:00
Joris Verhaegen
2c92e2fbe9 ALSA: compress_offload: Add 64-bit safe timestamp infrastructure
The copied_total field in struct snd_compr_tstamp is a 32-bit
value that can overflow on long-running high-bitrate streams,
leading to incorrect calculations for buffer availablility.

This patch adds a 64-bit safe timestamping mechanism.
A new UAPI struct, snd_compr_tstamp64, is added which uses 64-bit
types for byte counters. The relevant ops structures across the
ASoC and core compress code are updated to use this new struct.
ASoC drivers are updated to use u64 counters.

Internal timestamps being u64 now, a compatibility function is added
to convert the 64-bit timestamp back to the 32-bit format for legacy
ioctl callers.

Reviewed-by: Miller Liang <millerliang@google.com>
Tested-by: Joris Verhaegen <verhaegen@google.com>
Signed-off-by: Joris Verhaegen <verhaegen@google.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250905091301.2711705-2-verhaegen@google.com
2025-09-08 09:33:24 +02:00
Geoffrey D. Bennett
cbd676874e ALSA: scarlett2: Add Vocaster speaker/headphone mute controls
Add support for the speaker and headphone mute controls on Focusrite
Vocaster interfaces. Unlike other Focusrite interfaces, these mute
controls are per-output, not per-channel.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://patch.msgid.link/aLm2Dy6+O/eLTGVn@m.b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-06 20:02:52 +02:00
Chandra Mohan Sundar
400f60b274 ALSA: cs4281: Send the PCM period elapsed notification properly
As part of spin lock code cleanup using guard(), a new
variable (period_elapsed) was introduced. However this variable
is never set, causing period elapsed notification to be not sent.

Set the value of period_elapsed appropiately.

This issue was reported by static coverity analyzer.

Fixes: 7a5127c2c8 ("ALSA: cs4281: Use guard() for spin locks")
Signed-off-by: Chandra Mohan Sundar <chandramohan.explore@gmail.com>
Link: https://patch.msgid.link/20250906162158.564899-1-chandramohan.explore@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-06 19:55:10 +02:00
Cryolitia PukNgae
a73349c5dd ALSA: usb-audio: apply quirk for MOONDROP Quark2
It reports a MIN value -15360 for volume control, but will mute when
setting it less than -14208

Tested-by: Guoli An <anguoli@uniontech.com>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250903-sound-v1-4-d4ca777b8512@uniontech.com
2025-09-04 15:37:30 +02:00
Cryolitia PukNgae
806a38293f ALSA: usb-audio: apply "mixer_min_mute" quirks on some devices
- QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE
- QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE

Suggested-by: Guoli An <anguoli@uniontech.com>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250903-sound-v1-3-d4ca777b8512@uniontech.com
2025-09-04 15:37:30 +02:00
Cryolitia PukNgae
759b5ce3e6 ALSA: usb-audio: add quirk QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE
The same hardware problem to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE also
occurs on the capture streams on some USB devices. Add a new flag for
processing the quirk.

Link: https://lore.kernel.org/all/C22C1A172EBB9BD9+eccc2e4a-d21e-4a7d-848c-bbf3982feb94@uniontech.com/
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250903-sound-v1-2-d4ca777b8512@uniontech.com
2025-09-04 15:37:30 +02:00
Cryolitia PukNgae
ace1817ab4 ALSA: usb-audio: rename QUIRK_FLAG_MIXER_MIN_MUTE to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE
As a preparation of introduction QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE

Also make it printing an info while applying

Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250903-sound-v1-1-d4ca777b8512@uniontech.com
2025-09-04 15:37:30 +02:00
Thorsten Blum
c3c9a75ede ALSA: hda/conexant: Fix typos in comments
s/OPLC/OLPC/

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20250902154858.86102-2-thorsten.blum@linux.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-03 12:51:32 +02:00
Dan Carpenter
8409816b1e ALSA: rme32: Fix serialization in snd_rme32_capture_adat_open()
We accidentally deleted the wrong line of code when we did the
conversion to guard() locks.  If the rme32->capture_substream has
already been set we should return -EBUSY.

Fixes: 8bb75ae244 ("ALSA: rme32: Use guard() for spin locks")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aLfXmIQRFTXr5h8O@stanley.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-03 09:21:58 +02:00
Takashi Iwai
649c6e1314 ALSA: hda/realtek: Use is_s4_resume() macro
Use the given macro for determining the resume state instead of
referring to the raw value.

Only a cleanup for now.  The infrastructure might be changed in
future, though.

Link: https://patch.msgid.link/20250902095636.21462-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-09-02 11:57:14 +02:00
Takashi Iwai
b8e1684163 ALSA: misc: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-20-tiwai@suse.de
2025-09-01 13:54:28 +02:00
Takashi Iwai
69f374931f ALSA: virtio: Use guard() for spin locks
Replace the manual spin lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-19-tiwai@suse.de
2025-09-01 13:54:28 +02:00
Takashi Iwai
c07824a14d ALSA: ac97bus: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-18-tiwai@suse.de
2025-09-01 13:54:28 +02:00
Takashi Iwai
94f8cb2b35 ALSA: atmel: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-17-tiwai@suse.de
2025-09-01 13:54:28 +02:00
Takashi Iwai
372020ddaa ALSA: pxa2xx: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-16-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
bc58470aa2 ALSA: aaci: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-15-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
1cb6ecbb37 ALSA: aoa: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-14-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
3d10c26fae ALSA: sparc: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-13-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
89008621bb ALSA: vxpocket: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-12-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
2c24032607 ALSA: pdaudiocf: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-11-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
7b4d15bcdc ALSA: at73c213: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-10-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
3ddf4f9716 ALSA: xen: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-9-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
ab770b4163 ALSA: x86: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-8-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
10403f910a ALSA: x86: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code
simplification.

Only code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-7-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
826f35b829 ALSA: synth: Use guard() for preset locks
Define a macro for the preset locking/unlocking pairs for soundfont
using guard() macro as a further code cleanup.

The new macro is put in soundfont.h (and some function renames) along
with it for avoiding unnecessary troubles with clang.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-6-tiwai@suse.de
2025-09-01 13:54:27 +02:00
Takashi Iwai
59ede7178d ALSA: synth: Use guard() for spin locks
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829151335.7342-5-tiwai@suse.de
2025-09-01 13:54:26 +02:00