linux-2.6-microblaze.git
7 months agoALSA: seq: core: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:09 +0000 (12:15 +0100)]
ALSA: seq: core: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-10-tiwai@suse.de
7 months agoALSA: seq: ump: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:08 +0000 (12:15 +0100)]
ALSA: seq: ump: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-9-tiwai@suse.de
7 months agoALSA: seq: virmidi: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:07 +0000 (12:15 +0100)]
ALSA: seq: virmidi: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-8-tiwai@suse.de
7 months agoALSA: seq: oss: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:06 +0000 (12:15 +0100)]
ALSA: seq: oss: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-7-tiwai@suse.de
7 months agoALSA: vmaster: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:05 +0000 (12:15 +0100)]
ALSA: vmaster: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-6-tiwai@suse.de
7 months agoALSA: timer: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:04 +0000 (12:15 +0100)]
ALSA: timer: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-5-tiwai@suse.de
7 months agoALSA: compress_offload: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:03 +0000 (12:15 +0100)]
ALSA: compress_offload: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

A caveat is that some allocations are memdup_user() and they return an
error pointer instead of NULL.  Those need special cares and the value
has to be cleared with no_free_ptr() at the allocation error path.

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-4-tiwai@suse.de
7 months agoALSA: control: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:02 +0000 (12:15 +0100)]
ALSA: control: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

A caveat is that some allocations are memdup_user() and they return an
error pointer instead of NULL.  Those need special cares and the value
has to be cleared with no_free_ptr() at the allocation error path.

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-3-tiwai@suse.de
7 months agoALSA: pcm: Use automatic cleanup of kfree()
Takashi Iwai [Thu, 22 Feb 2024 11:15:01 +0000 (12:15 +0100)]
ALSA: pcm: Use automatic cleanup of kfree()

There are common patterns where a temporary buffer is allocated and
freed at the exit, and those can be simplified with the recent cleanup
mechanism via __free(kfree).

A caveat is that some allocations are memdup_user() and they return an
error pointer instead of NULL.  Those need special cares and the value
has to be cleared with no_free_ptr() at the allocation error path.

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-2-tiwai@suse.de
7 months agoALSA: seq: prioq: Unify cell removal functions
Takashi Iwai [Thu, 22 Feb 2024 13:21:52 +0000 (14:21 +0100)]
ALSA: seq: prioq: Unify cell removal functions

Both snd_seq_prioq_remove_events() and snd_seq_prioq_leave() have a
very similar loop for removing events.  Unify them with a callback for
code simplification.

Only the code refactoring, and no functional changes.

Link: https://lore.kernel.org/r/20240222132152.29063-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda: beep: Drop stale mutex
Takashi Iwai [Thu, 22 Feb 2024 15:31:48 +0000 (16:31 +0100)]
ALSA: hda: beep: Drop stale mutex

The beep->mutex is no longer used since the drop of beep_mode=2.
Let's get rid of it.

Fixes: 0920c9b4c4d8 ("ALSA: hda - Remove beep_mode=2")
Link: https://lore.kernel.org/r/20240222153148.19691-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: echoaudio: remove redundant assignment to variable clock
Colin Ian King [Wed, 21 Feb 2024 11:38:09 +0000 (11:38 +0000)]
ALSA: echoaudio: remove redundant assignment to variable clock

The variable clock is being assigned a value that is never read,
it is being re-assigned a new value in every case in the following
switch statement. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
sound/pci/echoaudio/echoaudio_3g.c:277:2: warning: Value stored
to 'clock' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20240221113809.3410109-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoMerge branch 'for-linus' into for-next
Takashi Iwai [Wed, 21 Feb 2024 10:16:43 +0000 (11:16 +0100)]
Merge branch 'for-linus' into for-next

Pull 6.8-rc devel branch.  The trivial merge conflict got resolved.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: fix mute/micmute LED For HP mt440
Eniac Zhang [Tue, 20 Feb 2024 17:58:12 +0000 (17:58 +0000)]
ALSA: hda/realtek: fix mute/micmute LED For HP mt440

The HP mt440 Thin Client uses an ALC236 codec and needs the
ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF quirk to make the mute and
micmute LEDs work.

There are two variants of the USB-C PD chip on this device. Each uses
a different BIOS and board ID, hence the two entries.

Signed-off-by: Eniac Zhang <eniac-xw.zhang@hp.com>
Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240220175812.782687-1-alexandru.gagniuc@hp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda: Downgrade BDL table overflow message
Takashi Iwai [Wed, 21 Feb 2024 10:06:07 +0000 (11:06 +0100)]
ALSA: hda: Downgrade BDL table overflow message

When BDL table entry overflow happens, the driver spews an error
message explicitly.  But basically this condition can be triggered
easily by an application and it may flood of error logs
unnecessarily.

Downgrade the error message with dev_dbg() as a debug message
instead.

Link: https://lore.kernel.org/r/20240221100607.6565-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda: Set up BDL table at hw_params
Takashi Iwai [Wed, 21 Feb 2024 10:06:06 +0000 (11:06 +0100)]
ALSA: hda: Set up BDL table at hw_params

So far the setup of BDL table is performed at the prepare stage, where
all PCM parameters have been already set up.  When something wrong
happens at it, we return -EINVAL; it's supposed to be a rare case
since the involved memory allocation is a small chunk of kmalloc for
the table.

However, when we receive too many small non-contiguous pages in highly
fragmented memories, it may overflow the max table size, resulting in
the same -EINVAL error from the prepare, too.  A bad scenario is that
user-space cannot know what went wrong (as it's an error from the
prepare stage) and -EINVAL, hence it may retry with the same
parameters, failing again repeatedly.

In this patch, we try to set up the BDL table at hw_params right after
the buffer allocation, and return -ENOMEM if it overflows.
This allows user-space knowing that it should reduce the buffer size
request accordingly and may retry with more fitting parameters.

Link: https://lore.kernel.org/r/20240221100607.6565-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: Drop leftover snd-rtctimer stuff from Makefile
Takashi Iwai [Wed, 21 Feb 2024 09:21:56 +0000 (10:21 +0100)]
ALSA: Drop leftover snd-rtctimer stuff from Makefile

We forgot to remove the line for snd-rtctimer from Makefile while
dropping the functionality.  Get rid of the stale line.

Fixes: 34ce71a96dcb ("ALSA: timer: remove legacy rtctimer")
Link: https://lore.kernel.org/r/20240221092156.28695-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: ump: Fix the discard error code from snd_ump_legacy_open()
Takashi Iwai [Tue, 20 Feb 2024 15:08:43 +0000 (16:08 +0100)]
ALSA: ump: Fix the discard error code from snd_ump_legacy_open()

snd_ump_legacy_open() didn't return the error code properly even if it
couldn't open.  Fix it.

Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240220150843.28630-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: Enable Mute LED on HP 840 G8 (MB 8AB8)
Hans Peter [Mon, 19 Feb 2024 16:38:49 +0000 (17:38 +0100)]
ALSA: hda/realtek: Enable Mute LED on HP 840 G8 (MB 8AB8)

