]> Git Repo - linux.git/log
linux.git
7 months agoALSA: seq: ump: Optimize conversions from SysEx to UMP
Takashi Iwai [Fri, 26 Jul 2024 14:34:54 +0000 (16:34 +0200)]
ALSA: seq: ump: Optimize conversions from SysEx to UMP

The current conversion from the legacy SysEx event to UMP SysEx packet
in the sequencer core has a couple of issues:

* The first packet trims the SysEx start byte (0xf0), hence it
  contains only 5 bytes instead of 6.  This isn't wrong, per
  specification, but it's strange not to fill 6 bytes.

* When the SysEx end marker (0xf7) is placed at the first byte of the
  next packet, it'll end up with an empty data just with the END
  status.  It can be rather folded into the previous packet with the
  END status.

This patch tries to address those issues.  The first packet may have 6
bytes even with the SysEx start, and an empty packet with the SysEx
end marker is omitted.

Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: hda/conexant: Mute speakers at suspend / shutdown
Takashi Iwai [Fri, 26 Jul 2024 14:26:20 +0000 (16:26 +0200)]
ALSA: hda/conexant: Mute speakers at suspend / shutdown

Use the new helper to mute speakers at suspend / shutdown for avoiding
click noises.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1228269
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown
Takashi Iwai [Fri, 26 Jul 2024 14:26:19 +0000 (16:26 +0200)]
ALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown

Some devices indicate click noises at suspend or shutdown when the
speakers are unmuted.  This patch adds a helper,
snd_hda_gen_shutup_speakers(), to work around it.  The new function is
supposed to be called at suspend or shutdown by the codec driver, and
it mutes the speakers.

The mute status isn't cached, hence the original mute state will be
restored at resume again.

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: hda: conexant: Fix headset auto detect fail in the polling mode
songxiebing [Fri, 26 Jul 2024 10:07:26 +0000 (18:07 +0800)]
ALSA: hda: conexant: Fix headset auto detect fail in the polling mode

The previous fix (7aeb25908648) only handles the unsol_event reporting
during interrupts and does not include the polling mode used to set
jackroll_ms, so now we are replacing it with
snd_hda_jack_detect_enable_callback.

Fixes: 7aeb25908648 ("ALSA: hda/conexant: Fix headset auto detect fail in cx8070 and SN6140")
Co-developed-by: bo liu <[email protected]>
Signed-off-by: bo liu <[email protected]>
Signed-off-by: songxiebing <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoMerge tag 'asoc-fix-v6.11-merge-window' of https://git.kernel.org/pub/scm/linux/kerne...
Takashi Iwai [Thu, 25 Jul 2024 16:04:55 +0000 (18:04 +0200)]
Merge tag 'asoc-fix-v6.11-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.11

A selection of routine fixes and quirks that came in since the merge
window.  The fsl-asoc-card change is a fix for systems with multiple
cards where updating templates in place leaks data from one card to
another.

7 months agoASoC: fsl-asoc-card: Dynamically allocate memory for snd_soc_dai_link_components
Shengjiu Wang [Thu, 25 Jul 2024 03:22:53 +0000 (11:22 +0800)]
ASoC: fsl-asoc-card: Dynamically allocate memory for snd_soc_dai_link_components

The static snd_soc_dai_link_components cause conflict for multiple
instances of this generic driver. For example, when there is
wm8962 and SPDIF case enabled together, the contaminated
snd_soc_dai_link_components will cause another device probe fail.

Fixes: 6d174cc4f224 ("ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c")
Signed-off-by: Shengjiu Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoASoC: amd: yc: Support mic on Lenovo Thinkpad E16 Gen 2
Takashi Iwai [Thu, 25 Jul 2024 06:54:28 +0000 (08:54 +0200)]
ASoC: amd: yc: Support mic on Lenovo Thinkpad E16 Gen 2

