linux-2.6-microblaze.git
2 months agoALSA: scarlett2: Fix Scarlett 4th Gen input gain range
Geoffrey D. Bennett [Sun, 10 Mar 2024 10:34:59 +0000 (21:04 +1030)]
ALSA: scarlett2: Fix Scarlett 4th Gen input gain range

The input gain range TLV was declared as -70dB to 0dB, but the preamp
gain range is actually 0dB to +70dB. Rename SCARLETT2_GAIN_BIAS to
SCARLETT2_MAX_GAIN and update the TLV to fix.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <9168317b5ac5335943d3f14dbcd1cc2d9b2299d0.1710047969.git.g@b4.vu>

2 months agoALSA: scarlett2: Fix Scarlett 4th Gen autogain status values
Geoffrey D. Bennett [Sun, 10 Mar 2024 10:34:41 +0000 (21:04 +1030)]
ALSA: scarlett2: Fix Scarlett 4th Gen autogain status values

The meanings of the raw_auto_gain_status values were originally
guessed through experimentation, but the official names have now been
discovered. Update the autogain status control strings accordingly.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <8bd12a5e7dc714801dd9887c4bc5cb35c384e27c.1710047969.git.g@b4.vu>

2 months agoALSA: scarlett2: Fix Scarlett 4th Gen 4i4 low-voltage detection
Geoffrey D. Bennett [Sun, 10 Mar 2024 10:34:27 +0000 (21:04 +1030)]
ALSA: scarlett2: Fix Scarlett 4th Gen 4i4 low-voltage detection

The value currently being read to determine the low-voltage state is
actually the front panel state. Fix the code to use the correct offset
for the low-voltage state.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Fixes: d7cfa2fdfc8a ("ALSA: scarlett2: Add power status control")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <d97b7d87f43b0e54f37e1552394be2f3ae182704.1710047969.git.g@b4.vu>

2 months agoALSA: hda/tas2781: restore power state after system_resume
Gergo Koteles [Fri, 8 Mar 2024 17:41:44 +0000 (18:41 +0100)]
ALSA: hda/tas2781: restore power state after system_resume

After system_resume the amplifers will remain off, even if they were on
before system_suspend.

Use playback_started bool to save the playback state, and restore power
state based on it.

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <1742b61901781826f6e6212ffe1d21af542d134a.1709918447.git.soyer@irl.hu>

2 months agoALSA: hda/tas2781: do not call pm_runtime_force_* in system_resume/suspend
Gergo Koteles [Fri, 8 Mar 2024 17:41:43 +0000 (18:41 +0100)]
ALSA: hda/tas2781: do not call pm_runtime_force_* in system_resume/suspend

The runtime_resume function calls prmg_load and apply_calibration
functions, but system_resume also calls them, so calling
pm_runtime_force_resume before reset is unnecessary.

For consistency, do not call the pm_runtime_force_suspend in
system_suspend, as runtime_suspend does the same.

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <d0b4cc1248b9d375d59c009563da42d60d69eac3.1709918447.git.soyer@irl.hu>

2 months agoALSA: hda/tas2781: do not reset cur_* values in runtime_suspend
Gergo Koteles [Fri, 8 Mar 2024 17:41:42 +0000 (18:41 +0100)]
ALSA: hda/tas2781: do not reset cur_* values in runtime_suspend

The amplifier doesn't loose register state in software shutdown mode, so
there is no need to reset the cur_* values.

Without these resets, the amplifier can be turned on after
runtime_suspend without waiting for the program and
profile to be restored.

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <aa27ae084150988bf6a0ead7e3403bc485d790f8.1709918447.git.soyer@irl.hu>

2 months agoALSA: hda/tas2781: add lock to system_suspend
Gergo Koteles [Fri, 8 Mar 2024 17:41:41 +0000 (18:41 +0100)]
ALSA: hda/tas2781: add lock to system_suspend

Add the missing lock around tasdevice_tuning_switch().

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <c666da13d4bc48cd1ab1357479e0c6096541372c.1709918447.git.soyer@irl.hu>

2 months agoALSA: hda/tas2781: use dev_dbg in system_resume
Gergo Koteles [Fri, 8 Mar 2024 17:41:40 +0000 (18:41 +0100)]
ALSA: hda/tas2781: use dev_dbg in system_resume

The system_resume function uses dev_info for tracing, but the other pm
functions use dev_dbg.

Use dev_dbg as the other pm functions.

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <140f3c689c9eb5874e6eb48a570fcd8207f06a41.1709918447.git.soyer@irl.hu>

2 months agoALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops
Athaariq Ardhiansyah [Sun, 10 Mar 2024 13:58:44 +0000 (20:58 +0700)]
ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops

Realtek codec on HP Envy laptop series are heavily modified by vendor.
Therefore, need intervention to make it work properly. The patch fixes:

- B&O soundbar speakers (between lid and keyboard) activation
- Enable LED on mute button
- Add missing process coefficient which affects the output amplifier
- Volume control synchronization between B&O soundbar and side speakers
- Unmute headset output on several HP Envy models
- Auto-enable headset mic when plugged

This patch was tested on HP Envy x360 13-AR0107AU with Realtek ALC285

The only unsolved problem is output amplifier of all built-in speakers
is too weak, which causes volume of built-in speakers cannot be loud
as vendor's proprietary driver due to missing _DSD parameter in the
firmware. The solution is currently on research. Expected to has another
patch in the future.

Potential fix to related issues, need test before close those issues:

