52010 Commits

Author SHA1 Message Date
Takashi Iwai
958448bfee
ASoC: au1x: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Use the new DEFINE_SIMPLE_DEV_PM_OPS() macro instead of open code
together with pm_ptr(), which allows us dropping CONFIG_PM ifdefs.

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250317095603.20073-2-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-17 10:13:47 +00:00
Easwar Hariharan
344825e17c ALSA: ac97: convert timeouts to secs_to_jiffies()
Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies().  As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies() to avoid the
multiplication

This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:

@depends on patch@
expression E;
@@

-msecs_to_jiffies
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)

Link: https://lkml.kernel.org/r/20250225-converge-secs-to-jiffies-part-two-v3-4-a43967e36c88@linux.microsoft.com
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: Chris Mason <clm@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Damien Le Maol <dlemoal@kernel.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: Dongsheng Yang <dongsheng.yang@easystack.cn>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Frank Li <frank.li@nxp.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: James Bottomley <james.bottomley@HansenPartnership.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Niklas Cassel <cassel@kernel.org>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Selvin Thyparampil Xavier <selvin.xavier@broadcom.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Shyam-sundar S-k <Shyam-sundar.S-k@amd.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-03-16 23:24:16 -07:00
keenplify
309b367eaf
ASoC: amd: Add DMI quirk for ACP6X mic support
Some AMD laptops with ACP6X do not expose the DMIC properly on Linux.
Adding a DMI quirk enables mic functionality.

Similar to Bugzilla #218402, this issue affects multiple users.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=219853
Signed-off-by: keenplify <keenplify@gmail.com>
Link: https://patch.msgid.link/20250315111617.12194-1-keenplify@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:35:16 +00:00
Chen Ni
3cab1fc85f
ASoC: cs35l56: Remove redundant 'flush_workqueue()' calls
'destroy_workqueue()' already drains the queue before destroying it, so
there is no need to flush it explicitly.

Remove the redundant 'flush_workqueue()' calls.

This was generated with coccinelle:

@@
expression E;
@@
-flush_workqueue(E);
 destroy_workqueue(E);

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250312072635.1429870-1-nichen@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:44 +00:00
Haoxiang Li
3e330acf4e
ASoC: codecs: wcd937x: fix a potential memory leak in wcd937x_soc_codec_probe()
When snd_soc_dapm_new_controls() or snd_soc_dapm_add_routes() fails,
wcd937x_soc_codec_probe() returns without releasing 'wcd937x->clsh_info',
which is allocated by wcd_clsh_ctrl_alloc. Add wcd_clsh_ctrl_free()
to prevent potential memory leak.

Fixes: 313e978df7fc ("ASoC: codecs: wcd937x: add audio routing and Kconfig")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Link: https://patch.msgid.link/20250226085050.3584898-1-haoxiang_li2024@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:43 +00:00
Kuninori Morimoto
ede6445d54
ASoC: soc-pcm: tidyup function name to snd_soc_dpcm_be_can_xxx()
We have similar but different function names

	snd_soc_dpcm_fe_can_xxx()
	snd_soc_dpcm_be_can_xxx()
	snd_soc_dpcm_can_be_xxx()
	             ~~~~~~
Let's unified these to can_xx

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87plip7ie4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:42 +00:00
Dan Carpenter
02026aabaa
ASoC: amd: acp: Fix leak in acp_pci_probe()
There needs to be some cleanup on this error path.  We can't just
return directly.

Fixes: aaf7a668bb38 ("ASoC: amd: acp: Add new interrupt handle callbacks in acp_common_hw_ops")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/3dad80cb-e177-45aa-97ac-df9c98a47d94@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:41 +00:00
Chen Ni
9aa499f28e
ASoC: tlv320adc3xxx: remove unnecessary NULL check before clk_disable_unprepare()
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for adc3xxx->mclk here.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250312034337.1235378-1-nichen@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:40 +00:00
Ritu Chaudhary
f1d742c35b
ASoC: tegra: Use non-atomic timeout for ADX status register
ADX startup() callback uses atomic poll timeout on ADX status register.

This is unnecessary because:

- The startup() callback itself is non-atomic.
- The subsequent timeout call in the same function already uses a
  non-atomic version.

Using atomic version can hog CPU when it is not really needed,
so replace it with non-atomic version.