On my EliteBook 840 G8 Notebook PC (ProdId 5S7R6EC#ABD; built 2022 for
german market) the Mute LED is always on. The mute button itself works
as expected. alsa-info.sh shows a different subsystem-id 0x8ab9 for
Realtek ALC285 Codec, thus the existing quirks for HP 840 G8 don't work.
Therefore, add a new quirk for this type of EliteBook.

Signed-off-by: Hans Peter <flurry123@gmx.ch>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240219164518.4099-1-flurry123@gmx.ch
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: Fix top speaker connection on Dell Inspiron 16 Plus 7630
Jay Ajit Mate [Mon, 19 Feb 2024 10:04:04 +0000 (15:34 +0530)]
ALSA: hda/realtek: Fix top speaker connection on Dell Inspiron 16 Plus 7630

The Dell Inspiron 16 Plus 7630, similar to its predecessors (7620 models),
experiences an issue with unconnected top speakers. Since the controller
remains unchanged, this commit addresses the problem by correctly
connecting the speakers on NID 0X17 to the DAC on NIC 0x03.

Signed-off-by: Jay Ajit Mate <jay.mate15@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240219100404.9573-1-jay.mate15@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: firewire-lib: fix to check cycle continuity
Takashi Sakamoto [Sun, 18 Feb 2024 03:30:26 +0000 (12:30 +0900)]
ALSA: firewire-lib: fix to check cycle continuity

The local helper function to compare the given pair of cycle count
evaluates them. If the left value is less than the right value, the
function returns negative value.

If the safe cycle is less than the current cycle, it is the case of
cycle lost. However, it is not currently handled properly.

This commit fixes the bug.

Cc: <stable@vger.kernel.org>
Fixes: 705794c53b00 ("ALSA: firewire-lib: check cycle continuity")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218033026.72577-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: oxfw: add support for Miglia Harmony Audio
Takashi Sakamoto [Sun, 18 Feb 2024 07:41:28 +0000 (16:41 +0900)]
ALSA: oxfw: add support for Miglia Harmony Audio

Miglia Technology ships Harmony Audio 2004. It uses Oxford Semiconductor
OXFW970 for communication function in IEEE 1394 bus. This commit adds
support for the model.

In my opinion, the firmware of ASIC is really the initial stage, since
it has the following quirks.

* It skips several isochronous cycles to transmit isochronous packets
  when receiving any asynchronous transaction.
* The value of dbc field in the transmitted packet is the number of
  accumulated quadlets in CIP payload, instead of the accumulated data
  blocks. Furthermore, the value includes the quadlets of CIP payload in
  the packet.
* It neither supports AV/C Stream Format Information command nor AV/C
  Extended Stream Format Information command.
* The vendor and model information in root directory of configuration
  ROM includes some mistakes.

Additionally, when operating at 96.0 kHz, it often skips much isochronous
cycles to transmit the isochronous packets. The issue is detected as cycle
discontinuity and ALSA PCM application receives -EIO at any operation for
PCM substream. I have never found any workaround yet.

$ config-rom-pretty-printer < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
1024  04249e04  bus_info_length 4, crc_length 36, crc 40452
1028  31333934  bus_name "1394"
1032  20ff5003  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 5 (64)
1036  0030e002  company_id 0030e0     |
1040  00454647  device_id 8594474567  | EUI-64 13757098081207879

               root directory
               -----------------------------------------------------------------
1044  00062d69  directory_length 6, crc 11625
1048  030030e0  vendor
1052  8100000a  --> descriptor leaf at 1092
1056  1700f970  model
1060  81000011  --> descriptor leaf at 1128
1064  0c0083c0  node capabilities: per IEEE 1394
1068  d1000001  --> unit directory at 1072

               unit directory at 1072
               -----------------------------------------------------------------
1072  00046ff9  directory_length 4, crc 28665 (should be 43676)
1076  1200a02d  specifier id
1080  13010001  version
1084  1700f970  model
1088  8100000f  --> descriptor leaf at 1148

               descriptor leaf at 1092
               -----------------------------------------------------------------
1092  00085f8a  leaf_length 8, crc 24458
1096  00000000  textual descriptor
1100  00000000  minimal ASCII
1104  4d69676c  "Migl"
1108  69612054  "ia T"
1112  6563686e  "echn"
1116  6f6c6f67  "olog"
1120  79204c74  "y Lt"
1124  642e0000  "d."

               descriptor leaf at 1128
               -----------------------------------------------------------------
1128  00040514  leaf_length 4, crc 1300
1132  00000000  textual descriptor
1136  00000000  minimal ASCII
1140  4f584657  "OXFW"
1144  20393730  " 970"

               descriptor leaf at 1148
               -----------------------------------------------------------------
1148  0005a1dc  leaf_length 5, crc 41436
1152  00000000  textual descriptor
1156  00000000  minimal ASCII
1160  4861726d  "Harm"
1164  6f6e7941  "onyA"
1168  7564696f  "udio"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter
Takashi Sakamoto [Sun, 18 Feb 2024 07:41:27 +0000 (16:41 +0900)]
ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter

Miglia Harmony Audio (OXFW970) has a quirk to put the number of
accumulated quadlets in CIP payload into the dbc field of CIP header.

This commit handles the quirk in the packet processing layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: oxfw: support the case that AV/C Stream Format Information command is not available
Takashi Sakamoto [Sun, 18 Feb 2024 07:41:26 +0000 (16:41 +0900)]
ALSA: oxfw: support the case that AV/C Stream Format Information command is not available

Miglia Harmony Audio does neither support AV/C Stream Format Information
command nor AV/C Extended Stream Format Information command.

This commit adds a workaround for the case and uses the hard-coded formats.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: oxfw: use const qualifier for immutable argument
Takashi Sakamoto [Sun, 18 Feb 2024 07:41:25 +0000 (16:41 +0900)]
ALSA: oxfw: use const qualifier for immutable argument

In the helper function, the first argument is immutable, thus it is
preferable to use const qualifier.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: core: fix buffer overflow in test_format_fill_silence()
Arnd Bergmann [Sat, 17 Feb 2024 10:42:38 +0000 (11:42 +0100)]
ALSA: core: fix buffer overflow in test_format_fill_silence()

KASAN caught a buffer overflow with the hardcoded 2048 byte buffer
size, when 2080 bytes are written to it:

 BUG: KASAN: slab-out-of-bounds in snd_pcm_format_set_silence+0x3bc/0x3e4
 Write of size 8 at addr ffff0000c8149800 by task kunit_try_catch/1297

 CPU: 0 PID: 1297 Comm: kunit_try_catch Tainted: G N 6.8.0-rc4-next-20240216 #1
 Hardware name: linux,dummy-virt (DT)
 Call trace:
  kasan_report+0x78/0xc0
  __asan_report_store_n_noabort+0x1c/0x28
  snd_pcm_format_set_silence+0x3bc/0x3e4
  _test_fill_silence+0xdc/0x298
  test_format_fill_silence+0x110/0x228
  kunit_try_run_case+0x144/0x3bc
  kunit_generic_run_threadfn_adapter+0x50/0x94
  kthread+0x330/0x3e8
  ret_from_fork+0x10/0x20

 Allocated by task 1297:
  __kmalloc+0x17c/0x2f0
  kunit_kmalloc_array+0x2c/0x78
  test_format_fill_silence+0xcc/0x228
  kunit_try_run_case+0x144/0x3bc
  kunit_generic_run_threadfn_adapter+0x50/0x94
  kthread+0x330/0x3e8
  ret_from_fork+0x10/0x20