Lenovo Thinkpad E16 Gen 2 AMD model (model 21M5) needs a corresponding
quirk entry for making the internal mic working.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1228269
Cc: [email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoALSA: hda/realtek: Implement sound init sequence for Samsung Galaxy Book3 Pro 360
Nick Weihs [Thu, 25 Jul 2024 05:47:22 +0000 (22:47 -0700)]
ALSA: hda/realtek: Implement sound init sequence for Samsung Galaxy Book3 Pro 360

Samsung Galaxy Book3 Pro 360 sends a large amount of data to the codec
through hda processing coefficients.  This data was captured using a
modified version of QEMU, but the actual content of the data remains
opaque to me.  Elliding any part of the data seems to cause sound to
not work.

Signed-off-by: Nick Weihs <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: hda/realtek: cs35l41: Fixup remaining asus strix models
Luke D. Jones [Tue, 23 Jul 2024 01:12:24 +0000 (13:12 +1200)]
ALSA: hda/realtek: cs35l41: Fixup remaining asus strix models

Adjust quirks for 0x3a20, 0x3a30, 0x3a50 to match the 0x3a60. This
set has now been confirmed to work with this patch.

Signed-off-by: Luke D. Jones <[email protected]>
Fixes: 811dd426a9b1 ("ALSA: hda/realtek: Add quirks for Asus ROG 2024 laptops using CS35L41")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoASoC: SOF: ipc4-topology: Preserve the DMA Link ID for ChainDMA on unprepare
Peter Ujfalusi [Wed, 24 Jul 2024 08:19:32 +0000 (11:19 +0300)]
ASoC: SOF: ipc4-topology: Preserve the DMA Link ID for ChainDMA on unprepare

The DMA Link ID is set to the IPC message's primary during dai_config,
which is only during hw_params.
During xrun handling the hw_params is not called and the DMA Link ID
information will be lost.

All other fields in the message expected to be 0 for re-configuration, only
the DMA Link ID needs to be preserved and the in case of repeated
dai_config, it is correctly updated (masked and then set).

Cc: [email protected]
Fixes: ca5ce0caa67f ("ASoC: SOF: ipc4/intel: Add support for chained DMA")
Link: https://github.com/thesofproject/linux/issues/5116
Signed-off-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoASoC: SOF: ipc4-topology: Only handle dai_config with HW_PARAMS for ChainDMA
Peter Ujfalusi [Wed, 24 Jul 2024 08:19:31 +0000 (11:19 +0300)]
ASoC: SOF: ipc4-topology: Only handle dai_config with HW_PARAMS for ChainDMA

The DMA Link ID is only valid in snd_sof_dai_config_data when the
dai_config is called with HW_PARAMS.

The commit that this patch fixes is actually moved a code section without
changing it, the same bug exists in the original code, needing different
patch to kernel prior to 6.9 kernels.

Cc: [email protected]
Fixes: 3858464de57b ("ASoC: SOF: ipc4-topology: change chain_dma handling in dai_config")
Link: https://github.com/thesofproject/linux/issues/5116
Signed-off-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoALSA: ump: Force 1 Group for MIDI1 FBs
Takashi Iwai [Mon, 22 Jul 2024 14:06:06 +0000 (16:06 +0200)]
ALSA: ump: Force 1 Group for MIDI1 FBs

When a Function Block declares it being a legacy MIDI1 device, it has
to be only with a single UMP Group.  Correct the attribute when a
device declares it wrongly.

Fixes: 37e0e14128e0 ("ALSA: ump: Support UMP Endpoint and Function Block parsing")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: ump: Don't update FB name for static blocks
Takashi Iwai [Mon, 22 Jul 2024 13:59:28 +0000 (15:59 +0200)]
ALSA: ump: Don't update FB name for static blocks

When a device tries to update the FB name string even if its Endpoint
is declared as static, we should skip it, just already done for the FB
info update reply.

Fixes: 37e0e14128e0 ("ALSA: ump: Support UMP Endpoint and Function Block parsing")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: usb-audio: Add a quirk for Sonix HD USB Camera
wangdicheng [Mon, 22 Jul 2024 08:48:22 +0000 (16:48 +0800)]
ALSA: usb-audio: Add a quirk for Sonix HD USB Camera

Sonix HD USB Camera does not support reading the sample rate which leads
to many lines of "cannot get freq at ep 0x84".
This patch adds the USB ID to quirks.c and avoids those error messages.

(snip)
[1.789698] usb 3-3: new high-speed USB device number 2 using xhci_hcd
[1.984121] usb 3-3: New USB device found, idVendor=0c45, idProduct=6340, bcdDevice= 0.00
[1.984124] usb 3-3: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[1.984127] usb 3-3: Product: USB 2.0 Camera
[1.984128] usb 3-3: Manufacturer: Sonix Technology Co., Ltd.
[5.440957] usb 3-3: 3:1: cannot get freq at ep 0x84
[12.130679] usb 3-3: 3:1: cannot get freq at ep 0x84
[12.175065] usb 3-3: 3:1: cannot get freq at ep 0x84

Signed-off-by: wangdicheng <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoASoC: TAS2781: Fix tasdev_load_calibrated_data()
Dan Carpenter [Fri, 19 Jul 2024 23:53:48 +0000 (18:53 -0500)]
ASoC: TAS2781: Fix tasdev_load_calibrated_data()

This function has a reversed if statement so it's either a no-op or it
leads to a NULL dereference.

Fixes: b195acf5266d ("ASoC: tas2781: Fix wrong loading calibrated data sequence")
Signed-off-by: Dan Carpenter <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoASoC: tegra: select CONFIG_SND_SIMPLE_CARD_UTILS
Arnd Bergmann [Fri, 19 Jul 2024 07:48:03 +0000 (09:48 +0200)]
ASoC: tegra: select CONFIG_SND_SIMPLE_CARD_UTILS

This I2S client driver now uses functions exported from a helper module
but fails to link when the helper is disabled:

ERROR: modpost: "simple_util_parse_convert" [sound/soc/tegra/snd-soc-tegra210-i2s.ko] undefined!
ERROR: modpost: "simple_util_get_sample_fmt" [sound/soc/tegra/snd-soc-tegra210-i2s.ko] undefined!

Add a Kconfig select line to ensure it's always turned on here.

Fixes: 2502f8dd8c30 ("ASoC: tegra: I2S client convert formats handling")
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Sameer Pujar <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoASoC: Intel: use soc_intel_is_byt_cr() only when IOSF_MBI is reachable
Pierre-Louis Bossart [Mon, 22 Jul 2024 08:30:02 +0000 (10:30 +0200)]
ASoC: Intel: use soc_intel_is_byt_cr() only when IOSF_MBI is reachable

the Intel kbuild bot reports a link failure when IOSF_MBI is built-in
but the Merrifield driver is configured as a module. The
soc-intel-quirks.h is included for Merrifield platforms, but IOSF_MBI
is not selected for that platform.

ld.lld: error: undefined symbol: iosf_mbi_read
>>> referenced by atom.c
>>>               sound/soc/sof/intel/atom.o:(atom_machine_select) in archive vmlinux.a

This patch forces the use of the fallback static inline when IOSF_MBI is not reachable.

Fixes: 536cfd2f375d ("ASoC: Intel: use common helpers to detect CPUs")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Suggested-by: Takashi Iwai <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
7 months agoALSA: usb-audio: Move HD Webcam quirk to the right place
Takashi Iwai [Mon, 22 Jul 2024 08:06:04 +0000 (10:06 +0200)]
ALSA: usb-audio: Move HD Webcam quirk to the right place

The quirk_flags_table[] is sorted in the USB ID order, while the last
fix was put at a wrong position.  Adjust the entry at the right
position.

Fixes: 74dba2408818 ("ALSA: usb-audio: Fix microphone sound on HD webcam.")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: hda: tas2781: mark const variables as __maybe_unused
Arnd Bergmann [Fri, 19 Jul 2024 09:56:34 +0000 (11:56 +0200)]
ALSA: hda: tas2781: mark const variables as __maybe_unused

An earlier patch changed the DECLARE_TLV_DB_SCALE declaration, but
now there are additional static const variables that cause
the same build warnings:

In file included from sound/pci/hda/tas2781_hda_i2c.c:23:
include/sound/tas2781-tlv.h:23:28: error: 'tas2563_dvc_table' defined but not used [-Werror=unused-const-variable=]
   23 | static const unsigned char tas2563_dvc_table[][4] = {
      |                            ^~~~~~~~~~~~~~~~~
In file included from include/sound/tlv.h:10,
                 from sound/pci/hda/tas2781_hda_i2c.c:22:
include/sound/tas2781-tlv.h:20:35: error: 'tas2563_dvc_tlv' defined but not used [-Werror=unused-const-variable=]
   20 | static const DECLARE_TLV_DB_SCALE(tas2563_dvc_tlv, -12150, 50, 1);
      |                                   ^~~~~~~~~~~~~~~

Mark them all as unused as well.

Signed-off-by: Arnd Bergmann <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
7 months agoALSA: usb-audio: Fix microphone sound on HD webcam.
wangdicheng [Fri, 19 Jul 2024 02:09:06 +0000 (10:09 +0800)]
ALSA: usb-audio: Fix microphone sound on HD webcam.

I own an external usb Webcam, HD webcam, which had low mic volume and
inconsistent sound quality. Video works as expected.

(snip)
[   95.473820][ 1] [   T73] usb 5-2.2: new high-speed USB device number 7 using xhci_hcd
[   95.773974][ 1] [   T73] usb 5-2.2: New USB device found, idVendor=1bcf, idProduct=2281, bcdDevice= 0.05
[   95.783445][ 1] [   T73] usb 5-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   95.791872][ 1] [   T73] usb 5-2.2: Product: HD webcam
[   95.797001][ 1] [   T73] usb 5-2.2: Manufacturer: Sunplus IT Co
[   95.802996][ 1] [   T73] usb 5-2.2: SerialNumber: 20200513
[   96.092610][ 2] [ T3680] usb 5-2.2: Warning! Unlikely big volume range (=4096), cval->res is probably wrong.
[   96.102436][ 2] [ T3680] usb 5-2.2: [5] FU [Mic Capture Volume] ch = 1, val = 0/4096/1

Set up quirk cval->res to 16 for 256 levels,
Set GET_SAMPLE_RATE quirk flag to stop trying to get the sample rate.
Confirmed that happened anyway later due to the backoff mechanism,
After 3 failures.

All audio stream on device interfaces share the same values,
apart from wMaxPacketSize and tSamFreq :

      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass         1 Audio

Interface Descriptor:
  bLength                 9
  bDescriptorType         4
  bInterfaceNumber        3
  bAlternateSetting       4
  bNumEndpoints           1
  bInterfaceClass         1 Audio
  bInterfaceSubClass      2 Streaming
  bInterfaceProtocol      0
  iInterface              0
  AudioStreaming Interface Descriptor:
    bLength                 7
    bDescriptorType        36
    bDescriptorSubtype      1 (AS_GENERAL)
    bTerminalLink           3
    bDelay                  1 frames
    wFormatTag         0x0001 PCM
  AudioStreaming Interface Descriptor:
    bLength                11
    bDescriptorType        36
    bDescriptorSubtype      2 (FORMAT_TYPE)
    bFormatType             1 (FORMAT_TYPE_I)
    bNrChannels             1
    bSubframeSize           2
    bBitResolution         16
    bSamFreqType            1 Discrete
    tSamFreq[ 0]        48000
  Endpoint Descriptor:
    bLength                 9
    bDescriptorType         5
    bEndpointAddress     0x86  EP 6 IN
    bmAttributes            5
      Transfer Type            Isochronous
      Synch Type               Asynchronous
      Usage Type               Data
    wMaxPacketSize     0x0064  1x 100 bytes
    bInterval               4
    bRefresh                0
    bSynchAddress           0
    AudioStreaming Endpoint Descriptor:
      bLength                 7
      bDescriptorType        37
      bDescriptorSubtype      1 (EP_GENERAL)
      bmAttributes         0x01
        Sampling Frequency
      bLockDelayUnits         0 Undefined
      wLockDelay         0x0000
(snip)

Testing patch provides consistent good sound recording quality and volume range.

(snip)
[   95.473820][ 1] [   T73] usb 5-2.2: new high-speed USB device number 7 using xhci_hcd
[   95.773974][ 1] [   T73] usb 5-2.2: New USB device found, idVendor=1bcf, idProduct=2281, bcdDevice= 0.05
[   95.783445][ 1] [   T73] usb 5-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   95.791872][ 1] [   T73] usb 5-2.2: Product: HD webcam
[   95.797001][ 1] [   T73] usb 5-2.2: Manufacturer: Sunplus IT Co
[   95.802996][ 1] [   T73] usb 5-2.2: SerialNumber: 20200513
[   96.110630][ 3] [ T3680] usbcore: registered new interface driver snd-usb-audio
[   96.114329][ 7] [ T3677] usb 5-2.2: Found UVC 1.00 device HD webcam (1bcf:2281)
[   96.167555][ 7] [ T3677] usbcore: registered new interface driver uvcvideo

