platform/kernel/linux-starfive.git
11 months agoALSA: hda/realtek: Fix spelling mistake "powe" -> "power"
Colin Ian King [Mon, 21 Aug 2023 08:00:03 +0000 (09:00 +0100)]
ALSA: hda/realtek: Fix spelling mistake "powe" -> "power"

There is a spelling mistake in a quirk entry. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://lore.kernel.org/r/20230821080003.16678-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: asihpi: Remove unused declarations
Yue Haibing [Fri, 18 Aug 2023 12:48:52 +0000 (20:48 +0800)]
ALSA: asihpi: Remove unused declarations

These are not implemented, so can remove them.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20230818124852.51468-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcm: Drop obsoleted PCM copy_user and copy_kernel ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:36 +0000 (21:01 +0200)]
ALSA: pcm: Drop obsoleted PCM copy_user and copy_kernel ops

Finally all users have been converted to the new PCM copy ops, let's
drop the obsoleted copy_kernel and copy_user ops completely.

Link: https://lore.kernel.org/r/20230815190136.8987-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: pcm: Drop obsoleted PCM copy_user ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:35 +0000 (21:01 +0200)]
ASoC: pcm: Drop obsoleted PCM copy_user ops

Now all ASoC users have been replaced to use the new PCM copy ops,
let's drop the obsoleted copy_user ops and its helper function.

Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230815190136.8987-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: doc: Update description for the new PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:34 +0000 (21:01 +0200)]
ALSA: doc: Update description for the new PCM copy ops

Update the documentation about the PCM copy callbacks.
The update was kept minimalistic, just correcting the use of copy_user
ops with the single copy ops, and drop/update the text mentioning the
copy_kernel.

Link: https://lore.kernel.org/r/20230815190136.8987-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: dmaengine: Use iov_iter for process callback, too
Takashi Iwai [Tue, 15 Aug 2023 19:01:33 +0000 (21:01 +0200)]
ASoC: dmaengine: Use iov_iter for process callback, too

Along with the conversion to PCM copy ops, use the iov_iter for the
pointer to be passed to the dmaengine process callback, too.  It
avoids the direct reference of iter_iov_addr(), and it can potentially
help for the drivers to access memory properly (although both atmel
and stm drivers don't use the given buffer address at all for now).

Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Olivier Moysan <olivier.moysan@foss.st.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Link: https://lore.kernel.org/r/20230815190136.8987-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: dmaengine: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:32 +0000 (21:01 +0200)]
ASoC: dmaengine: Convert to generic PCM copy ops

This patch converts the ASoC dmaenging driver code to use the new
unified PCM copy callback.  It's a straightforward conversion from
*_user() to *_iter() variants.

The process callback is still using the direct pointer as of now, but
it'll be converted in the next patch.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20230815190136.8987-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: qcom: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:31 +0000 (21:01 +0200)]
ASoC: qcom: Convert to generic PCM copy ops

This patch converts the qcom lpass driver code to use the new unified
PCM copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Banajit Goswami <bgoswami@quicinc.com>
Link: https://lore.kernel.org/r/20230815190136.8987-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: mediatek: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:30 +0000 (21:01 +0200)]
ASoC: mediatek: Convert to generic PCM copy ops

This patch converts the mediatek BT SCO driver code to use the new
unified PCM copy callback.  It's a straightforward conversion from
*_user() to *_iter() variants.  As copy_form/to_iter() updates the
internal offset at each read/write, we can drop the cur_*_idx counter
in the loop, too.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230815190136.8987-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoASoC: component: Add generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:29 +0000 (21:01 +0200)]
ASoC: component: Add generic PCM copy ops

For following the ALSA PCM core change, a new PCM copy ops is added
toe ASoC component framework: snd_soc_component_driver receives the
copy ops, and snd_soc_pcm_component_copy() helper is provided.

This also fixes a long-standing potential bug where the ASoC driver
covers only copy_user PCM callback and misses the copy from kernel
pointers (such as OSS PCM layer), too.

As of this patch, the old copy_user is still kept, but it'll be
dropped later after all drivers are converted.

Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230815190136.8987-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agomedia: solo6x10: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:28 +0000 (21:01 +0200)]
media: solo6x10: Convert to generic PCM copy ops

This patch converts the solo6x10 driver code to use the new unified
PCM copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.  As copy_to_iter() updates the internal offest at
each write, we can drop the dst counter update in the loop, too.

Note that copy_to_iter() returns the copied bytes, hence the error
condition is adjusted accordingly.

Acked-by: Ismael Luceno <ismael@iodev.co.uk>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
Cc: Anton Sviridenko <anton@corp.bluecherry.net>
Cc: Andrey Utkin <andrey_utkin@fastmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Link: https://lore.kernel.org/r/20230815190136.8987-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcmtest: Update comment about PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:27 +0000 (21:01 +0200)]
ALSA: pcmtest: Update comment about PCM copy ops

Just an update of a comment mentioning the old PCM callbacks to
correct to the new PCM copy ops.

Link: https://lore.kernel.org/r/20230815190136.8987-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: xen: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:26 +0000 (21:01 +0200)]
ALSA: xen: Convert to generic PCM copy ops

This patch converts the xen frontend driver code to use the new
unified PCM copy callback.  It's a straightforward conversion from
*_user() to *_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: xen-devel@lists.xenproject.org
Link: https://lore.kernel.org/r/20230815190136.8987-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: sh: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:25 +0000 (21:01 +0200)]
ALSA: sh: Convert to generic PCM copy ops

This patch converts the sh_dac_audio driver code to use the new
unified PCM copy callback.  It's a straightforward conversion from
*_user() to *_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: rme9652: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:24 +0000 (21:01 +0200)]
ALSA: rme9652: Convert to generic PCM copy ops

This patch converts the rme9652 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hdsp: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:23 +0000 (21:01 +0200)]
ALSA: hdsp: Convert to generic PCM copy ops