- https://bugzilla.kernel.org/show_bug.cgi?id=189331
- https://bugzilla.kernel.org/show_bug.cgi?id=216632
- https://bugzilla.kernel.org/show_bug.cgi?id=216311
- https://bugzilla.kernel.org/show_bug.cgi?id=213507

Signed-off-by: Athaariq Ardhiansyah <foss@athaariq.my.id>
Message-ID: <20240310140249.3695-1-foss@athaariq.my.id>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 11 Mar 2024 08:12:58 +0000 (09:12 +0100)]
Merge branch 'for-next' into for-linus

Prep for 6.9 merge.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoplatform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57
Simon Trimmer [Fri, 8 Mar 2024 13:59:00 +0000 (13:59 +0000)]
platform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57

Add the ACPI HIDs and smi_node descriptions for the CS35L54 and CS35L57
Boosted Smart Amplifiers.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240308135900.603192-4-rf@opensource.cirrus.com>

2 months agoALSA: hda: cs35l56: Add support for CS35L54 and CS35L57
Simon Trimmer [Fri, 8 Mar 2024 13:58:59 +0000 (13:58 +0000)]
ALSA: hda: cs35l56: Add support for CS35L54 and CS35L57

Add the HID for the CS35L54 and CS35L57 Boosted Smart Amplifiers. These
have the same control interface as the CS35L56 so are handled by the
cs35l56-hda driver.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240308135900.603192-3-rf@opensource.cirrus.com>

2 months agoASoC: cs35l56: Add support for CS35L54 and CS35L57
Simon Trimmer [Fri, 8 Mar 2024 13:58:58 +0000 (13:58 +0000)]
ASoC: cs35l56: Add support for CS35L54 and CS35L57

The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has
I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire
control and audio.

The hardware differences between L54, L56 and L57 do not affect the
driver control interface so they can all be handled by the same 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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240308135900.603192-2-rf@opensource.cirrus.com>

2 months agoMerge tag 'asoc-fix-v6.8-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Fri, 8 Mar 2024 07:53:36 +0000 (08:53 +0100)]
Merge tag 'asoc-fix-v6.8-rc7' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.8

Some more driver specific fixes for v6.8, plus one new x86 platform
quirk.  All good fixes to have if you have systems that use the relevant
hardware.

2 months agoALSA: hda: hda_component: Include sound/hda_codec.h
Richard Fitzgerald [Thu, 7 Mar 2024 11:12:16 +0000 (11:12 +0000)]
ALSA: hda: hda_component: Include sound/hda_codec.h

hda_component.h uses hda_codec_dev from sound/hda_codec.h.
Include sound/hda_codec.h instead of assuming that it has already
been included by the parent .c file.

This isn't causing any problems with current code, so no need to
backport to older kernels.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Message-ID: <20240307111216.45053-2-rf@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda: hda_component: Add missing #include guards
Richard Fitzgerald [Thu, 7 Mar 2024 11:12:15 +0000 (11:12 +0000)]
ALSA: hda: hda_component: Add missing #include guards

Add the conventional include guards around the content of the
hda_component.h header file. This prevents double-declaration of
struct hda_component if the header gets included multiple times.

This isn't causing any problems with current code, so no need to
backport to older kernels.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Message-ID: <20240307111216.45053-1-rf@opensource.cirrus.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoASoC: wm8962: Fix up incorrect error message in wm8962_set_fll
Stuart Henderson [Wed, 6 Mar 2024 16:14:39 +0000 (16:14 +0000)]
ASoC: wm8962: Fix up incorrect error message in wm8962_set_fll

Use source instead of ret, which seems to be unrelated and will always
be zero.

Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com>
Link: https://msgid.link/r/20240306161439.1385643-5-stuarth@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: wm8962: Enable both SPKOUTR_ENA and SPKOUTL_ENA in mono mode
Stuart Henderson [Wed, 6 Mar 2024 16:14:36 +0000 (16:14 +0000)]
ASoC: wm8962: Enable both SPKOUTR_ENA and SPKOUTL_ENA in mono mode

Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com>
Link: https://msgid.link/r/20240306161439.1385643-2-stuarth@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: wm8962: Enable oscillator if selecting WM8962_FLL_OSC
Stuart Henderson [Wed, 6 Mar 2024 16:14:35 +0000 (16:14 +0000)]
ASoC: wm8962: Enable oscillator if selecting WM8962_FLL_OSC

Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com>
Link: https://msgid.link/r/20240306161439.1385643-1-stuarth@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: dt-bindings: nvidia: Fix 'lge' vendor prefix
Rob Herring [Tue, 5 Mar 2024 15:21:31 +0000 (09:21 -0600)]
ASoC: dt-bindings: nvidia: Fix 'lge' vendor prefix

The documented vendor prefix for LG Electronics is 'lg' not 'lge'. Just
change the example to 'lg' as there doesn't appear to be any dependency
on the existing compatible string.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://msgid.link/r/20240305152131.3424326-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook
Andy Chi [Mon, 4 Mar 2024 13:40:32 +0000 (21:40 +0800)]
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook

The HP EliteBook using ALC236 codec which using 0x02 to
control mute LED and 0x01 to control micmute LED.
Therefore, add a quirk to make it works.

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240304134033.773348-1-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoASoC: amd: yc: Add HP Pavilion Aero Laptop 13-be2xxx(8BD6) into DMI quirk table
Al Raj Hassain [Mon, 4 Mar 2024 10:39:23 +0000 (16:09 +0530)]
ASoC: amd: yc: Add HP Pavilion Aero Laptop 13-be2xxx(8BD6) into DMI quirk table