Signed-off-by: wangdicheng <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agokselftest/alsa: Log the PCM ID in pcm-test
Mark Brown [Tue, 16 Jul 2024 14:48:00 +0000 (15:48 +0100)]
kselftest/alsa: Log the PCM ID in pcm-test

Drivers report a string with a name for each PCM, log it during startup of
pcm-test as a diagnostic aid.

Signed-off-by: Mark Brown <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agokselftest/alsa: Use card name rather than number in test names
Mark Brown [Tue, 16 Jul 2024 14:47:59 +0000 (15:47 +0100)]
kselftest/alsa: Use card name rather than number in test names

Currently for the PCM and mixer tests we report test names which identify
the card being tested with the card number. This ensures we have unique
names but since card numbers are dynamically assigned at runtime the names
we end up with will often not be stable on systems with multiple cards
especially where those cards are provided by separate modules loeaded at
runtime. This makes it difficult for automated systems and UIs to relate
test results between runs on affected platforms.

Address this by replacing our use of card numbers with card names which are
more likely to be stable across runs. We use the card ID since it is
guaranteed to be unique by default, unlike the long name. There is still
some vulnerability to ordering issues if multiple cards with the same base
ID are present in the system but have separate dependencies but not all
drivers put distinguishing information in their long names.

Signed-off-by: Mark Brown <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book Pro 360
Seunghun Han [Thu, 18 Jul 2024 08:09:08 +0000 (17:09 +0900)]
ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book Pro 360