Replace the incorrect size with the correct length of 260 64-bit samples.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Suggested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240217104311.3749655-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: virtio: Fix "Coverity: virtsnd_kctl_tlv_op(): Uninitialized variables" warning.
Aiswarya Cyriac [Fri, 16 Feb 2024 10:06:43 +0000 (11:06 +0100)]
ALSA: virtio: Fix "Coverity: virtsnd_kctl_tlv_op(): Uninitialized variables" warning.

This commit fixes the following warning when building virtio_snd driver.

"
*** CID 1583619:  Uninitialized variables  (UNINIT)
sound/virtio/virtio_kctl.c:294 in virtsnd_kctl_tlv_op()
288
289      break;
290      }
291
292      kfree(tlv);
293
vvv     CID 1583619:  Uninitialized variables  (UNINIT)
vvv     Using uninitialized value "rc".
294      return rc;
295     }
296
297     /**
298      * virtsnd_kctl_get_enum_items() - Query items for the ENUMERATED element type.
299      * @snd: VirtIO sound device.
"

This warning is caused by the absence of the "default" branch in the
switch-block, and is a false positive because the kernel calls
virtsnd_kctl_tlv_op() only with values for op_flag processed in
this block.

Also, this commit unifies the cleanup path for all possible control
paths in the callback function.

Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com>
Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@opensynergy.com>
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1583619 ("Uninitialized variables")
Fixes: d6568e3de42d ("ALSA: virtio: add support for audio controls")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20240216100643.688590-1-aiswarya.cyriac@opensynergy.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: avoid 'bool' as variable name
Arnd Bergmann [Fri, 16 Feb 2024 13:02:04 +0000 (14:02 +0100)]
ALSA: avoid 'bool' as variable name

In modern C versions, 'bool' is a keyword that cannot be used as
a variable name, so change this instance use something else, and
change the type to bool instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240216130211.3828455-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoMerge branch 'for-linus' into for-next
Takashi Iwai [Thu, 15 Feb 2024 15:57:32 +0000 (16:57 +0100)]
Merge branch 'for-linus' into for-next

Pull the latest 6.8 stuff into devel branch for further development.
Fixed the trivial merge conflict for HD-audio Realtek stuff.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: usb-audio: More relaxed check of MIDI jack names
Takashi Iwai [Thu, 15 Feb 2024 15:31:44 +0000 (16:31 +0100)]
ALSA: usb-audio: More relaxed check of MIDI jack names

The USB audio driver tries to retrieve MIDI jack name strings that can
be used for rawmidi substream names and sequencer port names, but its
checking is too strict: often the firmware provides the jack info for
unexpected directions, and then we miss the info although it's
present.

In this patch, the code to extract the jack info is changed to allow
both in and out directions in a single loop.  That is, the former two
functions to obtain the descriptor pointers for jack in and out are
changed to a single function that returns iJack of the corresponding
jack ID, no matter which direction is used.  It's a code
simplification at the same time as well as the fix.

Fixes: eb596e0fd13c ("ALSA: usb-audio: generate midi streaming substream names from jack names")
Link: https://lore.kernel.org/r/20240215153144.26047-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: fix mute/micmute LED For HP mt645
Eniac Zhang [Thu, 15 Feb 2024 15:49:22 +0000 (15:49 +0000)]
ALSA: hda/realtek: fix mute/micmute LED For HP mt645

The HP mt645 G7 Thin Client uses an ALC236 codec and needs the
ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF quirk to make the mute and
micmute LEDs work.

There are two variants of the USB-C PD chip on this device. Each uses
a different BIOS and board ID, hence the two entries.

Signed-off-by: Eniac Zhang <eniac-xw.zhang@hp.com>
Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240215154922.778394-1-alexandru.gagniuc@hp.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: seq: remove redundant 'tristate' for SND_SEQ_UMP_CLIENT
Masahiro Yamada [Thu, 15 Feb 2024 13:53:04 +0000 (22:53 +0900)]
ALSA: seq: remove redundant 'tristate' for SND_SEQ_UMP_CLIENT

'def_tristate' is a shorthand for 'default' + 'tristate'.

Another 'tristate' is redundant.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20240215135304.1909431-1-masahiroy@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoMerge tag 'asoc-fix-v6.8-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Thu, 15 Feb 2024 14:00:31 +0000 (15:00 +0100)]
Merge tag 'asoc-fix-v6.8-rc4' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.8

A relatively large set of fixes and quirk additions here but they're all
driver specific, people seem to be back into the swing of things after
the holidays.  This is all driver specific and much of it fairly minor.

7 months agoALSA: seq: make snd_seq_bus_type const
Ricardo B. Marliere [Wed, 14 Feb 2024 19:28:29 +0000 (16:28 -0300)]
ALSA: seq: make snd_seq_bus_type const

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the snd_seq_bus_type variable to be a constant
structure as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240214-bus_cleanup-alsa-v1-2-8fedbb4afa94@marliere.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: aoa: make soundbus_bus_type const
Ricardo B. Marliere [Wed, 14 Feb 2024 19:28:28 +0000 (16:28 -0300)]
ALSA: aoa: make soundbus_bus_type const

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the soundbus_bus_type variable to be a constant
structure as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240214-bus_cleanup-alsa-v1-1-8fedbb4afa94@marliere.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: cs35l41: Fix order and duplicates in quirks table
Jean-Loïc Charroud [Tue, 13 Feb 2024 23:44:24 +0000 (00:44 +0100)]
ALSA: hda/realtek: cs35l41: Fix order and duplicates in quirks table

Move entry {0x1043, 0x16a3, "ASUS UX3402VA"} following device ID order.
Remove duplicate entry for device {0x1043, 0x1f62, "ASUS UX7602ZM"}.

Fixes: 51d976079976 ("ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models")
Signed-off-by: Jean-Loïc Charroud <lagiraudiere+linux@free.fr>
Link: https://lore.kernel.org/r/1969151851.650354669.1707867864074.JavaMail.zimbra@free.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: cs35l41: Fix device ID / model name
Jean-Loïc Charroud [Tue, 13 Feb 2024 23:42:12 +0000 (00:42 +0100)]
ALSA: hda/realtek: cs35l41: Fix device ID / model name

The patch 51d976079976c800ef19ed1b542602fcf63f0edb ("ALSA: hda/realtek:
Add quirks for ASUS Zenbook 2022 Models") modified the entry 1043:1e2e
from "ASUS UM3402" to "ASUS UM6702RA/RC" and added another entry for
"ASUS UM3402" with 104e:1ee2.
The first entry was correct, while the new one corresponds to model
"ASUS UM6702RA/RC"
Fix the model names for both devices.

Fixes: 51d976079976 ("ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models")
Signed-off-by: Jean-Loïc Charroud <lagiraudiere+linux@free.fr>
Link: https://lore.kernel.org/r/1656546983.650349575.1707867732866.JavaMail.zimbra@free.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: cs35l41: Add internal speaker support for ASUS UM3402 with missing DSD
Jean-Loïc Charroud [Tue, 13 Feb 2024 23:38:31 +0000 (00:38 +0100)]
ALSA: hda/realtek: cs35l41: Add internal speaker support for ASUS UM3402 with missing DSD

Add the values for the missing DSD properties to the cs35l41 config table.

Signed-off-by: Jean-Loïc Charroud <lagiraudiere+linux@free.fr>
Link: https://lore.kernel.org/r/1435594585.650325975.1707867511062.JavaMail.zimbra@free.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: cs35l56: Workaround for ACPI with broken spk-id-gpios property
Richard Fitzgerald [Fri, 9 Feb 2024 11:18:40 +0000 (11:18 +0000)]
ASoC: cs35l56: Workaround for ACPI with broken spk-id-gpios property

The ACPI in some SoundWire laptops has a spk-id-gpios property but
it points to the wrong Device node. This patch adds a workaround to
try to get the GPIO directly from the correct Device node.

If the attempt to get the GPIOs from the property fails, the workaround
looks for the SDCA node "AF01", which is where the GpioIo resource is
defined. If this exists, a spk-id-gpios mapping is added to that node
and then the GPIO is got from that node using the property.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240209111840.1543630-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: SOF: Intel: pci-tgl/lnl: Change default paths
Mark Brown [Tue, 13 Feb 2024 17:12:51 +0000 (17:12 +0000)]
ASoC: SOF: Intel: pci-tgl/lnl: Change default paths

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

Hi,

Align the IPC4 firmware path/name and the topology path to the documentation:
default_fw_path:     intel/sof-ipc4/{platform_name}
default_lib_path:    intel/sof-ipc4-lib/{platform_name}
default_tplg_path:   intel/sof-ipc4-tplg
default_fw_filename: sof-{platform_name}.ri

Tiger Lake and Lunar Lake support is not yet available via the official
firmware release, the paths can be changed now to avoid misalignment in the
future.

Regards,
Peter
---
Peter Ujfalusi (2):
  ASoC: SOF: Intel: pci-tgl: Change the default paths and firmware names
  ASoC: SOF: Intel: pci-lnl: Change the topology path to
    intel/sof-ipc4-tplg

 sound/soc/sof/intel/pci-lnl.c |  2 +-
 sound/soc/sof/intel/pci-tgl.c | 64 +++++++++++++++++------------------
 2 files changed, 33 insertions(+), 33 deletions(-)

--
2.43.0

7 months agoALSA: seq: fix function cast warnings
Takashi Iwai [Tue, 13 Feb 2024 13:53:43 +0000 (14:53 +0100)]
ALSA: seq: fix function cast warnings

clang-16 points out a control flow integrity (kcfi) issue when event
callbacks get converted to incompatible types:

sound/core/seq/seq_midi.c:135:30: error: cast from 'int (*)(struct snd_rawmidi_substream *, const char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  135 |                 snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)dump_midi, substream);
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/seq/seq_virmidi.c:83:31: error: cast from 'int (*)(struct snd_rawmidi_substream *, const unsigned char *, int)' to 'snd_seq_dump_func_t' (aka 'int (*)(void *, void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   83 |                         snd_seq_dump_var_event(ev, (snd_seq_dump_func_t)snd_rawmidi_receive, vmidi->substream);
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For addressing those errors, introduce wrapper functions that are used
for callbacks and bridge to the actual function call with pointer
cast.

The code was originally added with the initial ALSA merge in linux-2.5.4.

[ the patch description shamelessly copied from Arnd's original patch
  -- tiwai ]

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213101020.459183-1-arnd@kernel.org
Link: https://lore.kernel.org/r/20240213135343.16411-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda: Add Lenovo Legion 7i gen7 sound quirk
Tomasz Kudela [Tue, 13 Feb 2024 11:56:14 +0000 (12:56 +0100)]
ALSA: hda: Add Lenovo Legion 7i gen7 sound quirk

Add sound support for the Legion 7i gen7 laptop (16IAX7).

Signed-off-by: Tomasz Kudela <ramzes005@gmail.com>
Link: https://lore.kernel.org/r/20240213115614.10420-1-ramzes005@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: SOF: IPC3: fix message bounds on ipc ops
Curtis Malainey [Tue, 13 Feb 2024 12:38:34 +0000 (14:38 +0200)]
ASoC: SOF: IPC3: fix message bounds on ipc ops

commit 74ad8ed65121 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
introduced a new allocation before the upper bounds check in
do_rx_work. As a result A DSP can cause bad allocations if spewing
garbage.

Fixes: 74ad8ed65121 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
Reported-by: Tim Van Patten <timvp@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213123834.4827-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: SOF: ipc4-pcm: Workaround for crashed firmware on system suspend
Peter Ujfalusi [Tue, 13 Feb 2024 11:52:33 +0000 (13:52 +0200)]
ASoC: SOF: ipc4-pcm: Workaround for crashed firmware on system suspend

When the system is suspended while audio is active, the
sof_ipc4_pcm_hw_free() is invoked to reset the pipelines since during
suspend the DSP is turned off, streams will be re-started after resume.

If the firmware crashes during while audio is running (or when we reset
the stream before suspend) then the sof_ipc4_set_multi_pipeline_state()
will fail with IPC error and the state change is interrupted.
This will cause misalignment between the kernel and firmware state on next
DSP boot resulting errors returned by firmware for IPC messages, eventually
failing the audio resume.
On stream close the errors are ignored so the kernel state will be
corrected on the next DSP boot, so the second boot after the DSP panic.

If sof_ipc4_trigger_pipelines() is called from sof_ipc4_pcm_hw_free() then
state parameter is SOF_IPC4_PIPE_RESET and only in this case.

Treat a forced pipeline reset similarly to how we treat a pcm_free by
ignoring error on state sending to allow the kernel's state to be
consistent with the state the firmware will have after the next boot.

Link: https://github.com/thesofproject/sof/issues/8721
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240213115233.15716-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: q6dsp: fix event handler prototype
Arnd Bergmann [Tue, 13 Feb 2024 10:10:46 +0000 (11:10 +0100)]
ASoC: q6dsp: fix event handler prototype

clang-16 points out a mismatch in function types that was hidden
by a typecast:

sound/soc/qcom/qdsp6/q6apm-dai.c:355:38: error: cast from 'void (*)(uint32_t, uint32_t, uint32_t *, void *)' (aka 'void (*)(unsigned int, unsigned int, unsigned int *, void *)') to 'q6apm_cb' (aka 'void (*)(unsigned int, unsigned int, void *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  355 |         prtd->graph = q6apm_graph_open(dev, (q6apm_cb)event_handler, prtd, graph_id);
sound/soc/qcom/qdsp6/q6apm-dai.c:499:38: error: cast from 'void (*)(uint32_t, uint32_t, uint32_t *, void *)' (aka 'void (*)(unsigned int, unsigned int, unsigned int *, void *)') to 'q6apm_cb' (aka 'void (*)(unsigned int, unsigned int, void *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  499 |         prtd->graph = q6apm_graph_open(dev, (q6apm_cb)event_handler_compr, prtd, graph_id);

The only difference here is the 'payload' argument, which is not even
used in this function, so just fix its type and remove the cast.

Fixes: 88b60bf047fd ("ASoC: q6dsp: q6apm-dai: Add open/free compress DAI callbacks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://msgid.link/r/20240213101105.459402-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: SOF: Intel: pci-lnl: Change the topology path to intel/sof-ipc4-tplg
Peter Ujfalusi [Tue, 13 Feb 2024 08:04:18 +0000 (10:04 +0200)]
ASoC: SOF: Intel: pci-lnl: Change the topology path to intel/sof-ipc4-tplg

The firmware release which going to introduce support for Lunar Lake will
use the documented default topology directory for IPC4:
intel/sof-ipc4-tplg

Change the default path accordingly before sof-bin (sof-firmware) release
includes Lunar Lake firmware and topologies.

Link: https://github.com/thesofproject/sof-docs/blob/master/getting_started/intel_debug/introduction.rst#2-topology-file
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@linux.intel.com>
Link: https://msgid.link/r/20240213080418.21256-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: SOF: Intel: pci-tgl: Change the default paths and firmware names
Peter Ujfalusi [Tue, 13 Feb 2024 08:04:17 +0000 (10:04 +0200)]
ASoC: SOF: Intel: pci-tgl: Change the default paths and firmware names

The currently used paths and firmware name reflects the reference firmware
convention:

default_fw_path:     intel/avs/{platform_name}
default_lib_path:    intel/avs-lib/{platform_name}
default_tplg_path:   intel/avs-tplg
default_fw_filename: dsp_basefw.bin

The SOF supports building the firmware for cAVS2.5 platforms using IPC4 and
it is the preferred IPC4 implementation to be used on these devices.

Change the paths and firmware names to reflect this:

default_fw_path:     intel/sof-ipc4/{platform_name}
default_lib_path:    intel/sof-ipc4-lib/{platform_name}
default_tplg_path:   intel/sof-ipc4-tplg
default_fw_filename: sof-{platform_name}.ri

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240213080418.21256-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoALSA: aw2: avoid casting function pointers
Arnd Bergmann [Tue, 13 Feb 2024 10:13:19 +0000 (11:13 +0100)]
ALSA: aw2: avoid casting function pointers

clang-16 started warning about incompatible function pointers here:

sound/pci/aw2/aw2-alsa.c:363:11: error: cast from 'void (*)(struct snd_pcm_substream *)' to 'snd_aw2_saa7146_it_cb' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  363 |                                                     (snd_aw2_saa7146_it_cb)
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~
  364 |                                                     snd_pcm_period_elapsed,
      |                                                     ~~~~~~~~~~~~~~~~~~~~~~
sound/pci/aw2/aw2-alsa.c:392:10: error: cast from 'void (*)(struct snd_pcm_substream *)' to 'snd_aw2_saa7146_it_cb' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  392 |                                                    (snd_aw2_saa7146_it_cb)
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~
  393 |                                                    snd_pcm_period_elapsed,
      |                                                    ~~~~~~~~~~~~~~~~~~~~~~

Add a forward declaration for struct snd_pcm_substrea to allow it to just
use the correct prototype.

Fixes: 98f2a97f207a ("[ALSA] Emagic Audiowerk 2 ALSA driver.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213101327.460191-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: ctxfi: avoid casting function pointers
Arnd Bergmann [Tue, 13 Feb 2024 10:12:46 +0000 (11:12 +0100)]
ALSA: ctxfi: avoid casting function pointers

This driver creates an abstraction for different components by casting function
pointers to slightly incompatible types for each one to get the correct
argument even when the caller does not know those types. This is a
bit unreliable and not allowed in combination with control flow integrity
(KCFI):

sound/pci/ctxfi/ctatc.c:115:25: error: cast from 'int (*)(struct hw *, struct src_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  115 |         [SRC]           = { .create     = (create_t)src_mgr_create,
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:116:20: error: cast from 'int (*)(struct src_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  116 |                             .destroy    = (destroy_t)src_mgr_destroy    },
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:117:27: error: cast from 'int (*)(struct hw *, struct srcimp_mgr **)' to 'create_t' (aka 'int (*)(struct hw *, void **)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  117 |         [SRCIMP]        = { .create     = (create_t)srcimp_mgr_create,
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/pci/ctxfi/ctatc.c:118:20: error: cast from 'int (*)(struct srcimp_mgr *)' to 'destroy_t' (aka 'int (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  118 |                             .destroy    = (destroy_t)srcimp_mgr_destroy },
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change these to always pass void pointers and move the abstraction one level
down.

Fixes: 8cc72361481f ("ALSA: SB X-Fi driver merge")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213101303.460008-1-arnd@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: amd: yc: Fix non-functional mic on Lenovo 82UU
Attila Tőkés [Sat, 10 Feb 2024 19:36:38 +0000 (21:36 +0200)]
ASoC: amd: yc: Fix non-functional mic on Lenovo 82UU

Like many other models, the Lenovo 82UU (Yoga Slim 7 Pro 14ARH7)
needs a quirk entry for the internal microphone to function.

Signed-off-by: Attila Tőkés <attitokes@gmail.com>
Link: https://msgid.link/r/20240210193638.144028-1-attitokes@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: rt5645: Add DMI quirk for inverted jack-detect on MeeGoPad T8
Hans de Goede [Sun, 11 Feb 2024 21:27:36 +0000 (22:27 +0100)]
ASoC: rt5645: Add DMI quirk for inverted jack-detect on MeeGoPad T8

The MeeGoPad T8 uses the standard rt5645 jd_mode=3 setting for jack-detect,
but the used jack connector outputs an inverted jack-detect signal.

Add a DMI quirk for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://msgid.link/r/20240211212736.179605-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: rt5645: Make LattePanda board DMI match more precise
Hans de Goede [Sun, 11 Feb 2024 21:27:35 +0000 (22:27 +0100)]
ASoC: rt5645: Make LattePanda board DMI match more precise

The DMI strings used for the LattePanda board DMI quirks are very generic.

Using the dmidecode database from https://linux-hardware.org/ shows
that the chosen DMI strings also match the following 2 laptops
which also have a rt5645 codec:

Insignia NS-P11W7100 https://linux-hardware.org/?computer=E092FFF8BA04
Insignia NS-P10W8100 https://linux-hardware.org/?computer=AFB6C0BF7934

All 4 hw revisions of the LattePanda board have "S70CR" in their BIOS
version DMI strings:

DF-BI-7-S70CR100-*
DF-BI-7-S70CR110-*
DF-BI-7-S70CR200-*
LP-BS-7-S70CR700-*

See e.g. https://linux-hardware.org/?computer=D98250A817C0

Add a partial (non exact) DMI match on this string to make the LattePanda
board DMI match more precise to avoid false-positive matches.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://msgid.link/r/20240211212736.179605-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoALSA: doc: Use DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:40 +0000 (16:51 +0100)]
ALSA: doc: Use DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for the example code.  This allows us to drop CONFIG_PM_SLEEP ifdefs.

While we're at it, expand the driver definition instead of passing
directly via .driver.pm field.  This seems to be a more common
pattern.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-30-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: via82xx: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:39 +0000 (16:51 +0100)]
ALSA: via82xx: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
state dumps even if it's not really used, but the code simplification
should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-29-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: sis7019: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:38 +0000 (16:51 +0100)]
ALSA: sis7019: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of all 4 pages no matter with
CONFIG_PM, but the code simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: rme96: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:37 +0000 (16:51 +0100)]
ALSA: rme96: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

The temporary buffers for PCM stream backups are conditionally
allocated since the sizes aren't too small.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-27-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: riptide: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:36 +0000 (16:51 +0100)]
ALSA: riptide: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with an additional allocation of a flag without
CONFIG_PM, but the code simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: maestro3: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:35 +0000 (16:51 +0100)]
ALSA: maestro3: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

The area for register dump is conditionally allocated instead of
ifdef now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: fm801: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:34 +0000 (16:51 +0100)]
ALSA: fm801: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: es1968: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:33 +0000 (16:51 +0100)]
ALSA: es1968: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: es1938: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:32 +0000 (16:51 +0100)]
ALSA: es1938: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: echoaudio: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:31 +0000 (16:51 +0100)]
ALSA: echoaudio: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of firmware caches if it's not really
used without CONFIG_PM, but the code simplification should justify the
cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: cs4281: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:30 +0000 (16:51 +0100)]
ALSA: cs4281: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: cmipci: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:29 +0000 (16:51 +0100)]
ALSA: cmipci: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: azt3328: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:28 +0000 (16:51 +0100)]
ALSA: azt3328: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: ali5451: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:27 +0000 (16:51 +0100)]
ALSA: ali5451: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
image even if it's not really used, but the code-simplification should
justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: ali5451: Embed suspend image into struct snd_ali
Takashi Iwai [Wed, 7 Feb 2024 15:51:26 +0000 (16:51 +0100)]
ALSA: ali5451: Embed suspend image into struct snd_ali

Instead of allocating the memory with an additional devm_kmalloc(),
just put the image into the existing struct snd_ali.  The allocation
size isn't too big, hence it works better with less allocation calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: at73c213: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:25 +0000 (16:51 +0100)]
ALSA: at73c213: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: pxa2xx-ac97: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:24 +0000 (16:51 +0100)]
ASoC: pxa2xx-ac97: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: pxa2xx-ac97: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:23 +0000 (16:51 +0100)]
ALSA: pxa2xx-ac97: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: aaci: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:22 +0000 (16:51 +0100)]
ALSA: aaci: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: aoa: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:21 +0000 (16:51 +0100)]
ALSA: aoa: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: nm256: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:20 +0000 (16:51 +0100)]
ALSA: nm256: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: intel8x0: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:19 +0000 (16:51 +0100)]
ALSA: intel8x0: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: ens137x: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:18 +0000 (16:51 +0100)]
ALSA: ens137x: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

For building properly, add the dummy functions for
snd_ak4531_suspend/resume() functions, too.

Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: atiixp: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:17 +0000 (16:51 +0100)]
ALSA: atiixp: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: als4000: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:16 +0000 (16:51 +0100)]
ALSA: als4000: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

For building properly, add the dummy functions for
snd_sbmixer_suspend/resume() functions, too.

Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: als300: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:15 +0000 (16:51 +0100)]
ALSA: als300: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: pcsp: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:14 +0000 (16:51 +0100)]
ALSA: pcsp: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: dummy: Replace with DEFINE_SIPMLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:13 +0000 (16:51 +0100)]
ALSA: dummy: Replace with DEFINE_SIPMLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: aloop: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Takashi Iwai [Wed, 7 Feb 2024 15:51:12 +0000 (16:51 +0100)]
ALSA: aloop: Replace with DEFINE_SIMPLE_DEV_PM_OPS()

Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT
Mark Brown [Mon, 12 Feb 2024 01:11:19 +0000 (01:11 +0000)]
ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT

Merge series from Hans de Goede <hdegoede@redhat.com>:

While testing 6.8 on a Bay Trail device with a ALC5640 codec
I noticed a regression in 6.8 which causes a NULL pointer deref
in probe().

All BYT/CHT Intel machine drivers are affected. Patch 1/2 of
this series fixes all of them.

Patch 2/2 adds some small cleanups to cht_bsw_rt5645.c for
issues which I noticed while working on 1/2.

7 months agoASoC: SOF: amd: Fix locking in ACP IRQ handler
Cristian Ciocaltea [Thu, 8 Feb 2024 23:43:14 +0000 (01:43 +0200)]
ASoC: SOF: amd: Fix locking in ACP IRQ handler

A recent change in acp_irq_thread() was meant to address a potential race
condition while trying to acquire the hardware semaphore responsible for
the synchronization between firmware and host IPC interrupts.

This resulted in an improper use of the IPC spinlock, causing normal
kernel memory allocations (which may sleep) inside atomic contexts:

1707255557.133976 kernel: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:315

...

1707255557.134757 kernel:  sof_ipc3_rx_msg+0x70/0x130 [snd_sof]
1707255557.134793 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
1707255557.134855 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]
1707255557.134904 kernel:  ? irq_thread+0xb5/0x1e0
1707255557.134947 kernel:  ? __pfx_irq_thread_fn+0x10/0x10
1707255557.134985 kernel:  irq_thread_fn+0x23/0x60

Moreover, there are attempts to lock a mutex from the same atomic
context:

1707255557.136357 kernel: =============================
1707255557.136393 kernel: [ BUG: Invalid wait context ]
1707255557.136413 kernel: 6.8.0-rc3-next-20240206-audio-next #9 Tainted: G        W
1707255557.136432 kernel: -----------------------------
1707255557.136451 kernel: irq/66-AudioDSP/502 is trying to lock:
1707255557.136470 kernel: ffff965152f26af8 (&sb->s_type->i_mutex_key#2){+.+.}-{3:3}, at: start_creating.part.0+0x5f/0x180

...

1707255557.137429 kernel:  start_creating.part.0+0x5f/0x180
1707255557.137457 kernel:  __debugfs_create_file+0x61/0x210
1707255557.137475 kernel:  snd_sof_debugfs_io_item+0x75/0xc0 [snd_sof]
1707255557.137494 kernel:  sof_ipc3_do_rx_work+0x7cf/0x9f0 [snd_sof]
1707255557.137513 kernel:  sof_ipc3_rx_msg+0xb3/0x130 [snd_sof]
1707255557.137532 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
1707255557.137551 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]

Fix the issues by reducing the lock scope in acp_irq_thread(), so that
it guards only the hardware semaphore acquiring attempt.  Additionally,
restore the initial locking in acp_sof_ipc_irq_thread() to synchronize
the handling of immediate replies from DSP core.

Fixes: 802134c8c2c8 ("ASoC: SOF: amd: Refactor spinlock_irq(&sdev->ipc_lock) sequence in irq_handler")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20240208234315.2182048-1-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
Alexey Khoroshilov [Sun, 11 Feb 2024 09:58:34 +0000 (12:58 +0300)]
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()

There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex
is left locked forever. That may lead to deadlock
when rt5645_jack_detect_work() is called for the second time.

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

Fixes: cdba4301adda ("ASoC: rt5650: add mutex to avoid the jack detection failure")
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Link: https://lore.kernel.org/r/1707645514-21196-1-git-send-email-khoroshilov@ispras.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: Intel: cht_bsw_rt5645: Cleanup codec_name handling
Hans de Goede [Sat, 10 Feb 2024 13:44:00 +0000 (14:44 +0100)]
ASoC: Intel: cht_bsw_rt5645: Cleanup codec_name handling

4 fixes / cleanups to the rt5645 mc driver's codec_name handling:

1. In the for loop looking for the dai_index for the codec, replace
card->dai_link[i] with cht_dailink[i]. The for loop already uses
ARRAY_SIZE(cht_dailink) as bound and card->dai_link is just a pointer to
cht_dailink using card->dai_link only obfuscates that cht_dailink is being
modified directly rather then say a copy of cht_dailink. Using
cht_dailink[i] also makes the code consistent with other machine drivers.

2. Don't set cht_dailink[dai_index].codecs->name in the for loop,
this immediately gets overridden using acpi_dev_name(adev) directly
below the loop.

3. Add a missing break to the loop.

4. Remove the now no longer used (only set, never read) codec_name field
from struct cht_mc_private.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT boards
Hans de Goede [Sat, 10 Feb 2024 13:43:59 +0000 (14:43 +0100)]
ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT boards

Since commit 13f58267cda3 ("ASoC: soc.h: don't create dummy Component
via COMP_DUMMY()") dummy snd_soc_dai_link.codecs entries no longer
have a name set.

This means that when looking for the codec dai_link the machine
driver can no longer unconditionally run strcmp() on
snd_soc_dai_link.codecs[0].name since this may now be NULL.

Add a check for snd_soc_dai_link.codecs[0].name being NULL to all
BYT/CHT machine drivers to avoid NULL pointer dereferences in
their probe() methods.

Fixes: 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: cs35l56: Remove default from IRQ1_CFG register
Richard Fitzgerald [Fri, 9 Feb 2024 14:57:00 +0000 (14:57 +0000)]
ASoC: cs35l56: Remove default from IRQ1_CFG register

The driver never uses the IRQ1_CFG register so there's no need to provide
a default value. It's set as a readable register only for debugging
through the regmap registers file.

A system-specific firmware could overwrite this register with a non-default
value. Therefore the driver can't hardcode what the initial value actually
is. As the register is only for debugging the value can be left unknown
until someone wants to read it through debugfs.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240209145700.1555950-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoALSA: virtio: add support for audio controls
Anton Yakovlev [Mon, 15 Jan 2024 13:36:54 +0000 (14:36 +0100)]
ALSA: virtio: add support for audio controls

Implementation of support for audio controls in accordance with the
extension of the virtio sound device specification [1] planned for
virtio-v1.3-cs01.

The device can announce the VIRTIO_SND_F_CTLS feature. If the feature is
negotiated, then an additional field appears in the configuration space:

  struct virtio_snd_config {
    ...
    /* number of available control elements */
    __le32 controls;
  };

