linux-block.git
3 months agoselftests/alsa: make dump_config_tree() as void function
Jaroslav Kysela [Mon, 6 May 2024 07:54:19 +0000 (09:54 +0200)]
selftests/alsa: make dump_config_tree() as void function

dump_config_tree() is declared to return an int, but the compiler cannot
prove that it always returns any value at all. This leads to a clang
warning, when building via:

    make LLVM=1 -C tools/testing/selftests

Suggested-by: John Hubbard <jhubbard@nvidia.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240506075419.301780-1-perex@perex.cz
3 months agoALSA: docs: Correct the kernel object suffix of target
Andy Shevchenko [Mon, 6 May 2024 08:52:19 +0000 (11:52 +0300)]
ALSA: docs: Correct the kernel object suffix of target

The correct suffix is 'y' for the kernel code and
'objs' for the user space. Update documentation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240506085219.3403731-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: hda: Add Intel BMG PCI ID and HDMI codec vid
Chaitanya Kumar Borah [Mon, 6 May 2024 05:25:31 +0000 (10:55 +0530)]
ALSA: hda: Add Intel BMG PCI ID and HDMI codec vid

Add HD Audio PCI ID and HDMI codec vendor ID for Intel Battlemage.

Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Link: https://lore.kernel.org/r/20240506052531.1150062-1-chaitanya.kumar.borah@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: aoa: soundbus: i2sbus: pcm: use 'time_left' variable with wait_for_completion_t...
Wolfram Sang [Tue, 30 Apr 2024 12:10:27 +0000 (14:10 +0200)]
ALSA: aoa: soundbus: i2sbus: pcm: use 'time_left' variable with wait_for_completion_timeout()

There is a confusing pattern in the kernel to use a variable named 'timeout' to
store the result of wait_for_completion_timeout() causing patterns like:

timeout = wait_for_completion_timeout(...)
if (!timeout) return -ETIMEDOUT;

with all kinds of permutations. Use 'time_left' as a variable to make the code
self explaining.

Fix to the proper variable type 'unsigned long' while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20240430121028.30443-1-wsa+renesas@sang-engineering.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: usb-audio: Add sampling rates support for Mbox3
Manuel Barrio Linares [Tue, 30 Apr 2024 17:10:18 +0000 (14:10 -0300)]
ALSA: usb-audio: Add sampling rates support for Mbox3

This adds support for all sample rates supported by the
hardware,Digidesign Mbox 3 supports: {44100, 48000, 88200, 96000}

Fixes syncing clock issues that presented as pops. To test this, without
this patch playing 440hz tone produces pops.

Clock is now synced between playback and capture interfaces so no more
latency drift issue when using pipewire pro-profile.
(https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3900)

Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
Link: https://lore.kernel.org/r/20240430171020.192285-1-mbarriolinares@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: hda: cs35l41: Add support for ASUS ROG 2024 Laptops
Stefan Binding [Mon, 29 Apr 2024 15:48:53 +0000 (16:48 +0100)]
ALSA: hda: cs35l41: Add support for ASUS ROG 2024 Laptops

All of these laptops do not have _DSD, so need to be added to the
configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240429154853.9393-3-sbinding@opensource.cirrus.com
3 months agoALSA: hda: cs35l41: Ignore errors when configuring IRQs
Stefan Binding [Mon, 29 Apr 2024 15:48:52 +0000 (16:48 +0100)]
ALSA: hda: cs35l41: Ignore errors when configuring IRQs

IRQs used for CS35L41 HDA are used to detect and attempt to recover
from errors. Without these interrupts, the driver should behave as
normal.

For laptops which contain a bad configuration for the interrupt in the
BIOS, the current behaviour of failing when trying to configure the
interrupt means the probe fails, and audio is broken.

It is better for the user experience if the driver instead warns that
no interrupt is configured rather than simply failing.
The drawback is that if an error occurs without the interrupt, we
firstly would not be able to trace the issue, and secondly would not
be able to attempt to recover from the issue, but this is better than
failing immediately.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240429154853.9393-2-sbinding@opensource.cirrus.com
3 months agoMerge branch 'topic/emu10k1-fix' into for-next
Takashi Iwai [Sun, 28 Apr 2024 10:00:57 +0000 (12:00 +0200)]
Merge branch 'topic/emu10k1-fix' into for-next

Pull emu10k1 fixes from Oswald Buddenhagen

Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: emu10k1: move code for entering E-MU card FPGA programming mode
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:17 +0000 (11:37 +0200)]
ALSA: emu10k1: move code for entering E-MU card FPGA programming mode

... into snd_emu1010_load_firmware_entry(). This makes it clearer that
these steps belong together tightly, as implied by prior commits.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093717.3198716-5-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: move snd_emu1010_load_firmware_entry() to io.c
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:16 +0000 (11:37 +0200)]
ALSA: emu10k1: move snd_emu1010_load_firmware_entry() to io.c

It is a low-level I/O access function, so io.c is the natural place for
it.

While we're moving the code, reduce the scope of some variables, use
compound assignment operators, and add/adjust some comments.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093717.3198716-4-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: make snd_emu1010_load_firmware_entry() void
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:15 +0000 (11:37 +0200)]
ALSA: emu10k1: make snd_emu1010_load_firmware_entry() void

There is only one call site, and there we already know that we actually
have a firmware.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093717.3198716-3-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: simplify E-MU card FPGA reset sequence
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:14 +0000 (11:37 +0200)]
ALSA: emu10k1: simplify E-MU card FPGA reset sequence

Firstly, it is pointless to explicitly disable the power to the dock
prior to resetting the FPGA, as the latter will do the former anyway.

Secondly, it doesn't make much sense to check whether the FPGA is
already programmed. It's much simpler to just presume it is, and issue
the self-reset command. If it isn't, the effect isn't worse than the
checks themselves. As a side effect, we lose the info if the reset
fails, but there is no plausible way how that could happen unless the
card burns out while operating, and in that case we'll detect a firmware
upload failure a bit later anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093717.3198716-2-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: make E-MU FPGA writes potentially more reliable
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:16 +0000 (11:37 +0200)]
ALSA: emu10k1: make E-MU FPGA writes potentially more reliable

We did not delay after the second strobe signal, so another immediately
following access could potentially corrupt the written value.

This is a purely speculative fix with no supporting evidence, but after
taking out the spinlocks around the writes, it seems plausible that a
modern processor could be actually too fast. Also, it's just cleaner to
be consistent.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-7-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: fix E-MU dock initialization
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:15 +0000 (11:37 +0200)]
ALSA: emu10k1: fix E-MU dock initialization

A side effect of making the dock monitoring interrupt-driven was that
we'd be very quick to program a freshly connected dock. However, for
unclear reasons, the dock does not work when we do that - despite the
FPGA netlist upload going just fine. We work around this by adding a
delay before programming the dock; for safety, the value is several
times as much as was determined empirically.