Fixes: a99ab6f395a9e ("ASoC: tegra: Add Tegra210 based ADX driver")
Signed-off-by: Ritu Chaudhary <rituc@nvidia.com>
Signed-off-by: Sheetal <sheetal@nvidia.com>
Link: https://patch.msgid.link/20250311062010.33412-1-sheetal@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:39 +00:00
Chenyuan Yang
0ec6bd1670
ASoC: sma1307: Add NULL check in sma1307_setting_loaded()
All varibale allocated by kzalloc and devm_kzalloc could be NULL.
Multiple pointer checks and their cleanup are added.

This issue is found by our static analysis tool

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Link: https://patch.msgid.link/20250311015714.1333857-1-chenyuan0y@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:38 +00:00
Chen Ni
f37ab219a3
ASoC: mt8365: remove unnecessary NULL check before clk_disable_unprepare()
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for clk here.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250312032600.1235158-1-nichen@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:37 +00:00
Chen Ni
1458fae110
ASoC: ti: davinci-i2s: remove unnecessary NULL check before clk_disable_unprepare()
clk_disable_unprepare() already checks NULL by using IS_ERR_OR_NULL.
Remove unneeded NULL check for dev->ext_clk here.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250312033509.1235268-1-nichen@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:33:36 +00:00
Charles Keepax
d1cd13f80d
ASoC: SDCA: Add support for GE Entity properties
Add support for parsing the Group Entity properties from DisCo/ACPI.
Group Entities allow control of several other Entities, typically
Selector Units, from a single control.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:58 +00:00
Charles Keepax
2a4667f3d5
ASoC: SDCA: Add type flag for Controls
SDCA Controls come in a variety of data formats, to simplify later
parsing work out this data type as the control is parsed and stash it
for later use.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:56 +00:00
Charles Keepax
49680c9f13
ASoC: SDCA: Allow naming of imp def controls
Implementation defined controls will not be present in the large list of
known controls for SDCA. The driver should not return an error for these,
because it is perfectly legal to have implementation defined controls.
Update the handling to instead generate a generic name.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:55 +00:00
Charles Keepax
0d16daa940
ASoC: SDCA: Use __free() to manage local buffers
Use the cleanup.h helpers to manage some local buffers, this cleans up
the error paths a little.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:54 +00:00
Charles Keepax
988adcb736
ASoC: SDCA: Tidy up initialization write parsing
Slightly neaten up the initialization write code to overlay a struct
rather than shifting the pointer along manually. This also removes the
Sparse warning:

sound/soc/sdca/sdca_functions.c:233:36: warning: cast to restricted __le32

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:53 +00:00
Linus Walleij
17fdf318f5
ASoC: pcm6240: Drop bogus code handling IRQ as GPIO
The current code for the IRQ in pcm6240 makes no sense:
it looks up an IRQ with of_irq_get(), treat it as a GPIO
by issuing gpio_request(), gpio_direction_input()
and gpio_to_irq() on it.

This is just wrong, if the device tree assigns the IRQ
from a GPIO number this is just incorrect: it is clearly
stated that GPIO providers and IRQ providers are
orthogonal.

It is possible to look up an IRQ to a corresponding GPIO
line but this is taking an IRQ and pretending it's a
GPIO, which is just semantically wrong.

Drop the offending code and treat the IRQ that we get
from the device tree as any other IRQ, see for example
other codec drivers.

The DT bindings for this codec does not have any in-tree
DTS files, which may explain why things are weird.

As a bonus, this moves the driver away from the legacy
<linux/gpio.h> include.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20250312-pcm-codecs-v1-3-41ffc4f8fc5c@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:39 +00:00
Linus Walleij
ef5aa8bd22
ASoC: pcm3008: Convert to GPIO descriptors
This converts the PCM3008 driver to look up the GPIO lines
using descriptors.

Apparently there are no in-tree users of the platform data
struct, so users need to adopt.

New users can associate the GPIO lines with the platform
device "pcm3008-codec".

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20250312-pcm-codecs-v1-2-41ffc4f8fc5c@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:38 +00:00
Linus Walleij
98dba9dab5
ASoC: pcm1681: Drop unused include
This driver includes the legacy GPIO header <linux/gpio.h>
but does not use any symbols from it so drop the include.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20250312-pcm-codecs-v1-1-41ffc4f8fc5c@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:37 +00:00
Nícolas F. R. A. Prado
f35d834d67
ASoC: mediatek: mt8188-mt6359: Add accdet headset jack detect support
Enable headset jack detection for MT8188 platforms that use the MT6359
ACCDET block for it, indicated by the mediatek,accdet property in DT.
For those platforms, register a jack and initialize the ACCDET block to
report jack events through it.