Samsung Galaxy Book Pro 360 (13" 2022 NT935QDB-KC71S) with codec SSID
144d:c1a4 requires the same workaround to enable the speaker amp
as other Samsung models with the ALC298 codec.

Signed-off-by: Seunghun Han <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoASoC: sof: amd: fix for firmware reload failure in Vangogh platform
Venkata Prasad Potturu [Thu, 18 Jul 2024 06:20:02 +0000 (11:50 +0530)]
ASoC: sof: amd: fix for firmware reload failure in Vangogh platform

Setting ACP ACLK as clock source when ACP enters D0 state causing
firmware load failure, as per design clock source should be internal
clock.

Remove acp_clkmux_sel field so that ACP will use internal clock
source when ACP enters into D0 state.

Fixes: d0dab6b76a9f ("ASoC: SOF: amd: Add sof support for vangogh platform")
Signed-off-by: Venkata Prasad Potturu <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoALSA: hda/tas2781: Add new quirk for Lenovo Hera2 Laptop
Shenghao Ding [Wed, 17 Jul 2024 11:53:04 +0000 (19:53 +0800)]
ALSA: hda/tas2781: Add new quirk for Lenovo Hera2 Laptop

Add new vendor_id and subsystem_id in quirk for Lenovo Hera2 Laptop.

Signed-off-by: Shenghao Ding <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: seq: ump: Skip useless ports for static blocks
Takashi Iwai [Wed, 17 Jul 2024 08:33:01 +0000 (10:33 +0200)]
ALSA: seq: ump: Skip useless ports for static blocks

When the UMP Endpoint is configured with static blocks, the block
configuration will never change, hence the unused ports will be
unchanged as well.  Creating sequencer ports for those unused ports
is simply useless, and it might be rather confusing for users.
The idea behind the inactive ports was for allowing connections
from/to ports that can become usable later, but this will never
happen for inactive groups in static blocks.

Let's change the sequencer UMP binding to skip those unused ports when
the UMP EP is with static blocks.

Fixes: 81fd444aa371 ("ALSA: seq: Bind UMP device")
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: pcm_dmaengine: Don't synchronize DMA channel when DMA is paused
Shengjiu Wang [Wed, 17 Jul 2024 06:44:53 +0000 (14:44 +0800)]
ALSA: pcm_dmaengine: Don't synchronize DMA channel when DMA is paused

When suspended, the DMA channel may enter PAUSE state if dmaengine_pause()
is supported by DMA.
At this state, dmaengine_synchronize() should not be called, otherwise
the DMA channel can't be resumed successfully.

Fixes: e8343410ddf0 ("ALSA: dmaengine: Synchronize dma channel after drop()")
Signed-off-by: Shengjiu Wang <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoASoC: Intel: Fix RT5650 SSP lookup
Curtis Malainey [Tue, 16 Jul 2024 08:40:12 +0000 (10:40 +0200)]
ASoC: Intel: Fix RT5650 SSP lookup

Commit 8efcd4864652 ("ASoC: Intel: sof_rt5682: use common module for
sof_card_private initialization") migrated the pin assignment in the
context struct up to soc-acpi-intel-ssp-common.c. This uses a lookup
table to see if a device has a amp/codec before assigning the pin. The
issue here arises when combination parts that serve both (with 2 ports)
are used.

sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:1f.3/adl_rt5682_def/SSP0-Codec'
CPU: 1 PID: 2079 Comm: udevd Tainted: G     U             6.6.36-03391-g744739e00023 #1 3be1a2880a0970f65545a957db7d08ef4b3e2c0d
Hardware name: Google Anraggar/Anraggar, BIOS Google_Anraggar.15217.552.0 05/07/2024
Call Trace:
 <TASK>
 dump_stack_lvl+0x69/0xa0
 sysfs_warn_dup+0x5b/0x70
 sysfs_create_dir_ns+0xb0/0x100
 kobject_add_internal+0x133/0x3c0
 kobject_add+0x66/0xb0
 ? device_add+0x65/0x780
 device_add+0x164/0x780
 snd_soc_add_pcm_runtimes+0x2fa/0x800
 snd_soc_bind_card+0x35e/0xc20
 devm_snd_soc_register_card+0x48/0x90
 platform_probe+0x7b/0xb0
 really_probe+0xf7/0x2a0
 ...
kobject: kobject_add_internal failed for SSP0-Codec with -EEXIST, don't try to register things with the same name in the same directory.

The issue is that the ALC5650 was only defined in the codec table and
not the amp table which left the pin unassigned but the dai link was
still created by the machine driver.

Also patch the suffix filename code for the topology to prevent double
suffix names as a result of this change.

Fixes: 8efcd4864652 ("ASoC: Intel: sof_rt5682: use common module for sof_card_private initialization")
Reviewed-by: Bard Liao <[email protected]>
Signed-off-by: Curtis Malainey <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASOC: SOF: Intel: hda-loader: only wait for HDaudio IOC for IPC4 devices
Pierre-Louis Bossart [Tue, 16 Jul 2024 08:45:30 +0000 (10:45 +0200)]
ASOC: SOF: Intel: hda-loader: only wait for HDaudio IOC for IPC4 devices

Multiple users report a regression bisected to commit d5263dbbd8af
("ASoC: SOF: Intel: don't ignore IOC interrupts for non-audio
transfers"). The firmware version is the likely suspect, as these
users relied on SOF 2.0 while Intel only tested with the 2.2 release.

Rather than completely disable the wait_for_completion(), which can
help us gather timing information on the different stages of the boot
process, the simplest course of action is to just disable it for older
IPC versions which are no longer under active development.

Closes: https://github.com/thesofproject/linux/issues/5072
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218961
Fixes: d5263dbbd8af ("ASoC: SOF: Intel: don't ignore IOC interrupts for non-audio transfers")
Tested-by: Mike Krinkin <[email protected]>
Tested-by: Todd Brandt <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: SOF: imx8m: Fix DSP control regmap retrieval
Daniel Baluta [Mon, 15 Jul 2024 15:16:53 +0000 (18:16 +0300)]
ASoC: SOF: imx8m: Fix DSP control regmap retrieval

According to Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
fsl,dsp-ctrl is a phandle to syscon block so we need to use correct
function to retrieve it.

Currently there is no SOF DSP DTS merged into mainline so there is no
need to support the old way of retrieving the dsp control node.

Fixes: 9ba23717b292 ("ASoC: SOF: imx8m: Implement DSP start")
Signed-off-by: Daniel Baluta <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoMerge tag 'asoc-v6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Mon, 15 Jul 2024 14:31:00 +0000 (16:31 +0200)]
Merge tag 'asoc-v6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for for v6.11

There are a lot of changes in here, though the big bulk of things is
cleanups and simplifications of various kinds which are internally
rather than externally visible.  A good chunk of those are DT schema
conversions, but there's also a lot of changes in the code.

Highlights:

 - Syncing of features between simple-audio-card and the two
   audio-graph cards so there is no reason to stick with an older
   driver.
 - Support for specifying the order of operations for components within
   cards to allow quirking for unusual systems.
 - New support for Asahi Kasei AK4619, Cirrus Logic CS530x, Everest
   Semiconductors ES8311, NXP i.MX95 and LPC32xx, Qualcomm LPASS v2.5
   and WCD937x, Realtek RT1318 and RT1320 and Texas Instruments PCM5242.

8 months agoALSA: usb: Use BIT() for bit values
Takashi Iwai [Mon, 15 Jul 2024 12:36:45 +0000 (14:36 +0200)]
ALSA: usb: Use BIT() for bit values

Instead of the explicit "1 << x", use BIT() macro for one bit values.
This will improve the readability and also avoids the possible bad
value for 31bit shift.

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: usb: Fix UBSAN warning in parse_audio_unit()
Takashi Iwai [Mon, 15 Jul 2024 12:35:54 +0000 (14:35 +0200)]
ALSA: usb: Fix UBSAN warning in parse_audio_unit()

A malformed USB descriptor may pass the lengthy mixer description with
a lot of channels, and this may overflow the 32bit integer shift
size, as caught by syzbot UBSAN test.  Although this won't cause any
real trouble, it's better to address.

This patch introduces a sanity check of the number of channels to bail
out the parsing when too many channels are found.

Reported-by: [email protected]
Closes: https://lore.kernel.org/[email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 15 Jul 2024 06:17:55 +0000 (08:17 +0200)]
Merge branch 'for-next' into for-linus

Pull 6.11 devel branch

Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: hda/realtek: Enable headset mic on Positivo SU C1400
Edson Juliano Drosdeck [Fri, 12 Jul 2024 18:06:42 +0000 (15:06 -0300)]
ALSA: hda/realtek: Enable headset mic on Positivo SU C1400

Positivo SU C1400 is equipped with ALC256, and it needs
ALC269_FIXUP_ASPIRE_HEADSET_MIC quirk to make its headset mic work.

Signed-off-by: Edson Juliano Drosdeck <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoFix the unbalanced pm_runtime_enable in wcd937x-sdw
Mark Brown [Fri, 12 Jul 2024 16:38:18 +0000 (17:38 +0100)]
Fix the unbalanced pm_runtime_enable in wcd937x-sdw

Merge series from Mohammad Rafi Shaik <[email protected]>:

This patch set change will fix the unbalanced pm_runtime_enable in wcd937x-sdw soundwire slave.

And removed the string compare with widget name in MIC BIAS settings, instead
of string compare use the MIC BIAS id's as value.

Removed separate handling for vdd-buck regulator supply which is not
required. The vdd-buck regulator supply enabled using bulk enable.

Added the error handling in wcd937x_probe() and disable the regulators in error case.

8 months agoASoC: tas2781: Add new Kontrol to set tas2563 digital Volume
Shenghao Ding [Wed, 10 Jul 2024 06:42:37 +0000 (14:42 +0800)]
ASoC: tas2781: Add new Kontrol to set tas2563 digital Volume

Requriment from customer to add new kcontrol to set tas2563 digital
Volume

Signed-off-by: Shenghao Ding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd937x: Remove separate handling for vdd-buck supply
Mohammad Rafi Shaik [Thu, 4 Jul 2024 08:17:23 +0000 (13:47 +0530)]
ASoC: codecs: wcd937x: Remove separate handling for vdd-buck supply

Remove separate handling for vdd-buck regulator supply which is not
required. The vdd-buck regulator supply enabled using bulk enable.

Add the error handling in wcd937x_probe() and disable the regulators in
error case.

Reported-by: Christophe JAILLET <[email protected]>
Closes: https://lore.kernel.org/linux-sound/[email protected]/
Signed-off-by: Mohammad Rafi Shaik <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd937x: Remove the string compare in MIC BIAS widget settings
Mohammad Rafi Shaik [Thu, 4 Jul 2024 08:17:22 +0000 (13:47 +0530)]
ASoC: codecs: wcd937x: Remove the string compare in MIC BIAS widget settings

Remove the string compare with widget name in MIC BIAS settings, instead
of string compare use the MIC BIAS id's.

Reported-by: Srinivas Kandagatla <[email protected]>
Closes: https://lore.kernel.org/linux-sound/[email protected]/
Signed-off-by: Mohammad Rafi Shaik <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd937x-sdw: Fix Unbalanced pm_runtime_enable
Mohammad Rafi Shaik [Thu, 4 Jul 2024 08:17:21 +0000 (13:47 +0530)]
ASoC: codecs: wcd937x-sdw: Fix Unbalanced pm_runtime_enable

Fix the unbalanced pm_runtime_enable! in wcd937x-sdw soundwire slave.

Fixes: c99a515ff153 ("ASoC: codecs: wcd937x-sdw: add SoundWire driver")
Signed-off-by: Mohammad Rafi Shaik <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dt-bindings: cirrus,cs42xx8: Convert to dtschema
Animesh Agarwal [Wed, 10 Jul 2024 07:27:52 +0000 (12:57 +0530)]
ASoC: dt-bindings: cirrus,cs42xx8: Convert to dtschema

Convert the Cirrus Logic CS42448/CS42888 audio CODEC bindings to DT
schema format. Set power supply properties to required only for CS42888.

Cc: Daniel Baluta <[email protected]>
Signed-off-by: Animesh Agarwal <[email protected]>
Reviewed-by: Rob Herring (Arm) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoMerge tag 'asoc-fix-v6.10-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Thu, 11 Jul 2024 15:11:50 +0000 (17:11 +0200)]
Merge tag 'asoc-fix-v6.10-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.10

A few fairly small fixes for ASoC, there's a relatively large set of
hardening changes for the cs_dsp firmware file parsing and a couple of
other small device specific fixes.

8 months agoASoC: dt-bindings: convert qcom sound bindings to
Mark Brown [Wed, 10 Jul 2024 23:26:30 +0000 (00:26 +0100)]
ASoC: dt-bindings: convert qcom sound bindings to

Merge series from Rayyan Ansari <[email protected]>:

These patches convert the remaining plain text bindings for Qualcomm
sound drivers to dt schema, so device trees can be validated against
them.

8 months agofirmware: cs_dsp: Some small coding improvements
Mark Brown [Wed, 10 Jul 2024 23:26:23 +0000 (00:26 +0100)]
firmware: cs_dsp: Some small coding improvements

Merge series from Richard Fitzgerald <[email protected]>:

Commit series that makes some small improvements to code and the
kernel log messages.

8 months agoASoC: cs530x: Remove bclk from private structure
Paul Handrigan [Wed, 10 Jul 2024 16:04:16 +0000 (11:04 -0500)]
ASoC: cs530x: Remove bclk from private structure

Remove the bclk int from the private structure and pass it into
the set_bclk function.

Signed-off-by: Paul Handrigan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: cs530x: Calculate proper bclk rate using TDM
Paul Handrigan [Wed, 10 Jul 2024 16:04:15 +0000 (11:04 -0500)]
ASoC: cs530x: Calculate proper bclk rate using TDM

Calculate the proper bclk rate using the number of tdm slots
and the width of the tdm data.

Fixes: 2884c29152c0 ("ASoC: cs530x: Support for cs530x ADCs")
Signed-off-by: Paul Handrigan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dt-bindings: cirrus,cs4270: Convert to dtschema
Animesh Agarwal [Tue, 9 Jul 2024 18:42:25 +0000 (00:12 +0530)]
ASoC: dt-bindings: cirrus,cs4270: Convert to dtschema

Convert the Cirrus Logic CS4270 audio CODEC bindings to DT schema. Add
missing va-supply, vd-supply and vlc-supply properties, because they
are already being used in the DTS and the driver for this device.

Cc: Daniel Baluta <[email protected]>
Signed-off-by: Animesh Agarwal <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agofirmware: cs_dsp: Rename fw_ver to wmfw_ver
Richard Fitzgerald [Wed, 10 Jul 2024 10:36:40 +0000 (11:36 +0100)]
firmware: cs_dsp: Rename fw_ver to wmfw_ver

Rename the confusingly named struct member fw_ver to wmfw_ver. It
contains the wmfw format version of the loaded wmfw file.

This commit also contains an update to wm_adsp for the new name.

Signed-off-by: Richard Fitzgerald <[email protected]>
Reviewed-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agofirmware: cs_dsp: Clarify wmfw format version log message
Richard Fitzgerald [Wed, 10 Jul 2024 10:36:39 +0000 (11:36 +0100)]
firmware: cs_dsp: Clarify wmfw format version log message

Change the log message of the wmfw format version to include
the file name, and change the message to say "format" instead
of "Firmware version". Merge this with the message that logs
the timestamp.

The wmfw format version is information that is useful to have
logged because the behaviour of firmware controls depends on
the wmfw format. So "unexpected" behaviour could be caused by
having expectations based on one format of wmfw when a
different format has been loaded.

But the original message was confusing. It reported the file
format version but didn't actually log the name of the file it
referred to. It also called it "Firmware version", which is
confusing when a later message also logs a firmware version
that is the version of the actual firmware within the wmfw.

The logging of the firmware timestamp has been merged into this.
That was originally a dbg-only message, but as we are already
logging a line of info, we might as well add a few extra
characters to log the timestamp. The timestamp is now logged
in hexadecimal - it's not particularly useful as a decimal
value.

Signed-off-by: Richard Fitzgerald <[email protected]>
Reviewed-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agofirmware: cs_dsp: Make wmfw and bin filename arguments const char *
Richard Fitzgerald [Wed, 10 Jul 2024 10:36:38 +0000 (11:36 +0100)]
firmware: cs_dsp: Make wmfw and bin filename arguments const char *

The wmfw_filename and bin_filename strings passed into cs_dsp_power_up()
and cs_dsp_adsp1_power_up() should be const char *.

Signed-off-by: Richard Fitzgerald <[email protected]>
Reviewed-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agofirmware: cs_dsp: Don't allocate temporary buffer for info text
Richard Fitzgerald [Wed, 10 Jul 2024 10:36:37 +0000 (11:36 +0100)]
firmware: cs_dsp: Don't allocate temporary buffer for info text

Don't allocate a temporary buffer to hold a NUL-terminated copy
of the NAME/INFO string from the wmfw/bin. It can be printed
directly to the log. Also limit the maximum number of characters
that will be logged from this string.

The NAME/INFO blocks in the firmware files are an array of
characters with a length, not a NUL-terminated C string. The
original code allocated a temporary buffer to make a
NUL-terminated copy of the string and then passed that to
dev_info(). There's no need for this: printf formatting can
use "%.*s" to print a character array of a given length.

Signed-off-by: Richard Fitzgerald <[email protected]>
Reviewed-by: Charles Keepax <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dt-bindings: qcom,apq8096-sndcard: use dtschema
Rayyan Ansari [Wed, 10 Jul 2024 11:36:08 +0000 (12:36 +0100)]
ASoC: dt-bindings: qcom,apq8096-sndcard: use dtschema

Remove old txt bindings and add apq8096 soundcard entry to existing
dt schema.

Signed-off-by: Rayyan Ansari <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dt-bindings: qcom,msm8916-wcd-digital-codec: convert to dtschema
Rayyan Ansari [Wed, 10 Jul 2024 11:36:06 +0000 (12:36 +0100)]
ASoC: dt-bindings: qcom,msm8916-wcd-digital-codec: convert to dtschema

Convert the Qualcomm MSM8916 WCD Digital Audio Codec bindings from text
to yaml dt schema format.
Make bindings complete by adding #sound-dai-cells.

Signed-off-by: Rayyan Ansari <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: qcom: topology: Simplify with cleanup.h
Krzysztof Kozlowski [Mon, 1 Jul 2024 17:19:17 +0000 (19:19 +0200)]
ASoC: qcom: topology: Simplify with cleanup.h

Allocate memory, which is being freed at end of the scope, with
scoped/cleanup.h to reduce number of error paths and make code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: aw88395: Simplify with cleanup.h
Krzysztof Kozlowski [Mon, 1 Jul 2024 17:19:16 +0000 (19:19 +0200)]
ASoC: codecs: aw88395: Simplify with cleanup.h

Allocate memory, which is being freed at end of the scope, with
scoped/cleanup.h to reduce number of error paths and make code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: Intel: sof_sdw: Convert comma to semicolon
Chen Ni [Tue, 9 Jul 2024 03:09:21 +0000 (11:09 +0800)]
ASoC: Intel: sof_sdw: Convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Signed-off-by: Chen Ni <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoc: TAS2781: rename the tas2781_reset as tasdevice_reset
Shenghao Ding [Tue, 9 Jul 2024 04:33:40 +0000 (12:33 +0800)]
ASoc: TAS2781: rename the tas2781_reset as tasdevice_reset

Rename the tas2781_reset as tasdevice_reset in case of misunderstanding.
RESET register for both tas2563 and tas2781 is same and the use of reset
pin is also same.

Signed-off-by: Shenghao Ding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoALSA: hda/realtek: Enable Mute LED on HP 250 G7
Nazar Bilinskyi [Tue, 9 Jul 2024 08:05:46 +0000 (11:05 +0300)]
ALSA: hda/realtek: Enable Mute LED on HP 250 G7

HP 250 G7 has a mute LED that can be made to work using quirk
ALC269_FIXUP_HP_LINE1_MIC1_LED. Enable already existing quirk.

Signed-off-by: Nazar Bilinskyi <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: ppc: keywest: Drop explicit initialization of struct i2c_device_id::driver_data...
Uwe Kleine-König [Mon, 8 Jul 2024 13:02:53 +0000 (15:02 +0200)]
ALSA: ppc: keywest: Drop explicit initialization of struct i2c_device_id::driver_data to 0

The driver doesn't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoASoC: fsl-asoc-card: add S/PDIF controller support
Mark Brown [Mon, 8 Jul 2024 18:30:39 +0000 (19:30 +0100)]
ASoC: fsl-asoc-card: add S/PDIF controller support

Merge series from Elinor Montmasson <[email protected]>:

This is a series of patches aiming to make the machine driver
`fsl-asoc-card` compatible with S/PDIF controllers on imx boards.  The
main goal is to allow the use of S/PDIF controllers with ASRC modules.

The `imx-spdif` machine driver already has specific support for S/PDIF
controllers but doesn't support using an ASRC with it. However, the
`fsl-asoc-card` machine driver has the necessary code to create a sound
card which can use an ASRC module.
It is then possible to extend the support for S/PDIF audio cards by
merging the `imx-spdif` driver into `fsl-asoc-card`.

The first three patches adapt the `fsl-asoc-card` driver to support
multiple codec use cases.
The driver can get 2 codec phandles from the device tree, and
codec-related variables are doubled.
`for_each_codecs` macros are also used when possible to ease adding
other multi-codec use cases in the future.
It makes possible to use the two S/PDIF dummy codec drivers
`spdif_receiver` and `spdif_transmitter` instead of `snd-soc-dummy`,
which was used in `imx-spdif`.

The fourth patch merges the S/PDIF support from `imx-spdif` to
`fsl-asoc-card`.
`fsl-asoc-card` offers the same functionalities as `imx-spdif` did, but
this merge also extends the S/PDIF support with the possibility of using
an ASRC.
Compatible "fsl,imx-audio-spdif" is kept, but `fsl-asoc-card` uses
different DT properties compared to `imx-spdif`:
* The "spdif-controller" property from `imx-spdif` is named "audio-cpu"
  in `fsl-asoc-card`.
* `fsl-asoc-card` uses codecs explicitly declared in DT with
  "audio-codec". With an S/PDIF, codec drivers `spdif_transmitter` and
  `spdif_receiver` should be used. Driver `imx-spdif` used instead the
  dummy codec and a pair of boolean properties, "spdif-in" and
  "spdif-out".
Backward compatibility is therefore implemented in `fsl-asoc-card`.
However, it is recommended to use the new properties when needed.
Especially, declaring and using S/PDIF transmitter and/or receiver nodes
is better than using the dummy codec.

The last three patches update the device tree bindings of
`fsl-asoc-card` and update all in-tree device trees to use the
`fsl-asoc-card` properties.
Note that as the old properties are still supported:
* previous versions of in-tree device trees are still supported.
* out-of-tree device trees are still supported.

This series of patches was successfully built for arm64 and x86 on top
of the latest "for-next" branch of the ASoC git tree on the 26th of June
2024.
These modifications have also been tested on an i.MX8MN evaluation board
with a linux kernel RT v6.1.26-rt8.

8 months agoASoC: Simplify code with cleanup.h
Mark Brown [Mon, 8 Jul 2024 15:50:14 +0000 (16:50 +0100)]
ASoC: Simplify code with cleanup.h

Merge series from Krzysztof Kozlowski <[email protected]>:

Allocate the memory with scoped/cleanup.h to reduce error handling
(simpler error paths) and make the code a bit smaller.

8 months agoASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge
Elinor Montmasson [Thu, 27 Jun 2024 08:31:02 +0000 (10:31 +0200)]
ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge

The S/PDIF audio card support with compatible "fsl,imx-audio-spdif"
was merged from imx-spdif into the fsl-asoc-card driver.
It makes possible to use an S/PDIF with an ASRC.

This merge introduces new DT bindings to use with compatible
"fsl,imx-audio-spdif" to follow the way fsl-asoc-card works:
* the "spdif-controller" property from imx-spdif is named "audio-cpu"
  in fsl-asoc-card.
* fsl-asoc-card uses codecs explicitly declared in DT
  with "audio-codec".
  With an SPDIF, codec drivers spdif_transmitter and
  spdif_receiver should be used.
  Driver imx-spdif used instead the dummy codec and a pair of
  boolean properties, "spdif-in" and "spdif-out".

In an upcoming commit, in-tree DTs will be modified to follow these new
properties:
* Property "spdif-controller" will be renamed "audio-cpu".
* spdif_transmitter and spdif_receiver nodes will be declared
  and linked to the fsl-asoc-card node with the property "audio-codec".

To keep backward compatibility with other DTs, support for
"spdif-controller", "spdif-in" and "spdif-out" properties is kept.
However, it is recommended to use the new properties if possible.
It is better to declare transmitter and/or receiver
in DT than using the dummy codec.

DTs using compatible "fsl,imx-audio-spdif" are still supported, and
fsl-asoc-card will behave the same as imx-spdif for these DTs.

Signed-off-by: Elinor Montmasson <[email protected]>
Reviewed-by: Rob Herring (Arm) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
Elinor Montmasson [Thu, 27 Jun 2024 08:31:01 +0000 (10:31 +0200)]
ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c

The imx-spdif machine driver creates audio card to directly use an
S/PDIF device. However, it doesn't support interacting with an ASRC.
fsl-asoc-card already has the support to create audio card which can
use the ASRC.

Merge the S/PDIF support from imx-spdif into driver fsl-asoc-card
to extend the support of S/PDIF audio card with the use of ASRC devices.

fsl-asoc-card uses slightly different DT properties than imx-spdif:
* the "spdif-controller" property from imx-spdif is named "audio-cpu" in
  fsl-asoc-card.
* fsl-asoc-card uses codecs explicitly declared in DT
  with "audio-codec".
  With an SPDIF, codec drivers spdif_transmitter and
  spdif_receiver should be used.
  Driver imx-spdif used instead the dummy codec and a pair of
  boolean properties, "spdif-in" and "spdif-out".

To keep backward compatibility, support for "spdif-controller",
"spdif-in" and "spdif-out" is also added to fsl-asoc-card.
However, it is recommended to use the new properties if possible.
It is better to declare transmitter and/or receiver in DT
than using the dummy codec.

DTs using compatible "fsl,imx-audio-spdif" are still compatible, and
fsl-asoc-card will behave the same as imx-spdif
for these DTs.

Signed-off-by: Elinor Montmasson <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
Elinor Montmasson [Thu, 27 Jun 2024 08:31:00 +0000 (10:31 +0200)]
ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links

Adapt the driver to work with configurations using two codecs or more.
Modify fsl_asoc_card_probe() to handle use cases where 2 codecs are
given in the device tree.
This will be needed to add support for the SPDIF.

Use cases using one codec will ignore any given codecs other than the
first.

Co-developed-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Elinor Montmasson <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl-asoc-card: add second dai link component for codecs
Elinor Montmasson [Thu, 27 Jun 2024 08:30:59 +0000 (10:30 +0200)]
ASoC: fsl-asoc-card: add second dai link component for codecs

Add a second dai link component for codecs that will be used for use
cases with 2 codecs.
It is needed for future integration of the SPDIF support, which will
use spdif_receiver and spdif_transmitter drivers.

To prevent deferring in use cases using only one codec, also set
by default the number of codecs to 1 for the relevant dai links.

Co-developed-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Elinor Montmasson <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl-asoc-card: add support for dai links with multiple codecs
Elinor Montmasson [Thu, 27 Jun 2024 08:30:58 +0000 (10:30 +0200)]
ASoC: fsl-asoc-card: add support for dai links with multiple codecs

Add support for dai links using multiple codecs for multi-codec
use cases.

Co-developed-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Philip-Dylan Gleonec <[email protected]>
Signed-off-by: Elinor Montmasson <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agofirmware: cs_dsp: Use strnlen() on name fields in V1 wmfw files
Richard Fitzgerald [Mon, 8 Jul 2024 14:48:55 +0000 (15:48 +0100)]
firmware: cs_dsp: Use strnlen() on name fields in V1 wmfw files

Use strnlen() instead of strlen() on the algorithm and coefficient name
string arrays in V1 wmfw files.

In V1 wmfw files the name is a NUL-terminated string in a fixed-size
array. cs_dsp should protect against overrunning the array if the NUL
terminator is missing.

Signed-off-by: Richard Fitzgerald <[email protected]>
Fixes: f6bc909e7673 ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs")
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoc: TAS2781: replace beXX_to_cpup with get_unaligned_beXX for potentially broken...
Shenghao Ding [Sun, 7 Jul 2024 08:30:07 +0000 (16:30 +0800)]
ASoc: TAS2781: replace beXX_to_cpup with get_unaligned_beXX for potentially broken alignment

Use get_unaligned_be16 instead of be16_to_cpup and get_unaligned_be32
instead of be32_to_cpup for potentially broken alignment.

Signed-off-by: Shenghao Ding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dapm: Simplify snd_soc_dai_link_event_pre_pmu() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:05 +0000 (14:11 +0200)]
ASoC: dapm: Simplify snd_soc_dai_link_event_pre_pmu() with cleanup.h

Allocate the memory with scoped/cleanup.h in
snd_soc_dai_link_event_pre_pmu() to reduce error handling (less error
paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: dapm: Simplify dapm_cnew_widget() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:04 +0000 (14:11 +0200)]
ASoC: dapm: Simplify dapm_cnew_widget() with cleanup.h

Allocate the memory with scoped/cleanup.h in dapm_cnew_widget() to
reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: ops: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:03 +0000 (14:11 +0200)]
ASoC: ops: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: simple-card: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:02 +0000 (14:11 +0200)]
ASoC: simple-card: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Kuninori Morimoto <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:01 +0000 (14:11 +0200)]
ASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Kuninori Morimoto <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: audio-graph-card: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:00 +0000 (14:11 +0200)]
ASoC: audio-graph-card: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Kuninori Morimoto <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: simple-card-utils: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:59 +0000 (14:10 +0200)]
ASoC: simple-card-utils: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Kuninori Morimoto <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd934x: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:58 +0000 (14:10 +0200)]
ASoC: codecs: wcd934x: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd9335: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:57 +0000 (14:10 +0200)]
ASoC: codecs: wcd9335: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_probe() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:56 +0000 (14:10 +0200)]
ASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_probe() with cleanup.h