Note that a badly timed dock hot-plug would have triggered the problem
even before the referenced commit - but now it would happen 100% instead
of about 3% of the time, thus making it impossible to work around by
re-plugging.

Fixes: fbb64eedf5a3 ("ALSA: emu10k1: make E-MU dock monitoring interrupt-driven")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218584
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-6-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: use mutex for E-MU FPGA access locking
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:14 +0000 (11:37 +0200)]
ALSA: emu10k1: use mutex for E-MU FPGA access locking

The FPGA access through the GPIO port does not interfere with other
sound processor register access, so there is no need to subject it to
emu_lock. And after moving all FPGA access out of the interrupt handler,
it does not need to be IRQ-safe, either.

What's more, attaching the dock causes a firmware upload, which takes
several seconds. We really don't want to disable IRQs for this long, and
even less also have someone else spin with IRQs disabled waiting for us.

Therefore, use a mutex for FPGA access locking.

This makes the code somewhat more noisy, as we need to wrap bigger
sections into the mutex, as it needs to enclose the spinlocks.

The latter has the "side effect" of fixing dock FPGA programming in a
corner case: a really badly timed mixer access right between entering
FPGA programming mode and uploading the netlist would mess up the
protocol.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-5-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: move the whole GPIO event handling to the workqueue
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:13 +0000 (11:37 +0200)]
ALSA: emu10k1: move the whole GPIO event handling to the workqueue

The actual event processing was already done by workqueue items. We can
move the event dispatching there as well, rather than doing it already
in the interrupt handler callback.

This change has a rather profound "side effect" on the reliability of
the FPGA programming: once we enter programming mode, we must not issue
any snd_emu1010_fpga_{read,write}() calls until we're done, as these
would badly mess up the programming protocol. But exactly that would
happen when trying to program the dock, as that triggers GPIO interrupts
as a side effect. This is mitigated by deferring the actual interrupt
handling, as workqueue items are not re-entrant.

To avoid scheduling the dispatcher on non-events, we now explicitly
ignore GPIO IRQs triggered by "uninteresting" pins, which happens a lot
as a side effect of calling snd_emu1010_fpga_{read,write}().

Fixes: fbb64eedf5a3 ("ALSA: emu10k1: make E-MU dock monitoring interrupt-driven")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218584
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-4-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: factor out snd_emu1010_load_dock_firmware()
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:12 +0000 (11:37 +0200)]
ALSA: emu10k1: factor out snd_emu1010_load_dock_firmware()

Pulled out of the next patch to improve its legibility.

As the function is now available, call it directly from
snd_emu10k1_emu1010_init(), thus making the MicroDock firmware loading
synchronous - there isn't really a reason not to. Note that this does
not affect the AudioDocks of rev1 cards, as these have no independent
power supplies, and thus come up only a while after the main card is
initialized.

As a drive-by, adjust the priorities of two messages to better reflect
their impact.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-3-oswald.buddenhagen@gmx.de>

3 months agoALSA: emu10k1: fix E-MU card dock presence monitoring
Oswald Buddenhagen [Sun, 28 Apr 2024 09:37:11 +0000 (11:37 +0200)]
ALSA: emu10k1: fix E-MU card dock presence monitoring

While there are two separate IRQ status bits for dock attach and detach,
the hardware appears to mix them up more or less randomly, making them
useless for tracking what actually happened. It is much safer to check
the dock status separately and proceed based on that, as the old polling
code did.

Note that the code assumes that only the dock can be hot-plugged - if
other option card bits changed, the logic would break.

Fixes: fbb64eedf5a3 ("ALSA: emu10k1: make E-MU dock monitoring interrupt-driven")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218584
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093716.3198666-2-oswald.buddenhagen@gmx.de>

3 months agoALSA: kunit: use const qualifier for immutable data
Takashi Sakamoto [Thu, 25 Apr 2024 23:36:53 +0000 (08:36 +0900)]
ALSA: kunit: use const qualifier for immutable data

Some data for testing is immutable. In the case, the const qualifier is
available for any loader to place it to read-only segment.

Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240425233653.218434-1-o-takashi@sakamocchi.jp>

3 months agoALSA: kunit: make read-only array buf_samples static const
Colin Ian King [Thu, 25 Apr 2024 16:07:54 +0000 (17:07 +0100)]
ALSA: kunit: make read-only array buf_samples static const

Don't populate the read-only array buf_samples on the stack at
run time, instead make it static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240425160754.114716-1-colin.i.king@gmail.com>

3 months agoALSA: control: Use list_for_each_entry_safe()
Andy Shevchenko [Wed, 24 Apr 2024 14:49:41 +0000 (17:49 +0300)]
ALSA: control: Use list_for_each_entry_safe()

Instead of reiterating the list, use list_for_each_entry_safe()
that allows to continue without starting over.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Message-ID: <20240424145020.1057216-1-andriy.shevchenko@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Add quirks for Lenovo 13X
Stefan Binding [Tue, 23 Apr 2024 16:23:03 +0000 (17:23 +0100)]
ALSA: hda/realtek: Add quirks for Lenovo 13X

Add laptop using CS35L41 HDA.
This laptop does not have _DSD, so require entries in property
configuration table for cs35l41_hda driver.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Message-ID: <20240423162303.638211-3-sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda: cs35l41: Support Lenovo 13X laptop without _DSD
Stefan Binding [Tue, 23 Apr 2024 16:23:02 +0000 (17:23 +0100)]
ALSA: hda: cs35l41: Support Lenovo 13X laptop without _DSD

This laptop does not have the correct _DSD settings, so needs to
obtain its configuration from the configuration table.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Message-ID: <20240423162303.638211-2-sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: scarlett2: Zero initialize ret in scarlett2_ag_target_ctl_get()
Nathan Chancellor [Sat, 20 Apr 2024 00:25:59 +0000 (17:25 -0700)]
ALSA: scarlett2: Zero initialize ret in scarlett2_ag_target_ctl_get()