The HP Pavilion Aero Laptop 13-be2xxx(8BD6) requires a quirk entry for its internal microphone to function.

Signed-off-by: Al Raj Hassain <alrajhassain@gmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://msgid.link/r/20240304103924.13673-1-alrajhassain@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: rcar: adg: correct TIMSEL setting for SSI9
Andreas Pape [Fri, 1 Mar 2024 08:50:03 +0000 (09:50 +0100)]
ASoC: rcar: adg: correct TIMSEL setting for SSI9

Timing select registers for SRC and CMD are by default
referring to the corresponding SSI word select.
The calculation rule from HW spec skips SSI8, which has
no clock connection.

>From section 43.2.18 CMD Output Timing Select Register (CMDOUT_TIMSEL),
of R-Car Series, 3rd Generation Hardware User’s Manual Rev.2.20:

CMD0_OUT_DIVCLK_ Output Timing
SEL [4:0] Signal Select
B'0 0110:  ssi_ws0
B'0 0111:  ssi_ws1
B'0 1000:  ssi_ws2
B'0 1001:  ssi_ws3
B'0 1010:  ssi_ws4
B'0 1011:  ssi_ws5
B'0 1100:  ssi_ws6
B'0 1101:  ssi_ws7
<GAP>
B'0 1110:  ssi_ws9
B'0 1111:  Setting prohibited

Fix the erroneous prohibited setting of timsel value 1111 (0xf) for SSI9
by using timsel value 1110 (0xe) instead. This is possible because SSI8
is not connected as shown by <GAP> in the table above.

[21.695055] rcar_sound ec500000.sound: b adg[0]-CMDOUT_TIMSEL (32):00000f00/00000f1f

Correct the timsel assignment.

Fixes: 629509c5bc478c ("ASoC: rsnd: add Gen2 SRC and DMAEngine support")
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Andreas Pape <Andreas.Pape4@bosch.com>
Signed-off-by: Yeswanth Rayapati <yeswanth.rayapati@in.bosch.com>
Tested-by: Yeswanth Rayapati <yeswanth.rayapati@in.bosch.com>
[erosca: massage commit description]
Signed-off-by: Eugeniu Rosca <eugeniu.rosca@bosch.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://msgid.link/r/20240301085003.3057-1-erosca@de.adit-jv.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoALSA: ac97: More cleanup with snd_ctl_find_id_mixer()
Takashi Iwai [Mon, 4 Mar 2024 08:21:58 +0000 (09:21 +0100)]
ALSA: ac97: More cleanup with snd_ctl_find_id_mixer()

There was one overlooked place to be replaced with
snd_ctl_find_id_mixer() for code simplification.

No functional change, only code refactoring.

Link: https://lore.kernel.org/r/20240304082158.8583-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda: Reuse for_each_pcm_streams()
Cezary Rojewski [Mon, 26 Feb 2024 12:44:32 +0000 (13:44 +0100)]
ALSA: hda: Reuse for_each_pcm_streams()

Use the macro to improve readability.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240226124432.1203798-6-cezary.rojewski@intel.com
2 months agoASoC: codecs: hda: Cleanup error messages
Cezary Rojewski [Mon, 26 Feb 2024 12:44:31 +0000 (13:44 +0100)]
ASoC: codecs: hda: Cleanup error messages

Be cohesive and use same pattern in each error message.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240226124432.1203798-5-cezary.rojewski@intel.com
2 months agoASoC: Intel: avs: Ignore codecs with no suppoting driver
Cezary Rojewski [Mon, 26 Feb 2024 12:44:30 +0000 (13:44 +0100)]
ASoC: Intel: avs: Ignore codecs with no suppoting driver

HDMI codecs which are present and functional from audio perspective lack
i915 support on drm side what results in -ENODEV during the probing
sequence. There is no reason to perform recovery procedure e.g.: reset
the HDAudio controller if this is the case.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240226124432.1203798-4-cezary.rojewski@intel.com
2 months agoASoC: codecs: hda: Skip HDMI/DP registration if i915 is missing
Cezary Rojewski [Mon, 26 Feb 2024 12:44:29 +0000 (13:44 +0100)]
ASoC: codecs: hda: Skip HDMI/DP registration if i915 is missing

If i915 does not support given platform but the hardware i.e.: HDAudio
codec is still there, the codec-probing procedure will succeed for such
device but the follow up initialization will always end up with -ENODEV.

While bus could filter out address '2' which Intel's HDMI/DP codecs
always enumerate on, more robust approach is to check for i915 presence
before registering display codecs.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240226124432.1203798-3-cezary.rojewski@intel.com
2 months agoALSA: hda: Skip i915 initialization on CNL/LKF-based platforms
Cezary Rojewski [Mon, 26 Feb 2024 12:44:28 +0000 (13:44 +0100)]
ALSA: hda: Skip i915 initialization on CNL/LKF-based platforms

Commit 78f613ba1efb ("drm/i915: finish removal of CNL") and its friends
removed support for i915 for all CNL-based platforms. HDAudio library,
however, still treats such platforms as valid candidates for i915
binding. Update query mechanism to reflect changes made in drm tree.

At the same time, i915 support for LKF-based platforms has not been
provided so remove them from valid binding candidates.

Link: https://lore.kernel.org/all/20210728215946.1573015-1-lucas.demarchi@intel.com/
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240226124432.1203798-2-cezary.rojewski@intel.com
2 months agoALSA: usb-audio: Name feature ctl using output if input is PCM
Kenny Levinsen [Fri, 1 Mar 2024 23:11:07 +0000 (00:11 +0100)]
ALSA: usb-audio: Name feature ctl using output if input is PCM

