Takashi Iwai [Wed, 29 Jan 2025 13:39:55 +0000 (14:39 +0100)]
Merge tag 'asoc-fix-v6.14-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.14
A bunch of fixes that came in during the merge window, plus a few new
device IDs. The i.MX changes are a little large since they add some new
quirk data as well as device IDs, and the audio graph card change for
picking the correct endpoint for links is large due to updating a number
of call sites.
Kuan-Wei Chiu [Tue, 28 Jan 2025 16:54:15 +0000 (00:54 +0800)]
ALSA: hda: Fix headset detection failure due to unstable sort
The auto_parser assumed sort() was stable, but the kernel's sort() uses
heapsort, which has never been stable. After commit 0e02ca29a563
("lib/sort: optimize heapsort with double-pop variation"), the order of
equal elements changed, causing the headset to fail to work.
Fix the issue by recording the original order of elements before
sorting and using it as a tiebreaker for equal elements in the
comparison function.
Fixes: b9030a005d58 ("ALSA: hda - Use standard sort function in hda_auto_parser.c") Reported-by: Austrum <austrum.lab@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219158 Tested-by: Austrum <austrum.lab@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://patch.msgid.link/20250128165415.643223-1-visitorckw@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Daniel Baluta [Mon, 27 Jan 2025 08:34:22 +0000 (10:34 +0200)]
ASoC: amd: acp: Fix possible deadlock
On error path, function acp_i2s_set_tdm_slot returns without releasing
the lock and this could result in potential deadlocks in the future.
Error reported by sparse:
sound/soc/amd/acp/acp-i2s.c:95:12: error: context imbalance in
'acp_i2s_set_tdm_slot' - different lock contexts for basic block
Fixes: cd60dec8994c ("ASoC: amd: acp: Refactor TDM slots selction based on acp revision id") Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://patch.msgid.link/20250127083422.20406-1-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Geert Uytterhoeven [Sat, 25 Jan 2025 19:32:15 +0000 (20:32 +0100)]
firmware: cs_dsp: FW_CS_DSP_KUNIT_TEST should not select REGMAP
Enabling a (modular) test should not silently enable additional kernel
functionality, as that may increase the attack vector of a product.
Fix this by making FW_CS_DSP_KUNIT_TEST (and FW_CS_DSP_KUNIT_TEST_UTILS)
depend on REGMAP instead of selecting it.
After this, one can safely enable CONFIG_KUNIT_ALL_TESTS=m to build
modules for all appropriate tests for ones system, without pulling in
extra unwanted functionality, while still allowing a tester to manually
enable REGMAP_BUILD and this test suite on a system where REGMAP is not
enabled by default.
Lianqin Hu [Sun, 26 Jan 2025 03:51:11 +0000 (03:51 +0000)]
ALSA: usb-audio: Add delay quirk for iBasso DC07 Pro
Audio control requests that sets sampling frequency sometimes fail on
this card. Adding delay between control messages eliminates that problem.
usb 1-1: New USB device found, idVendor=2fc6, idProduct=f0b7
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: iBasso DC07 Pro
usb 1-1: Manufacturer: iBasso
usb 1-1: SerialNumber: CTUA171130B
Takashi Iwai [Sat, 25 Jan 2025 12:04:40 +0000 (13:04 +0100)]
ALSA: hda/realtek: Fix quirk matching for Legion Pro 7
The recent cleanup of the quirk table entries with the codec ID
matching caused a regression on some Lenovo Legion 7 models with PCI
SSID 17aa:386f: it assumed wrongly as if the codec SSID on the machine
were also 17aa:386f, but in this case, it was 17aa:38a8. This made
the binding with a wrong sub-codec, instead of TAS2781, the Cirrus
codec was bound.
For addressing the regression, correct the quirk entry to the right
value 17aa:38a8.
Note that this makes the entry appearing in an unsorted position.
This exception is needed because the entry must match before the PCI
SSID 17aa:386f.
Also there is another entry for 17aa:38a8, but the latter is for PCI
SSID matching while the new entry is for the codec SSID matching.
Hans de Goede [Thu, 23 Jan 2025 13:25:07 +0000 (14:25 +0100)]
ASoC: Intel: bytcr_rt5640: Add DMI quirk for Vexia Edu Atla 10 tablet 5V
The Vexia EDU ATLA 10 tablet comes in 2 different versions with
significantly different mainboards. The only outward difference is that
the charging barrel on one is marked 5V and the other is marked 9V.
The 5V version mostly works with the BYTCR defaults, except that it is
missing a CHAN package in its ACPI tables and the default of using
SSP0-AIF2 is wrong, instead SSP0-AIF1 must be used. That and its jack
detect signal is not inverted as it usually is.
Add a DMI quirk for the 5V version to fix sound not working.
Iuliana Prodan [Wed, 22 Jan 2025 16:35:44 +0000 (18:35 +0200)]
ASoC: SOF: imx8m: Add entry for new 8M Plus revision
The new revision for 8M Plus has wm8962 codec instead of wm8960.
Therefore add new entry in sof_imx8mp_machs, an array of snd_sof_of_mach,
where we describe topology name and driver name.
For the new revision we have new compatible value and based on this,
we select the new topology file, for wm8962 codec.
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Link: https://patch.msgid.link/20250122163544.1392869-5-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Iuliana Prodan [Wed, 22 Jan 2025 16:35:43 +0000 (18:35 +0200)]
ASoC: SOF: imx8: Add entries for new 8QM and 8QXP revisions
The new revisions for 8QM and 8QXP have wm8962 codec instead of wm8960.
Therefore add new entries in sof_imx8_machs, an array of snd_sof_of_mach,
where we describe topology name and driver name.
For the new revisions we have new compatible values and based on these,
we select the new topology file, for wm8962 codec.
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://patch.msgid.link/20250122163544.1392869-4-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Daniel Baluta [Wed, 22 Jan 2025 16:35:42 +0000 (18:35 +0200)]
ASoC: SOF: imx: Add mach entry to select cs42888 topology
After commit 2b9cdef13648 ("ASoC: SOF: imx: Add devicetree support
to select topologies") we select topology to be used by the board
compatible string in the dts.
Now that we have a way to know when the baseboard is installed, use
the board compatible and select proper topology files when the cs42888
Audio IO card is used.
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://patch.msgid.link/20250122163544.1392869-3-daniel.baluta@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Iuliana Prodan [Wed, 22 Jan 2025 16:35:41 +0000 (18:35 +0200)]
dt-bindings: arm: imx: Add board revisions for i.MX8MP, i.MX8QM and i.MX8QXP
wm8960 codec is EOL so we have i.MX8MP EVK Rev B4,
i.MX8QM MEK Rev D and i.MX8QXP MEK WCPU boards with
wm8962 codec.
Therefore, add compatibles for them.
Ivaylo Dimitrov [Tue, 21 Jan 2025 06:48:15 +0000 (08:48 +0200)]
ASoC: audio-graph-card2: use correct endpoint when getting link parameters
When link DT nodes are parsed, most functions get port as a parameter,
which results in port endpoint@0 always being used. However, each endpoint
might have different settings, but those are currently ignored.
Fix that by passing endpoint instead of port when parsing link parameters.
Takashi Iwai [Wed, 22 Jan 2025 08:47:55 +0000 (09:47 +0100)]
ALSA: hda: tas2781-spi: Fix bogus error handling in tas2781_hda_spi_probe()
The error handling in tas2781_hda_spi_probe() has quite a few
problems, as reported by Dan Carpenter. The code jumps to err label
and calls tas2781_hda_remove(), but this call would rather crash.
In some places, no error code is set properly, and the runtime PM
setup is doubly done.
This patch tries to address those bogus error handling. Basically we
can return immediately at each error before adding the component.
Also, the error code should be set properly for the unmatched SPI
device name. And finally, component_add() should be added before
enabling the runtime PM.
Dan Carpenter [Wed, 22 Jan 2025 07:18:06 +0000 (10:18 +0300)]
ALSA: hda: tas2781-spi: Delete some dead code
The scnprintf() function never returns negatives. And it won't return
zero here either, plus if it did we'd need to fix the error code.
Delete this dead code.
Detlev Casanova [Fri, 17 Jan 2025 16:31:02 +0000 (11:31 -0500)]
ASoC: rockchip: i2s_tdm: Re-add the set_sysclk callback
In commit 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates"),
the set_sysclk callback was removed as considered unused as the mclk rate
can be set in the hw_params callback.
The difference between hw_params and set_sysclk is that the former is
called with the audio sampling rate set in the params (e.g.: 48000 Hz)
while the latter is called with a clock rate already computed with
sampling_rate * mclk-fs (e.g.: 48000 * 256)
For HDMI audio using the Rockchip I2S TDM driver, the mclk-fs value must
be set to 128 instead of the default 256, and that value is set in the
device tree at the machine driver level (like a simple-audio-card
compatible node).
Therefore, the i2s_tdm driver has no idea that another mclk-fs value can
be configured and simply computes the mclk rate in the hw_params callback
with DEFAULT_MCLK_FS * params_rate(params), which is wrong for HDMI
audio.
Re-add the set_sysclk callback so that the mclk rate is computed by the
machine driver which has the correct mclk-fs value set in its device tree
node.
Takashi Iwai [Mon, 20 Jan 2025 15:15:07 +0000 (16:15 +0100)]
Merge tag 'asoc-v6.14' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v6.14
This was quite a quiet release for what I imagine are holiday related
reasons, the diffstat is dominated by some Cirrus Logic Kunit tests.
There's the usual mix of small improvements and fixes, plus a few new
drivers and features. The diffstat includes some DRM changes due to
work on HDMI audio.
- Allow clocking on each DAI in an audio graph card to be configured
separately.
- Improved power management for Renesas RZ-SSI.
- KUnit testing for the Cirrus DSP framework.
- Memory to meory operation support for Freescale/NXP platforms.
- Support for pause operations in SOF.
- Support for Allwinner suinv F1C100s, Awinc AW88083, Realtek
ALC5682I-VE
Shengjiu Wang [Mon, 20 Jan 2025 08:19:38 +0000 (16:19 +0800)]
ASoC: fsl_asrc_m2m: return error value in asrc_m2m_device_run()
The asrc_m2m_device_run() function is the main process function
of converting, the error need to be returned to user, that user
can handle error case properly.
Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://patch.msgid.link/20250120081938.2501554-3-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Shengjiu Wang [Mon, 20 Jan 2025 08:19:37 +0000 (16:19 +0800)]
ASoC: fsl_asrc_m2m: only handle pairs for m2m in the suspend
ASRC memory to memory cases and memory to peripheral cases are
sharing the same pair pools, the pairs got for m2m suspend
function may be used for memory to peripheral, which is handled
memory to peripheral driver and can't be handled in
memory to memory suspend function.
Use the "pair->dma_buffer" as a flag for memory to memory case,
when it is allocated, handle the suspend operation for the related
pairs.
Fixes: 24a01710f627 ("ASoC: fsl_asrc_m2m: Add memory to memory function") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://patch.msgid.link/20250120081938.2501554-2-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Nathan Chancellor [Mon, 20 Jan 2025 13:32:48 +0000 (06:32 -0700)]
ALSA: hda: tas2781-spi: Fix -Wsometimes-uninitialized in tasdevice_spi_switch_book()
Clang warns (or errors with CONFIG_WERROR=y):
sound/pci/hda/tas2781_hda_spi.c:110:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
110 | if (tas_priv->cur_book != TASDEVICE_BOOK_ID(reg)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/hda/tas2781_hda_spi.c:119:9: note: uninitialized use occurs here
119 | return ret;
| ^~~
sound/pci/hda/tas2781_hda_spi.c:110:2: note: remove the 'if' if its condition is always true
110 | if (tas_priv->cur_book != TASDEVICE_BOOK_ID(reg)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/hda/tas2781_hda_spi.c:108:9: note: initialize the variable 'ret' to silence this warning
108 | int ret;
| ^
| = 0
Sink the declaration of ret into the if block and just return 0 at the
end of the function, as there is nothing to do if cur_book has already
been changed.
There was a lote of code duplication in the dao_clear_left_input() and
dao_clear_right_input() functions. A new function, dao_clear_input(),
was created and now the left and right functions call it instead of
repeating themselves.
Takashi Iwai [Mon, 20 Jan 2025 07:46:54 +0000 (08:46 +0100)]
ALSA: hda: tas2781-spi: select CRC32 instead of CRC32_SARWATE
Just like the I2C driver (as in commit 86c96e7289c5 "ALSA:
hda/tas2781: select CRC32 instead of CRC32_SARWATE"), the new tas2781
SPI driver has to select CONFIG_CRC32 instead of
CONFIG_CRC32_SARWATE for fixing the build failures.
Geoffrey D. Bennett [Thu, 16 Jan 2025 17:47:58 +0000 (04:17 +1030)]
ALSA: scarlett2: Add device_setup option to use FCP driver
Add a new device_setup option (SCARLETT2_USE_FCP_DRIVER = 0x08) that
allows users to opt in to using the new FCP driver instead of the
existing scarlett2 driver for their device. This provides a way to
test the new FCP driver on existing supported hardware while keeping
the Scarlett2 driver as the default.
When the SCARLETT2_USE_FCP_DRIVER bit is set in device_setup, the
scarlett2 driver initialisation will hand off to the FCP driver
instead of proceeding with its own initialisation. The FCP driver then
provides access to the device via its hwdep interface.
Geoffrey D. Bennett [Thu, 16 Jan 2025 17:47:38 +0000 (04:17 +1030)]
ALSA: FCP: Add Focusrite Control Protocol driver
Add a new kernel driver for the Focusrite Control Protocol (FCP),
which is used by Focusrite Scarlett 2nd Gen, 3rd Gen, 4th Gen, Clarett
USB, Clarett+, and Vocaster series audio interfaces. This driver
provides a user-space control interface via ALSA's hwdep subsystem.
Unlike the existing Scarlett2 driver which implements all ALSA
controls in kernel space, this new FCP driver takes a different
approach by providing a minimal kernel interface that allows a
user-space driver to send FCP commands and receive notifications. The
only control implemented in kernel space is the Level Meter, since it
requires frequent polling of volatile data.
While this driver supports all interfaces that the Scarlett2 driver
works with, it is initially enabled only for 4th Gen 16i16, 18i16,
and 18i20 interfaces that are not supported by the Scarlett2 driver.
Baojun Xu [Mon, 16 Dec 2024 12:20:08 +0000 (20:20 +0800)]
ALSA: hda/tas2781: Add tas2781 hda SPI driver
This patch was used to add TAS2781 devices on SPI support in sound/pci/hda.
It use ACPI node descript about parameters of TAS2781 on SPI, it like:
Scope (_SB.PC00.SPI0)
{
Device (GSPK)
{
Name (_HID, "TXNW2781") // _HID: Hardware ID
Method (_CRS, 0, NotSerialized)
{
Name (RBUF, ResourceTemplate ()
{
SpiSerialBusV2 (...)
SpiSerialBusV2 (...)
}
}
}
}
And in platform/x86/serial-multi-instantiate.c, those spi devices will be
added into system as a single SPI device, so TAS2781 SPI driver will
probe twice for every single SPI device. And driver will also parser
mono DSP firmware binary and RCA binary for itself.
The code support Realtek as the primary codec.
In patch version-10, add multi devices firmware binary support,
to compatble with windows driver, they can share same firmware binary.
Michal Simek [Thu, 16 Jan 2025 14:55:46 +0000 (15:55 +0100)]
ASoC: xilinx: xlnx_spdif: Simpify using devm_clk_get_enabled()
Clock handling can be very simlified with using devm_clk_get_enabled() as
was done by commit 8d2aaf4382b7 ("gpio: zynq: Simplify using
devm_clk_get_enabled()").
Simon Trimmer [Thu, 2 Jan 2025 12:33:35 +0000 (20:33 +0800)]
ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 83JX, 83MC and 83NM
Update the DMI match for a Lenovo laptop to a new DMI identifier.
This laptop ships with a different DMI identifier to what was expected
and now has three match entries. It also has the DMICs connected to the
host rather than the cs42l43 codec.
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Fixes: 83c062ae81e8 ("ASoC: Intel: sof_sdw: Add quirks for some new Lenovo laptops") Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://patch.msgid.link/20250102123335.256698-3-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Martin Blumenstingl [Tue, 14 Jan 2025 21:56:17 +0000 (22:56 +0100)]
ASoC: dapm: add support for preparing streams
Codec driver can implement .hw_params and/or .prepare from struct
snd_soc_dai_ops. For codec-to-codec links only the former (.hw_params)
callback has been called.
On platforms like Amlogic Meson8/8b/8m2 the SoC's sound card
(sound/soc/meson/gx-card.c) uses a codec-to-codec link for the HDMI
codec output because further digital routing is required after the
backend. The new DRM HDMI (audio) codec framework (which internally
uses sound/soc/codecs/hdmi-codec.c) relies on the .prepare callback
of the hdmi-codec to be called. Implement calls to
snd_soc_dai_prepare() so the .prepare callback is called. In this
case the mandatory part is the call to prepare the sink (which is
the hdmi-codec on those platforms). Also call snd_soc_dai_prepare()
for the source to stay consistent with the rest of the code (even
though it's not strictly necessary to make the DRM HDMI codec
framework work on Amlogic Meson8/8b/8m2).
For platforms or sound cards without a codec-to-codec link with
additional parameters (which applies to most hardware) this changes
nothing as the .prepare callback is already called via
snd_pcm_do_prepare() (as well as dpcm_fe_dai_prepare() and
dpcm_be_dai_prepare()) on those.
Suggested-by: Jerome Brunet <jbrunet@baylibre.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20250114215617.336105-3-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Martin Blumenstingl [Tue, 14 Jan 2025 21:56:16 +0000 (22:56 +0100)]
ASoC: soc-dai: add snd_soc_dai_prepare() and use it internally
Add a new snd_soc_dai_prepare() which can be used (in an upcoming patch)
by soc-dapm.c. Use this new function internally in
snd_soc_pcm_dai_prepare() to avoid duplicating code.
Suggested-by: Jerome Brunet <jbrunet@baylibre.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://patch.msgid.link/20250114215617.336105-2-martin.blumenstingl@googlemail.com Signed-off-by: Mark Brown <broonie@kernel.org>
As of commit cb18cd26039f ("ASoC: soc-core: do rtd->id trick at
snd_soc_add_pcm_runtime()") the ID stored in the PCM runtime data can
no longer be safely used to index the priv->dai_props array. This is
because the ID may be modified during snd_soc_add_pcm_runtime(), thus
resulting in an ID that's no longer a valid array index.
To fix this, use the position of the dai_link stored inside the PCM
runtime data relative to the start of the dai_link array as index into
the priv->dai_props array.
Lianqin Hu [Wed, 15 Jan 2025 09:32:35 +0000 (09:32 +0000)]
ALSA: usb-audio: Add delay quirk for USB Audio Device
Audio control requests that sets sampling frequency sometimes fail on
this card. Adding delay between control messages eliminates that problem.
usb 1-1: New USB device found, idVendor=0d8c, idProduct=0014
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: USB Audio Device
usb 1-1: Manufacturer: C-Media Electronics Inc.
Cezary Rojewski [Tue, 14 Jan 2025 18:42:39 +0000 (19:42 +0100)]
ALSA: hda: Transfer firmware in two chunks
As per specification, SDxLVI shall be at least 1 i.e.: two chunks to
perform a valid transfer. This is true for the PCM transfer code but
not firmware-transfer one.
Technical background:
- the LVI > 0 rule shall be obeyed in PCM transfer
- HW permits LVI == 0 when transfer is SW-controlled (SPIB)
- FW download is not a PCM transfer and is SW-controlled (SPIB)
The above is the fundament which AudioDSP firmware loading functions
have been built upon and worked since 2016. The presented changes are to
align the loading flows and avoid rising more questions in the future.
Achieve the goal by splitting snd_hdac_stream_setup_periods() into
substream-dependent and -independent part. Let snd_hdac_dsp_prepare()
utilize the latter so that both DSP-loading and PCM flows utilize same
BLDE setup loop which already takes care of cutting the buffer based on
azx_dev->period_bytes.
ALSA: hda/realtek: Enable headset mic on Positivo C6400
Positivo C6400 is equipped with ALC269VB, and it needs
ALC269VB_FIXUP_ASUS_ZENBOOK quirk to make its headset mic work.
Also must to limits the microphone boost.
Takashi Iwai [Tue, 14 Jan 2025 10:47:01 +0000 (11:47 +0100)]
ALSA: rawmidi: Make tied_device=0 as default / unknown
In the original change, rawmidi_info.tied_device showed -1 for the
unknown or untied device. But this would require the user-space to
check the protocol version and judge the value conditionally, which
is rather error-prone.
Instead, set the tied_device = 0 to be default as unknown, and
indicate the real device with the offset 1, for achieving more
backward compatibility.
Bence Csókás [Tue, 14 Jan 2025 09:59:07 +0000 (10:59 +0100)]
ASoC: sun4i-codec: Use new devm clk and reset APIs
Clean up error handling by using the new devm_
clock and reset functions. This should make it
easier to add new code, as we can eliminate the
"goto ladder" in probe().
Shengjiu Wang [Tue, 14 Jan 2025 10:27:20 +0000 (18:27 +0800)]
ASoC: dt-bindings: fsl,micfil: Add compatible string for i.MX943 platform
Add compatible string "fsl,imx943-micfil" for i.MX943 platform.
The definition of register map and some register bit map is
different on the i.MX943 platform.
Shengjiu Wang [Tue, 14 Jan 2025 10:27:19 +0000 (18:27 +0800)]
ASoC: fsl_micfil: Add i.MX943 platform support
On i.MX943, the FIFO data address is changed to 0x20~0x3c,
compared to previous version, there is a minus 4 offset,
so add a new regmap configuration for it.
And the bit width of CICOSR is changed to 5 bits, from bit
16th to 20th in REG_MICFIL_CTRL2 register, so update its
definition header file.
Mark Brown [Mon, 13 Jan 2025 20:08:47 +0000 (20:08 +0000)]
ASoC: extra format on each DAI
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Current clock provider/consumer setting is set by dai_link->dai_fmt, and it
is Codec base on Sound Card driver (= SND_SOC_DAIFMT_CBx_CFx).
Current CPU/Codec drivers are already based on its own base
(= SND_SOC_DAIFMT_Bx_Fx). So, Codec clock setting uses dai_link->dai_fmt
as-is, and CPU side clock setting is created from Codec base setting by
flipping. Because of this, we can't set both CPU/Codec clock consumer for
example.
To solve this issue, this patch-set adds new ext_fmt on each DAI.
It can keep compatible with legacy style.
dai_fmt : dai_link->dai_fmt = common settings
ext_fmt : each DAI settings
Legacy
dai_fmt includes 1, 2, 3, 4
New style
dai_fmt includes 1, 2, 3
ext_fmt includes 4
Audio-Graph-Card2 will use this new style by this patch-set.
By this patch, Card2 default behavior (= no "clock-master / frame-master"
settings on DT) will be changed, but no drivers are using it.
In case of no DAI has "clock-master / frame-master" property on DT,
it will be...
Legacy
CPU : provider (because flipped from Codec)
Codec: consumer
New style
CPU : consumer
Codec: consumer
One note is that Simple-Card, Audio-Graph-Card don't implement
this new style to keep compatiblily.
In Overlay case, port order can be random, so we shouldn't use get_next()
function to get next port.
Mark Brown [Mon, 13 Jan 2025 18:33:14 +0000 (18:33 +0000)]
ASoC: fsl: Support MQS on i.MX943
Merge series from Shengjiu Wang <shengjiu.wang@nxp.com>:
There are two MQS instances on the i.MX943 platform.
The definition of bit positions in the control register are
different. In order to support these MQS modules, define
two compatible strings to distinguish them.
Kuninori Morimoto [Mon, 6 Jan 2025 05:49:49 +0000 (05:49 +0000)]
ASoC: audio-graph-card2: Use extra format on each DAI
Current ASoC is using dai_link->dai_fmt to set DAI format for both
CPU/Codec. But because it is using same settings, and
SND_SOC_DAIFMT_CLOCK_PROVIDER is flipped for CPU, we can't set both
CPU/Codec as clock consumer, for example.
To solve this issue, this patch uses extra format for each DAI which can
keep compatibility with legacy system,
Kuninori Morimoto [Mon, 6 Jan 2025 05:49:45 +0000 (05:49 +0000)]
ASoC: soc-core: Enable to use extra format on each DAI
Current ASoC is using dai_link->dai_fmt to set DAI format for both
CPU/Codec. But because it is using same settings, and
SND_SOC_DAIFMT_CLOCK_PROVIDER is flipped for CPU, we can't set both
CPU/Codec as clock consumer, for example.
To solve this issue, this patch enable to use extra format for each
DAI which can keep compatibility with legacy system,
Kuninori Morimoto [Mon, 6 Jan 2025 05:49:41 +0000 (05:49 +0000)]
ASoC: audio-graph-card2: use of_graph_get_port_by_id() at graph_get_next_multi_ep()
Audio Graph Card2 is assuming "port" are necessarily in order, but there
is no guarantee in case of overlay. Use of_graph_get_port_by_id() instead
to handle it correctly.
Maxim Kochetkov [Thu, 19 Dec 2024 04:22:27 +0000 (07:22 +0300)]
ASoC: codecs: nau8824: fix max volume for Speaker output
There is no audio output if Speaker volume is set above 25.
According to datasheet Rev 2.5 maximum allowed value for the
Speaker output is 0b11001 (25)
0x6D CLASSD_GAIN_1/ 0x6E CLASSD_GAIN_2:
Left/Right Channel Class-D Driver Gain For DAC Left/Right
Input
(Step size is 1dB.)
00000 = Mute (DEFAULT)
00001 = 0dB
00002 = 1dB
...
11000 = 23dB
11001 = 24dB
So adjust this value in accordance with the datasheet.
Shengjiu Wang [Mon, 13 Jan 2025 09:03:21 +0000 (17:03 +0800)]
ASoC: dt-bindings: fsl,mqs: Add compatible string for i.MX943 platform
There are two MQS instances on the i.MX943 platform.
The definition of bit positions in the control register are
different. In order to support these MQS modules, define
two compatible strings to distinguish them.
As one instance is in the always-on domain, another is in the
wakeup domain, so the compatible strings are
"fsl,imx943-aonmix-mqs", "fsl,imx943-wakeupmix-mqs".
Shengjiu Wang [Mon, 13 Jan 2025 09:03:20 +0000 (17:03 +0800)]
ASoC: fsl_mqs: Add i.MX943 platform support
There are two MQS instances on the i.MX943 platform.
The definition of bit positions in the control register are
different. In order to support these MQS modules, define
two compatible strings to distinguish them.
On i.MX943 one instance is in Always-on mix, another is in
Wakeup-mix.
This patch fixes the volume adjustment issue on the Lenovo ThinkBook 16P Gen5
by applying the necessary quirk configuration for the Realtek ALC287 codec.
The issue was caused by incorrect configuration in the driver,
which prevented proper volume control on certain systems.
Takashi Iwai [Fri, 10 Jan 2025 15:59:41 +0000 (16:59 +0100)]
ALSA: seq: Notify UMP EP and FB changes
So far we notify the sequencer client and port changes upon UMP FB
changes, but those aren't really corresponding to the UMP updates.
e.g. when a FB info gets updated, it's not notified but done only when
some of sequencer port attribute is changed. This is no ideal
behavior.
This patch adds the two new sequencer event types for notifying the
UMP EP and FB changes via the announce port. The new event takes
snd_seq_ev_ump_notify type data, which is compatible with
snd_seq_addr (where the port number is replaced with the block
number).
The events are sent when the EP and FB info gets updated explicitly
via ioctl, or the backend UMP receives the corresponding UMP
messages.
The sequencer protocol version is bumped to 1.0.5 along with it.
Takashi Iwai [Fri, 10 Jan 2025 15:59:40 +0000 (16:59 +0100)]
ALSA: seq: Allow system notification in atomic
Currently the system notification helper assumes only the non-atomic
delivery. For allowing an event delivery in non-atomic context, add
the atomic flag to the helper function.
This is a preliminary change for the support of UMP EP/FB
notification.
Takashi Iwai [Fri, 10 Jan 2025 15:59:39 +0000 (16:59 +0100)]
ALSA: ump: Update rawmidi name per EP name update
The rawmidi name string should be updated dynamically when the device
receives the UMP EP name update, too. Both the core and legacy
rawmidi names are updated.
Takashi Iwai [Fri, 10 Jan 2025 15:59:38 +0000 (16:59 +0100)]
ALSA: ump: Copy safe string name to rawmidi
The UMP helper didn't set up the rawmidi name string by itself but
left it to the driver. But since the only user (USB MIDI2 driver)
picks up the UMP info name string to the rawmidi name as default, it's
better to set up in the UMP core side.
Meanwhile, UMP receives the EP name string from the device, and it
might contain garbage letters. We should purify the string to be
usable for the kernel as done previously for UMP Group names.
This implements the copy of the UMP info name string into the rawmidi
name at the creation of UMP EP object in a safe way to strip the
non-ASCII or non-printable characters. Also, change the reference
from the legacy rawmidi and other places to rawmidi name field instead
of ump info; this assures the sane strings.
Takashi Iwai [Fri, 10 Jan 2025 15:59:37 +0000 (16:59 +0100)]
ALSA: ump: Copy FB name string more safely
The UMP group names are referred as the corresponding sequencer port
names, hence they should be proper ASCII strings. OTOH, the UMP group
names are composed from the UMP FB strings that are received from the
device; i.e. a device may give some bogus letters and we can't trust
them fully.
To assure that the group names consist of the proper ASCII strings,
replace the normal string copy and append operations with special ones
that strip the non-printable letters.
Takashi Iwai [Fri, 10 Jan 2025 15:59:35 +0000 (16:59 +0100)]
ALSA: rawmidi: Show substream activity in info ioctl
The UMP legacy rawmidi may turn on/off the substream dynamically
depending on the UMP Function Block information. So far, there was no
direct way to know whether the substream is disabled (inactive) or
not; at most one can take a look at the substream name string or try
to open and get -ENODEV.
This patch extends the rawmidi info ioctl to show the current inactive
state of the given substream. When the selected substream is
inactive, info flags field contains the new bit flag
SNDRV_RAWMIDI_INFO_STREAM_INACTIVE.
Cezary Rojewski [Fri, 10 Jan 2025 11:33:25 +0000 (12:33 +0100)]
ALSA: hda: Fix compilation of snd_hdac_adsp_xxx() helpers
The snd_hdac_adsp_xxx() wrap snd_hdac_reg_xxx() helpers to simplify
register access for AudioDSP drivers e.g.: the avs-driver. Byte- and
word-variants of said helps do not expand to bare readx/writex()
operations but functions instead and, due to pointer type
incompatibility, cause compilation to fail.
As the macros are utilized by the avs-driver alone, relocate the code
introduced with commit c19bd02e9029 ("ALSA: hda: Add helper macros for
DSP capable devices") into the avs/ directory and update it to operate
on 'adev' i.e.: the avs-driver-context directly to fix the issue.
Fixes: c19bd02e9029 ("ALSA: hda: Add helper macros for DSP capable devices") Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://patch.msgid.link/20250110113326.3809897-2-cezary.rojewski@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Rob Herring (Arm) [Thu, 9 Jan 2025 18:22:02 +0000 (12:22 -0600)]
ASoC: simple-card: Drop unnecessary "dai-tdm-slot-width-map" property presence check
It doesn't matter whether "dai-tdm-slot-width-map" is not present or
there is some other issue parsing it in of_property_count_elems_of_size()
causing an error. Drop the presence check and rely on
of_property_count_elems_of_size() error return if not present.
Takashi Iwai [Fri, 10 Jan 2025 14:30:28 +0000 (15:30 +0100)]
Merge tag 'asoc-fix-v6.13-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.13
A collection of device specific fixes that came in over the holidays,
plus a MAINTAINERS update and some documentation to help users debug
problems with some of the Cirrus CODECs found in modern laptops.
Yu-Chun Lin [Thu, 9 Jan 2025 17:15:47 +0000 (01:15 +0800)]
ASoC: amd: Add ACPI dependency to fix build error
As reported by the kernel test robot, the following error occurs:
sound/soc/amd/yc/acp6x-mach.c: In function 'acp6x_probe':
>> sound/soc/amd/yc/acp6x-mach.c:573:15: error: implicit declaration of function 'acpi_evaluate_integer'; did you mean 'acpi_evaluate_object'? [-Werror=implicit-function-declaration]
573 | ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
| ^~~~~~~~~~~~~~~~~~~~~
| acpi_evaluate_object
cc1: some warnings being treated as errors
The function 'acpi_evaluate_integer' and its prototype in 'acpi_bus.h'
are only available when 'CONFIG_ACPI' is enabled. Add a 'depends on ACPI'
directive in Kconfig to ensure proper compilation.
Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202501090345.pBIDRTym-lkp@intel.com/ Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com> Link: https://patch.msgid.link/20250109171547.362412-1-eleanor15x@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Mark Brown [Thu, 9 Jan 2025 15:55:24 +0000 (15:55 +0000)]
ASoC: Intel: avs: Fixes and cleanups
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:
A set of loosely connected changes, fixing few outstanding issues as
well as improving readability of the existing code.
The fixes lead the series, first five patches. The goal is to make sure
proper read() is used when accessing the registers, probe() and remove()
sequences for HDAudio streaming are synced, minimal AudioDSP firmware
version points to correct values and recent additions to the topology
are parsed properly.
The only patch that points to 'new functionality' is:
ASoC: Intel: avs: Update ASRC definition
as with the struct definition updates, one can utilize the ASRC module
in both streaming directions now (previously limited to Capture).
Everything else either improves the logging or provides comments vital
for long-term maintenance of the code.