Clang warns (or errors with CONFIG_WERROR):

  sound/usb/mixer_scarlett2.c:3697:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
   3697 |         if (private->autogain_updated) {
        |             ^~~~~~~~~~~~~~~~~~~~~~~~~
  sound/usb/mixer_scarlett2.c:3707:9: note: uninitialized use occurs here
   3707 |         return err;
        |                ^~~
  sound/usb/mixer_scarlett2.c:3697:2: note: remove the 'if' if its condition is always true
   3697 |         if (private->autogain_updated) {
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  sound/usb/mixer_scarlett2.c:3688:9: note: initialize the variable 'err' to silence this warning
   3688 |         int err;
        |                ^
        |                 = 0
  1 error generated.

Initialize ret to zero to ensure ret is initialized in all paths within
scarlett2_ag_target_ctl_get(), which matches the style of other
functions in this driver.

Fixes: e30ea5340c25 ("ALSA: scarlett2: Add autogain target controls")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20240419-alsa-scarlett2-fix-wsometimes-uninitialized-v1-1-e2ace8642e08@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: seq: dummy: Allow UMP conversion
Takashi Iwai [Fri, 19 Apr 2024 10:11:02 +0000 (12:11 +0200)]
ALSA: seq: dummy: Allow UMP conversion

Although the purpose of dummy seq client is a direct pass-through,
it's sometimes helpful for debugging if it can convert to a certain
UMP MIDI version.  This patch adds an option to specify the UMP event
conversion.  As default, it skips the conversion and does
passthrough, while user can pass ump=1 or ump=2 to enforce the
conversion to UMP MIDI1 or MIDI2 format.

Message-ID: <20240419101105.15571-1-tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: seq: ump: Fix conversion from MIDI2 to MIDI1 UMP messages
Takashi Iwai [Fri, 19 Apr 2024 10:04:39 +0000 (12:04 +0200)]
ALSA: seq: ump: Fix conversion from MIDI2 to MIDI1 UMP messages

The conversion from MIDI2 to MIDI1 UMP messages had a leftover
artifact (superfluous bit shift), and this resulted in the bogus type
check, leading to empty outputs.  Let's fix it.

Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
Cc: <stable@vger.kernel.org>
Link: https://github.com/alsa-project/alsa-utils/issues/262
Message-ID: <20240419100442.14806-1-tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC
Ai Chao [Fri, 19 Apr 2024 08:21:59 +0000 (16:21 +0800)]
ALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC

The Haier Boyue G42 with ALC269VC cannot detect the MIC of headset,
the line out and internal speaker until
ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS quirk applied.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
Cc: <stable@vger.kernel.org>
Message-ID: <20240419082159.476879-1-aichao@kylinos.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Add quirks for Huawei Matebook D14 NBLB-WAX9N
Mauro Carvalho Chehab [Wed, 17 Apr 2024 16:16:33 +0000 (17:16 +0100)]
ALSA: hda/realtek: Add quirks for Huawei Matebook D14 NBLB-WAX9N

The headset mic requires a fixup to be properly detected/used.

As a reference, this specific model from 2021 reports
the following devices:
https://alsa-project.org/db/?f=1a5ddeb0b151db8fe051407f5bb1c075b7dd3e4a

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: <stable@vger.kernel.org>
Message-ID: <b92a9e49fb504eec8416bcc6882a52de89450102.1713370457.git.mchehab@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: aloop: add support for up to 768kHz sample rate
Pavel Hofman [Tue, 16 Apr 2024 12:17:26 +0000 (14:17 +0200)]
ALSA: aloop: add support for up to 768kHz sample rate

Many modern codecs support rates up to 768kHz (including DSD1024). Add
support for rates up to 768kHz to the loopback driver.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240416121726.628679-4-pavel.hofman@ivitera.com>

4 months agoALSA: pcm: add support for 705.6kHz and 768kHz sample rates
Pavel Hofman [Tue, 16 Apr 2024 12:17:25 +0000 (14:17 +0200)]
ALSA: pcm: add support for 705.6kHz and 768kHz sample rates

Many modern codecs support 705.6kHz and 768kHz sample rates. Current HW
params fail to set 705.6kHz and 768kHz sample rates as these are not in the
known-rates list.

Add these new rates to the known-rates list to allow them.

Also add defines in pcm.h so that drivers can use it.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240416121726.628679-3-pavel.hofman@ivitera.com>

4 months agoALSA: aloop: add DSD formats
Pavel Hofman [Tue, 16 Apr 2024 12:17:24 +0000 (14:17 +0200)]
ALSA: aloop: add DSD formats

The snd-aloop loopback driver does not modify or access the actual samples
in any way, defines no volume or mute controls, it's strictly bitperfect.
Therefore DSD formats can be supported without any modification.

Add all DSD formats to the list of supported formats.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240416121726.628679-2-pavel.hofman@ivitera.com>

4 months agoALSA: hda/realtek: Fix volumn control of ThinkBook 16P Gen4
Huayu Zhang [Sat, 13 Apr 2024 11:41:22 +0000 (19:41 +0800)]
ALSA: hda/realtek: Fix volumn control of ThinkBook 16P Gen4

change HDA & AMP configuration from ALC287_FIXUP_CS35L41_I2C_2 to
ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD for ThinkBook 16P Gen4
models to fix volumn control issue (cannot fully mute).

Signed-off-by: Huayu Zhang <zhanghuayu1233@qq.com>
Fixes: 6214e24cae9b ("ALSA: hda/realtek: Add quirks for Lenovo Thinkbook 16P laptops")
Message-ID: <tencent_37EB880C5E5BD99D21C16B288115C4545F06@qq.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Fixes for Asus GU605M and GA403U sound
Vitalii Torshyn [Thu, 11 Apr 2024 12:58:03 +0000 (15:58 +0300)]
ALSA: hda/realtek: Fixes for Asus GU605M and GA403U sound

Added the correct pin table for Asus GU605M and GA403U, enabling all
speakers to be controlled with the master.
Updated quirks for GU605M and GA403U by including the pin table patch
in the chain.

Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Vitalii Torshyn <vitaly.torshyn@gmail.com>
Message-ID: <20240411125803.18539-1-vitaly.torshyn@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda: cs35l41: Remove Speaker ID for Lenovo Legion slim 7 16ARHA7
Stefan Binding [Thu, 11 Apr 2024 11:08:13 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Remove Speaker ID for Lenovo Legion slim 7 16ARHA7

These laptops do not have _DSD and must be added by configuration
table, however, the initial entries for them are incorrect:
Neither laptop contains a Speaker ID GPIO.
This issue would not affect audio playback, but may affect which files
are loaded when loading firmware.

Fixes: b67a7dc418aa ("ALSA: hda/realtek: Add sound quirks for Lenovo Legion slim 7 16ARHA7 models")

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-8-sbinding@opensource.cirrus.com>

4 months agoALSA: hda: cs35l41: Remove redundant argument to cs35l41_request_firmware_file()
Richard Fitzgerald [Thu, 11 Apr 2024 11:08:12 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Remove redundant argument to cs35l41_request_firmware_file()

In every case the 'dir' argument to cs35l41_request_firmware_file() is passed
the string "cirrus/", so this is a redundant argument and can be removed.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-7-sbinding@opensource.cirrus.com>

4 months agoALSA: hda: cs35l41: Use shared cs-amp-lib to apply calibration
Stefan Binding [Thu, 11 Apr 2024 11:08:11 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Use shared cs-amp-lib to apply calibration

The original mechanism for applying calibration assumed that the
calibration data would be ordered the same as the amp instances.
However, for some 4 amp laptops, this is not the case.
To ensure that the correct calibration is applied to the correct amp,
the calibration data contains a unique id, which matches a unique id
inside the CS35L41. This can be used to match to the correct data
entry. This mechanism is available inside the shared module cs-amp-lib.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-6-sbinding@opensource.cirrus.com>

4 months agoALSA: hda: cs35l41: Update DSP1RX5/6 Sources for DSP config
Stefan Binding [Thu, 11 Apr 2024 11:08:10 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Update DSP1RX5/6 Sources for DSP config

Currently, all PC systems are set to use VBSTMON for DSP1RX5_SRC,
however, this is required only for external boost systems.
Internal boost systems require VPMON instead of VBSTMON to be the
input to DSP1RX5_SRC.
All systems require DSP1RX6_SRC to be set to VBSTMON.
Also fix incorrect comment for DACPCM1_SRC to use DSP1TX1.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-5-sbinding@opensource.cirrus.com>

4 months agoALSA: hda/realtek: Add quirks for HP Omen models using CS35L41
Stefan Binding [Thu, 11 Apr 2024 11:08:09 +0000 (12:08 +0100)]
ALSA: hda/realtek: Add quirks for HP Omen models using CS35L41

Add 4 laptops using CS35L41 HDA.
None of these laptops have _DSD, so require entries in property
configuration table for cs35l41_hda driver.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-4-sbinding@opensource.cirrus.com>

4 months agoALSA: hda: cs35l41: Support HP Omen models without _DSD
Stefan Binding [Thu, 11 Apr 2024 11:08:08 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Support HP Omen models without _DSD

Add support for 2 new HP Omen models without _DSD into configuration
table.
These laptops use the PCM Gain setting for the tuning setting file.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-3-sbinding@opensource.cirrus.com>

4 months agoALSA: hda: cs35l41: Set the max PCM Gain using tuning setting
Stefan Binding [Thu, 11 Apr 2024 11:08:07 +0000 (12:08 +0100)]
ALSA: hda: cs35l41: Set the max PCM Gain using tuning setting

Some systems requires different max PCM Gains settings than the default.
The current default value, when running firmware is 17.5 dB, which is
used for all systems. Some systems require lower values.
Value when running without firmware is 4.5 dB and remains unchanged.

Since the gain value is dependent on Tuning and Firmware, it can
change, so it cannot be saved in _DSD. Instead we can store it inside
a configuration binary file alongside the Firmware and Tuning files.

The gain value increments in steps of 1 dB, with value 0 representing
0.5 dB. The max value is 20, which corresponds to 20.5 dB.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240411110813.330483-2-sbinding@opensource.cirrus.com>

4 months agoALSA: hda/tas2781: Add new vendor_id and subsystem_id to support ThinkPad ICE-1
Shenghao Ding [Thu, 11 Apr 2024 09:18:22 +0000 (17:18 +0800)]
ALSA: hda/tas2781: Add new vendor_id and subsystem_id to support ThinkPad ICE-1

Add new vendor_id and subsystem_id to support new Lenovo laptop
ThinkPad ICE-1

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Cc: <stable@vger.kernel.org>
Message-ID: <20240411091823.1644-1-shenghao-ding@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoASoC: SOF: Intel: hda-bus: Use PIO mode for Lunar Lake
Peter Ujfalusi [Tue, 9 Apr 2024 08:38:12 +0000 (11:38 +0300)]
ASoC: SOF: Intel: hda-bus: Use PIO mode for Lunar Lake

It is recommended that on Lunar Lake the PIO (immediate command response)
is used instead of CORB/RIRB for commands/verbs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240409083812.14001-6-peter.ujfalusi@linux.intel.com>

4 months agoALSA: hda: Intel: Select AZX_DCAPS_PIO_COMMANDS for Lunar Lake
Peter Ujfalusi [Tue, 9 Apr 2024 08:38:11 +0000 (11:38 +0300)]
ALSA: hda: Intel: Select AZX_DCAPS_PIO_COMMANDS for Lunar Lake

It is recommended that on Lunar Lake the PIO (immediate command response)
is used instead of CORB/RIRB for commands/verbs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240409083812.14001-5-peter.ujfalusi@linux.intel.com>

4 months agoALSA: pci: hda: hda_controller: Add support for use_pio_for_commands mode
Peter Ujfalusi [Tue, 9 Apr 2024 08:38:10 +0000 (11:38 +0300)]
ALSA: pci: hda: hda_controller: Add support for use_pio_for_commands mode

Set the use_pio_for_commands flag in case AZX_DCAPS_PIO_COMMANDS quirk is
enabled.

When the PIO command mode is used we can re-use the existing
azx_single_send_cmd() / azx_single_get_response() functions safely as the
CORB DMA is not going to be enabled in snd_hdac_bus_init_cmd_io().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240409083812.14001-4-peter.ujfalusi@linux.intel.com>

4 months agoALSA: hda: hdac_controller: Implement support for use_pio_for_commands mode
Peter Ujfalusi [Tue, 9 Apr 2024 08:38:09 +0000 (11:38 +0300)]
ALSA: hda: hdac_controller: Implement support for use_pio_for_commands mode

In case the use_pio_for_commands flag is set we must not enable the
CORB DMA to make sure that it is not interfering with the immediate
command mode.

Convert the snd_hdac_bus_send_cmd/snd_hdac_bus_get_response as wrappers to
call either the PIO or CORB based command handling depending on the
use_pio_for_commands flag.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240409083812.14001-3-peter.ujfalusi@linux.intel.com>

4 months agoALSA: hda: Introduce flags to force commands via PIO instead of CORB
Peter Ujfalusi [Tue, 9 Apr 2024 08:38:08 +0000 (11:38 +0300)]
ALSA: hda: Introduce flags to force commands via PIO instead of CORB

Add AZX_DCAPS_PIO_COMMANDS quirk (bit 31) and use_pio_for_commands flag to
be able to select PIO mode as alternative for CORB based command sending
while retaining the RIRB functionality to receive unsolicited responses.

This mode differs from the azx single_cmd mode when RIRB is disabled.

The mixed mode is needed on Lunar Lake family because it is recommended to
use Immediate Command Response (PIO mode) instead of CORB for HDA commands.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240409083812.14001-2-peter.ujfalusi@linux.intel.com>

4 months agoALSA: scarlett2: Add Bluetooth volume control for Vocaster Two
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:38:10 +0000 (05:08 +1030)]
ALSA: scarlett2: Add Bluetooth volume control for Vocaster Two

The Vocaster Two has a Bluetooth module with a volume control. Add a
corresponding ALSA mixer control.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <b78687f7243142a4466f63c0aee9742b44ee395d.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add autogain target controls
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:37:56 +0000 (05:07 +1030)]
ALSA: scarlett2: Add autogain target controls

The Scarlett 4th Gen and Vocaster interfaces allow the autogain target
dBFS value(s) to be configured. Add Mean and Peak Target controls for
4th Gen, and a Hot Target control for Vocaster.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <33d7f6dc965ab09522361ec99745a0685e4b8272.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add support for Focusrite Vocaster One and Two
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:37:43 +0000 (05:07 +1030)]
ALSA: scarlett2: Add support for Focusrite Vocaster One and Two

Add Focusrite Vocaster One and Two USB IDs, notification arrays,
config sets, and device info data.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <5fb48555a8db7bb322b25784b165829357cd6e42.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add DSP controls
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:37:12 +0000 (05:07 +1030)]
ALSA: scarlett2: Add DSP controls

Add filter and compressor DSP controls for the Vocaster interfaces.
Mark scarlett2_notify_input_dsp() as __always_unused until it gets
used when the Vocaster callback function array is added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <a45316f79600b862dae38da24f13def638b06476.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add input mute controls
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:36:23 +0000 (05:06 +1030)]
ALSA: scarlett2: Add input mute controls

Add controls for the input mute switches that the Vocaster interfaces
have. Mark scarlett2_notify_input_mute() as __always_unused until it
gets used when the Vocaster callback function array is added.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <3b384b4e759241bd06f0c223e9f4f00467d88318.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Define autogain status texts per-config-set
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:36:04 +0000 (05:06 +1030)]
ALSA: scarlett2: Define autogain status texts per-config-set

The autogain status texts are different for Vocaster vs. Scarlett 4th
Gen, so make them configurable per-config-set.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <b1adcd3dc48117d4ebe16812eeb7f1dbf1ede472.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Define the maximum preamp input gain per-config-set
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:35:57 +0000 (05:05 +1030)]
ALSA: scarlett2: Define the maximum preamp input gain per-config-set