Allocate the memory with scoped/cleanup.h in audio_iio_aux_probe() to
reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_add_dapms() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:55 +0000 (14:10 +0200)]
ASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_add_dapms() with cleanup.h

Allocate the memory with scoped/cleanup.h in audio_iio_aux_add_dapms()
to reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoALSA: seq: Add tempo base unit for MIDI2 Set Tempo messages
Takashi Iwai [Fri, 5 Jul 2024 16:03:42 +0000 (18:03 +0200)]
ALSA: seq: Add tempo base unit for MIDI2 Set Tempo messages

MIDI2 Set Tempo message defines the tempo in 10ns unit for finer
accuracy, while MIDI1 was defined in 1us unit.  For adapting this
different unit, introduce "tempo_base" field to snd_seq_queue_tempo
struct so that user-space can pass the proper tempo base unit.

The accepted value is limited, it must be either 0, 10 or 1000.

The protocol version is bumped to 1.0.4 along with this.

The access with the older protocol version ignores the tempo-base
value in ioctls and always treats as 1000.

Reviewed-by: Jaroslav Kysela <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: hda/realtek: Limit mic boost on VAIO PRO PX
Edson Juliano Drosdeck [Fri, 5 Jul 2024 14:10:12 +0000 (11:10 -0300)]
ALSA: hda/realtek: Limit mic boost on VAIO PRO PX