Co-developed-by: Zoran Zhan <zoran.zhan@mediatek.com>
Signed-off-by: Zoran Zhan <zoran.zhan@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://patch.msgid.link/20250306-mt8188-accdet-v3-4-7828e835ff4b@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:22 +00:00
Nícolas F. R. A. Prado
0116a7d84b
ASoC: mediatek: mt6359: Add stub for mt6359_accdet_enable_jack_detect
Add a stub for mt6359_accdet_enable_jack_detect() to prevent linker
failures in the machine sound drivers calling it when
CONFIG_SND_SOC_MT6359_ACCDET is not enabled.

Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://patch.msgid.link/20250306-mt8188-accdet-v3-3-7828e835ff4b@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:21 +00:00
Nícolas F. R. A. Prado
cf536e2622
ASoC: mediatek: common: Handle mediatek,accdet property
Handle the optional mediatek,accdet property. When present, retrieve the
sound component from its phandle, so the machine sound driver can use it
to register the audio jack and initialize the MT6359 ACCDET for jack
detection.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://patch.msgid.link/20250306-mt8188-accdet-v3-2-7828e835ff4b@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:20 +00:00
Weidong Wang
94e412c28e
ASoC: codecs: Add aw88166 amplifier driver
The driver is for amplifiers aw88166 of Awinic Technology
Corporation. The AW88166 is a high efficiency digital
Smart K audio amplifier

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://patch.msgid.link/20250312120100.9730-3-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-16 23:27:05 +00:00
Takashi Iwai
5a0c72c1da ALSA: hda/realtek: Always honor no_shutup_pins
The workaround for Dell machines to skip the pin-shutup for mic pins
introduced alc_headset_mic_no_shutup() that is replaced from the
generic snd_hda_shutup_pins() for certain codecs.  The problem is that
the call is done unconditionally even if spec->no_shutup_pins is set.
This seems causing problems on other platforms like Lenovo.

This patch corrects the behavior and the driver honors always
spec->no_shutup_pins flag and skips alc_headset_mic_no_shutup() if
it's set.

Fixes: dad3197da7a3 ("ALSA: hda/realtek - Fixup headphone noise via runtime suspend")
Reported-and-tested-by: Oleg Gorobets <oleg.goro@gmail.com>
Link: https://patch.msgid.link/20250315143020.27184-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-03-15 15:31:04 +01:00
Ricard Wanderlof
c2820405ba ALSA: usb-audio: Fix CME quirk for UF series keyboards
Fix quirk for CME master keyboards so it not only handles
sysex but also song position pointer, MIDI timing clock, start
and stop messages, and active sensing. All of these can be
output by the CME UF series master keyboards.

Tested with a CME UF6 in a desktop Linux environment as
well as on the Zynthian Raspberry Pi based platform.

Signed-off-by: Ricard Wanderlof <ricard2013@butoba.net>
Link: https://patch.msgid.link/20250313-cme-fix-v1-1-d404889e4de8@butoba.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-03-14 11:18:14 +01:00
Takashi Iwai
9335a36faa ALSA: intel-hdmi-audio: Convert to SYSTEM_SLEEP_PM_OPS()
Use the newer SYSTEM_SLEEP_PM_OPS() macro instead of
SET_SYSTEM_SLEEP_PM_OPS() together with pm_ptr(), which allows us
dropping ugly __maybe_unused attributes.

This optimizes slightly	when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-10-tiwai@suse.de
2025-03-14 11:07:14 +01:00
Takashi Iwai
f3f9dfde4c ALSA: vx222: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Use the newer DEFINE_SIMPLE_DEV_PM_OPS() macro instead of
SIMPLE_DEV_PM_OPS() together with pm_ptr(), which makes
CONFIG_PM_SLEEP ifdefs superfluous.

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-9-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
5ea0a2206b ALSA: oxygen: Convert to EXPORT_SIMPLE_DEV_PM_OPS()
Use the newer EXPORT_SIMPLE_DEV_PM_OPS() macro instead of
SIPLE_DEV_PM_OPS() and manual export, together with pm_ptr() macro,
which makes CONFIG_PM_SLEEP ifdefs superfluous.

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-8-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
f923335da9 ALSA: hda/tegra: Convert to RUNTIME_PM_OPS() & co
Use the newer RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() macros
instead of SET_SET_RUNTIME_PM_OPS() and SET_SYSTEM_SLEEP_PM_OPS()
together with pm_ptr(), which allows us dropping ugly __maybe_unused
attributes.