This patch converts the hdsp driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: rme96: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:22 +0000 (21:01 +0200)]
ALSA: rme96: Convert to generic PCM copy ops

This patch converts the rme96 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: rme32: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:21 +0000 (21:01 +0200)]
ALSA: rme32: Convert to generic PCM copy ops

This patch converts the rme32 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: nm256: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:20 +0000 (21:01 +0200)]
ALSA: nm256: Convert to generic PCM copy ops

This patch converts the nm256 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Link: https://lore.kernel.org/r/20230815190136.8987-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: korg1212: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:19 +0000 (21:01 +0200)]
ALSA: korg1212: Convert to generic PCM copy ops

This patch converts the korg1212 driver code to use the new unified
PCM copy callback.  The open-coded conditional memory copies are
replaced with simpler copy_from/to_iter() calls.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: es1938: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:18 +0000 (21:01 +0200)]
ALSA: es1938: Convert to generic PCM copy ops

This patch converts the es1938 driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants in most parts.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: emu8000: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:17 +0000 (21:01 +0200)]
ALSA: emu8000: Convert to generic PCM copy ops

This patch converts the SB Emu8000 driver code to use the new unified
PCM copy callback.  The conversion is a bit complicated because of
many open code in emu8000_pcm.c.  GET_VAL() and LOOP_WRITE() macros
were rewritten / simplified with copy_from_iter().  As
copy_from_iter() updates the internal offset value, we can drop the
corresponding part, too.

Link: https://lore.kernel.org/r/20230815190136.8987-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: gus: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:16 +0000 (21:01 +0200)]
ALSA: gus: Convert to generic PCM copy ops

This patch converts the GUS driver code to use the new unified PCM
copy callback.  It's a straightforward conversion from *_user() to
*_iter() variants.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: dummy: Convert to generic PCM copy ops
Takashi Iwai [Tue, 15 Aug 2023 19:01:15 +0000 (21:01 +0200)]
ALSA: dummy: Convert to generic PCM copy ops

This patch converts the dummy driver code to use the new unified PCM
copy callback.  As dummy driver doesn't do anything in the callback,
it's just a simple replacement.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230815190136.8987-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: core: Add memory copy helpers between iov_iter and iomem
Takashi Iwai [Tue, 15 Aug 2023 19:01:14 +0000 (21:01 +0200)]
ALSA: core: Add memory copy helpers between iov_iter and iomem

Add two more helpers for copying memory between iov_iter and iomem,
which will be used by the new PCM copy ops in a few drivers.
The existing helpers became wrappers of those now.

Note that copy_from/to_iter() returns the copied bytes, hence the
error condition is adjusted accordingly.

Link: https://lore.kernel.org/r/20230815190136.8987-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcm: Add copy ops with iov_iter
Takashi Iwai [Tue, 15 Aug 2023 19:01:13 +0000 (21:01 +0200)]
ALSA: pcm: Add copy ops with iov_iter

iov_iter is a universal interface to copy the data chunk from/to
user-space and kernel in a unified manner.  This API can fit for ALSA
PCM copy ops, too; we had to split to copy_user and copy_kernel in the
past, and those can be unified to a single ops with iov_iter.

This patch adds a new PCM copy ops that passes iov_iter for copying
both kernel and user-space in the same way.  This patch touches only
the ALSA PCM core part, and the actual users will be replaced in the
following patches.

The expansion of iov_iter is done in the PCM core right before calling
each copy callback.  It's a bit suboptimal, but I took this now as
it's the most straightforward replacement.  The more conversion to
iov_iter in the caller side is a TODO for future.

As of now, the old copy_user and copy_kernel ops are still kept.
Once after all users are converted, we'll drop the old copy_user and
copy_kernel ops, too.

Link: https://lore.kernel.org/r/20230815190136.8987-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoiov_iter: Export import_ubuf()
Takashi Iwai [Tue, 15 Aug 2023 19:01:12 +0000 (21:01 +0200)]
iov_iter: Export import_ubuf()

Export import_ubuf() to be used in sound subsystem for generic memory
handling as Linus suggested.  It's used for constructing an iov_iter
of a single segment user-space copy for PCM data.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Link: https://lore.kernel.org/r/CAHk-=wh-mUL6mp4chAc6E_UjwpPLyCPRCJK+iB4ZMD2BqjwGHA@mail.gmail.com
Link: https://lore.kernel.org/r/20230815190136.8987-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/tas2781: Add tas2781 HDA driver
Shenghao Ding [Fri, 18 Aug 2023 08:58:36 +0000 (16:58 +0800)]
ALSA: hda/tas2781: Add tas2781 HDA driver

Create tas2781 side codec HDA driver for Lenovo Laptops. The quantity
of the speakers has been define in ACPI. All of the tas2781s in the
laptop will be aggregated as one audio speaker. The code supports
realtek codec as the primary codec. Code offers several controls for
digtial/analog gain setting during playback, and other for eq params
setting in case of different audio profiles, such as music, voice,
movie, etc.

[ adjusted patch to be applied to the latest for-next branch -- tiwai ]

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://lore.kernel.org/r/20230818085836.1442-2-shenghao-ding@ti.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/tas2781: Add tas2781 HDA driver
Shenghao Ding [Fri, 18 Aug 2023 08:58:35 +0000 (16:58 +0800)]
ALSA: hda/tas2781: Add tas2781 HDA driver

Integrate tas2781 configs for Lenovo Laptops. All of the tas2781s in the
laptop will be aggregated as one audio device. The code support realtek
as the primary codec. Rename "struct cs35l41_dev_name" to
"struct scodec_dev_name" for all other side codecs instead of the certain
one.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://lore.kernel.org/r/20230818085836.1442-1-shenghao-ding@ti.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: Make SND_PCMTEST depend on DEBUG_FS
Ruan Jinjie [Thu, 17 Aug 2023 09:37:39 +0000 (17:37 +0800)]
ALSA: Make SND_PCMTEST depend on DEBUG_FS