Remove the #define SCARLETT2_MAX_GAIN_DB and replace with a
per-config-set TLV as the Vocaster has a maximum gain of 70dB vs the
4th Gen 69dB.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <ade8e18ce38927ea0224946ec7cfea23ad3793d8.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add additional input configuration parameters
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:35:47 +0000 (05:05 +1030)]
ALSA: scarlett2: Add additional input configuration parameters

The 4th Gen Scarlett interfaces added software-controllable input gain
along with channel select, channel link, auto-gain, and "safe" mode.
Vocaster has software-controllable input gain and auto-gain but not
channel select, channel link, or safe mode.

Add a device info field safe_input_count to indicate how many channels
have a safe mode control, and use the presence of the input select and
input link switch configuration parameters to determine if those
controls should be created.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <167f04a37d0fb23f3077705df835adbc4f2b6a8e.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add support for config items with size = 32
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:35:30 +0000 (05:05 +1030)]
ALSA: scarlett2: Add support for config items with size = 32

Update scarlett2_usb_get_config() to support 32-bit values which are
needed by the upcoming Vocaster support.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <ee35dce0172b2aa3fec8163ab8f35bdc35a141bd.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add pbuf field to struct scarlett2_config
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:35:15 +0000 (05:05 +1030)]
ALSA: scarlett2: Add pbuf field to struct scarlett2_config