When building feature controls from a unit without a name, we try to
derive a name first from the feature unit's input, then fall back to the
output terminal.

If a feature unit connects directly to a "USB Streaming" input terminal
rather than a mixer or other virtual type, the control receives the
somewhat meaningless name "PCM", even if the output had a descriptive
type such as "Headset" or "Speaker".

Here is an example of such AudioControl descriptor from a USB headset
which ends up named "PCM Playback" and is therefore not recognized as
headphones by userspace:

      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             4
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          5
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             5
        wTerminalType      0x0402 Headset
        bAssocTerminal          4
        bSourceID               6
        iTerminal               0
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 6
        bSourceID               4
        bControlSize            2
        bmaControls(0)     0x0002
          Volume Control
        bmaControls(1)     0x0000
        bmaControls(2)     0x0000
        iFeature                0

Other headsets and DACs I tried that used their output terminal for
naming only did so due to their input being an unnamed sidetone mixer.

Instead of always starting with the input terminal, check the type of it
first. If it seems uninteresting, invert the order and use the output
terminal first for naming.

This makes userspace recognize headsets with simple controls as
headphones, and leads to more consistent naming of playback devices
based on their outputs irrespective of sidetone mixers.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
Link: https://lore.kernel.org/r/20240301231107.42679-1-kl@kl.wtf
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda: cs35l41: Overwrite CS35L41 configuration for ASUS UM5302LA
Stefan Binding [Fri, 1 Mar 2024 16:01:54 +0000 (16:01 +0000)]
ALSA: hda: cs35l41: Overwrite CS35L41 configuration for ASUS UM5302LA

Whilst this laptop contains _DSD inside the BIOS, there is an error in
this configuration. Override the _DSD in the BIOS with the correct
configuration for this laptop.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240301160154.158398-4-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda/realtek: Add quirks for Lenovo Thinkbook 16P laptops
Stefan Binding [Fri, 1 Mar 2024 16:01:53 +0000 (16:01 +0000)]
ALSA: hda/realtek: Add quirks for Lenovo Thinkbook 16P laptops

These models use 2 CS35L41 amps with HDA using I2C.
Both models have _DSD support inside cs35l41_hda_property.c.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218437

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240301160154.158398-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda: cs35l41: Support Lenovo Thinkbook 16P
Stefan Binding [Fri, 1 Mar 2024 16:01:52 +0000 (16:01 +0000)]
ALSA: hda: cs35l41: Support Lenovo Thinkbook 16P

Adds sound support for 2 Lenovo Thinkbook 16P laptops using CS35L41
HDA with External Boost.

SSIDs:
17AA38A9
17AA38AB

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218437

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240301160154.158398-2-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda/realtek - Add Headset Mic supported Acer NB platform
Kailang Yang [Fri, 1 Mar 2024 07:04:02 +0000 (15:04 +0800)]
ALSA: hda/realtek - Add Headset Mic supported Acer NB platform

It will be enable headset Mic for Acer NB platform.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/fe0eb6661ca240f3b7762b5b3257710d@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hwdep: Move put_user() call out of scoped_guard() in snd_hwdep_control_ioctl()
Nathan Chancellor [Fri, 1 Mar 2024 17:08:22 +0000 (10:08 -0700)]
ALSA: hwdep: Move put_user() call out of scoped_guard() in snd_hwdep_control_ioctl()