Since pcmtest is a test module that manipulates or gets
notification via debugfs, without DEBUG_FS it can not work fine.
So make SND_PCMTEST depend on DEBUG_FS.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Acked-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230817093740.1732738-1-ruanjinjie@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: aoa: Fix typos in PCM fix patch
Takashi Iwai [Fri, 18 Aug 2023 07:09:13 +0000 (09:09 +0200)]
ALSA: aoa: Fix typos in PCM fix patch

There was typos in the previous fix for PCM to detach the struct
device that caused build errors.  Corrected here.

Fixes: bc41a7228ced ("ALSA: pcm: Don't embed device")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308181347.q3XPr3Lm-lkp@intel.com/
Link: https://lore.kernel.org/r/20230818070913.23336-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: core: Drop snd_device_initialize()
Takashi Iwai [Wed, 16 Aug 2023 16:02:52 +0000 (18:02 +0200)]
ALSA: core: Drop snd_device_initialize()

Now all users of snd_device_intialize() are gone, let's drop it.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: seq: Create device with snd_device_alloc()
Takashi Iwai [Wed, 16 Aug 2023 16:02:51 +0000 (18:02 +0200)]
ALSA: seq: Create device with snd_device_alloc()

Align with the other components, and use snd_device_alloc() for the
new sound device for sequencer, too.  No functional changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: timer: Create device with snd_device_alloc()
Takashi Iwai [Wed, 16 Aug 2023 16:02:50 +0000 (18:02 +0200)]
ALSA: timer: Create device with snd_device_alloc()

Align with the other components, and use snd_device_alloc() for the
new sound device for timer, too.  No functional changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: compress: Don't embed device
Takashi Iwai [Wed, 16 Aug 2023 16:02:49 +0000 (18:02 +0200)]
ALSA: compress: Don't embed device

Embedding the struct device to snd_compr object may result in UAF when
the delayed kobj release is used.  Like other devices, let's detach
the struct device from the snd_compr by allocating dynamically via
snd_device_alloc().

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: rawmidi: Don't embed device
Takashi Iwai [Wed, 16 Aug 2023 16:02:48 +0000 (18:02 +0200)]
ALSA: rawmidi: Don't embed device

This patch detaches the struct device from the snd_rawmidi object by
allocating via snd_device_alloc(), just like done for other devices.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hwdep: Don't embed device
Takashi Iwai [Wed, 16 Aug 2023 16:02:47 +0000 (18:02 +0200)]
ALSA: hwdep: Don't embed device