scarlett2_usb_set_config() was using size = 0 as a signal to use the
parameter buffer. Replace that with an explicit indication (pbuf = 1),
as the upcoming Vocaster support has a config item written via the
parameter buffer with size = 1 rather than the implicit size of 8.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <50a7d85bb04f9a7f13f667c70a706826c8d3ef93.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Rename gen4_write_addr to param_buf_addr
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:34:59 +0000 (05:04 +1030)]
ALSA: scarlett2: Rename gen4_write_addr to param_buf_addr

The location pointed to by gen4_write_addr and gen4_write_addr + 1 is
officially known as the parameter buffer. Update the code to match.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <aa36ecb8d3ce67387b5edf6c900f0b8a509241ce.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Add support for reading from flash
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:34:42 +0000 (05:04 +1030)]
ALSA: scarlett2: Add support for reading from flash

Add hwdep read op so flash segments can be read.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <800d20a801e8c59c2905c82ecae5676cd4f31429.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Implement handling of the ACK notification
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:34:14 +0000 (05:04 +1030)]
ALSA: scarlett2: Implement handling of the ACK notification

After scarlett2_usb() sends a command, it seems that we should wait
for an ACK before attempting to read the response. Not doing that
didn't seem necessary previously but seems to be causing occasional
issues with 4th Gen devices.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <452d1263c40fa8eba1cfb24e2055e40a84cbc437.1710264833.git.g@b4.vu>

4 months agoALSA: scarlett2: Move initialisation code lower in the source
Geoffrey D. Bennett [Tue, 12 Mar 2024 18:33:14 +0000 (05:03 +1030)]
ALSA: scarlett2: Move initialisation code lower in the source

So that more forward declarations won't be required when we add
handling of the ACK notification, move the initialisation functions to
after the notification functions.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <0922071cb8be99a2394705de27b917d1e4e46f3f.1710264833.git.g@b4.vu>

4 months agoMerge branch 'topic/emu10k1-fix' into for-next
Takashi Iwai [Sun, 7 Apr 2024 06:38:02 +0000 (08:38 +0200)]
Merge branch 'topic/emu10k1-fix' into for-next

Pull emu10k1 fix patch series

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: simplify snd_sf_list.callback handling
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:30 +0000 (08:48 +0200)]
ALSA: emux: simplify snd_sf_list.callback handling

Both drivers provide both sample_new and sample_free, and it makes no
sense to pretend that they could not. In fact, load_data() would already
crash if sample_new was null. So remove the remaining null checks.

Contrary to that, the emu10k1 driver actually has a null sample_reset,
though I'm not convinced that this inconsistency is justified.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-18-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: shrink blank space in front of wavetable samples
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:29 +0000 (08:48 +0200)]
ALSA: emu10k1: shrink blank space in front of wavetable samples

There is no need for it to be 32 samples - 3 will do just fine (which is
the interpolator's epsilon). The old size was presumably meant to
compensate for the cache's presence, but we're now handling that
properly.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-17-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: fix wavetable playback position and caching, take 2
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:28 +0000 (08:48 +0200)]
ALSA: emu10k1: fix wavetable playback position and caching, take 2

Compensate for the cache lag of 64 frames, and actually populate the
cache. Without these, the playback would start with garbage (which
would be (mostly?) masqueraded by the note's attack phase).

Note that we set the starting address only 61 frames ahead, to
compensate for the interpolator's epsilon. Unlike for PCM playback, we
don't even need to manually silence-fill the first frames in the cache,
because we insert some silence in front of each sample anyway.

A challenge are extremely short samples with a loop end below the cache
size, because a) we'd have to wrap the current address to be within the
loop and b) automatic pre-filling of the cache with the right data does
not work in this case.

We could pre-fill the cache manually, but that's slow, requires
additional code for each sample width, and is made even more complex by
the driver's virtual address space having no contiguous mapping for the
CPU.

We could have the engine fill the cache piece-wise (which is really what
happens when playback is running), but that would also be complex, and
we'd need to wait for the engine to handle each piece, so it wouldn't be
that much faster than the manual fill.

For the case of requiring only one loop iteration prior to reaching the
cache size, we could leverage the engine's looping mechanism around
CCR_CACHELOOPFLAG, but this special case doesn't seem worth the
complexity.

So we just unroll the loop as far as necessary to be able to play back
the sample without any fiddling.