The internal mic boost on the VAIO models VJFE-CL and VJFE-IL is too high.
Fix this by applying the ALC269_FIXUP_LIMIT_INT_MIC_BOOST fixup to the machine
to limit the gain.

Signed-off-by: Edson Juliano Drosdeck <[email protected]>
Cc: <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoASoc: pcm6240: Remove unnecessary name-prefix for all the controls
Shenghao Ding [Fri, 5 Jul 2024 06:48:46 +0000 (14:48 +0800)]
ASoc: pcm6240: Remove unnecessary name-prefix for all the controls

Adding name-prefix for each audio controls is a redundant, because
name-prefix will be automatically added behind the control name when
creating a new control.

Signed-off-by: Shenghao Ding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoALSA: pcm: Fix id copying in snd_pcm_set_sync_per_card()
Jaroslav Kysela [Fri, 5 Jul 2024 07:58:28 +0000 (09:58 +0200)]
ALSA: pcm: Fix id copying in snd_pcm_set_sync_per_card()

Avoid to use strncpy and do proper length limiting (12 bytes)
to avoid out of array access.

Fixes: d712c58c55d9 ("ALSA: pcm: optimize and clarify stream synchronization ID API")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Jaroslav Kysela <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: hda: cs35l41: Fix swapped l/r audio channels for Lenovo ThinBook 13x Gen4
Dmitry Savin [Thu, 4 Jul 2024 21:14:01 +0000 (22:14 +0100)]
ALSA: hda: cs35l41: Fix swapped l/r audio channels for Lenovo ThinBook 13x Gen4