This optimizes slightly	when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-7-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
dd69342a04 ALSA: hda-intel: Convert to RUNTIME_PM_OPS()
Use the newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS()
together with pm_ptr(), which allows us dropping ugly __maybe_unused
attributes.

This optimizes slightly	when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-6-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
3f38aa32c5 ALSA: hda: Use RUNTIME_PM_OPS() and pm_ptr()
Clean up the code with the helper macros, and also assure that no PM
ops is assigned without CONFIG_PM via pm_ptr().

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-5-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
0d8dfeba4b ALSA: pcm: Convert to SYSTEM_SLEEP_PM_OPS()
Use the newer SYSTEM_SLEEP_PM_OPS() macro instead of
SET_SYSTEM_SLEEP_PM_OPS(), which makes CONFIG_PM_SLEEP ifdefs
superfluous.

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-4-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
4c60cf85e2 ALSA: atmel: Convert to DEFINE_SIMPLE_DEV_PM_OPS() macro
Use the newer DEFINE_SIMPLE_DEV_PM_OPS() macro instead of
SIMPLE_DEV_PM_OPS() together with pm_ptr(), which makes
CONFIG_PM_SLEEP ifdefs superfluous.

Merely a cleanup, there should be no actual code change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-3-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Takashi Iwai
3954382bb5 ALSA: ac97: Convert to RUNTIME_PM_OPS() macro
Use a newer RUNTIME_PM_OPS() macro instead of SET_RUNTIME_PM_OPS()
together with pm_ptr(), which makes CONFIG_PM ifdefs superfluous.

This optimizes slightly when CONFIG_PM is disabled, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250313170731.26943-2-tiwai@suse.de
2025-03-14 11:07:13 +01:00
Mark Brown
d9a06936ee
ASoC: sun4i-codec: add headphone dectection for
Merge series from Ryan Walklin <ryan@testtoast.com>:

Hi All,

V3 of this patch adding headphone jack detection support to the Anbernic RGnnXX series of handhelds. V3 corrects my misunderstanding of derivation of ALSA UCM file paths, and adds recieved Reviewed-by and Tested-by tags. Thanks to those that have reviewed and fed back on previous versions.

Original message below:

This series adds the required device tree bindings to describe GPIOs for jack detection in the sun4i-codec driver, adds support for jack detection to the codec machine driver, and describes the hardware configuration in the RG35XX DTS. The existing speaker amplifier GPIO pin can then be used in concert with jack detection to enable userspace sound servers (via an ALSA UCM configuration) to disable the speaker route when headphones are connected.

Thanks to Chris Morgan for his assistance putting this series together.

Regards,

Ryan

Chris Morgan (2):
  ASoC: dt-bindings: sun4i-a10-codec: add hp-det-gpios
  arm64: dts: allwinner: h700: Add hp-det-gpios for Anbernic RG35XX

Ryan Walklin (3):
  ASoC: sun4i-codec: correct dapm widgets and controls for h616
  ASoC: sun4i-codec: support hp-det-gpios property
  ASoC: sun4i-codec: add h616 card long_name

 .../sound/allwinner,sun4i-a10-codec.yaml      |  6 ++
 .../sun50i-h700-anbernic-rg35xx-2024.dts      |  5 +-
 sound/soc/sunxi/sun4i-codec.c                 | 57 ++++++++++++++++++-
 3 files changed, 66 insertions(+), 2 deletions(-)

--
2.48.1
2025-03-14 03:11:27 +00:00
Mark Brown
e0afd7d370
ASoC: Merge up fixes
Merge the for-6.14 to resolve conflicts with simple-card-utils.c due to
parallel delveopment.
2025-03-14 02:31:06 +00:00
Ryan Walklin
d389719fb4
ASoC: sun4i-codec: add h616 card long_name
Adding jack detection requires sound servers to act on the emitted
events, which are described by ALSA Use Case Manager configurations in
userspace. These configurations include the long card name in the file
path (falling back to card->name if this is not present), so add a long
card name for the H616 without spaces, making UCM referencing easier.

The corresponding ALSA UCM patch is here (now merged):
https://github.com/alsa-project/alsa-ucm-conf/pull/491

Signed-off-by: Ryan Walklin <ryan@testtoast.com>