Pedantically, this would be incorrect for loop-until-release samples
with a low loop end which are released very quickly, but that would be
relatively harmless, is not a plausible use case in the first place, and
SoundFont sample mode 3 isn't actually implemented anyway (it's
conflated with mode 1, infinite looping).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-16-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: improve cache behavior documentation
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:27 +0000 (08:48 +0200)]
ALSA: emu10k1: improve cache behavior documentation

Resulting from more reverse engineering in the course of debugging.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-15-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: de-duplicate size calculations for 16-bit samples
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:26 +0000 (08:48 +0200)]
ALSA: emu10k1: de-duplicate size calculations for 16-bit samples

Instead of repeatedly checking the sample width, assign a size shift
centrally.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-14-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: fix wavetable offset recalculation
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:25 +0000 (08:48 +0200)]
ALSA: emu10k1: fix wavetable offset recalculation

The offsets are counted in samples, not in bytes.

While the code block is being rewritten, also move it up a bit, to avoid
churn in a subsequent patch.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-13-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: merge conditions in patch loader
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:24 +0000 (08:48 +0200)]
ALSA: emu10k1: merge conditions in patch loader

This de-duplicates the code slightly. But the real reason is that it
moves the code up, which the next patch will depend on.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-12-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: fix playback of 8-bit wavetable samples
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:23 +0000 (08:48 +0200)]
ALSA: emu10k1: fix playback of 8-bit wavetable samples

Samples are byte-sized in this mode, and thus the offset calculation
needs no shifting.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-11-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: fix sample signedness issues in wavetable loader
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:22 +0000 (08:48 +0200)]
ALSA: emu10k1: fix sample signedness issues in wavetable loader

The hardware supports S16LE and U8 samples, while U16LE and S8 (which
the driver implicitly claims to support) require sign flipping.

Note that this matters only for the GUS patch loader, as the implemented
SoundFont v2.01 spec is limited to S16LE.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-10-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: move patch loader assertions into low-level functions
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:21 +0000 (08:48 +0200)]
ALSA: emu10k1: move patch loader assertions into low-level functions

