Johan Hovold [Tue, 22 Jul 2025 09:25:42 +0000 (11:25 +0200)]
ASoC: mediatek: common: fix device and OF node leak
Make sure to drop the references to the accdet OF node and platform
device taken by of_parse_phandle() and of_find_device_by_node() after
looking up the sound component during probe.
Fixes: cf536e2622e2 ("ASoC: mediatek: common: Handle mediatek,accdet property") Cc: stable@vger.kernel.org # 6.15 Cc: NĂcolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20250722092542.32754-1-johan@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
ALSA: hda/realtek: Fix mute LED mask on HP OMEN 16 laptop
this patch is to fix my previous Commit <e5182305a519> i have fixed mute
led but for by This patch corrects the coefficient mask value introduced
in commit <e5182305a519>, which was intended to enable the mute LED
functionality. During testing, multiple values were evaluated, and
an incorrect value was mistakenly included in the final commit.
This update fixes that error by applying the correct mask value for
proper mute LED behavior.
The mutexes qdev_mutex and chip->mutex are acquired in that order
throughout the driver. To preserve proper lock hierarchy and avoid
potential deadlocks, they must be released in the reverse
order of acquisition.
This change reorders the unlock sequence to first release chip->mutex
followed by qdev_mutex, ensuring consistency with the locking pattern.
[ fixed the code indentations and Fixes tag by tiwai ]
The glitch was detected in the high frequency of the HP playback.
This patch adjusts the DAC dither setting to avoid this situation
for almost all cases.
ALSA: hda/realtek - Add mute LED support for HP Pavilion 15-eg0xxx
The mute LED on the HP Pavilion Laptop 15-eg0xxx,
which uses the ALC287 codec, didn't work.
This patch fixes the issue by enabling the ALC287_FIXUP_HP_GPIO_LED quirk.
Tested on a physical device, the LED now works as intended.
ASoC: mediatek: mt8365-dai-i2s: pass correct size to mt8365_dai_set_priv
Given mt8365_dai_set_priv allocate priv_size space to copy priv_data which
means we should pass mt8365_i2s_priv[i] or "struct mtk_afe_i2s_priv"
instead of afe_priv which has the size of "struct mt8365_afe_private".
Fixes: 402bbb13a195 ("ASoC: mediatek: mt8365: Add I2S DAI support") Signed-off-by: Guoqing Jiang <guoqing.jiang@canonical.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patch.msgid.link/20250710011806.134507-1-guoqing.jiang@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
Merge tag 'asoc-fix-v6.16-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.16
A relatively large set of changes, but most of them are quirk
information for various x86 systems. There is one more substantial fix
for a NULL pointer dereference when removing the AVS driver, plus one
for Kconfig dependencies.
ALSA: hda/cs35l56: Workaround bad dev-index on Lenovo Yoga Book 9i GenX
The Lenovo Yoga Book 9i GenX has the wrong values in the cirrus,dev-index
_DSD property. Add a fixup for this model to ignore the property and
hardcode the index from the I2C bus address.
The error in the cirrus,dev-index property would prevent the second amp
instance from probing. The component binding would never see all the
required instances and so there would not be a binding between
patch_realtek.c and the cs35l56 driver.
It is currently possible to configure a kernel with all Intel SoC
configs as loadable modules, but the board config as built-in. This
causes a link failure in the reference to the snd_soc_sof.ko module:
x86_64-linux-ld: sound/soc/intel/boards/sof_rt5682.o: in function `sof_rt5682_hw_params':
sof_rt5682.c:(.text+0x1f9): undefined reference to `sof_dai_get_mclk'
x86_64-linux-ld: sof_rt5682.c:(.text+0x234): undefined reference to `sof_dai_get_bclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_rt5682.o: in function `sof_rt5682_codec_init':
sof_rt5682.c:(.text+0x3e0): undefined reference to `sof_dai_get_mclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_cs42l42.o: in function `sof_cs42l42_hw_params':
sof_cs42l42.c:(.text+0x2a): undefined reference to `sof_dai_get_bclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_nau8825.o: in function `sof_nau8825_hw_params':
sof_nau8825.c:(.text+0x7f): undefined reference to `sof_dai_get_bclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_da7219.o: in function `da7219_codec_init':
sof_da7219.c:(.text+0xbf): undefined reference to `sof_dai_get_mclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_maxim_common.o: in function `max_98373_hw_params':
sof_maxim_common.c:(.text+0x6f9): undefined reference to `sof_dai_get_tdm_slots'
x86_64-linux-ld: sound/soc/intel/boards/sof_realtek_common.o: in function `rt1015_hw_params':
sof_realtek_common.c:(.text+0x54c): undefined reference to `sof_dai_get_bclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_realtek_common.o: in function `rt1308_hw_params':
sof_realtek_common.c:(.text+0x702): undefined reference to `sof_dai_get_mclk'
x86_64-linux-ld: sound/soc/intel/boards/sof_cirrus_common.o: in function `cs35l41_hw_params':
sof_cirrus_common.c:(.text+0x2f): undefined reference to `sof_dai_get_bclk'
Add an optional dependency on SND_SOC_SOF_INTEL_COMMON, to ensure that whenever
the SOF support is in a loadable module, none of the board code can be built-in.
This may be be a little heavy-handed, but I also don't see a reason why one would
want the boards to be built-in but not the SoC, so it shouldn't actually cause
any usability problems.
ALSA: hda: Return the codec init error properly at snd_hda_codec_build_controls()
The error from snd_hda_codec_init() was ignored in
snd_hda_codec_build_controls(), which should have been taken account
and abort the flow. Fix it now.
ALSA: hda: Drop superfluous driver->ops NULL checks
After all conversions, driver->ops became a must in most places
(except for the codec power setup which might be called before binding
to the codec driver), hence we can get rid of the superfluous
driver->ops NULL checks, too.
Now that all patch_ops usage have been converted to the new
hda_codec_ops probe, we can drop patch_ops from the hda_codec,
together with the calls of patch_ops callbacks.
The hda_codec_ops.free callback is removed as all have been replaced
with the new remove callback.
Also, correct comments mentioning "patch"; it's replaced with "codec
driver".
Convert the HDMI codec drivers to use the new hda_codec_ops probe.
The Intel and Nvidia-MCP HDMI drivers needed slightly more changes to
deal with the unified callbacks among all models.
Also another non-trivial change is Intel driver's set_power_state
callback. An additional NULL check of codec->spec is needed there
since the set_power_state() may be called before the probe gets called
(e.g. in ASoC hda codec hda_codec_probe()).
Convert the CS8409 codec driver to use the new hda_codec_ops probe.
The Dolphin support needs an override of unsol_event callback, and
redirect via spec->unsol_event function pointer for now.
ALSA: hda/cirrus: Split to cs420x and cs421x drivers
Since the codec ops for CS420x and CS421x are fairly independent,
split the cirrus codec driver into two drivers, snd-hda-codec-cs420x
and snd-hda-code-cs421x. Together with the split, convert to the new
hda_codec_ops probe.
Convert the Analog Device codec driver to use the new hda_codec_ops
probe. The probe function had to be unified and branched with the
model type specified via driver_data instead.
Until now, we use "patch_ops" embedded in hda_codec object for
defining the callbacks that are used in various places to manage
HD-audio codec. But from the device driver POV, this should have been
rather the driver ops, instead of the callbacks in the codec object.
This patch defines the driver ops for HD-audio codec driver as the
replacement. We reuse the same struct hda_codec_ops, and this is put
as hda_codec_driver.ops. When the driver->ops callbacks are defined,
they are called primarily instead of codec->patch_ops callbacks.
With converting to the driver ops, there is no need to pass the ugly
patch_ops handling in hda_device_id tables. That is, driver_data
field of hda_device_id becomes really optional and it can be used for
passing the codec-specific data (e.g. specifying a model).
The codec entries after the conversion should be with HDA_CODEC_ID()
and co, instead of the former HDA_CODEC_ENTRY().
Once after converting all codec drivers to use driver ops, we can get
rid of codec patch_ops.
In the past, we unified HD-audio HDMI codec driver once with a slight
hope that more vendors will follow the standard, but in reality, the
driver received more and more vendor-specific code. In order to make
the messy code a bit more understandable, this patch splits the HDMI
codec driver into multiple drivers again.
Namely, the vendor-specific code for Intel, AMD and Nvidia are moved
into the own drivers, while we split the common HDMI code to two
drivers, the generic HDMI driver and the simple HDMI driver.
So, now we have:
- The generic HDMI driver (snd-hda-codec-hdmi):
providing the common helpers, also supports Glenfly HDMI codecs and
some other codecs that don't need vendor-specific stuff
- The simple HDMI driver (snd-hda-codec-simplehdmi):
devices with no dynamic PCM assignment and with fixed channels,
mostly used by some other drivers, but this driver alone suffices
for VIA HDMI codec support, too
- Intel HDMI driver (snd-hda-codec-intelhdmi):
bound with i915 / Xe DRM, based on the generic HDMI driver
- AMD/ATI HDMI driver (snd-hda-codec-atihdmi):
optionally bound with radeon / amdgpu DRM, based on the generic HDMI
driver
- Nvidia HDMI driver (snd-hda-codec-nvhdmi);
optionally bound with nouveau DRM, based on the generic HDMI driver
- Legacy Nvidia HDMI driver (snd-hda-codec-nvhdmi-mcp):
for 2ch or 8ch outputs, based on the simple HDMI driver
- Nvidia Tegra HDMI driver (snd-hda-codec-tegrahdmi):
based on the generic HDMI driver
Along with the driver split, the enable_silent_stream module option is
moved to snd-hda-codec-intelhdmi, too, as it's an Intel-specific
feature.
Most of the changes here are just to split and move the code to
different files, as well as to rename/expose the functions that are
commonly used by drivers.
The silent stream handling code is slightly modified for putting the
stuff into Intel driver; now a new callback "silent_stream" is defined
in hdmi_ops, and it's called in silent_stream_enable() and *_disable()
functions. The runtime-PM handling in silent_stream_enable() was
cleaned up, and rather taking the runtime PM refcount in the
silent_stream() callback appropriately, instead.
Other than that, there should be no functional changes.
The snd-hda-codec-realtek driver supports many different codec models
and accumulated lots of quirks. Now let's split it to multiple
modules per probe function, i.e. for ALC260, ALC262, ALC269, etc.
The common code and quirks are provided by the common library module,
snd-hda-codec-realtek-lib now. One drawback of this action is that
many symbols have to be exported. But they are limited with
SND_HDA_CODEC_REALTEK namespace, at least.
This patch tries to be idiomatic and doesn't try to rewrite the
existing code. We can move the codec model-specific code into each
codec driver later.
The HD-audio sub-codec component binding is currently specific to
ALC269, hence the management is moved into alc269.c.
After that, alc_free() became identical with snd_hda_gen_free(), and
it's replaced as a macro just to call snd_hda_gen_free().
ALSA: hda: Move codec drivers into sound/hda/codecs directory
Now move the all remaining codec drivers from sound/pci/hda to
sound/hda/codecs subdirectory. Some drivers are put under the further
vendor subdirectory, and the vendor helper code (*_helper.c) are put
under helpers subdirectory. Also the sub-codec drivers are moved under
a different subdirectory, sound/hda/codecs/sub-codecs, for
distinguishing from the main HD-audio codec drivers.
The prefix patch_ and hda_ as well as the suffix _helper are dropped
from file names as they are mostly superfluous.
No functional changes but just file path shuffling.
ALSA: hda: Move controller drivers into sound/hda/controllers directory
Now HD-audio controller drivers are moved into sound/hda/controllers
directory as a part of HD-audio code reorganization. Most of drivers
are independent from PCI bus, hence it makes more sense to put under
sound/hda.
The hda_ prefix is dropped from most of files at moving, as it's
more or less superfluous.
ALSA: hda: Move common codec driver into sound/hda/common directory
The snd-hda-codec module contains the most of common code used by both
HD-audio controller and codec drivers, and it's basically independent
from PCI. Let's move the code to sound/hda/common directory as a part
of code reorganization.
The hda_ prefix is dropped from the most of file names as it's rather
superfluous.
ALSA: hda: Move HD-audio core stuff into sound/hda/core
This is a part of HD-audio code restructuring.
Simply move the current code of sound/hda/* into the subdirectory
sound/hda/core, so that more stuff can be moved into sound/hda cleanly
later.
Most of file names with hdac_ and hdac_ext_ prefix are renamed without
the prefix, since they can be identified well in the directory name
and superfluous.
ALSA: hda: Move widget capability macros into hdaudio.h
The get_wcaps() and co are used not only by HD-audio core but also
other driver code, hence it'd be better to put into the common header
instead of local.h.
OTOH, there are macros of the same name like get_wcaps() that are
still used in sound/pci/hda/* locally, and those conflict with each
other. So we need to rename get_wcaps() (to be moved from hda-core)
with the proper snd_hdac prefix for avoiding name conflicts, and
define in the common hdaudio.h.
Replace strcpy() and sprintf() usages in the USB audio drivers with
the safer versions (strscpy() and scnprintf()) with the proper max
size evaluation. Only for safety, no actual behavior change.
snd_ac97_get_name() blindly assumes that the name buffer is large
enough, but we should be more careful. Pass the max buffer length and
allow trimming to the size.
Only a cosmetic safety matter, no functional changes intended.