--
Changelog v1..v2:
- Separate patch for card->long_name
- Note UCM patch link

Changelog v2..v3:
- Add card->long_name rather than change existing card->name

Link: https://patch.msgid.link/20250214220247.10810-6-ryan@testtoast.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:50:07 +00:00
Ryan Walklin
a149377c03
ASoC: sun4i-codec: support hp-det-gpios property
Add support for GPIO headphone detection with the hp-det-gpios
property. In order for this to properly disable the path upon
removal of headphones, the output must be labelled Headphone which
is a common sink in the driver.

Describe a headphone jack and detection GPIO in the driver, check for
a corresponding device tree node, and enable jack detection in a new
machine init function if described.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Ryan Walklin <ryan@testtoast.com>

--
Changelog v1..v2:
- Separate DAPM changes into separate patch and add rationale.

Tested-by: Philippe Simons <simons.philippe@gmail.com>
Link: https://patch.msgid.link/20250214220247.10810-4-ryan@testtoast.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:50:06 +00:00
Ryan Walklin
ae5f76d404
ASoC: sun4i-codec: correct dapm widgets and controls for h616
The previous H616 support patch added a single LINEOUT DAPM pin switch
to the card controls. As the codec in this SoC only has a single route,
this seemed reasonable at the time, however is redundant given the
existing DAPM codec widget definitions controlling the digital and
analog sides of the codec.