Convert some checks in snd_emu10k1_sample_new() back into assertions (as
they were prior to da3cec35dd (ALSA: Kill snd_assert() in sound/pci/*,
2008-08-08)), and move them into the low-level memory access functions
they protect.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-9-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: improve patch ioctl data validation
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:20 +0000 (08:48 +0200)]
ALSA: emux: improve patch ioctl data validation

In load_data(), make the validation of and skipping over the main info
block match that in load_guspatch().

In load_guspatch(), add checking that the specified patch length matches
the actually supplied data, like load_data() already did.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-8-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: centralize & improve patch info validation
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:19 +0000 (08:48 +0200)]
ALSA: emux: centralize & improve patch info validation

This does several closely related things:
- Move the code from the drivers into the SoundFont loader, which
  de-duplicates it.
- Sort of explain the weird "recalculate address offset" feature. Note
  that I don't think it actually makes any sense - the calling user
  space code should do that. The background is certainly that the source
  data (the SoundFont format) uses pointers into a single wave block
  (and the API allows doing the same for on-board ROM), but the API
  expects the wave data from user space to be pre-chopped into
  individual patches anyway.
- Make sure that the specified offsets actually lie within the supplied
  wave data. Note that we don't validate ROM offsets, so one can play
  back anything within the sound card's address space.
- In load_guspatch(), don't call the sample_new callback anymore when
  the patch size is zero, as was already the case in load_data(). The
  callbacks would instantly return in that case anyway; these checks are
  now removed.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-7-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emu10k1: prune vestiges of SNDRV_SFNT_SAMPLE_{BIDIR,REVERSE}_LOOP support
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:18 +0000 (08:48 +0200)]
ALSA: emu10k1: prune vestiges of SNDRV_SFNT_SAMPLE_{BIDIR,REVERSE}_LOOP support

This is required only to implement WAVE_BIDIR_LOOP and WAVE_LOOP_BACK in
the GUS patch loader. It has not worked on emu10k1 since before ALSA hit
mainline, yet nobody appears to have complained. And as it isn't super
easy to implement, just admit defeat and clean up the code.

If somebody wanted to resurrect the feature, the emu8k driver could
serve as a template, but the code would be quite different. But
arguably, this should be done in user space in the first place, as this
doesn't represent a hardware feature (somewhat ironically, the actual
GUS driver has no synth support, and therefore no GUS patch loader).

Note that instead of properly rejecting affected samples, we continue to
just pretend that the feature wasn't requested. This is extremely
questionable behavior, but avoids that possibly unused instruments
suddenly prevent loading the entire file, which would break backwards
compatibility. But at least we log a warning now.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-6-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: fix init of patch_info.truesize in load_data()
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:17 +0000 (08:48 +0200)]
ALSA: emux: fix init of patch_info.truesize in load_data()

The field is explicitly documented to be initialized by the driver
(which it actually is). Also, using patch_info.size would be actually
wrong for 16-bit data, as one field counts samples, while the other
counts bytes.

load_guspatch() already did it right.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-5-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: fix validation of snd_emux.num_ports
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:16 +0000 (08:48 +0200)]
ALSA: emux: fix validation of snd_emux.num_ports

Both bounds had off-by-one errors.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-4-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: prune unused parameter from snd_soundfont_load_guspatch()
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:15 +0000 (08:48 +0200)]
ALSA: emux: prune unused parameter from snd_soundfont_load_guspatch()

The `client` parameter was not used, so eliminate it from the call
chain.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-3-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: emux: fix /proc teardown at module unload
Oswald Buddenhagen [Sat, 6 Apr 2024 06:48:14 +0000 (08:48 +0200)]
ALSA: emux: fix /proc teardown at module unload

We forgot to remember the wavetable /proc entry, so we'd fail to free it
at module unload.

This matters only when only the synth module is unloaded, as unloading
the card driver would tear down the sub-entry anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240406064830.1029573-2-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/tas2781: correct the register for pow calibrated data
Shenghao Ding [Sat, 6 Apr 2024 13:20:09 +0000 (21:20 +0800)]
ALSA: hda/tas2781: correct the register for pow calibrated data

Calibrated data was written into an incorrect register, which cause
speaker protection sometimes malfuctions

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Cc: <stable@vger.kernel.org>
Message-ID: <20240406132010.341-1-shenghao-ding@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Add quirk for HP SnowWhite laptops
Vitaly Rodionov [Fri, 5 Apr 2024 21:06:35 +0000 (22:06 +0100)]
ALSA: hda/realtek: Add quirk for HP SnowWhite laptops

Add support for HP SnowWhite laptops with CS35L51 amplifiers on I2C
bus connected to Realtek codec.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Message-ID: <20240405210635.22193-1-vitalyr@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoMerge tag 'asoc-fix-v6.9-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Fri, 5 Apr 2024 06:48:12 +0000 (08:48 +0200)]
Merge tag 'asoc-fix-v6.9-rc2' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.9

A relatively large set of fixes here, the biggest piece of it is a
series correcting some problems with the delay reporting for Intel SOF
cards but there's a bunch of other things.  Everything here is driver
specific except for a fix in the core for an issue with sign extension
handling volume controls.

4 months agoASoC: SOF: Core: Add remove_late() to sof_init_environment failure path
Chaitanya Kumar Borah [Thu, 4 Apr 2024 18:48:13 +0000 (13:48 -0500)]
ASoC: SOF: Core: Add remove_late() to sof_init_environment failure path

In cases where the sof driver is unable to find the firmware and/or
topology file [1], it exits without releasing the i915 runtime
pm wakeref [2]. This results in dmesg warnings[3] during
suspend/resume or driver unbind. Add remove_late() to the failure path
of sof_init_environment so that i915 wakeref is released appropriately

[1]

[    8.990366] sof-audio-pci-intel-mtl 0000:00:1f.3: SOF firmware and/or topology file not found.
[    8.990396] sof-audio-pci-intel-mtl 0000:00:1f.3: Supported default profiles
[    8.990398] sof-audio-pci-intel-mtl 0000:00:1f.3: - ipc type 1 (Requested):
[    8.990399] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware file: intel/sof-ipc4/mtl/sof-mtl.ri
[    8.990401] sof-audio-pci-intel-mtl 0000:00:1f.3:  Topology file: intel/sof-ace-tplg/sof-mtl-rt711-2ch.tplg
[    8.990402] sof-audio-pci-intel-mtl 0000:00:1f.3: Check if you have 'sof-firmware' package installed.
[    8.990403] sof-audio-pci-intel-mtl 0000:00:1f.3: Optionally it can be manually downloaded from:
[    8.990404] sof-audio-pci-intel-mtl 0000:00:1f.3:    https://github.com/thesofproject/sof-bin/
[    8.999088] sof-audio-pci-intel-mtl 0000:00:1f.3: error: sof_probe_work failed err: -2

[2]

ref_tracker: 0000:00:02.0@ffff9b8511b6a378 has 1/5 users at
     track_intel_runtime_pm_wakeref.part.0+0x36/0x70 [i915]
     __intel_runtime_pm_get+0x51/0xb0 [i915]
     intel_runtime_pm_get+0x17/0x20 [i915]
     intel_display_power_get+0x2f/0x70 [i915]
     i915_audio_component_get_power+0x23/0x120 [i915]
     snd_hdac_display_power+0x89/0x130 [snd_hda_core]
     hda_codec_i915_init+0x3f/0x50 [snd_sof_intel_hda]
     hda_dsp_probe_early+0x170/0x250 [snd_sof_intel_hda_common]
     snd_sof_device_probe+0x224/0x320 [snd_sof]
     sof_pci_probe+0x15b/0x220 [snd_sof_pci]
     hda_pci_intel_probe+0x30/0x70 [snd_sof_intel_hda_common]
     local_pci_probe+0x4c/0xb0
     pci_device_probe+0xcc/0x250
     really_probe+0x18e/0x420
     __driver_probe_device+0x7e/0x170
     driver_probe_device+0x23/0xa0

[3]
[  484.105070] ------------[ cut here ]------------
[  484.108238] thunderbolt 0000:00:0d.2: PM: pci_pm_suspend_late+0x0/0x50 returned 0 after 0 usecs
[  484.117106] i915 0000:00:02.0: i915 raw-wakerefs=1 wakelocks=1 on cleanup
[  484.792005] WARNING: CPU: 2 PID: 2405 at drivers/gpu/drm/i915/intel_runtime_pm.c:444 intel_runtime_pm_driver_release+0x6c/0x80

Tested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://github.com/thesofproject/linux/pull/4878
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://msgid.link/r/20240404184813.134566-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: amd: fix for false dsp interrupts
Vijendar Mukunda [Thu, 4 Apr 2024 04:17:13 +0000 (09:47 +0530)]
ASoC: SOF: amd: fix for false dsp interrupts

Before ACP firmware loading, DSP interrupts are not expected.
Sometimes after reboot, it's observed that before ACP firmware is loaded
false DSP interrupt is reported.
Registering the interrupt handler before acp initialization causing false
interrupts sometimes on reboot as ACP reset is not applied.
Correct the sequence by invoking acp initialization sequence prior to
registering interrupt handler.

Fixes: 738a2b5e2cc9 ("ASoC: SOF: amd: Add IPC support for ACP IP block")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240404041717.430545-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: lnl: Disable DMIC/SSP offload on remove
Peter Ujfalusi [Wed, 3 Apr 2024 11:18:39 +0000 (14:18 +0300)]
ASoC: SOF: Intel: lnl: Disable DMIC/SSP offload on remove

During probe the DMIC/SSP offload is enabled and it is not reversed on
remove.

Add a remove wrapper for LNL to disable the offload for DMIC and SSP
similarly to what is done during probe.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240403111839.27259-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Merge up left over v6.8 fix
Mark Brown [Wed, 3 Apr 2024 15:03:56 +0000 (16:03 +0100)]
ASoC: Merge up left over v6.8 fix

This v6.8 change didn't make it into the release, send it as a fix for
v6.9.

4 months agoASoC: codecs: ES8326: solve some hp issues and
Mark Brown [Tue, 2 Apr 2024 20:01:43 +0000 (21:01 +0100)]
ASoC: codecs: ES8326: solve some hp issues and

Merge series from Zhang Yi <zhangyi@everest-semi.com>:

We solved some issues related to headphone detection.And for using
the same configuration in different power conditions,we modified the
clock table

4 months agoASoC: Intel: avs: boards: Add modules description
Amadeusz Sławiński [Tue, 2 Apr 2024 13:06:40 +0000 (15:06 +0200)]
ASoC: Intel: avs: boards: Add modules description

Modpost warns about missing module description, add it.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240402130640.3310999-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: ES8326: Removing the control of ADC_SCALE
Zhang Yi [Tue, 2 Apr 2024 06:20:43 +0000 (14:20 +0800)]
ASoC: codecs: ES8326: Removing the control of ADC_SCALE

We removed the configuration of ES8326_ADC_SCALE
in es8326_jack_detect_handler because user changed
the configuration by snd_controls

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-5-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume
Zhang Yi [Tue, 2 Apr 2024 06:20:42 +0000 (14:20 +0800)]
ASoC: codecs: ES8326: Solve a headphone detection issue after suspend and resume

We got a headphone detection issue after suspend and resume.
And we fixed it by modifying the configuration at es8326_suspend
and invoke es8326_irq at es8326_resume.

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-4-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: ES8326: modify clock table
Zhang Yi [Tue, 2 Apr 2024 06:20:41 +0000 (14:20 +0800)]
ASoC: codecs: ES8326: modify clock table

We got a digital microphone feature issue. And we fixed it by modifying
the clock table. Also, we changed the marco ES8326_CLK_ON declaration

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-3-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: ES8326: Solve error interruption issue
Zhang Yi [Tue, 2 Apr 2024 06:20:40 +0000 (14:20 +0800)]
ASoC: codecs: ES8326: Solve error interruption issue

We got an error report about headphone type detection and button detection.
We fixed the headphone type detection error by adjusting the debounce timer
configuration. And we fixed the button detection error by disabling the
button detection feature when the headphone are unplugged and enabling it
when headphone are plugged in.

Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
Link: https://msgid.link/r/20240402062043.20608-2-zhangyi@everest-semi.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoALSA: line6: Zero-initialize message buffers
Takashi Iwai [Tue, 2 Apr 2024 06:36:25 +0000 (08:36 +0200)]
ALSA: line6: Zero-initialize message buffers

For shutting up spurious KMSAN uninit-value warnings, just replace
kmalloc() calls with kzalloc() for the buffers used for
communications.  There should be no real issue with the original code,
but it's still better to cover.

Reported-by: syzbot+7fb05ccf7b3d2f9617b3@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/00000000000084b18706150bcca5@google.com
Message-ID: <20240402063628.26609-1-tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: cs35l41: Support ASUS ROG G634JYR
Luke D. Jones [Tue, 2 Apr 2024 01:51:26 +0000 (14:51 +1300)]
ALSA: hda/realtek: cs35l41: Support ASUS ROG G634JYR

Fixes the realtek quirk to initialise the Cirrus amp correctly and adds
related quirk for missing DSD properties. This model laptop has slightly
updated internals compared to the previous version with Realtek Codec
ID of 0x1caf.

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Cc: <stable@vger.kernel.org>
Message-ID: <20240402015126.21115-1-luke@ljones.dev>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone
I Gede Agastya Darma Laksana [Mon, 1 Apr 2024 17:46:02 +0000 (00:46 +0700)]
ALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone

This patch addresses an issue with the Panasonic CF-SZ6's existing quirk,
specifically its headset microphone functionality. Previously, the quirk
used ALC269_FIXUP_HEADSET_MODE, which does not support the CF-SZ6's design
of a single 3.5mm jack for both mic and audio output effectively. The
device uses pin 0x19 for the headset mic without jack detection.

Following verification on the CF-SZ6 and discussions with the original
patch author, i determined that the update to
ALC269_FIXUP_ASPIRE_HEADSET_MIC is the appropriate solution. This change
is custom-designed for the CF-SZ6's unique hardware setup, which includes
a single 3.5mm jack for both mic and audio output, connecting the headset
microphone to pin 0x19 without the use of jack detection.

Fixes: 0fca97a29b83 ("ALSA: hda/realtek - Add Panasonic CF-SZ6 headset jack quirk")
Signed-off-by: I Gede Agastya Darma Laksana <gedeagas22@gmail.com>
Cc: <stable@vger.kernel.org>
Message-ID: <20240401174602.14133-1-gedeagas22@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Add sound quirks for Lenovo Legion slim 7 16ARHA7 models
Christian Bendiksen [Mon, 1 Apr 2024 12:26:10 +0000 (12:26 +0000)]
ALSA: hda/realtek: Add sound quirks for Lenovo Legion slim 7 16ARHA7 models

This fixes the sound not working from internal speakers on
Lenovo Legion Slim 7 16ARHA7 models. The correct subsystem ID
have been added to cs35l41_hda_property.c and patch_realtek.c.

Signed-off-by: Christian Bendiksen <christian@bendiksen.me>
Cc: <stable@vger.kernel.org>
Message-ID: <20240401122603.6634-1-christian@bendiksen.me>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoRevert "ALSA: emu10k1: fix synthesizer sample playback position and caching"
Oswald Buddenhagen [Mon, 1 Apr 2024 14:58:05 +0000 (16:58 +0200)]
Revert "ALSA: emu10k1: fix synthesizer sample playback position and caching"

As already anticipated in the original commit, playback was broken for
very short samples. I just didn't expect it to be an actual problem,
because we're talking about less than 1.5 milliseconds here. But clearly
such wavetable samples do actually exist.

The problem was that for such short samples we'd set the current
position beyond the end of the loop, so we'd run off the end of the
sample and play garbage.
This is a bigger (more audible) problem than the original one, which was
that we'd start playback with garbage (whatever was still in the cache),
which would be mostly masked by the note's attack phase.

So revert to the old behavior for now. We'll subsequently fix it
properly with a bigger patch series.
Note that this isn't a full revert - the dead code is not re-introduced,
because that would be silly.

Fixes: df335e9a8bcb ("ALSA: emu10k1: fix synthesizer sample playback position and caching")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218625
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Message-ID: <20240401145805.528794-1-oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoOSS: dmasound/paula: Mark driver struct with __refdata to prevent section mismatch
Uwe Kleine-König [Fri, 29 Mar 2024 21:54:42 +0000 (22:54 +0100)]
OSS: dmasound/paula: Mark driver struct with __refdata to prevent section mismatch

As described in the added code comment, a reference to .exit.text is ok
for drivers registered via module_platform_driver_probe(). Make this
explicit to prevent the following section mismatch warning

WARNING: modpost: sound/oss/dmasound/dmasound_paula: section mismatch in reference: amiga_audio_driver+0x8 (section: .data) -> amiga_audio_remove (section: .exit.text)

that triggers on an allmodconfig W=1 build.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-ID: <c216a129aa88f3af5c56fe6612a472f7a882f048.1711748999.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoALSA: hda/realtek: Add quirks for ASUS Laptops using CS35L56
Simon Trimmer [Fri, 29 Mar 2024 11:28:03 +0000 (11:28 +0000)]
ALSA: hda/realtek: Add quirks for ASUS Laptops using CS35L56

These ASUS laptops use the Realtek HDA codec combined with a number of
CS35L56 amplifiers.

The SSID of the GA403U matches a previous ASUS laptop - we can tell them
apart because they use different codecs.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Message-ID: <20240329112803.23897-1-simont@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 months agoASoC: amd: acp: fix for acp_init function error handling
Vijendar Mukunda [Fri, 29 Mar 2024 05:38:12 +0000 (11:08 +0530)]
ASoC: amd: acp: fix for acp_init function error handling

If acp_init() fails, acp pci driver probe should return error.
Add acp_init() function return value check logic.

Fixes: e61b415515d3 ("ASoC: amd: acp: refactor the acp init and de-init sequence")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20240329053815.2373979-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: tas2781: mark dvc_tlv with __maybe_unused
Gergo Koteles [Thu, 28 Mar 2024 22:47:37 +0000 (23:47 +0100)]
ASoC: tas2781: mark dvc_tlv with __maybe_unused

Since we put dvc_tlv static variable to a header file it's copied to
each module that includes the header. But not all of them are actually
used it.

Fix this W=1 build warning:

include/sound/tas2781-tlv.h:18:35: warning: 'dvc_tlv' defined but not
used [-Wunused-const-variable=]

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403290354.v0StnRpc-lkp@intel.com/
Fixes: ae065d0ce9e3 ("ALSA: hda/tas2781: remove digital gain kcontrol")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Message-ID: <0e461545a2a6e9b6152985143e50526322e5f76b.1711665731.git.soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>