Clang prior to 17.0.0 has a bug in its asm goto jump scope analysis to
determine that no variables with the cleanup attribute are skipped by an
indirect jump. Instead of only checking the scope of each label that is
a possible target of each asm goto statement, it checks the scope of
every label, which can cause an error when a variable with the cleanup
attribute is used between two asm goto statements with different scopes,
even if they have completely different label targets:

  sound/core/hwdep.c:273:8: error: cannot jump from this asm goto statement to one of its possible targets
                          if (get_user(device, (int __user *)arg))
                              ^
  arch/powerpc/include/asm/uaccess.h:295:5: note: expanded from macro 'get_user'
                    __get_user(x, _gu_addr) :                             \
                    ^
  arch/powerpc/include/asm/uaccess.h:283:2: note: expanded from macro '__get_user'
          __get_user_size_allowed(__gu_val, __gu_addr, __gu_size, __gu_err);      \
          ^
  arch/powerpc/include/asm/uaccess.h:199:3: note: expanded from macro '__get_user_size_allowed'
                  __get_user_size_goto(x, ptr, size, __gus_failed);       \
                  ^
  arch/powerpc/include/asm/uaccess.h:187:10: note: expanded from macro '__get_user_size_goto'
          case 1: __get_user_asm_goto(x, (u8 __user *)ptr, label, "lbz"); break;  \
                  ^
  arch/powerpc/include/asm/uaccess.h:158:2: note: expanded from macro '__get_user_asm_goto'
          asm_volatile_goto(                                      \
          ^
  include/linux/compiler_types.h:366:33: note: expanded from macro 'asm_volatile_goto'
  #define asm_volatile_goto(x...) asm goto(x)
                                  ^
  sound/core/hwdep.c:291:9: note: possible target of asm goto statement
                                  if (put_user(device, (int __user *)arg))
                                      ^
  arch/powerpc/include/asm/uaccess.h:66:5: note: expanded from macro 'put_user'
                    __put_user(x, _pu_addr) : -EFAULT;                    \
                    ^
  arch/powerpc/include/asm/uaccess.h:52:9: note: expanded from macro '__put_user'
                                                                  \
                                                                  ^
  sound/core/hwdep.c:276:4: note: jump bypasses initialization of variable with __attribute__((cleanup))
                          scoped_guard(mutex, &register_mutex) {
                          ^
  include/linux/cleanup.h:169:20: note: expanded from macro 'scoped_guard'
          for (CLASS(_name, scope)(args),                                 \

To avoid this issue, move the put_user() call out of the scoped_guard()
scope, which allows the asm goto scope analysis to see that the variable
with the cleanup attribute will never be skipped by the asm goto
statements.

There should be no functional change because prior to the refactoring,
put_user() was not called under register_mutex, so this call does not
even need to be in the scoped_guard() in the first place.

Fixes: e6684d08cc19 ("ALSA: hwdep: Use guard() for locking")
Closes: https://github.com/ClangBuiltLinux/linux/issues/2003
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20240301-fix-snd-hwdep-guard-v1-1-6aab033f3f83@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda: optimize the probe codec process
songxiebing [Fri, 1 Mar 2024 01:18:41 +0000 (09:18 +0800)]
ALSA: hda: optimize the probe codec process

In azx_probe_codecs function, when bus->codec_mask is becomes to 0(no codecs),
execute azx_init_chip, bus->codec_mask will be initialized to a value again,
this causes snd_hda_codec_new function to run, the process is as follows:
-->snd_hda_codec_new
-->snd_hda_codec_device_init
-->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
       ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
       ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
       ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
       ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
when no codecs, read communication is error, each command will be polled for
2 second, a total of 10s, it is easy to some problem.
like this:
  2 [   14.833404][ 6] [  T164] hda 0006:00: Codec #0 probe error; disabling it...
  3 [   14.844178][ 6] [  T164] hda 0006:00: codec_mask = 0x1
  4 [   14.880532][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0000
  5 [   15.891988][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0000
  6 [   16.978090][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0001
  7 [   18.140895][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0002
  8 [   19.135516][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0004
 10 [   19.900086][ 6] [  T164] hda 0006:00: no codecs initialized
 11 [   45.573398][ 2] [    C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]

Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.

Signed-off-by: songxiebing <songxiebing@kylinos.cn>
Link: https://lore.kernel.org/r/20240301011841.7247-1-soxiebing@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoALSA: hda/realtek - Fix headset Mic no show at resume back for Lenovo ALC897 platform
Kailang Yang [Fri, 1 Mar 2024 07:29:50 +0000 (15:29 +0800)]
ALSA: hda/realtek - Fix headset Mic no show at resume back for Lenovo ALC897 platform

Headset Mic will no show at resume back.
This patch will fix this issue.

Fixes: d7f32791a9fc ("ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/4713d48a372e47f98bba0c6120fd8254@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoASoC: Intel: bytcr_rt5640: Add an extra entry for the Chuwi Vi8 tablet
Alban Boyé [Wed, 28 Feb 2024 19:28:41 +0000 (19:28 +0000)]
ASoC: Intel: bytcr_rt5640: Add an extra entry for the Chuwi Vi8 tablet

The bios version can differ depending if it is a dual-boot variant of the tablet.
Therefore another DMI match is required.

Signed-off-by: Alban Boyé <alban.boye@protonmail.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240228192807.15130-1-alban.boye@protonmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: madera: Fix typo in madera_set_fll_clks shift value
Stuart Henderson [Thu, 29 Feb 2024 11:46:37 +0000 (11:46 +0000)]
ASoC: madera: Fix typo in madera_set_fll_clks shift value

Fix a typo in the shift value used in madera_set_fll_clks.

Fixes: 3863857dd5ca3 ("ASoC: madera: Enable clocks for input pins when used for the FLL")
Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com>
Link: https://msgid.link/r/20240229114637.352098-1-stuarth@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoMerge tag 'asoc-fix-v6.8-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Thu, 29 Feb 2024 07:29:04 +0000 (08:29 +0100)]
Merge tag 'asoc-fix-v6.8-rc5' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.8

A few small fixes, some driver specific and one slightly larger one
from Richard which adds a new core helper and updates a small clutch of
drivers to deal with the fact that they were using a helper which
requires that the lock for the list of controls without holding that
lock.  We also have some quirks for new AMD based Lenovo systems.

2 months agoALSA: control_led: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:53:06 +0000 (09:53 +0100)]
ALSA: control_led: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

A couple of functions that use snd_card_ref() and *_unref() are also
cleaned up with a defined class, too.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-25-tiwai@suse.de
2 months agoALSA: pcm: oss: Use guard() for setup
Takashi Iwai [Tue, 27 Feb 2024 08:53:05 +0000 (09:53 +0100)]
ALSA: pcm: oss: Use guard() for setup

The setup_mutex in PCM oss code can be simplified with guard().
(params_lock is tough and not trivial to covert, though.)

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-24-tiwai@suse.de
2 months agoALSA: pcm: Use guard() for PCM stream locks
Takashi Iwai [Tue, 27 Feb 2024 08:53:04 +0000 (09:53 +0100)]
ALSA: pcm: Use guard() for PCM stream locks

Define guard() usage for PCM stream locking and use it in appropriate
places.

The pair of snd_pcm_stream_lock() and snd_pcm_stream_unlock() can be
presented with guard(pcm_stream_lock) now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-23-tiwai@suse.de
2 months agoALSA: pcm: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:53:03 +0000 (09:53 +0100)]
ALSA: pcm: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-22-tiwai@suse.de
2 months agoALSA: seq: prioq: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:53:02 +0000 (09:53 +0100)]
ALSA: seq: prioq: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-21-tiwai@suse.de
2 months agoALSA: seq: virmidi: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:53:01 +0000 (09:53 +0100)]
ALSA: seq: virmidi: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-20-tiwai@suse.de
2 months agoALSA: seq: ump: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:53:00 +0000 (09:53 +0100)]
ALSA: seq: ump: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-19-tiwai@suse.de
2 months agoALSA: seq: midi: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:59 +0000 (09:52 +0100)]
ALSA: seq: midi: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-18-tiwai@suse.de
2 months agoALSA: seq: timer: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:58 +0000 (09:52 +0100)]
ALSA: seq: timer: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-17-tiwai@suse.de
2 months agoALSA: seq: queue: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:57 +0000 (09:52 +0100)]
ALSA: seq: queue: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-16-tiwai@suse.de
2 months agoALSA: seq: ports: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:56 +0000 (09:52 +0100)]
ALSA: seq: ports: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-15-tiwai@suse.de
2 months agoALSA: seq: memory: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:55 +0000 (09:52 +0100)]
ALSA: seq: memory: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-14-tiwai@suse.de
2 months agoALSA: seq: fifo: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:54 +0000 (09:52 +0100)]
ALSA: seq: fifo: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-13-tiwai@suse.de
2 months agoALSA: core: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:53 +0000 (09:52 +0100)]
ALSA: core: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-12-tiwai@suse.de
2 months agoALSA: jack: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:52 +0000 (09:52 +0100)]
ALSA: jack: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-11-tiwai@suse.de
2 months agoALSA: rawmidi: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:51 +0000 (09:52 +0100)]
ALSA: rawmidi: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