It is also insufficient to describe the scenario where separate
components (muxes, jack detection etc) are used to modify the audio
route external to the SoC. For example the Anbernic RG(##)XX series of
devices uses a headphone jack detection switch, GPIO-controlled speaker
amplifier and a passive external mux chip to route audio.

Remove the redundant LINEOUT card control, and add a Speaker pin switch
control and Headphone DAPM widget to allow control of the above
hardware.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Signed-off-by: Ryan Walklin <ryan@testtoast.com>
Tested-by: Philippe Simons <simons.philippe@gmail.com>
Link: https://patch.msgid.link/20250214220247.10810-3-ryan@testtoast.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:50:05 +00:00
Martin Povišer
f0066c8d1d
ASoC: tas2770: Fix and redo I/V sense TDM slot setting logic
The former code sets the V slot from inside set_bitwidth according to
the bitwidth of the PCM format. That's wrong, since:

 * It overrides the V slot parsed from DT binding.

 * The V slot is set shifted behind the I slot by the length of the PCM
   bitwidth, but the PCM bitwidth has no assured relation to the TDM
   slot width.

Replace the former logic by setting up the I/V sense transmission only
in case of both I/V slots being specified in devicetree, and never
override those values. In case the slots are left unspecified, disable
the transmission completely.

There's an improbable case someone is relying on the old behavior, but
if so, that's a setup that only works by accident, and cannot be sanely
supported going forward. There's no indication anyone is consuming the
I/V sense data up to today, so break the former behavior.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Link: https://patch.msgid.link/20250227-apple-codec-changes-v3-6-cbb130030acf@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:39:04 +00:00
Martin Povišer
6553ee024b
ASoC: tas2770: Factor out set_ivsense_slots
Add a new explicit function for the setting of I/V sense TDM slots.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Link: https://patch.msgid.link/20250227-apple-codec-changes-v3-5-cbb130030acf@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:39:03 +00:00
Martin Povišer
f8d5f28e3f
ASoC: tas2764: Add control concerning overcurrent events
Add control to expose the option of autoretry behavior on overcurrent
events in the codec.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Link: https://patch.msgid.link/20250227-apple-codec-changes-v3-4-cbb130030acf@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:39:02 +00:00
Martin Povišer
ad18392962
ASoC: tas2764: Extend driver to SN012776
SN012776 is a speaker amp chip found in Apple's 2021 laptops. It appears
similar and more-or-less compatible to TAS2764. Extend the TAS2764
driver with some SN012776 specifics and configure the chip assuming
it's in one of the Apple machines.

Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Link: https://patch.msgid.link/20250227-apple-codec-changes-v3-3-cbb130030acf@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:39:01 +00:00
Kuninori Morimoto
de74ec718e
ASoC: simple-card-utils: Don't use __free(device_node) at graph_util_parse_dai()
commit 419d1918105e ("ASoC: simple-card-utils: use __free(device_node) for
device node") uses __free(device_node) for dlc->of_node, but we need to
keep it while driver is in use.

Don't use __free(device_node) in graph_util_parse_dai().

Fixes: 419d1918105e ("ASoC: simple-card-utils: use __free(device_node) for device node")
Reported-by: Thuan Nguyen <thuan.nguyen-hong@banvien.com.vn>
Reported-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Thuan Nguyen <thuan.nguyen-hong@banvien.com.vn>
Tested-by: Detlev Casanova <detlev.casanova@collabora.com>
Link: https://patch.msgid.link/87eczisyhh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 22:33:02 +00:00
Andy Shevchenko
a935b3f981
ASoC: SOF: ipc4-topology: Allocate ref_params on stack
Currently the compiler (clang 19.1.7) is not happy about the size of
the stack frame in sof_ipc4_prepare_copier_module:

sound/soc/sof/ipc4-topology.c:1800:1: error: stack frame size (1288) exceeds limit (1024) in 'sof_ipc4_prepare_copier_module' [-Werror,-Wframe-larger-than]
 1800 | sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
      | ^

Work around this by allocating ref_params on stack, as it looks the biggest
variable on stack right now.

Note, this only happens when compile for 32-bit machines (x86_32 in my case).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20250312160516.3864295-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-13 12:46:22 +00:00
Takashi Iwai
de69d56daa ASoC: Fixes for v6.14
The bulk of this is driver specific fixes, mostly unremarkable.  There's
 also one core fix from Charles, fixing up confusion around the limiting
 of maximum control values.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmfSEi8ACgkQJNaLcl1U
 h9ALVQf+OpOZuoTfAiu44d/l3WXEtn7l6rwihWbozUuNW7LwfnNSDYnBstOl/FDM
 6ry8oJbaj8t2We3joJsixrGbrGYiJKFcbZvFd6FyPQzF63s0tUAZk9iu182If3i7
 nrjFSch0hYDR3A/o5NfOufelRwmNUvOEXFgvLIJ+Hn1qDeJz5nyUyauCGSu/M0S0
 blF36uVjuiEc+2QpNLcSvBqh9aJ9Atg9X4GFhpSsq4Kp6eFtRmiERHYlWQEI0ppM
 becNQnEwn4n9RZp0bt5OYx/f7wE1BcjNlJyKXV5rS74MypSZCeZKe5N+F4IoiKKN
 o/HwNoh1rl/+e0n8JmqHUyRXM6Fp2g==
 =nXOh
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v6.14-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.14

The bulk of this is driver specific fixes, mostly unremarkable.  There's
also one core fix from Charles, fixing up confusion around the limiting
of maximum control values.
2025-03-13 07:33:48 +01:00
Arnd Bergmann
658fb7fe8e
ASoC: cs42l43: convert to SYSTEM_SLEEP_PM_OPS
The custom suspend function causes a build warning when CONFIG_PM_SLEEP
is disabled:

sound/soc/codecs/cs42l43.c:2405:12: error: unused function 'cs42l43_codec_runtime_force_suspend' [-Werror,-Wunused-function]

Change SET_SYSTEM_SLEEP_PM_OPS() to the newer SYSTEM_SLEEP_PM_OPS(),
to avoid this.

Fixes: 164b7dd4546b ("ASoC: cs42l43: Add jack delay debounce after suspend")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250305172738.3437513-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-12 16:12:24 +00:00
Navon John Lukose
b11a74ac4f ALSA: hda/realtek: Add mute LED quirk for HP Pavilion x360 14-dy1xxx
Add a fixup to enable the mute LED on HP Pavilion x360 Convertible
14-dy1xxx with ALC295 codec. The appropriate coefficient index and bits
were identified through a brute-force method, as detailed in
https://bbs.archlinux.org/viewtopic.php?pid=2079504#p2079504.

Signed-off-by: Navon John Lukose <navonjohnlukose@gmail.com>
Link: https://patch.msgid.link/20250307213319.35507-1-navonjohnlukose@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-03-12 15:58:19 +01:00
Ethan Carter Edwards
520a563b9a ALSA: ctxfi: change dao_set_input functions from kzalloc to kcalloc
We are trying to get rid of all multiplications from allocation
functions to prevent potential integer overflows. Here the
multiplication is probably safe, but using kcalloc() is more
appropriate and improves readability. This patch has no effect
on runtime behavior.

Link: https://github.com/KSPP/linux/issues/162 [1]
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
Link: https://patch.msgid.link/20250308-ctdaio-kzalloc-v1-1-804a09875b0e@ethancedwards.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-03-12 15:32:41 +01:00