Like control and PCM devices, it's better to avoid the embedded struct
device for hwdep (although it's more or less well working), too.
Change it to allocate via snd_device_alloc(), and free the memory at
the common snd_hwdep_free().

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcm: Don't embed device
Takashi Iwai [Wed, 16 Aug 2023 16:02:46 +0000 (18:02 +0200)]
ALSA: pcm: Don't embed device

So far we use the embedded struct device for each PCM substreams in
struct snd_pcm.  This may result in UAF when the delayed kobj release
is used; each corresponding struct device is still accessed at the
(delayed) device release, while the snd_pcm object may be already
gone.

As a workaround, detach the struct device from the snd_pcm object by
allocating via the new snd_device_alloc() helper.

A caveat is that we store the PCM substream pointer to drvdata since
the device resume and others require the access to it.

This patch is based on the fix Curtis posted initially.  In this
patch, the changes are split and use the new helper function instead.

Link: https://lore.kernel.org/r/20230801171928.1460120-1-cujomalainey@chromium.org
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: control: Don't embed ctl_dev
Takashi Iwai [Wed, 16 Aug 2023 16:02:45 +0000 (18:02 +0200)]
ALSA: control: Don't embed ctl_dev

Embedding the ctl_dev in the snd_card object may result in UAF when
the delayed kobj release is used; at the delayed kobj release, it
still accesses the struct device itself while the card memory (that
embeds the struct device) may be already gone.

As a workaround, detach the struct device from the card object by
allocating via the new snd_device_alloc() helper.  The rest are just
replacing ctl_dev access to the pointer.

This is based on the fix Curtis posted initially.  In this patch, the
changes are split and use the new helper function instead.

Link: https://lore.kernel.org/r/20230801171928.1460120-1-cujomalainey@chromium.org
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: core: Introduce snd_device_alloc()
Takashi Iwai [Wed, 16 Aug 2023 16:02:44 +0000 (18:02 +0200)]
ALSA: core: Introduce snd_device_alloc()

Introduce a new helper, snd_device_alloc(), for allocating a struct
device that is bound with the sound class.  It's a replacement of
snd_device_initialize().

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Tested-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20230816160252.23396-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: cs35l41: change cs35l41_prop_model to static
Yang Yingliang [Thu, 17 Aug 2023 01:42:52 +0000 (09:42 +0800)]
ALSA: hda: cs35l41: change cs35l41_prop_model to static

cs35l41_prop_model is only used in cs35l41_hda_property.c now,
change it to static.

Fixes: ef4ba63f12b0 ("ALSA: hda: cs35l41: Support systems with missing _DSD properties")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230817014252.1511232-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: intel-dsp-cfg: Add Chromebook quirk to ADL/RPL
Brady Norander [Tue, 15 Aug 2023 13:52:46 +0000 (09:52 -0400)]
ALSA: hda: intel-dsp-cfg: Add Chromebook quirk to ADL/RPL

AlderLake and RaptorLake Chromebooks currently use the HDA driver by
default. Add a quirk to use the SOF driver on these platforms, which is
needed for functional internal audio.

Signed-off-by: Brady Norander <bradynorander@gmail.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/ZNuDLk5hgmfKrZg6@arch
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: cs35l41: Fix the loop check in cs35l41_add_dsd_properties
Takashi Iwai [Wed, 16 Aug 2023 06:35:25 +0000 (08:35 +0200)]
ALSA: hda: cs35l41: Fix the loop check in cs35l41_add_dsd_properties

model->hid is a pointer, and should be rather NULL-checked in the loop
of cs35l41_prop_model_table.

Fixes: ef4ba63f12b0 ("ALSA: hda: cs35l41: Support systems with missing _DSD properties")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308160506.8lCEeFDG-lkp@intel.com/
Link: https://lore.kernel.org/r/20230816063525.23009-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: cs35l41: Support systems with missing _DSD properties
Stefan Binding [Tue, 15 Aug 2023 16:10:33 +0000 (17:10 +0100)]
ALSA: hda: cs35l41: Support systems with missing _DSD properties

Some systems using CS35L41 with HDA were released without some
required _DSD properties in ACPI. To support these special cases,
add an api to configure the correct properties for systems with
this issue.

This initial commit moves the no _DSD support for Lenovo
Legion Laptops (CLSA0100, CLSA0101) into a new framework which
can be extended to support additional laptops in the future.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230815161033.3519-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: dice: add stream format parameters for Weiss devices
Takashi Sakamoto [Wed, 9 Aug 2023 00:26:31 +0000 (09:26 +0900)]
ALSA: dice: add stream format parameters for Weiss devices

Hard-coded stream format parameters are added for Weiss Engineering
FireWire devices. When the device vendor and model match, the parameters
are copied into the stream format cache. This allows for setting all
supported sampling rates up to 192kHz, and consequently adjusting the
number of available I/O channels.

Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230809002631.750120-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/tegra: refactor deprecated strncpy
Justin Stitt [Mon, 7 Aug 2023 17:49:28 +0000 (17:49 +0000)]
ALSA: hda/tegra: refactor deprecated strncpy

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ the case for `strncpy`!

It should be noted that the current implementation is unlikely to have a
bug because `drv_name` is a string literal with a size of 9 while
`card->driver` has a size of 16. However, it is probably worthwhile to
switch to a more robust and less ambiguous interface.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230807-sound-pci-hda-v1-1-6d9cdcd085ca@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: info: Remove unused function declarations
Yue Haibing [Mon, 7 Aug 2023 14:15:13 +0000 (22:15 +0800)]
ALSA: info: Remove unused function declarations

These declarations is never used since beginning of git history.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20230807141513.31440-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcmtest: Remove redundant definitions
Ivan Orlov [Fri, 4 Aug 2023 11:07:40 +0000 (15:07 +0400)]
ALSA: pcmtest: Remove redundant definitions

Remove redundant definitions of DEVNAME and CARD_NAME, as they're not
useful. The former is not used anywhere, and the latter is used only
in module parameters descriptions.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230804110740.9867-2-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: pcmtest: Move buffer iterator initialization to prepare callback
Ivan Orlov [Fri, 4 Aug 2023 11:07:39 +0000 (15:07 +0400)]
ALSA: pcmtest: Move buffer iterator initialization to prepare callback

Trigger callback is not the best place for buffer iterator
initialization, so move it out to the prepare callback, where it
have to be.

Minor enhancement: remove blank line.

Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230804110740.9867-1-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoMerge branch 'topic/intel-hda' into for-next
Takashi Iwai [Fri, 4 Aug 2023 11:05:16 +0000 (13:05 +0200)]
Merge branch 'topic/intel-hda' into for-next

Pull ArrowLake-S PCI ID addition and config for MTL/LNL

Link: https://lore.kernel.org/r/20230802150105.24604-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/i915: extend connectivity check to cover Intel ARL
Kai Vehmanen [Wed, 2 Aug 2023 15:01:05 +0000 (10:01 -0500)]
ALSA: hda/i915: extend connectivity check to cover Intel ARL

Expand the HDA/I915 connectivity check to correctly handle
the PCI topology used in some Intel Arrow Lake products.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: "T, Arun" <arun.t@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: intel-dsp-cfg: add LunarLake support
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:04 +0000 (10:01 -0500)]
ALSA: hda: intel-dsp-cfg: add LunarLake support

One more PCI ID for the road.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: intel-dsp-cfg: use common include for MeteorLake
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:03 +0000 (10:01 -0500)]
ALSA: hda: intel-dsp-cfg: use common include for MeteorLake

This was not updated in Commit 0cd0a7c2c599 ("ALSA: intel-dsp-config: Convert to PCI device IDs defines")

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: add HD Audio PCI ID for Intel Arrow Lake-S
Kai Vehmanen [Wed, 2 Aug 2023 15:01:02 +0000 (10:01 -0500)]
ALSA: hda: add HD Audio PCI ID for Intel Arrow Lake-S

Add HD Audio PCI ID for Intel Arrow Lake-S platform.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoPCI: add ArrowLake-S PCI ID for Intel HDAudio subsystem.
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:01:01 +0000 (10:01 -0500)]
PCI: add ArrowLake-S PCI ID for Intel HDAudio subsystem.

Add part ID to common include file

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802150105.24604-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda: cs35l41: Print amp configuration after bind
Stefan Binding [Wed, 2 Aug 2023 12:12:35 +0000 (13:12 +0100)]
ALSA: hda: cs35l41: Print amp configuration after bind

Print amp configuration information to be able to confirm ACPI
_DSD information (and other useful info) for each amp on each
system using CS35L41, without having to get the acpidump.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230802121235.467358-1-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: ac97: set variables dev_attr_vendor_id to static
Yu Liao [Wed, 2 Aug 2023 02:26:49 +0000 (10:26 +0800)]
ALSA: ac97: set variables dev_attr_vendor_id to static

sparse reports
sound/ac97/bus.c:465:1: sparse: sparse: symbol 'dev_attr_vendor_id' was not declared. Should it be static?