Fixes audio channel assignment in configuration table for ThinkBook 13x Gen4.

Fixes: b32f92d1af37 ("ALSA: hda: cs35l41: Support Lenovo Thinkbook 13x Gen 4")
Signed-off-by: Dmitry Savin <[email protected]>
Reviewed-by: Stefan Binding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoALSA: pcm: Fix missing export of snd_pcm_set_sync_per-card()
Takashi Iwai [Fri, 5 Jul 2024 06:35:53 +0000 (08:35 +0200)]
ALSA: pcm: Fix missing export of snd_pcm_set_sync_per-card()

The recent change for the PCM sync API forgot to export a new API
function that is currently used in emu10k1 driver.

This patch adds the missing export.

Fixes: d712c58c55d9 ("ALSA: pcm: optimize and clarify stream synchronization ID API")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Reviewed-by: Jaroslav Kysela <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoAdd support for non-interleaved mode in qmc_audio
Mark Brown [Thu, 4 Jul 2024 17:41:11 +0000 (18:41 +0100)]
Add support for non-interleaved mode in qmc_audio

Merge series from Herve Codina <[email protected]>:

The qmc_audio driver supports only audio in interleaved mode.
Non-interleaved mode can be easily supported using several QMC channel
per DAI. In that case, data related to ch0 are sent to (received from)
the first QMC channel, data related to ch1 use the next QMC channel and
so on up to the last channel.

In terms of constraints and settings, the interleaved and
non-interleaved modes are slightly different.

In interleaved mode:
  - The sample size should fit in the number of time-slots available for
    the QMC channel.
  - The number of audio channels should fit in the number of time-slots
    (taking into account the sample size) available for the QMC channel.

In non-interleaved mode:
  - The number of audio channels is the number of available QMC
    channels.
  - Each QMC channel should have the same number of time-slots.
  - The sample size equals the number of time-slots of one QMC channel.

This series add support for the non-interleaved mode in the qmc_audio
driver and is composed of the following parts:
  - Patches 1 and 2: Fix some issues in the qmc_audio
  - Patches 3 to 6: Prepare qmc_audio for the non-interleaved mode
  - Patches 7 and 8: Extend the QMC driver API
  - Patches 9 and 10: The support for non-interleaved mode itself

Compared to the previous iteration, this v2 series mainly improves
qmc_audio_access_is_interleaved().

8 months agoASoC: codecs: lpass-rx-macro: Few code cleanups
Mark Brown [Thu, 4 Jul 2024 17:41:03 +0000 (18:41 +0100)]
ASoC: codecs: lpass-rx-macro: Few code cleanups

Merge series from Krzysztof Kozlowski <[email protected]>:

Improve a bit the Qualcomm LPASS RX macro driver and align similar parts
of code with LPASS WSA macro driver for consistency.

No external dependencies.

8 months agoASoc: tas2781: Set "Speaker Force Firmware Load" as the common kcontrol for both...
Shenghao Ding [Thu, 4 Jul 2024 09:49:37 +0000 (17:49 +0800)]
ASoc: tas2781: Set "Speaker Force Firmware Load" as the common kcontrol for both tas27871 and tas2563

Set "Speaker Force Firmware Load" as the common kcontrol
for both tas27871 and tas2563 and move it into newly-created
tasdevice_snd_controls, and keep the digital gain and analog
gain in tas2781_snd_controls.