There are a few remaining explicit mutex and spinlock calls, and those
are the places where the temporary unlock/relocking happens -- which
guard() doens't cover well yet.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-10-tiwai@suse.de
2 months agoALSA: control: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:50 +0000 (09:52 +0100)]
ALSA: control: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

The lops calls under multiple rwsems are factored out as a simple
macro, so that it can be called easily from snd_ctl_dev_register()
and snd_ctl_dev_disconnect().

There are a few remaining explicit rwsem and spinlock calls, and those
are the places where the lock downgrade happens or where the temporary
unlock/relocking happens -- which guard() doens't cover well yet.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-9-tiwai@suse.de
2 months agoALSA: mixer_oss: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:49 +0000 (09:52 +0100)]
ALSA: mixer_oss: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-8-tiwai@suse.de
2 months agoALSA: info: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:48 +0000 (09:52 +0100)]
ALSA: info: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-7-tiwai@suse.de
2 months agoALSA: hwdep: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:47 +0000 (09:52 +0100)]
ALSA: hwdep: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

There are still a few remaining explicit mutex_lock/unlock calls, and
those are for the places where we do temporary unlock/relock, which
doesn't fit well with the guard(), so far.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-6-tiwai@suse.de
2 months agoALSA: hrtimer: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:46 +0000 (09:52 +0100)]
ALSA: hrtimer: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-5-tiwai@suse.de
2 months agoALSA: timer: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:45 +0000 (09:52 +0100)]
ALSA: timer: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

For making changes easier, some functions widen the application of
register_mutex, but those shouldn't influence on any actual
performance.

Also, one code block was factored out as a function so that guard()
can be applied cleanly without much indentation.

There are still a few remaining explicit spin_lock/unlock calls, and
those are for the places where we do temporary unlock/relock, which
doesn't fit well with the guard(), so far.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-4-tiwai@suse.de
2 months agoALSA: compress_offload: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:44 +0000 (09:52 +0100)]
ALSA: compress_offload: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

The explicit mutex_lock/unlock are still seen only in
snd_compress_wait_for_drain() which does temporary unlock/relocking.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-3-tiwai@suse.de
2 months agoALSA: ump: Use guard() for locking
Takashi Iwai [Tue, 27 Feb 2024 08:52:43 +0000 (09:52 +0100)]
ALSA: ump: Use guard() for locking

We can simplify the code gracefully with new guard() macro and co for
automatic cleanup of locks.

Only the code refactoring, and no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240227085306.9764-2-tiwai@suse.de
2 months agoALSA: kunit: Fix sparse warnings
Takashi Iwai [Tue, 27 Feb 2024 10:49:12 +0000 (11:49 +0100)]
ALSA: kunit: Fix sparse warnings

There were a few sparse warnings about the cast of strong-typed
snd_pcm_format_t.  Fix them with cast with __force.

For spreading the ugly mess, put them in the definitions
WRONG_FORMAT_1 and WRONG_FORMAT_2 and use them in the callers.

Fixes: 3e39acf56ede ("ALSA: core: Add sound core KUnit test")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202402270303.PmvmQrJV-lkp@intel.com
Link: https://lore.kernel.org/r/20240227104912.18921-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoASoC: amd: yc: Fix non-functional mic on Lenovo 21J2
Jiawei Wang [Wed, 28 Feb 2024 07:39:14 +0000 (15:39 +0800)]
ASoC: amd: yc: Fix non-functional mic on Lenovo 21J2

Like many other models, the Lenovo 21J2 (ThinkBook 16 G5+ APO)
needs a quirk entry for the internal microphone to function.

Signed-off-by: Jiawei Wang <me@jwang.link>
Link: https://msgid.link/r/20240228073914.232204-2-me@jwang.link
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoASoC: amd: yc: add new YC platform variant (0x63) support
Jiawei Wang [Wed, 28 Feb 2024 07:39:13 +0000 (15:39 +0800)]
ASoC: amd: yc: add new YC platform variant (0x63) support