This variable is only used in its defining file, so it should be static.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307242300.Oy0Dp2QI-lkp@intel.com/
Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Link: https://lore.kernel.org/r/20230802022649.2514787-1-liaoyu15@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: usb-audio: Remove unused function declaration
Yue Haibing [Tue, 1 Aug 2023 14:45:12 +0000 (22:45 +0800)]
ALSA: usb-audio: Remove unused function declaration

Commit 68e67f40b734 ("ALSA: snd-usb: move calls to usb_set_interface")
leave this unused declaration.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20230801144512.18716-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Reject I2C alias addresses
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:26 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Reject I2C alias addresses

The ACPI nodes for CS35L56 can contain an extra I2CSerialBusV2 that
is not a real device, it is an alias address.

This alias address will not be in the cirrus,dev-index array, so reject
any instantions with a device address not found in the array.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-10-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Fail if .bin not found and firmware not patched
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:25 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Fail if .bin not found and firmware not patched

A tuning patch is always needed to enable the ASP audio port.
If the BIOS did not patch the firmware, then it is mandatory to
have a .bin file.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-9-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Do not download firmware over existing RAM firmware
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:24 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Do not download firmware over existing RAM firmware

A RAM firmware can only be downloaded if the CS35L56 is currently
running from ROM firmware. The driver must not try to overwrite
the RAM if the CS35L56 is already running from that RAM.

Firmware can be downloaded in these two cases:

- The BIOS has already patched the firmware (secured mode).
  In this case the firmware files will only contain tunings that
  are safe to overwrite.

- The CS35L56 is running the built-in ROM firmware.

After a RAM firmware has been downloaded it can only be cleared by
hard resetting CS35L56. Some systems only hard-reset during
power-on and do not give the driver control of hard reset.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-8-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: cs_dsp_power_down() on cs35l56_hda_fw_load() error path
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:23 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: cs_dsp_power_down() on cs35l56_hda_fw_load() error path

If cs35l56_hda_fw_load() successfully called cs_dsp_power_up() the error
path must balance that with a call to cs_dsp_power_down().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-7-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove()
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:22 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove()

In cs35l56_hda_unbind() cs_dsp_power_down() must be called to cleanup
before calling cs_dsp_remove cs_dsp_remove().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-6-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Always power-up and start cs_dsp
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:21 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Always power-up and start cs_dsp

Always call cs_dsp_power_up() and cs_dsp_run() in
cs35l56_hda_fw_load() even if there aren't any firmware files
to download. Also, if there aren't any firmware files to
download there is no need to do cs35l56_firmware_shutdown() and
cs35l56_system_reset().

If there aren't any firmware files there's no need to write
anything to the CS35L56 registers to make it work - it will
already be running the ROM firmware. So it's not strictly
necessary to start cs_dsp.

But it's perfectly ok to call cs_dsp_power_up() and
cs_dsp_run() without downloading any firmware. This avoids
having to support a state where audio is playing but cs_dsp
is not running.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-5-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:20 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware

When firmware is reloaded after a system resume cs_dsp_power_down() should
be called before calling cs_dsp_power_up().

The fw_patched flag should also be cleared and only set again if the
firmware download succeeded.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-4-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Do not mark cache dirty after REINIT
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:19 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Do not mark cache dirty after REINIT

Only call regcache_mark_dirty() in cs35l56_hda_fw_load() if
the CS35L56 was SYSTEM_RESET.

recache_mark_dirty() changes the behaviour of regcache_sync()
to write out cache values that are not the default value, and
skip cache values that are the default.

AUDIO_REINIT does not reset the registers. regcache_mark_dirty()
after AUDIO_REINIT could cause the regcache_sync() to sync
registers incorrectly because it will assume that all registers
have reset to default.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-3-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Complete firmware reboot before calling cs_dsp_run()
Richard Fitzgerald [Mon, 31 Jul 2023 16:57:18 +0000 (17:57 +0100)]
ALSA: hda/cs35l56: Complete firmware reboot before calling cs_dsp_run()

Move the call to cs_dsp_run() in cs35l56_hda_fw_load() so that it
is after the CS35L56 has been reset/reinit'd and the regmap
cache has been synced.

cs_dsp_run() syncs up ALSA control cache values with the DSP memory
so this must not be done until the firmware has reinitialized.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230731165726.7940-2-rf@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: bcd2000: refactor deprecated strncpy
Justin Stitt [Thu, 27 Jul 2023 22:09:29 +0000 (22:09 +0000)]
ALSA: bcd2000: refactor deprecated strncpy

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ always the case for `strncpy`!

It should be noted that, in this case, the destination buffer has a
length strictly greater than the source string. Moreover, the source
string is NUL-terminated (and so is the destination) which means there
was no real bug happening here. Nonetheless, this patch would get us one
step closer to eliminating the `strncpy` API in the kernel, as its use
is too ambiguous. We need to favor less ambiguous replacements such as:
strscpy, strscpy_pad, strtomem and strtomem_pad (amongst others).

Technically, my patch yields subtly different behavior. The original
implementation with `strncpy` would fill the entire destination buffer
with null bytes [3] while `strscpy` will leave the junk, uninitialized
bytes trailing after the _mandatory_ NUL-termination. So, if somehow
`card->driver` or `card->shortname` require this NUL-padding behavior
then `strscpy_pad` should be used. My interpretation, though, is that
the aforementioned fields are just fine as NUL-terminated strings.
Please correct my assumptions if needed and I'll send in a v2.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html
[3]: https://linux.die.net/man/3/strncpy

Link: https://github.com/KSPP/linux/issues/90
Link: https://lore.kernel.org/r/20230727-sound-xen-v1-1-89dd161351f1@google.com
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230727-sound-usb-bcd2000-v1-1-0dc73684b2f0@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: xen-front: refactor deprecated strncpy
Justin Stitt [Thu, 27 Jul 2023 21:53:24 +0000 (21:53 +0000)]
ALSA: xen-front: refactor deprecated strncpy

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