Signed-off-by: Shenghao Ding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoALSA: hda: cs35l41: Fix missing Speaker ID GPIO description in _DSD
Stefan Binding [Wed, 3 Jul 2024 14:07:28 +0000 (15:07 +0100)]
ALSA: hda: cs35l41: Fix missing Speaker ID GPIO description in _DSD

Laptop 10431A63 contains valid _DSD, but missing Speaker ID
description. Add this discription, but keep the rest of the _DSD to
ensure the correct firmware and tuning is loaded for this laptop.

Signed-off-by: Stefan Binding <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
8 months agoASoC: amd: Adjust error handling in case of absent codec device
Aleksandr Mishin [Wed, 3 Jul 2024 19:10:07 +0000 (22:10 +0300)]
ASoC: amd: Adjust error handling in case of absent codec device

acpi_get_first_physical_node() can return NULL in several cases (no such
device, ACPI table error, reference count drop to 0, etc).
Existing check just emit error message, but doesn't perform return.
Then this NULL pointer is passed to devm_acpi_dev_add_driver_gpios()
where it is dereferenced.

Adjust this error handling by adding error code return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 02527c3f2300 ("ASoC: amd: add Machine driver for Jadeite platform")
Signed-off-by: Aleksandr Mishin <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: codecs: wcd939x: Fix typec mux and switch leak during device removal
Krzysztof Kozlowski [Mon, 1 Jul 2024 12:26:16 +0000 (14:26 +0200)]
ASoC: codecs: wcd939x: Fix typec mux and switch leak during device removal

Driver does not unregister typec structures (typec_mux_dev and
typec_switch_desc) during removal leading to leaks.  Fix this by moving
typec registering parts to separate function and using devm interface to
release them.  This also makes code a bit simpler:
 - Smaller probe() function with less error paths and no #ifdefs,
 - No need to store typec_mux_dev and typec_switch_desc in driver state
   container structure.

Cc: [email protected]
Fixes: 10f514bd172a ("ASoC: codecs: Add WCD939x Codec driver")
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Neil Armstrong <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: ak4458: remove "reset-gpios" property handler
Shengjiu Wang [Wed, 3 Jul 2024 12:26:15 +0000 (20:26 +0800)]
ASoC: ak4458: remove "reset-gpios" property handler

commit c721f189e89c0 ("reset: Instantiate reset GPIO controller for
shared reset-gpios") check if there is no "resets" property
will fallback to "reset-gpios".

So don't need to handle "reset-gpios" separately in the driver,
the "reset-gpios" handler is duplicated with "resets" control handler,
remove it.

Signed-off-by: Shengjiu Wang <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: SOF: ipc4-topology: Use single token list for the copiers
Peter Ujfalusi [Thu, 4 Jul 2024 08:59:44 +0000 (10:59 +0200)]
ASoC: SOF: ipc4-topology: Use single token list for the copiers

There is no need to keep separate token list for dai and 'common' copier
token list when the 'common' list is actually the aif list, the
SOF_COPIER_DEEP_BUFFER_TOKENS are not applicable for buffers.

We could have separate lists for all types but it is probably simpler to
just use a single list for all types of copiers. Function specific tokens
will be only parsed by function specific code anyways.

Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl: fsl_qmc_audio: Add support for non-interleaved mode.
Herve Codina [Mon, 1 Jul 2024 11:30:37 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Add support for non-interleaved mode.

The current fsl_qmc_audio works in interleaved mode. The audio samples
are interleaved and all data are sent to (received from) one QMC
channel.

Using several QMC channels, non interleaved mode can be easily
supported. In that case, data related to ch0 are sent to (received from)
the first QMC channel, data related to ch1 use the next QMC channel and
so on up to the last channel.

In terms of constraints and settings, the two modes are slightly
different:
- Interleaved mode:
    - The sample size should fit in the number of time-slots available
      for the QMC channel.
    - The number of audio channels should fit in the number of
      time-slots (taking into account the sample size) available for the
      QMC channel.
- Non-interleaved mode:
    - The number of audio channels is the number of available QMC
      channels.
    - Each QMC channel should have the same number of time-slots.
    - The sample size equals the number of time-slots of one QMC
      channel.

Add support for the non-interleaved mode allowing multiple QMC channel
per DAI. The DAI switches in non-interleaved mode when more that one QMC
channel is available.

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agodt-bindings: sound: fsl,qmc-audio: Add support for multiple QMC channels per DAI
Herve Codina [Mon, 1 Jul 2024 11:30:36 +0000 (13:30 +0200)]
dt-bindings: sound: fsl,qmc-audio: Add support for multiple QMC channels per DAI

The QMC audio uses one QMC channel per DAI and uses this QMC channel to
transmit interleaved audio channel samples.

In order to work in non-interleave mode, a QMC audio DAI needs to use
multiple QMC channels. In that case, the DAI maps each QMC channel to
exactly one audio channel.

Allow QMC audio DAIs with multiple QMC channels attached.

Signed-off-by: Herve Codina <[email protected]>
Reviewed-by: Rob Herring (Arm) <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agosoc: fsl: cpm1: qmc: Introduce qmc_chan_count_phandles()
Herve Codina [Mon, 1 Jul 2024 11:30:35 +0000 (13:30 +0200)]
soc: fsl: cpm1: qmc: Introduce qmc_chan_count_phandles()

No function in the QMC API is available to get the number of phandles
present in a phandle list.

Fill this lack introducing qmc_chan_count_phandles().

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agosoc: fsl: cpm1: qmc: Introduce functions to get a channel from a phandle list
Herve Codina [Mon, 1 Jul 2024 11:30:34 +0000 (13:30 +0200)]
soc: fsl: cpm1: qmc: Introduce functions to get a channel from a phandle list

qmc_chan_get_byphandle() and the resource managed version retrieve a
channel from a simple phandle.

Extend the API and introduce qmc_chan_get_byphandles_index() and the
resource managed version in order to retrieve a channel from a phandle
list using the provided index to identify the phandle in the list.

Also update qmc_chan_get_byphandle() and the resource managed version to
use qmc_chan_get_byphandles_index() and so avoid code duplication.

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl: fsl_qmc_audio: Introduce qmc_dai_constraints_interleaved()
Herve Codina [Mon, 1 Jul 2024 11:30:33 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Introduce qmc_dai_constraints_interleaved()

Constraints are set by qmc_dai_startup(). These constraints are specific
to the interleaved mode.

With the future introduction of support for non-interleaved mode, a new
set of constraints will be set. To make the code clear and keep
qmc_dai_startup() simple, extract the current interleaved mode
constraints settings to a specific function.

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl: fsl_qmc_audio: Introduce qmc_audio_pcm_{read,write}_submit()
Herve Codina [Mon, 1 Jul 2024 11:30:32 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Introduce qmc_audio_pcm_{read,write}_submit()

Submitting data to QMC channels is done in several places: transfer
completions and DAI start. The operation done is simple and consist in
one function call.

With the future introduction of support for non-interleaved mode,
submitting data will be more complex.

To avoid copy/paste of code in several places, introduce
qmc_audio_pcm_{read,write}_submit() whose goal is to handle this
data submission.

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
8 months agoASoC: fsl: fsl_qmc_audio: Identify the QMC channel involved in completion routines
Herve Codina [Mon, 1 Jul 2024 11:30:31 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Identify the QMC channel involved in completion routines

The current QMC audio driver uses only one QMC channel per DAI. The
context used by QMC channel transfer (read and write) completion
routines does not contains any QMC channel and the only one available
per DAI is used to schedule the next transfer.
This works pretty well with only one QMC channel per DAI.

The future support for non-inlerleave mode will use several QMC channel
per DAI. In that case, QMC channel transfer completion routines need to
identify the QMC channel related to the completion.

In order to fill this lack, even if identifying the current QMC channel
among several QMC channels is not needed for the current code, add one
indirection level and introduce the qmc_dai_chan data structrure.
This structure contains the QMC channel involved in the completion and
refererences to the runtime context (capture and playback) used by the
DAI.

Signed-off-by: Herve Codina <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
This page took 0.11841 seconds and 4 git commands to generate.