The Lenovo 21J2 (ThinkBook 16 G5+ APO) has this new variant,
as detected with lspci:

64:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD]
        ACP/ACP3X/ACP6x Audio Coprocessor (rev 63)

Signed-off-by: Jiawei Wang <me@jwang.link>
Link: https://msgid.link/r/20240228073914.232204-1-me@jwang.link
Signed-off-by: Mark Brown <broonie@kernel.org>
2 months agoALSA: hda/realtek - ALC285 reduce pop noise from Headphone port
Kailang Yang [Fri, 23 Feb 2024 06:54:34 +0000 (14:54 +0800)]
ALSA: hda/realtek - ALC285 reduce pop noise from Headphone port

It had pop noise from Headphone port when system reboot state.
If NID 58h Index 0x0 to fill default value, it will reduce pop noise.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/7493e207919a4fb3a0599324fd010e3e@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 months agoASoC: amd: yc: Add Lenovo ThinkBook 21J0 into DMI quirk table
Johnny Hsieh [Mon, 26 Feb 2024 13:44:50 +0000 (21:44 +0800)]
ASoC: amd: yc: Add Lenovo ThinkBook 21J0 into DMI quirk table

This patch adds Lenovo 21J0 (ThinkBook 16 G5+ ARP) to the DMI quirks table
to enable internal microphone array.

Cc: linux-sound@vger.kernel.org
Signed-off-by: Johnny Hsieh <mnixry@outlook.com>
Link: https://msgid.link/r/TYSPR04MB8429D62DFDB6727866ECF1DEC55A2@TYSPR04MB8429.apcprd04.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoALSA: hda/realtek: Add special fixup for Lenovo 14IRP8
Willian Wang [Sat, 24 Feb 2024 16:11:49 +0000 (13:11 -0300)]
ALSA: hda/realtek: Add special fixup for Lenovo 14IRP8

Lenovo Slim/Yoga Pro 9 14IRP8 requires a special fixup because there is
a collision of its PCI SSID (17aa:3802) with Lenovo Yoga DuetITL 2021
codec SSID.

Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555
Link: https://lore.kernel.org/all/d5b42e483566a3815d229270abd668131a0d9f3a.camel@irl.hu
Cc: stable@vger.kernel.org
Signed-off-by: Willian Wang <git@willian.wang>
Reviewed-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/170879111795.8.6687687359006700715.273812184@willian.wang
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol()
Richard Fitzgerald [Wed, 21 Feb 2024 12:37:10 +0000 (12:37 +0000)]
ASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol()

snd_soc_card_get_kcontrol() must be holding a read lock on
card->controls_rwsem while walking the controls list.

Compare with snd_ctl_find_numid().

The existing function is renamed snd_soc_card_get_kcontrol_locked()
so that it can be called from contexts that are already holding
card->controls_rwsem (for example, control get/put functions).

There are few direct or indirect callers of
snd_soc_card_get_kcontrol(), and most are safe. Three require
changes, which have been included in this patch:

codecs/cs35l45.c:
  cs35l45_activate_ctl() is called from a control put() function so
  is changed to call snd_soc_card_get_kcontrol_locked().

codecs/cs35l56.c:
  cs35l56_sync_asp1_mixer_widgets_with_firmware() is called from
  control get()/put() functions so is changed to call
  snd_soc_card_get_kcontrol_locked().

fsl/fsl_xcvr.c:
  fsl_xcvr_activate_ctl() is called from three places, one of which
  already holds card->controls_rwsem:
  1. fsl_xcvr_mode_put(), a control put function, which will
     already be holding card->controls_rwsem.
  2. fsl_xcvr_startup(), a DAI startup function.
  3. fsl_xcvr_shutdown(), a DAI shutdown function.

  To fix this, fsl_xcvr_activate_ctl() has been changed to call
  snd_soc_card_get_kcontrol_locked() so that it is safe to call
  directly from fsl_xcvr_mode_put().
  The fsl_xcvr_startup() and fsl_xcvr_shutdown() functions have been
  changed to take a read lock on card->controls_rsem() around calls
  to fsl_xcvr_activate_ctl(). While this is not very elegant, it
  keeps the change small, to avoid this patch creating a large
  collateral churn in fsl/fsl_xcvr.c.

Analysis of other callers of snd_soc_card_get_kcontrol() is that
they do not need any changes, they are not holding card->controls_rwsem
when they call snd_soc_card_get_kcontrol().

Direct callers of snd_soc_card_get_kcontrol():
  fsl/fsl_spdif.c: fsl_spdif_dai_probe() - DAI probe function
  fsl/fsl_micfil.c: voice_detected_fn() - IRQ handler

Indirect callers via soc_component_notify_control():
  codecs/cs42l43: cs42l43_mic_shutter() - IRQ handler
  codecs/cs42l43: cs42l43_spk_shutter() - IRQ handler
  codecs/ak4118.c: ak4118_irq_handler() - IRQ handler
  codecs/wm_adsp.c: wm_adsp_write_ctl() - not currently used

Indirect callers via snd_soc_limit_volume():
  qcom/sc8280xp.c: sc8280xp_snd_init() - DAIlink init function
  ti/rx51.c: rx51_aic34_init() - DAI init function

I don't have hardware to test the fsl/*, qcom/sc828xp.c, ti/rx51.c
and ak4118.c changes.

Backport note:
The fsl/, qcom/, cs35l45, cs35l56 and cs42l43 callers were added
since the Fixes commit so won't all be present on older kernels.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 209c6cdfd283 ("ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card")
Link: https://lore.kernel.org/r/20240221123710.690224-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoALSA: hda/realtek: tas2781: enable subwoofer volume control
Gergo Koteles [Fri, 23 Feb 2024 11:34:30 +0000 (12:34 +0100)]
ALSA: hda/realtek: tas2781: enable subwoofer volume control