A suitable replacement is `strscpy` [2] due to the fact that it
guarantees NUL-termination on its destination buffer argument which is
_not_ always the case for `strncpy`!

It should be noted that, in this case, the destination buffer has a
length strictly greater than the source string. Moreover, the source
string is NUL-terminated (and so is the destination) which means there
was no real bug happening here. Nonetheless, this patch would get us one
step closer to eliminating the `strncpy` API in the kernel, as its use
is too ambiguous. We need to favor less ambiguous replacements such as:
strscpy, strscpy_pad, strtomem and strtomem_pad (amongst others).

Technically, my patch yields subtly different behavior. The original
implementation with `strncpy` would fill the entire destination buffer
with null bytes [3] while `strscpy` will leave the junk, uninitialized
bytes trailing after the _mandatory_ NUL-termination. So, if somehow
`pcm->name` or `card->driver/shortname/longname` require this
NUL-padding behavior then `strscpy_pad` should be used. My
interpretation, though, is that the aforementioned fields are just fine
as NUL-terminated strings. Please correct my assumptions if needed and
I'll send in a v2.

[1]: www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
[2]: manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html
[3]: https://linux.die.net/man/3/strncpy

Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230727-sound-xen-v1-1-89dd161351f1@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoALSA: hda/cs35l56: Do some clean up on probe error
Dan Carpenter [Thu, 27 Jul 2023 07:16:33 +0000 (10:16 +0300)]
ALSA: hda/cs35l56: Do some clean up on probe error

Smatch complains that this return should be a goto:

    sound/pci/hda/cs35l56_hda.c:910 cs35l56_hda_common_probe()
    warn: missing unwind goto?

The goto error disables cansleep so that seems reasonable.

Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/465160f4-b7cf-41d5-931e-d6c9e68fa3c7@moroto.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 months agoMerge tag 'asoc-v6.6-early' of https://git.kernel.org/pub/scm/linux/kernel/git/brooni...
Takashi Iwai [Tue, 25 Jul 2023 12:06:08 +0000 (14:06 +0200)]
Merge tag 'asoc-v6.6-early' of https://git./linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v6.6

Here's an initial batch of updates for ASoC for this release cycle.
We've got a bunch of new drivers in here, a bit of core work from
Morimoto-san and quite a lot of janitorial work.  There's several
updates that pull in changes from other subsystems in order to build
on them:

 - An adaptor to allow use of IIO DACs and ADCs in ASoC which pulls in
   some IIO changes.
 - Create a library function for intlog10() and use it in the NAU8825
   driver.
 - Include the ASoC tests, including the topology tests, in the default
   KUnit full test coverage.  This also involves enabling UML builds of
   ALSA since that's the default KUnit test environment which pulls in
   the addition of some stubs to the driver.
 - More factoring out from Morimoto-san.
 - Convert a lot of drivers to use the more modern maple tree register
   cache.
 - Support for AMD machines with MAX98388 and NAU8821, Cirrus Logic
   CS35L36, Intel AVS machines with ES8336 and RT5663 and NXP i.MX93.

11 months agoALSA: hda: Adding support for CS35L56 on HDA
Mark Brown [Mon, 24 Jul 2023 17:42:26 +0000 (18:42 +0100)]
ALSA: hda: Adding support for CS35L56 on HDA

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

This set of patches adds support for using the CS35L56 boosted smart
amplifier on HDA systems. In these systems the CS35L56 audio is
routed through a HDA-to-I2S bridge codec.

This doesn't include the changes to the Realtek driver to actually hook
up the CS35L56 driver, because we don't yet have the QUIRK IDs to
associate it with. But we want to publish the driver now so that it is
available for bringing up hardware with the CS35L56.

The first 9 patches are moving code out of the ASoC driver and into the
shared library so that it can be shared with the HDA driver.

Patch #10 fixes missing #includes in the HDA headers so that the CS35L56
driver doesn't have to #include headers that it doesn't use.