The driver can send the following requests to manage audio controls:

  enum {
    ...
    /* control element request types */
    VIRTIO_SND_R_CTL_INFO = 0x0300,
    VIRTIO_SND_R_CTL_ENUM_ITEMS,
    VIRTIO_SND_R_CTL_READ,
    VIRTIO_SND_R_CTL_WRITE,
    VIRTIO_SND_R_CTL_TLV_READ,
    VIRTIO_SND_R_CTL_TLV_WRITE,
    VIRTIO_SND_R_CTL_TLV_COMMAND,
    ...
  };

And the device can send the following audio control event notification:

  enum {
    ...
    /* control element event types */
    VIRTIO_SND_EVT_CTL_NOTIFY = 0x1200,
    ...
  };

See additional details in [1].

[1] https://lists.oasis-open.org/archives/virtio-comment/202104/msg00013.html

Signed-off-by: Anton Yakovlev <anton.yakovlev@opensynergy.com>
Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@opensynergy.com>
Link: https://lore.kernel.org/r/20240115133654.576068-2-aiswarya.cyriac@opensynergy.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/cs35l56: select intended config FW_CS_DSP
Lukas Bulwahn [Fri, 9 Feb 2024 08:20:44 +0000 (09:20 +0100)]
ALSA: hda/cs35l56: select intended config FW_CS_DSP