The volume of subwoofer channels is always at maximum with the
ALC269_FIXUP_THINKPAD_ACPI chain.

Use ALC285_FIXUP_THINKPAD_HEADSET_JACK to align it to the master volume.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555#c827
Fixes: 3babae915f4c ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/7ffae10ebba58601d25fe2ff8381a6ae3a926e62.1708687813.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoALSA: pcm_oss: ump: Use automatic cleanup of kfree()
Takashi Iwai [Fri, 23 Feb 2024 08:42:41 +0000 (09:42 +0100)]
ALSA: pcm_oss: ump: Use automatic cleanup of kfree()

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

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240223084241.3361-5-tiwai@suse.de
3 months agoALSA: mixer_oss: ump: Use automatic cleanup of kfree()
Takashi Iwai [Fri, 23 Feb 2024 08:42:40 +0000 (09:42 +0100)]
ALSA: mixer_oss: ump: Use automatic cleanup of kfree()

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

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240223084241.3361-4-tiwai@suse.de
3 months agoALSA: pcm: Use CLASS() for fdget()/fdput()
Takashi Iwai [Fri, 23 Feb 2024 08:42:38 +0000 (09:42 +0100)]
ALSA: pcm: Use CLASS() for fdget()/fdput()

Now we have a nice definition of CLASS(fd) that can be applied as a
clean up for the fdget/fdput pairs in snd_pcm_link().

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

No functional changes, only code refactoring.

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

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

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

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

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

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

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

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

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

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

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

Other than that, the conversions are straightforward.

No functional changes, only code refactoring.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240222111509.28390-2-tiwai@suse.de
3 months agoALSA: pcm: clarify and fix default msbits value for all formats
Jaroslav Kysela [Thu, 22 Feb 2024 17:36:49 +0000 (18:36 +0100)]
ALSA: pcm: clarify and fix default msbits value for all formats

Return used most significant bits from sample bit-width rather than the whole
physical sample word size. The starting bit offset is defined in the format
itself.

The behaviour is not changed for 32-bit formats like S32_LE. But with this
change - msbits value 24 instead 32 is returned for 24-bit formats like S24_LE
etc.

Also, commit 2112aa034907 ("ALSA: pcm: Introduce MSBITS subformat interface")
compares sample bit-width not physical sample bit-width to reset MSBITS_MAX bit
from the subformat bitmask.

Probably no applications are using msbits value for other than S32_LE/U32_LE
formats, because no drivers are reducing msbits value for other formats (with
the msb offset) at the moment.

For sanity, increase PCM protocol version, letting the user space to detect
the changed behaviour.

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

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

Only the code refactoring, and no functional changes.

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

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

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

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

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

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20240221113809.3410109-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoASoC: qcom: Fix uninitialized pointer dmactl
Colin Ian King [Wed, 21 Feb 2024 13:48:04 +0000 (13:48 +0000)]
ASoC: qcom: Fix uninitialized pointer dmactl

In the case where __lpass_get_dmactl_handle is called and the driver
id dai_id is invalid the pointer dmactl is not being assigned a value,
and dmactl contains a garbage value since it has not been initialized
and so the null check may not work. Fix this to initialize dmactl to
NULL. One could argue that modern compilers will set this to zero, but
it is useful to keep this initialized as per the same way in functions
__lpass_platform_codec_intf_init and lpass_cdc_dma_daiops_hw_params.

Cleans up clang scan build warning:
sound/soc/qcom/lpass-cdc-dma.c:275:7: warning: Branch condition
evaluates to a garbage value [core.uninitialized.Branch]

Fixes: b81af585ea54 ("ASoC: qcom: Add lpass CPU driver for codec dma control")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://msgid.link/r/20240221134804.3475989-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoMerge branch 'for-linus' into for-next
Takashi Iwai [Wed, 21 Feb 2024 10:16:43 +0000 (11:16 +0100)]
Merge branch 'for-linus' into for-next

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Hans Peter <flurry123@gmx.ch>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240219164518.4099-1-flurry123@gmx.ch
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 months agoASoC: cs35l56: Must clear HALO_STATE before issuing SYSTEM_RESET
Richard Fitzgerald [Fri, 16 Feb 2024 14:05:35 +0000 (14:05 +0000)]
ASoC: cs35l56: Must clear HALO_STATE before issuing SYSTEM_RESET

The driver must write 0 to HALO_STATE before sending the SYSTEM_RESET
command to the firmware.

HALO_STATE is in DSP memory, which is preserved across a soft reset.
The SYSTEM_RESET command does not change the value of HALO_STATE.
There is period of time while the CS35L56 is resetting, before the
firmware has started to boot, where a read of HALO_STATE will return
the value it had before the SYSTEM_RESET. If the driver does not
clear HALO_STATE, this would return BOOT_DONE status even though the
firmware has not booted.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 8a731fd37f8b ("ASoC: cs35l56: Move utility functions to shared file")
Link: https://msgid.link/r/20240216140535.1434933-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoALSA: hda/realtek: Fix top speaker connection on Dell Inspiron 16 Plus 7630
Jay Ajit Mate [Mon, 19 Feb 2024 10:04:04 +0000 (15:34 +0530)]
ALSA: hda/realtek: Fix top speaker connection on Dell Inspiron 16 Plus 7630

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

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

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

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

This commit fixes the bug.

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>