12 months agoALSA: hda: cs35l41: Ensure amp is only unmuted during playback
Stefan Binding [Fri, 21 Jul 2023 15:18:16 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Ensure amp is only unmuted during playback

Currently we only mute after playback has finished, and unmute
prior to setting global enable. To prevent any possible pops
and clicks, mute at probe, and then only unmute after global
enable is set.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-12-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda
Stefan Binding [Fri, 21 Jul 2023 15:18:15 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Add device_link between HDA and cs35l41_hda

To ensure consistency between the HDA core and the CS35L41 HDA
driver, add a device_link between them. This ensures that the
HDA core will suspend first, and resume second, meaning the
amp driver will not miss any events from the playback hook from
the HDA core during system suspend and resume.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-11-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Rework System Suspend to ensure correct call separation
Stefan Binding [Fri, 21 Jul 2023 15:18:14 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Rework System Suspend to ensure correct call separation

In order to correctly pause audio on suspend, amps using external boost
require parts of the pause sequence to be called for all amps before moving
on to the next steps.
For example, as part of pausing the audio, the VSPK GPIO must be disabled,
but since this GPIO is controlled by one amp, but controls the boost for
all amps, it is required to separate the calls.
During playback this is achieved by using the pre and post playback hooks,
however during system suspend, this is not possible, so to separate the
calls, we use both the .prepare and .suspend calls to pause the audio.

Currently, for this reason, we do not restart audio on system resume.
However, we can support this by relying on the playback hook to resume
playback after system suspend.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-10-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Use pre and post playback hooks
Stefan Binding [Fri, 21 Jul 2023 15:18:13 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Use pre and post playback hooks

Use new hooks to ensure separation between play/pause actions,
as required by external boost.

External Boost on CS35L41 requires the amp to go through a
particular sequence of steps. One of these steps involes
the setting of a GPIO. This GPIO is connected to one or
more of the amps, and it may control the boost for all of
the amps. To ensure that the GPIO is set when it is safe
to do so, and to ensure that boost is ready for the rest of
the sequence to be able to continue, we must ensure that
the each part of the sequence is executed for each amp
before moving on to the next part of the sequence.

Some of the Play and Pause actions have moved from Open to
Prepare. This is because Open is not guaranteed to be called
again on system resume, whereas Prepare should.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-9-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: hda_component: Add pre and post playback hooks to hda_component
Stefan Binding [Fri, 21 Jul 2023 15:18:12 +0000 (16:18 +0100)]
ALSA: hda: hda_component: Add pre and post playback hooks to hda_component

These hooks can be used to add callbacks that would be run before and after
the main playback hooks. These hooks would be called for all amps, before
moving on to the next hook, i.e. pre_playback_hook would be called for
all amps, before the playback_hook is called for all amps, then finally
the post_playback_hook is called for all amps.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-8-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Move Play and Pause into separate functions
Stefan Binding [Fri, 21 Jul 2023 15:18:11 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Move Play and Pause into separate functions

This allows play and pause to be called from multiple places,
which is necessary for system suspend and resume.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-7-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Ensure we pass up any errors during system suspend.
Stefan Binding [Fri, 21 Jul 2023 15:18:10 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Ensure we pass up any errors during system suspend.

There are several steps required to put the system into system suspend.
Some of these steps may fail, so the driver should pass up the errors
if they occur.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Ensure we correctly re-sync regmap before system suspending.
Stefan Binding [Fri, 21 Jul 2023 15:18:09 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Ensure we correctly re-sync regmap before system suspending.

In order to properly system suspend, it is necessary to unload the firmware
and ensure the chip is ready for shutdown (if necessary). If the system
is currently in runtime suspend, it is necessary to wake up the device,
and then make it ready. Currently, the wake does not correctly resync
the device, which may mean it cannot suspend correctly. Fix this by
performaing a resync.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-5-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: hda: cs35l41: Check mailbox status of pause command after firmware load
Stefan Binding [Fri, 21 Jul 2023 15:18:08 +0000 (16:18 +0100)]
ALSA: hda: cs35l41: Check mailbox status of pause command after firmware load

Currently, we do not check the return status of the pause command,
immediately after we load firmware. If the pause has failed,
the firmware is not running.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: cs35l41: Poll for Power Up/Down rather than waiting a fixed delay
Stefan Binding [Fri, 21 Jul 2023 15:18:07 +0000 (16:18 +0100)]
ALSA: cs35l41: Poll for Power Up/Down rather than waiting a fixed delay

To ensure the chip has correctly powered up or down before continuing,
the driver will now poll a register, rather than wait a fixed delay.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoALSA: cs35l41: Use mbox command to enable speaker output for external boost
Stefan Binding [Fri, 21 Jul 2023 15:18:06 +0000 (16:18 +0100)]
ALSA: cs35l41: Use mbox command to enable speaker output for external boost

To enable the speaker output in external boost mode, 2 registers must
be set, one after another. The longer the time between the writes of
the two registers, the more likely, and more loudly a pop may occur.
To minimize this, an mbox command can be used to allow the firmware
to perform this action, minimizing any delay between write, thus
minimizing any pop or click as a result. The old method will remain
when running without firmware.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230721151816.2080453-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
12 months agoASoC: codecs: lpass: Log clk_get() failures
Bjorn Andersson [Fri, 21 Jul 2023 16:50:27 +0000 (09:50 -0700)]
ASoC: codecs: lpass: Log clk_get() failures

The LPASS macro drivers all acquire a number of clocks, but give no
indication when clk_get() fails, making it hard to identify and debug
system configuration issues.  Make these drivers provide useful debug
information when this happens.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/20230721165027.2155528-1-quic_bjorande@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
Simon Trimmer [Fri, 21 Jul 2023 13:21:20 +0000 (14:21 +0100)]
ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier

Add a driver for the Cirrus Logic CS35L56 amplifier. This uses the same
component binding API as the CS35L41 driver. This is not a standalone
HDA device; it provides control of the CS35L56 for systems that use a
combination of an HDA codec and CS35L56 amplifiers with audio routed
through the HDA codec.

The CS35L56 combines a high-performance mono audio amplifier, Class-H
tracking inductive boost converter, Halo Core(TM) DSP and a DC-DC boost
converter supporting Class-H tracking.

Control interfaces are I2C or SPI through the standard Linux I2C or SPI
bus framework.

Most chip functionality is controlled by on-board ROM firmware that is
always running. Firmware patches can be applied by the driver in the form
of a .wmfw file (firmware patch) and/or a .bin file (system tuning).

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230721132120.5523-12-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoALSA: hda: Fix missing header dependencies
Richard Fitzgerald [Fri, 21 Jul 2023 13:21:19 +0000 (14:21 +0100)]
ALSA: hda: Fix missing header dependencies

Add #includes of dependencies into hda_auto_parser.h and hda_generic.h

hda_auto_parser.h uses definitions in hda_local.h.

hda_generic.h uses definitions in hda_local.h and hda_auto_parser.h.
It also references struct hda_jack_callback, but only as a pointer.
This has been forward-declared so hda_jack.h only needs to be
included in source that actually uses it.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230721132120.5523-11-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Make a common function to shutdown the DSP
Simon Trimmer [Fri, 21 Jul 2023 13:21:18 +0000 (14:21 +0100)]
ASoC: cs35l56: Make a common function to shutdown the DSP

Move issuing of a CS35L56_MBOX_CMD_SHUTDOWN command and then waiting for
the DSP to reach CS35L56_HALO_STATE_SHUTDOWN in the register appropriate
for the hardware revision into a common function.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-10-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Make common function for control port wait
Simon Trimmer [Fri, 21 Jul 2023 13:21:17 +0000 (14:21 +0100)]
ASoC: cs35l56: Make common function for control port wait

Move the waits for CS35L56_CONTROL_PORT_READY_US into a common
function, and also allow a wider range of allowed wait times.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-9-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move part of cs35l56_init() to shared library
Richard Fitzgerald [Fri, 21 Jul 2023 13:21:16 +0000 (14:21 +0100)]
ASoC: cs35l56: Move part of cs35l56_init() to shared library

Part of the initialization code in cs35l56_init() can be re-used
by the HDA driver so move it into a new function in the shared
library.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-8-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move cs_dsp init into shared library
Richard Fitzgerald [Fri, 21 Jul 2023 13:21:15 +0000 (14:21 +0100)]
ASoC: cs35l56: Move cs_dsp init into shared library

Move the code that initialized the struct cs_dsp members
into the shared library so that the HDA driver can use it.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-7-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move runtime suspend/resume to shared library
Richard Fitzgerald [Fri, 21 Jul 2023 13:21:14 +0000 (14:21 +0100)]
ASoC: cs35l56: Move runtime suspend/resume to shared library

The majority of runtime_suspend and runtime_resume handling
doesn't have anything specific to the ASoC driver, so can be
shared by the HDA driver. Move this code into the shared
library.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move utility functions to shared file
Simon Trimmer [Fri, 21 Jul 2023 13:21:13 +0000 (14:21 +0100)]
ASoC: cs35l56: Move utility functions to shared file

Move the cs35l56 utility functions into the shared file so they are
available for use in HDA.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Convert utility functions to use common data structure
Simon Trimmer [Fri, 21 Jul 2023 13:21:12 +0000 (14:21 +0100)]
ASoC: cs35l56: Convert utility functions to use common data structure

Use the new cs35l56_base struct for utility functions.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Make cs35l56_system_reset() code more generic
Simon Trimmer [Fri, 21 Jul 2023 13:21:11 +0000 (14:21 +0100)]
ASoC: cs35l56: Make cs35l56_system_reset() code more generic

The function can be more easily reused in HDA if the tracking of whether
a soft reset is being performed and whether the device is connected to a
SoundWire bus is moved out of the function.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move shared data into a common data structure
Simon Trimmer [Fri, 21 Jul 2023 13:21:10 +0000 (14:21 +0100)]
ASoC: cs35l56: Move shared data into a common data structure

The ASoC and HDA drivers have structures that contain some of the same
information - instead of maintaining two locations for this data the
drivers should share a common data structure as this will enable common
utility functions to be created.

The first step is to move the location of these members in the ASoC
driver.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230721132120.5523-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: Merge up fixes from mainline
Mark Brown [Sun, 23 Jul 2023 22:33:05 +0000 (23:33 +0100)]
ASoC: Merge up fixes from mainline

There's several things here that will really help my CI.

12 months agoLinux 6.5-rc3
Linus Torvalds [Sun, 23 Jul 2023 22:24:10 +0000 (15:24 -0700)]
Linux 6.5-rc3

12 months agoMerge tag 'trace-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
Linus Torvalds [Sun, 23 Jul 2023 22:19:14 +0000 (15:19 -0700)]
Merge tag 'trace-v6.5-rc2' of git://git./linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

 - Swapping the ring buffer for snapshotting (for things like irqsoff)
   can crash if the ring buffer is being resized. Disable swapping when
   this happens. The missed swap will be reported to the tracer

 - Report error if the histogram fails to be created due to an error in
   adding a histogram variable, in event_hist_trigger_parse()

 - Remove unused declaration of tracing_map_set_field_descr()

* tag 'trace-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/histograms: Return an error if we fail to add histogram to hist_vars list
  ring-buffer: Do not swap cpu_buffer during resize process
  tracing: Remove unused extern declaration tracing_map_set_field_descr()

12 months agoMerge tag 'kbuild-fixes-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahi...
Linus Torvalds [Sun, 23 Jul 2023 21:55:41 +0000 (14:55 -0700)]
Merge tag 'kbuild-fixes-v6.5' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Fix stale help text in gconfig

 - Support *.S files in compile_commands.json

 - Flatten KBUILD_CFLAGS

 - Fix external module builds with Rust so that temporary files are
   created in the modules directories instead of the kernel tree

* tag 'kbuild-fixes-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: rust: avoid creating temporary files
  kbuild: flatten KBUILD_CFLAGS
  gen_compile_commands: add assembly files to compilation database
  kconfig: gconfig: correct program name in help text
  kconfig: gconfig: drop the Show Debug Info help text

12 months agokbuild: rust: avoid creating temporary files
Miguel Ojeda [Sun, 23 Jul 2023 14:21:28 +0000 (16:21 +0200)]
kbuild: rust: avoid creating temporary files

`rustc` outputs by default the temporary files (i.e. the ones saved
by `-Csave-temps`, such as `*.rcgu*` files) in the current working
directory when `-o` and `--out-dir` are not given (even if
`--emit=x=path` is given, i.e. it does not use those for temporaries).

Since out-of-tree modules are compiled from the `linux` tree,
`rustc` then tries to create them there, which may not be accessible.

Thus pass `--out-dir` explicitly, even if it is just for the temporary
files.

Similarly, do so for Rust host programs too.

Reported-by: Raphael Nestler <raphael.nestler@gmail.com>
Closes: https://github.com/Rust-for-Linux/linux/issues/1015
Reported-by: Andrea Righi <andrea.righi@canonical.com>
Tested-by: Raphael Nestler <raphael.nestler@gmail.com> # non-hostprogs
Tested-by: Andrea Righi <andrea.righi@canonical.com> # non-hostprogs
Fixes: 295d8398c67e ("kbuild: specify output names separately for each emission type from rustc")
Cc: stable@vger.kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Tested-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>