Commit 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic
CS35L56 amplifier") adds configs SND_HDA_SCODEC_CS35L56_{I2C,SPI},
which selects the non-existing config CS_DSP. Note the renaming in
commit d7cfdf17cb9d ("firmware: cs_dsp: Rename KConfig symbol CS_DSP ->
FW_CS_DSP"), though.

Select the intended config FW_CS_DSP.

This broken select command probably was not noticed as the configs also
select SND_HDA_CS_DSP_CONTROLS and this then selects FW_CS_DSP. So, the
select FW_CS_DSP could actually be dropped, but we will keep this
redundancy in place as the author originally also intended to have this
redundancy of selects in place.

Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Reviewed-by: Simon Trimmer <simont@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240209082044.3981-1-lukas.bulwahn@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: hda/realtek: Add "Intel Reference board" SSID in the ALC256.
Sayed, Karimuddin [Thu, 8 Feb 2024 16:39:04 +0000 (10:39 -0600)]
ALSA: hda/realtek: Add "Intel Reference board" SSID in the ALC256.

Add "Intel Reference board" SSID in the alc256.
Enable "power saving mode" and Enable "headset jack mode".

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Sayed, Karimuddin <karimuddin.sayed@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208163904.92977-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoALSA: HDA: intel-sdw-acpi: add kernel parameter to select alternate controller
Pierre-Louis Bossart [Thu, 8 Feb 2024 16:37:50 +0000 (10:37 -0600)]
ALSA: HDA: intel-sdw-acpi: add kernel parameter to select alternate controller

Existing DSDT or SSDT platforms hard-code clock and frame shape
configurations. For validation, we'd like to use alternate
configurations. It's not always possible to generate new tables due to
missing symbols, and modifying existing objects usually leads to
AE_OBJECT_EXIST errors.

The mechanism suggested in this patch is to add a NEW ACPI controller
device with a different _ADR value. e.g.

 Scope (_SB_.PC00.RP08.PXSX.HDAS) {

   Device (SDWP)
            {
                Name (_ADR, 0x40000001)  // _ADR: Address

The desired _ADR can be passed as a parameter with

options snd-intel-sdw-acpi sdw_ctrl_addr=0x40000001

This solution leads to minimal tables with just what the developers or
validation engineers need, and without overriding any of the existing
firmware definitions. It's consistent with the recommendation to
extend ACPI definitions and not redefine them with a risk of conflict.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240208163750.92849-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
7 months agoASoC: SOF: ipc3-topology: Fix pipeline tear down logic
Ranjani Sridharan [Thu, 8 Feb 2024 13:34:32 +0000 (15:34 +0200)]
ASoC: SOF: ipc3-topology: Fix pipeline tear down logic

With the change in the widget free logic to power down the cores only
when the scheduler widgets are freed, we need to ensure that the
scheduler widget is freed only after all the widgets associated with the
scheduler are freed. This is to ensure that the secondary core that the
scheduler is scheduled to run on is kept powered on until all widgets
that need them are in use. While this works well for dynamic pipelines,
in the case of static pipelines the current logic does not take this into
account and frees all widgets in the order they occur in the
widget_list. So, modify this to ensure that the scheduler widgets are freed
only after all other types of widgets in the widget_list are freed.

Link: https://github.com/thesofproject/linux/issues/4807
Fixes: 31ed8da1c8e5 ("ASoC: SOF: sof-audio: Modify logic for enabling/disabling topology cores")
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20240208133432.1688-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: cs35l56: Fix deadlock in ASP1 mixer register initialization
Richard Fitzgerald [Thu, 8 Feb 2024 12:37:42 +0000 (12:37 +0000)]
ASoC: cs35l56: Fix deadlock in ASP1 mixer register initialization

Rewrite the handling of ASP1 TX mixer mux initialization to prevent a
deadlock during component_remove().

The firmware can overwrite the ASP1 TX mixer registers with
system-specific settings. This is mainly for hardware that uses the
ASP as a chip-to-chip link controlled by the firmware. Because of this
the driver cannot know the starting state of the ASP1 mixer muxes until
the firmware has been downloaded and rebooted.

The original workaround for this was to queue a work function from the
dsp_work() job. This work then read the register values (populating the
regmap cache the first time around) and then called
snd_soc_dapm_mux_update_power(). The problem with this is that it was
ultimately triggered by cs35l56_component_probe() queueing dsp_work,
which meant that it would be running in parallel with the rest of the
ASoC component and card initialization. To prevent accessing DAPM before
it was fully initialized the work function took the card mutex. But this
would deadlock if cs35l56_component_remove() was called before the work job
had completed, because ASoC calls component_remove() with the card mutex
held.

This new version removes the work function. Instead the regmap cache and
DAPM mux widgets are initialized the first time any of the associated ALSA
controls is read or written.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 07f7d6e7a124 ("ASoC: cs35l56: Fix for initializing ASP1 mixer registers")
Link: https://lore.kernel.org/r/20240208123742.1278104-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: Intel: avs: Fix dynamic port assignment when TDM is set
Amadeusz Sławiński [Wed, 7 Feb 2024 11:26:24 +0000 (12:26 +0100)]
ASoC: Intel: avs: Fix dynamic port assignment when TDM is set

In case TDM is set in topology on SSP0, parser will overwrite vindex
value, because it only checks if port is set. Fix this by checking whole
field value.

Fixes: e6d50e474e45 ("ASoC: Intel: avs: Improve topology parsing of dynamic strings")
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20240207112624.2132821-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: cs42l43: Add system suspend ops to disable IRQ
Charles Keepax [Tue, 6 Feb 2024 11:38:50 +0000 (11:38 +0000)]
ASoC: cs42l43: Add system suspend ops to disable IRQ

The IRQ should be disabled whilst entering and exiting system suspend to
avoid the IRQ handler being called whilst the PM runtime is disabled.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240206113850.719888-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: cs42l43: Handle error from devm_pm_runtime_enable
Charles Keepax [Tue, 6 Feb 2024 11:38:49 +0000 (11:38 +0000)]
ASoC: cs42l43: Handle error from devm_pm_runtime_enable

As devm_pm_runtime_enable can fail due to memory allocations, it is
best to handle the error.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240206113850.719888-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: amd: yc: Add DMI quirk for Lenovo Ideapad Pro 5 16ARP8
Mario Limonciello [Mon, 5 Feb 2024 21:48:53 +0000 (15:48 -0600)]
ASoC: amd: yc: Add DMI quirk for Lenovo Ideapad Pro 5 16ARP8

The laptop requires a quirk ID to enable its internal microphone. Add
it to the DMI quirk table.

Reported-by: Stanislav Petrov <stanislav.i.petrov@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=216925
Cc: stable@vger.kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20240205214853.2689-1-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: tas2781: add module parameter to tascodec_init()
Gergo Koteles [Sun, 4 Feb 2024 20:01:17 +0000 (21:01 +0100)]
ASoC: tas2781: add module parameter to tascodec_init()

The tascodec_init() of the snd-soc-tas2781-comlib module is called from
snd-soc-tas2781-i2c and snd-hda-scodec-tas2781-i2c modules. It calls
request_firmware_nowait() with parameter THIS_MODULE and a cont/callback
from the latter modules.

The latter modules can be removed while their callbacks are running,
resulting in a general protection failure.

Add module parameter to tascodec_init() so request_firmware_nowait() can
be called with the module of the callback.

Fixes: ef3bcde75d06 ("ASoC: tas2781: Add tas2781 driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/118dad922cef50525e5aab09badef2fa0eb796e5.1707076603.git.soyer@irl.hu
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: Intel: avs: Fix pci_probe() error path
Cezary Rojewski [Fri, 2 Feb 2024 11:49:01 +0000 (12:49 +0100)]
ASoC: Intel: avs: Fix pci_probe() error path

Recent changes modified operation-order in the probe() function without
updating its error path accordingly. If snd_hdac_i915_init() exists with
status EPROBE_DEFER the error path must cleanup allocated IRQs before
leaving the scope.

Fixes: 2dddc514b6e4 ("ASoC: Intel: avs: Move snd_hdac_i915_init to before probe_work.")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20240202114901.1002127-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
7 months agoASoC: dt-bindings: google,sc7280-herobrine: Drop bouncing @codeaurora
Jeffrey Hugo [Fri, 2 Feb 2024 17:43:13 +0000 (10:43 -0700)]
ASoC: dt-bindings: google,sc7280-herobrine: Drop bouncing @codeaurora

The servers for the @codeaurora domain have long been retired and any
messages sent there bounce.  Srinivasa Rao Mandadapu has left the
company and there does not appear to be an updated address to suggest,
so drop Srinivasa as maintainer of the binding.  The binding still
appears to be maintined as Judy is listed.

Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240202174313.4113670-1-quic_jhugo@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>