linux-2.6-microblaze.git
2 years agoALSA: usb-audio: Validate MS endpoint descriptors
Takashi Iwai [Mon, 10 May 2021 15:06:59 +0000 (17:06 +0200)]
ALSA: usb-audio: Validate MS endpoint descriptors

snd_usbmidi_get_ms_info() may access beyond the border when a
malformed descriptor is passed.  This patch adds the sanity checks of
the given MS endpoint descriptors, and skips invalid ones.

Reported-by: syzbot+6bb23a5d5548b93c94aa@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210510150659.17710-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda: fixup headset for ASUS GU502 laptop
Daniel Cordova A [Fri, 7 May 2021 17:31:16 +0000 (12:31 -0500)]
ALSA: hda: fixup headset for ASUS GU502 laptop

The GU502 requires a few steps to make headset i/o works properly:
pincfg, verbs to unmute headphone out and callback to toggle output
between speakers and headphone using jack.

Signed-off-by: Daniel Cordova A <danesc87@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210507173116.12043-1-danesc87@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: reset eapd coeff to default value for alc287
Hui Wang [Fri, 7 May 2021 02:44:52 +0000 (10:44 +0800)]
ALSA: hda/realtek: reset eapd coeff to default value for alc287

Ubuntu users reported an audio bug on the Lenovo Yoga Slim 7 14IIL05,
he installed dual OS (Windows + Linux), if he booted to the Linux
from Windows, the Speaker can't work well, it has crackling noise,
if he poweroff the machine first after Windows, the Speaker worked
well.

Before rebooting or shutdown from Windows, the Windows changes the
codec eapd coeff value, but the BIOS doesn't re-initialize its value,
when booting into the Linux from Windows, the eapd coeff value is not
correct. To fix it, set the codec default value to that coeff register
in the alsa driver.

BugLink: http://bugs.launchpad.net/bugs/1925057
Suggested-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210507024452.8300-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP
Hui Wang [Tue, 4 May 2021 07:39:17 +0000 (15:39 +0800)]
ALSA: hda: generic: change the DAC ctl name for LO+SPK or LO+HP

Without this change, the DAC ctl's name could be changed only when
the machine has both Speaker and Headphone, but we met some machines
which only has Lineout and Headhpone, and the Lineout and Headphone
share the Audio Mixer0 and DAC0, the ctl's name is set to "Front".

On most of machines, the "Front" is used for Speaker only or Lineout
only, but on this machine it is shared by Lineout and Headphone,
This introduces an issue in the pipewire and pulseaudio, suppose users
want the Headphone to be on and the Speaker/Lineout to be off, they
could turn off the "Front", this works on most of the machines, but on
this machine, the "Front" couldn't be turned off otherwise the
headphone will be off too. Here we do some change to let the ctl's
name change to "Headphone+LO" on this machine, and pipewire and
pulseaudio already could handle "Headphone+LO" and "Speaker+LO".
(https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747)

BugLink: http://bugs.launchpad.net/bugs/804178
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20210504073917.22406-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Add fixup for HP OMEN laptop
Takashi Iwai [Tue, 4 May 2021 12:18:32 +0000 (14:18 +0200)]
ALSA: hda/realtek: Add fixup for HP OMEN laptop

HP OMEN dc0019-ur with codec SSID 103c:84da requires the pin config
overrides and the existing mic/mute LED setup.  This patch implements
those in the fixup table.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212733
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210504121832.4558-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Fix speaker amp on HP Envy AiO 32
Takashi Iwai [Tue, 4 May 2021 09:18:02 +0000 (11:18 +0200)]
ALSA: hda/realtek: Fix speaker amp on HP Envy AiO 32

HP Envy AiO 32-a12xxx has an external amp that is controlled via GPIO
bit 0x04.  However, unlike other devices, this amp seems to shut down
itself after the certain period, hence the OS needs to up/down the bit
dynamically only during the actual playback.

This patch adds the control of the GPIO bit via the existing pcm_hook
mechanism.  Ideally it should be triggered at the actual stream start,
but we have only the state change at prepare/cleanup, so use those for
switching the GPIO bit on/off.  This should be good enough for the
purpose, and was actually confirmed to work fine.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212873
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210504091802.13200-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Fix silent headphone output on ASUS UX430UA
Takashi Iwai [Tue, 4 May 2021 08:20:57 +0000 (10:20 +0200)]
ALSA: hda/realtek: Fix silent headphone output on ASUS UX430UA

It was reported that the headphone output on ASUS UX430UA (SSID
1043:1740) with ALC295 codec is silent while the speaker works.
After the investigation, it turned out that the DAC assignment has to
be fixed on this machine; unlike others, it expects DAC 0x02 to be
assigned to the speaker pin 0x07 while DAC 0x03 to headphone pin
0x21.

This patch provides a fixup for the fixed DAC/pin mapping for this
device.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212933
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210504082057.6913-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8
Timo Gurr [Mon, 3 May 2021 11:08:22 +0000 (13:08 +0200)]
ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8

The decibel volume range contains a negative maximum value resulting in
pipewire complaining about the device and effectivly having no sound
output. The wrong values also resulted in the headset sounding muted
already at a mixer level of about ~25%.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1049
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212897
Signed-off-by: Timo Gurr <timo.gurr@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210503110822.10222-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: ALC285 Thinkpad jack pin quirk is unreachable
Sami Loone [Sat, 1 May 2021 10:07:53 +0000 (12:07 +0200)]
ALSA: hda/realtek: ALC285 Thinkpad jack pin quirk is unreachable

In 9bbb94e57df1 ("ALSA: hda/realtek: fix static noise on ALC285 Lenovo
laptops") an existing Lenovo quirk was made more generic by removing a
0x12 pin requirement from the entry. This made the second chance table
Thinkpad jack entry unreachable as the pin configurations became
identical.

Revert the 0x12 pin requirement removal and move Thinkpad jack pin quirk
back to the primary pin table as they can co-exist when more specific
configurations come first.

Add a more targeted pin quirk for Lenovo devices that have 0x12 as
0x40000000.

Tested on Yoga 6 (AMD) laptop.

[ Corrected the commit ID -- tiwai ]

Fixes: 9bbb94e57df1 ("ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops")
Signed-off-by: Sami Loone <sami@loone.fi>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/YI0oefvTYn8URYDb@yoga
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/conexant: Re-order CX5066 quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:27:04 +0000 (13:27 +0200)]
ALSA: hda/conexant: Re-order CX5066 quirk table entries

Just re-order the cx5066_fixups[] entries for HP devices for avoiding
the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Remove redundant entry for ALC861 Haier/Uniwill devices
Takashi Iwai [Wed, 28 Apr 2021 11:27:03 +0000 (13:27 +0200)]
ALSA: hda/realtek: Remove redundant entry for ALC861 Haier/Uniwill devices

The quirk entry for Uniwill ECS M31EI is with the PCI SSID device 0,
which means matching with all.  That is, it's essentially equivalent
with SND_PCI_QUIRK_VENDOR(0x1584), which also matches with the
previous entry for Haier W18 applying the very same quirk.

Let's unify them with the single vendor-quirk entry.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC662 quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:27:02 +0000 (13:27 +0200)]
ALSA: hda/realtek: Re-order ALC662 quirk table entries

Just re-order the alc662_fixup_tbl[] entries for Acer and ASUS devices
for avoiding the oversight of the duplicated or unapplied item in
future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order remaining ALC269 quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:27:01 +0000 (13:27 +0200)]
ALSA: hda/realtek: Re-order remaining ALC269 quirk table entries

Just re-order the alc269_fixup_tbl[] entries for FSC, Medion, Samsung
and Lemote devices for avoiding the oversight of the duplicated or
unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 Lenovo quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:27:00 +0000 (13:27 +0200)]
ALSA: hda/realtek: Re-order ALC269 Lenovo quirk table entries

Just re-order the alc269_fixup_tbl[] entries for Lenovo devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 Sony quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:59 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC269 Sony quirk table entries

Just re-order the alc269_fixup_tbl[] entries for Sony devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 ASUS quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:58 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC269 ASUS quirk table entries

Just re-order the alc269_fixup_tbl[] entries for ASUS devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 Dell quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:57 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC269 Dell quirk table entries

Just re-order the alc269_fixup_tbl[] entries for Dell devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 Acer quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:56 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC269 Acer quirk table entries

Just re-order the alc269_fixup_tbl[] entries for Acer devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC269 HP quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:55 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC269 HP quirk table entries

Just re-order the alc269_fixup_tbl[] entries for HP devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Formerly, some entries were grouped for the actual codec, but this
doesn't seem reasonable to keep in that way.  So now we simply keep
the PCI SSID order for the whole.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC882 Clevo quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:54 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC882 Clevo quirk table entries

Just re-order the alc882_fixup_tbl[] entries for Clevo devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also, user lower hex letters in the entry.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC882 Sony quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:53 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC882 Sony quirk table entries

Just re-order the alc882_fixup_tbl[] entries for Sony devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2 years agoALSA: hda/realtek: Re-order ALC882 Acer quirk table entries
Takashi Iwai [Wed, 28 Apr 2021 11:26:52 +0000 (13:26 +0200)]
ALSA: hda/realtek: Re-order ALC882 Acer quirk table entries

Just re-order the alc882_fixup_tbl[] entries for Acer devices for
avoiding the oversight of the duplicated or unapplied item in future.
No functional changes.

Also Cc-to-stable for the further patch applications.

Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210428112704.23967-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: Remove redundant assignment to len
Jiapeng Chong [Tue, 27 Apr 2021 10:26:34 +0000 (18:26 +0800)]
ALSA: usb-audio: Remove redundant assignment to len

Variable len is set to zero but this value is never read as it is
overwritten with a new value later on, hence it is a redundant
assignment and can be removed.

Cleans up the following clang-analyzer warning:

sound/usb/mixer.c:2713:3: warning: Value stored to 'len' is never read
[clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1619519194-57806-1-git-send-email-jiapeng.chong@linux.alibaba.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx
Eckhart Mohr [Tue, 27 Apr 2021 15:30:25 +0000 (17:30 +0200)]
ALSA: hda/realtek: Add quirk for Intel Clevo PCx0Dx

This applies a SND_PCI_QUIRK(...) to the Clevo PCx0Dx barebones. This
fix enables audio output over the headset jack and ensures that a
microphone connected via the headset combo jack is correctly recognized
when pluged in.

[ Rearranged the list entries in a sorted order -- tiwai ]

Signed-off-by: Eckhart Mohr <e.mohr@tuxedocomputers.com>
Co-developed-by: Werner Sembach <wse@tuxedocomputers.com>
Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210427153025.451118-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: virtio: fix kernel-doc
Pierre-Louis Bossart [Mon, 26 Apr 2021 21:39:02 +0000 (16:39 -0500)]
ALSA: virtio: fix kernel-doc

make W=1 warning:

sound/virtio/virtio_ctl_msg.c:70: warning: expecting prototype for
virtsnd_ctl_msg_request(). Prototype was for
virtsnd_ctl_msg_response() instead

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210426213902.234711-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/cirrus: Use CS8409 filter to fix abnormal sounds on Bullseye
Stefan Binding [Mon, 26 Apr 2021 16:37:49 +0000 (17:37 +0100)]
ALSA: hda/cirrus: Use CS8409 filter to fix abnormal sounds on Bullseye

Cracking noises have been reported on the built-in speaker for certain
Bullseye platforms, when volume is > 80%.

This issue is caused by the specific combination of Codec and AMP in
this platform, and cannot be fixed by the AMP, so indead must be fixed
at codec level, by adding attenuation to the volume.

Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1924997
Reported-and-tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210426163749.196153-3-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/cirrus: Set Initial DMIC volume for Bullseye to -26 dB
Stefan Binding [Mon, 26 Apr 2021 16:37:48 +0000 (17:37 +0100)]
ALSA: hda/cirrus: Set Initial DMIC volume for Bullseye to -26 dB

After booting for first time on Bullseye, the DMIC is currently muted.
Instead, the DMIC volume should be set to a valid initial value.

Tested on DELL Inspiron-3505, DELL Inspiron-3501, DELL Inspiron-3500

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1923557
Reported-and-tested-by: You-Sheng Yang <vicamo.yang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210426163749.196153-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: sb: Fix two use after free in snd_sb_qsound_build
Lv Yunlong [Mon, 26 Apr 2021 14:55:41 +0000 (07:55 -0700)]
ALSA: sb: Fix two use after free in snd_sb_qsound_build

In snd_sb_qsound_build, snd_ctl_add(..,p->qsound_switch...) and
snd_ctl_add(..,p->qsound_space..) are called. But the second
arguments of snd_ctl_add() could be freed via snd_ctl_add_replace()
->snd_ctl_free_one(). After the error code is returned,
snd_sb_qsound_destroy(p) is called in __error branch.

But in snd_sb_qsound_destroy(), the freed p->qsound_switch and
p->qsound_space are still used by snd_ctl_remove().

My patch set p->qsound_switch and p->qsound_space to NULL if
snd_ctl_add() failed to avoid the uaf bugs. But these codes need
to further be improved with the code style.

Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210426145541.8070-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge tag 'asoc-v5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Mon, 26 Apr 2021 14:59:21 +0000 (16:59 +0200)]
Merge tag 'asoc-v5.13' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v5.13

A lot of changes here for quite a quiet release in subsystem terms -
there's been a lot of fixes and cleanups all over the subsystem both
from generic work and from people working on specific drivers.

 - More cleanup and consolidation work in the core and the generic card
   drivers from Morimoto-san.
 - Lots of cppcheck fixes for Pierre-Louis Brossart.
 - New drivers for Freescale i.MX DMA over rpmsg, Mediatek MT6358
   accessory detection, and Realtek RT1019, RT1316, RT711 and RT715.

3 years agoALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer
Lv Yunlong [Mon, 26 Apr 2021 13:11:29 +0000 (06:11 -0700)]
ALSA: emu8000: Fix a use after free in snd_emu8000_create_mixer

Our code analyzer reported a uaf.

In snd_emu8000_create_mixer, the callee snd_ctl_add(..,emu->controls[i])
calls snd_ctl_add_replace(.., kcontrol,..). Inside snd_ctl_add_replace(),
if error happens, kcontrol will be freed by snd_ctl_free_one(kcontrol).
Then emu->controls[i] points to a freed memory, and the execution comes
to __error branch of snd_emu8000_create_mixer. The freed emu->controls[i]
is used in snd_ctl_remove(card, emu->controls[i]).

My patch set emu->controls[i] to NULL if snd_ctl_add() failed to avoid
the uaf.

Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210426131129.4796-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops
Sami Loone [Sun, 25 Apr 2021 20:37:12 +0000 (22:37 +0200)]
ALSA: hda/realtek: fix static noise on ALC285 Lenovo laptops

Remove a duplicate vendor+subvendor pin fixup entry as one is masking
the other and making it unreachable. Consider the more specific newcomer
as a second chance instead.

The generic entry is made less strict to also match for laptops with
slightly different 0x12 pin configuration. Tested on Lenovo Yoga 6 (AMD)
where 0x12 is 0x40000000.

Fixes: 607184cb1635 ("ALSA: hda/realtek - Add supported for more Lenovo ALC285 Headset Button")
Signed-off-by: Sami Loone <sami@loone.fi>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/YIXS+GT/dGI/LtK6@yoga
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: usb-audio: Fix implicit sync clearance at stopping stream
Takashi Iwai [Mon, 26 Apr 2021 06:33:49 +0000 (08:33 +0200)]
ALSA: usb-audio: Fix implicit sync clearance at stopping stream

The recent endpoint management change for implicit feedback mode added
a clearance of ep->sync_sink (formerly ep->sync_slave) pointer at
snd_usb_endpoint_stop() to assure no leftover for the feedback from
the already stopped capture stream.  This turned out to cause a
regression, however, when full-duplex streams were running and only a
capture was stopped.  Because of the above clearance of ep->sync_sink
pointer, no more feedback is done, hence the playback will stall.

This patch fixes the ep->sync_sink clearance to be done only after all
endpoints are released, for addressing the regression.

Reported-and-tested-by: Lucas Endres <jaffa225man@gmail.com>
Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210426063349.18601-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge remote-tracking branch 'asoc/for-5.13' into asoc-next
Mark Brown [Fri, 23 Apr 2021 18:01:02 +0000 (19:01 +0100)]
Merge remote-tracking branch 'asoc/for-5.13' into asoc-next

3 years agoMerge remote-tracking branch 'asoc/for-5.12' into asoc-linus
Mark Brown [Fri, 23 Apr 2021 18:01:00 +0000 (19:01 +0100)]
Merge remote-tracking branch 'asoc/for-5.12' into asoc-linus

3 years agoASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2
Mark Brown [Fri, 23 Apr 2021 17:07:54 +0000 (18:07 +0100)]
ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2

A KernelCI bisection identified 59c35c44a9cf89 "ASoC: simple-card: add
simple_parse_node()" as causing simple-card to fail to instantiate on
kontron-sl28-var3-ads2 systems.  Since the merge window is expected to
open over the weekend drop that commit and subsequent ones which depend
on it for now in case other systems are affected too.

The boot log showed the error as:

<4>[    9.948821] sysfs: cannot create duplicate filename '/devices/platform/sound/(null)-wm8904-hifi'

(backtrace)

<3>[   10.191982] kobject_add_internal failed for (null)-wm8904-hifi with -EEXIST, don't try to register things with the same name in the same directory.

The dropped commits are:

73371bacf0475a20ab6 "ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()"
434392271afcff350fe "ASoC: simple-card: add simple_link_init()"
59c35c44a9cf89a83a9 "ASoC: simple-card: add simple_parse_node()"

Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt711-sdca: add the notification when volume changed
Shuming Fan [Thu, 22 Apr 2021 10:32:35 +0000 (18:32 +0800)]
ASoC: rt711-sdca: add the notification when volume changed

This patch adds the return value when the volume settings were changed.
The userspace application might monitor the kcontrols to check which control changed.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210422103235.22048-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt711-sdca: change capture switch controls
Shuming Fan [Thu, 22 Apr 2021 10:32:20 +0000 (18:32 +0800)]
ASoC: rt711-sdca: change capture switch controls

The DAPM event and mixer control could mute/unmute the capture directly.
That will be confused that capture still works if the user settings is unmute before the capture.
Therefore, this patch uses the variables to record the capture switch status of DAPM and mixer.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210422103220.21987-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: da7219: properly get clk from the provider
Jerome Brunet [Wed, 21 Apr 2021 12:05:12 +0000 (14:05 +0200)]
ASoC: da7219: properly get clk from the provider

Instead of using the clk embedded in the clk_hw (which is meant to go
away), a clock provider which need to interact with its own clock should
request clk reference through the clock provider API.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-6-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: lpass: use the clock provider API
Jerome Brunet [Wed, 21 Apr 2021 12:05:11 +0000 (14:05 +0200)]
ASoC: lpass: use the clock provider API

Clock providers should be registered using the clk_hw API.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-5-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt5682: clock driver must use the clock provider API
Jerome Brunet [Wed, 21 Apr 2021 12:05:10 +0000 (14:05 +0200)]
ASoC: rt5682: clock driver must use the clock provider API

Clock drivers ops should not call the clk API but the clock provider
(clk_hw) instead.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-4-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: wcd934x: use the clock provider API
Jerome Brunet [Wed, 21 Apr 2021 12:05:09 +0000 (14:05 +0200)]
ASoC: wcd934x: use the clock provider API

Clock providers should use the clk_hw API

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: stm32: properly get clk from the provider
Jerome Brunet [Wed, 21 Apr 2021 12:05:08 +0000 (14:05 +0200)]
ASoC: stm32: properly get clk from the provider

Instead of using the clk embedded in the clk_hw (which is meant to go
away), a clock provider which need to interact with its own clock should
request clk reference through the clock provider API.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: usb-audio: Generic application of implicit fb to Roland/BOSS devices
Takashi Iwai [Thu, 22 Apr 2021 12:04:13 +0000 (14:04 +0200)]
ALSA: usb-audio: Generic application of implicit fb to Roland/BOSS devices

Through the examinations and experiments with lots of Roland and BOSS
USB-audio devices, we found out that the recently introduced
full-duplex operations with the implicit feedback mode work fine for
quite a few devices, while the others need only the capture-side quirk
to enforce the full-duplex mode.  The recent commit d86f43b17ed4
("ALSA: usb-audio: Add support for many Roland devices' implicit
feedback quirks") tried to add such quirk entries manually in the
lists, but this turned out to be too many and error-prone, hence it
was reverted again.

This patch is another attempt to cover those missing Roland/BOSS
devices but in a more generic way.  It matches the devices with the
vendor ID 0x0582, and checks whether they are with both ASYNC sync
types or ASYNC is only for capture device.  In the former case, it's
the device with the implicit feedback mode, and applies accordingly.
In both cases, the capture stream requires always the full-duplex
mode, and we apply the known capture quirk for that, too.

Basically the already existing BOSS device quirk entries become
redundant after this generic matching, so those are removed.  Although
the capture_implicit_fb_quirks[] table became empty and superfluous, I
keep it for now, so that people can put a special device easily at any
time later again.

Link: https://lore.kernel.org/r/CAOsVg8rA61B=005_VyUwpw3piVwA7Bo5fs1GYEB054efyzGjLw@mail.gmail.com
Link: https://lore.kernel.org/r/20210414083255.9527-1-tiwai@suse.de
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212519
Tested-by: Lucas Endres <jaffa225man@gmail.com>
Link: https://lore.kernel.org/r/20210422120413.457-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoRevert "ALSA: usb-audio: Add support for many Roland devices..."
Takashi Iwai [Thu, 22 Apr 2021 12:04:12 +0000 (14:04 +0200)]
Revert "ALSA: usb-audio: Add support for many Roland devices..."

This reverts commit d86f43b17ed4 ("ALSA: usb-audio: Add support for
many Roland devices' feedback quirks").

It turned out that many quirk entries there don't contain the proper
EP values and/or the quirk types, which lead to the broken
operations.

As we're going to cover all Roland/BOSS devices in a more generic way
rather the explicit lists, let's revert the previous additions at
first.

Fixes: d86f43b17ed4 ("ALSA: usb-audio: Add support for many Roland devices' implicit feedback quirks")
Link: https://lore.kernel.org/r/20210422120413.457-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: tegra: mark runtime-pm functions as __maybe_unused
Arnd Bergmann [Thu, 22 Apr 2021 13:34:00 +0000 (15:34 +0200)]
ASoC: tegra: mark runtime-pm functions as __maybe_unused

A reorganization of the driver source led to two of them causing
a compile time warning in some configurations:

tegra/tegra20_spdif.c:36:12: error: 'tegra20_spdif_runtime_resume' defined but not used [-Werror=unused-function]
   36 | static int tegra20_spdif_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra20_spdif.c:27:12: error: 'tegra20_spdif_runtime_suspend' defined but not used [-Werror=unused-function]
   27 | static int tegra20_spdif_runtime_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra30_ahub.c:64:12: error: 'tegra30_ahub_runtime_resume' defined but not used [-Werror=unused-function]
   64 | static int tegra30_ahub_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra30_ahub.c:43:12: error: 'tegra30_ahub_runtime_suspend' defined but not used [-Werror=unused-function]
   43 | static int tegra30_ahub_runtime_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mark these functions as __maybe_unused to avoid this kind of warning.

Fixes: b5571449e618 ("ASoC: tegra30: ahub: Remove handing of disabled runtime PM")
Fixes: c53b396f0dd4 ("ASoC: tegra20: spdif: Remove handing of disabled runtime PM")
Fixes: 80ec4a4cb36d ("ASoC: tegra20: i2s: Remove handing of disabled runtime PM")
Fixes: b5f6f781fcb2 ("ASoC: tegra30: i2s: Remove handing of disabled runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210422133418.1757893-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: adau17x1: Avoid overwriting CHPF
Niklas Carlsson [Thu, 22 Apr 2021 13:02:26 +0000 (15:02 +0200)]
ASoC: adau17x1: Avoid overwriting CHPF

Configuring number of channels per LRCLK frame by using e.g.
snd_soc_dai_set_tdm_slot before configuring DAI format was being
overwritten by the latter due to a regmap_write which would write over
the whole register.

Signed-off-by: Niklas Carlsson <niklasc@axis.com>
Link: https://lore.kernel.org/r/20210422130226.15201-1-Niklas.Carlsson@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: tidyup graph_dai_link_of_dpcm()
Kuninori Morimoto [Wed, 21 Apr 2021 05:45:56 +0000 (14:45 +0900)]
ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()

Use local variable at local area only.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6psi417.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: simple-card: add simple_link_init()
Kuninori Morimoto [Wed, 21 Apr 2021 05:45:52 +0000 (14:45 +0900)]
ASoC: simple-card: add simple_link_init()

This patch adds simple_link_init() and share dai_link setting code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bla8i41b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: simple-card: add simple_parse_node()
Kuninori Morimoto [Wed, 21 Apr 2021 05:45:48 +0000 (14:45 +0900)]
ASoC: simple-card: add simple_parse_node()

Parse dai/tdm/clk are common for both CPU/Codec node.
This patch creates simple_parse_node() for it and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czuoi41f.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: add graph_link_init()
Kuninori Morimoto [Wed, 21 Apr 2021 05:45:43 +0000 (14:45 +0900)]
ASoC: audio-graph: add graph_link_init()

This patch adds graph_link_init() and share dai_link setting code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eef4i41k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: add graph_parse_node()
Kuninori Morimoto [Wed, 21 Apr 2021 05:45:21 +0000 (14:45 +0900)]
ASoC: audio-graph: add graph_parse_node()

Parse mclk_fs/dai/tdm/clk are common for both CPU/Codec node.
This patch creates graph_parse_node() for it and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fszki426.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: Intel: KMB: Fix random noise at the HDMI output
Sia Jee Heng [Wed, 21 Apr 2021 00:55:46 +0000 (08:55 +0800)]
ASoC: Intel: KMB: Fix random noise at the HDMI output

Random noise could be heard when playing audio to the HDMI output.
This is due to the IEC conversion is invoked in the external loop.
As a result, this additional loop takes up a lot of the processing
cycle.

hdmi_reformat_iec958() process the conversion using an internal loop,
it is safe to move it out from the external loop to avoid unnecessary
processing cycle been spent. Furthermore, ALSA IEC958 plugin works in
32bit format only.

Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210421005546.7534-1-jee.heng.sia@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: amd: drop S24_LE format support
Vijendar Mukunda [Wed, 21 Apr 2021 08:23:11 +0000 (13:53 +0530)]
ASoC: amd: drop S24_LE format support

AMD I2S Controller doesn't support S24_LE format.
Remove S24_LE format support from ACP DMA driver
and CPU DAI Driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/1618993402-10354-1-git-send-email-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: audio-graph: cleanups" from Kuninori Morimoto <kuninori.morimoto...
Mark Brown [Tue, 20 Apr 2021 18:30:50 +0000 (19:30 +0100)]
Merge series "ASoC: audio-graph: cleanups" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These patches cleanups audio-graph.
This is part of prepare for new audio-graph-card2.

Kuninori Morimoto (6):
  ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
  ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
  ASoC: audio-graph: check ports if exists
  ASoC: audio-graph: remove "audio-graph-card," preix support
  ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()
  ASoC: audio-graph: remove Platform support

 include/sound/graph_card.h               |  4 --
 include/sound/simple_card_utils.h        |  3 ++
 sound/soc/generic/audio-graph-card.c     | 52 ++++--------------------
 sound/soc/generic/simple-card-utils.c    | 25 ++++++++++++
 sound/soc/generic/simple-card.c          |  7 ----
 sound/soc/tegra/tegra_audio_graph_card.c |  4 +-
 6 files changed, 38 insertions(+), 57 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto

3 years agoASoC: ak4458: enable daisy chain
Viorel Suman [Tue, 20 Apr 2021 10:44:13 +0000 (18:44 +0800)]
ASoC: ak4458: enable daisy chain

Enable Daisy Chain if in TDM mode and the number of played
channels is bigger than the maximum supported number of channels.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1618915453-29445-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: remove Platform support
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:43 +0000 (11:02 +0900)]
ASoC: audio-graph: remove Platform support

Platform was one of mandatory component on ASoC before,
and audio-graph-card was assuming that CPU and Platform were
same driver.

But it is no longer mandatory on ASoC.
Current ASoC will just ignore if Platform and CPU were same
or doplicated component.

Of course ASoC is supporting Platform, but current
audio-graph-card doesn't support detecting it from DT.

This means current audio-graph-card operation for Platform so far
is 100% useless. This patch removes it.
We can respawn it when we need it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg3n3ubg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:38 +0000 (11:02 +0900)]
ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()

graph_parse_mclk_fs() has "node", but is not used.
This patch removes unused "node"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tuo33ubl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: remove "audio-graph-card, " preix support
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:34 +0000 (11:02 +0900)]
ASoC: audio-graph: remove "audio-graph-card, " preix support

No upstream code is using "audio-graph-card," preix,
and Yaml base Document doesn't indicate it.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v98j3ubp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: check ports if exists
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:29 +0000 (11:02 +0900)]
ASoC: audio-graph: check ports if exists

"endpoint" and "port" are always exists, but there is no guarantee
for "ports". This patch checks "ports" if exists, otherwise,
it might set un-expected settings.

This patch also do align to 100 char in 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnsz3ubu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:25 +0000 (11:02 +0900)]
ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c

audio-graph-card2 can reuse  audio_graph_remove() / asoc_simple_remove().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2df3uby.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
Kuninori Morimoto [Mon, 19 Apr 2021 02:02:19 +0000 (11:02 +0900)]
ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c

audio-graph-card2 can reuse audio_graph_card_probe().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgxv3uc4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails
Colin Ian King [Tue, 20 Apr 2021 13:47:19 +0000 (14:47 +0100)]
ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails

Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL)
the error return path returns -ENOMEM via the exit label "error". Other
uses of the same error exit label set the err variable to -ENOMEM but this
is not being used.  I believe the original intent was for the error exit
path to return the value in err rather than the hard coded -ENOMEM, so
return this rather than the hard coded -ENOMEM.

Addresses-Coverity: ("Unused value")
Fixes: 738d9edcfd44 ("ALSA: usb-audio: Add sanity checks for invalid EPs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210420134719.381409-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoASoC: simple-card-utils: Allocate link info structure on heap
Thierry Reding [Mon, 19 Apr 2021 16:41:17 +0000 (18:41 +0200)]
ASoC: simple-card-utils: Allocate link info structure on heap

struct link_info can grow fairly large and may cause the stack frame
size to be exceeded when allocated on the stack. Some architectures
such as 32-bit ARM, RISC-V or PowerPC have small stack frames where
this causes a compiler warning, so allocate these structures on the
heap instead of the stack.

Fixes: 343e55e71877 ("ASoC: simple-card-utils: Increase maximum number of links to 128")
Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20210419164117.1422242-1-thierry.reding@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt1015p: add support on format S32_LE
Jack Yu [Tue, 20 Apr 2021 09:30:48 +0000 (09:30 +0000)]
ASoC: rt1015p: add support on format S32_LE

Add support on format S32_LE for rt1015p.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/377f0ee05d514c66b567eb6385ac7753@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: hda/realtek: Enable mute/micmute LEDs and limit mic boost on EliteBook 845 G8
Kai-Heng Feng [Tue, 20 Apr 2021 11:55:29 +0000 (19:55 +0800)]
ALSA: hda/realtek: Enable mute/micmute LEDs and limit mic boost on EliteBook 845 G8

On HP EliteBook 845 G8, the audio LEDs can be enabled by
ALC285_FIXUP_HP_MUTE_LED. So use it accordingly.

In addition to that, the mic captures lots of noises, so also limits the
mic boost. The quality of capture audio becomes crystal clear after
limiting the mic boost.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20210420115530.1349353-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek - Headset Mic issue on HP platform
Kailang Yang [Tue, 20 Apr 2021 06:17:34 +0000 (14:17 +0800)]
ALSA: hda/realtek - Headset Mic issue on HP platform

Boot with plugged headset, the Headset Mic will be gone.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/207eecfc3189466a820720bc0c409ea9@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge series "ASoC: rt286/rt298: Fixes for DMIC2 config and combo jack" from David...
Mark Brown [Mon, 19 Apr 2021 17:18:45 +0000 (18:18 +0100)]
Merge series "ASoC: rt286/rt298: Fixes for DMIC2 config and combo jack" from David Ward <david.ward@gatech.edu>:

The last two patches in this series fix a longstanding issue that prevented
the ALC3263 codec from using a headset mic. This codec can be found on Dell
systems including the Latitude 13 7350, Venue 11 Pro 7140, and XPS 13 9343.
In fact, there is an ACPI quirk for the XPS 13 9343, which forces it to use
legacy HD Audio just to avoid this issue:

https://lore.kernel.org/alsa-devel/CAPeXnHv07HkvcHrYFmZMr8OTp7U7F=k_k=LPYnUtp89iPn2d2Q@mail.gmail.com/

This may allow that ACPI quirk to be removed. Either way, the other systems
mentioned above do not support this quirk and already use the ASoC driver,
so this fix is necessary for headset mic support on those systems.

Note: there is likely other handling for this codec that only exists in the
HDA driver, but which also belongs in the ASoC driver. Commit 394c97f824fa
("ALSA: hda/realtek - Change EAPD to verb control") describes an issue that
does not seem to be resolved in the ASoC driver, to give an example.

Other patches in this series are not specific to the ALC3263. These patches
set the correct combo jack configuration when headphones are inserted, and
fix a misaligned value set in the DMIC2 Configuration Default register.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=114171
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <david.ward@gatech.edu>
David Ward (5):
  ASoC: rt286: Fix upper byte in DMIC2 configuration
  ASoC: rt286: Configure combo jack for headphones
  ASoC: rt298: Configure combo jack for headphones
  ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
  ASoC: rt286: Generalize support for ALC3263 codec

 sound/soc/codecs/rt286.c | 34 +++++++++++++++++++++-------------
 sound/soc/codecs/rt298.c |  9 +++++++--
 2 files changed, 28 insertions(+), 15 deletions(-)

--
2.31.1

3 years agoASoC: rt286: Generalize support for ALC3263 codec
David Ward [Sun, 18 Apr 2021 13:46:58 +0000 (09:46 -0400)]
ASoC: rt286: Generalize support for ALC3263 codec

The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
and Venue 11 Pro 7140. They require the same handling for the combo jack to
work with a headset: GPIO pin 6 must be set.

The HDA driver always sets this pin on the ALC3263, which it distinguishes
by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
(Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
determine if Dell is the system vendor.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-6-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt298: Configure combo jack for headphones
David Ward [Sun, 18 Apr 2021 13:46:56 +0000 (09:46 -0400)]
ASoC: rt298: Configure combo jack for headphones

During jack detection, the combo jack is configured for a CTIA headset, and
then for an OMTP headset, while sensing the mic connection. If a mic is not
found in either case, the combo jack should be re-configured for headphones
only. This is consistent with the HDA driver behavior.

Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-4-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt286: Configure combo jack for headphones
David Ward [Sun, 18 Apr 2021 13:46:55 +0000 (09:46 -0400)]
ASoC: rt286: Configure combo jack for headphones

During jack detection, the combo jack is configured for a CTIA headset, and
then for an OMTP headset, while sensing the mic connection. If a mic is not
found in either case, the combo jack should be re-configured for headphones
only. This is consistent with the HDA driver behavior.

Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-3-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: sigmadsp: Disable cache mechanism for readbacks
Niklas Carlsson [Mon, 19 Apr 2021 14:49:01 +0000 (16:49 +0200)]
ASoC: sigmadsp: Disable cache mechanism for readbacks

The ALSA control readback functionality only works for non-volatile
controls, i.e. control values that does not change on their own without
driver interaction.

This doesn't work for readbacks since the DSP firmware updates the
control value. Disable the cache mechanism in the driver if the control
name matches the prefix used for readbacks to ensure that the control
value is valid.

Signed-off-by: Niklas Carlsson <niklasc@axis.com>
Link: https://lore.kernel.org/r/20210419144901.9441-1-Niklas.Carlsson@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoMerge series "ASoC: rt286/rt298: Fixes for DMIC2 config and combo jack" from David...
Mark Brown [Mon, 19 Apr 2021 15:51:43 +0000 (16:51 +0100)]
Merge series "ASoC: rt286/rt298: Fixes for DMIC2 config and combo jack" from David Ward <david.ward@gatech.edu>:

The last two patches in this series fix a longstanding issue that prevented
the ALC3263 codec from using a headset mic. This codec can be found on Dell
systems including the Latitude 13 7350, Venue 11 Pro 7140, and XPS 13 9343.
In fact, there is an ACPI quirk for the XPS 13 9343, which forces it to use
legacy HD Audio just to avoid this issue:

https://lore.kernel.org/alsa-devel/CAPeXnHv07HkvcHrYFmZMr8OTp7U7F=k_k=LPYnUtp89iPn2d2Q@mail.gmail.com/

This may allow that ACPI quirk to be removed. Either way, the other systems
mentioned above do not support this quirk and already use the ASoC driver,
so this fix is necessary for headset mic support on those systems.

Note: there is likely other handling for this codec that only exists in the
HDA driver, but which also belongs in the ASoC driver. Commit 394c97f824fa
("ALSA: hda/realtek - Change EAPD to verb control") describes an issue that
does not seem to be resolved in the ASoC driver, to give an example.

Other patches in this series are not specific to the ALC3263. These patches
set the correct combo jack configuration when headphones are inserted, and
fix a misaligned value set in the DMIC2 Configuration Default register.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=114171
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <david.ward@gatech.edu>
David Ward (5):
  ASoC: rt286: Fix upper byte in DMIC2 configuration
  ASoC: rt286: Configure combo jack for headphones
  ASoC: rt298: Configure combo jack for headphones
  ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
  ASoC: rt286: Generalize support for ALC3263 codec

 sound/soc/codecs/rt286.c | 34 +++++++++++++++++++++-------------
 sound/soc/codecs/rt298.c |  9 +++++++--
 2 files changed, 28 insertions(+), 15 deletions(-)

--
2.31.1

base-commit: a38fd8748464831584a19438cbb3082b5a2dab15

3 years agoASoC: rt286: Make RT286_SET_GPIO_* readable and writable
David Ward [Sun, 18 Apr 2021 13:46:57 +0000 (09:46 -0400)]
ASoC: rt286: Make RT286_SET_GPIO_* readable and writable

The GPIO configuration cannot be applied if the registers are inaccessible.
This prevented the headset mic from working on the Dell XPS 13 9343.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=114171
Signed-off-by: David Ward <david.ward@gatech.edu>
Link: https://lore.kernel.org/r/20210418134658.4333-5-david.ward@gatech.edu
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: rt286: Fix upper byte in DMIC2 configuration
David Ward [Sun, 18 Apr 2021 13:46:54 +0000 (09:46 -0400)]
ASoC: rt286: Fix upper byte in DMIC2 configuration

This HDA verb sets the upper byte of the Configuration Default register, so
only an 8-bit value should be used. For the rt298, the same fix was applied
in commit f8f2dc4a7127 ("ASoC: rt298: fix wrong setting of gpio2_en").

Signed-off-by: David Ward <david.ward@gatech.edu>
Link: https://lore.kernel.org/r/20210418134658.4333-2-david.ward@gatech.edu
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: usb-audio: Re-apply implicit feedback mode to Pioneer devices
Takashi Iwai [Mon, 19 Apr 2021 15:39:18 +0000 (17:39 +0200)]
ALSA: usb-audio: Re-apply implicit feedback mode to Pioneer devices

Pioneer devices are supposed to be working with the implicit feedback
mode, but so far the attempt to apply the implicit feedback caused
issues, hence we explicitly skipped the implicit feedback mode for
them.  Recently, Geraldo discovered that the device actually works if
you skip the generic matching of the sync EPs for the capture stream.
That is, we should apply the implicit feedback setup for the playback
like other similar devices, while we need to return 1 from
audioformat_capture_quirk() so that no further matching will be done.

And, later on, Olivia reported later that the fiddling with the
capture quirk alone doesn't suffice for the test with speaker-test
program.  This seems to be a similar case like the recently fixed BOSS
devices.  Indeed, the problem could be addressed by setting
playback_first flag, which indicates that the playback URBs have to be
sent out at first even in the implicit feedback mode.

This patch implements the application of the implicit feedback to
Pioneer devices as described in the above.  The former
skip_pioneer_sync_ep() was dropped, and instead we provide
is_pioneer_implicit_fb() to check the Pioneer devices that need the
implicit feedback.  In the audioformat_implicit_fb_quirk(), simply
apply the implicit fb for playback and set chip->playback_first flag
if matching, and in audioformat_capture_quirk()(), it returns 1 for
skipping the generic EP sync handling.

Reported-by: Geraldo <geraldogabriel@gmail.com>
Tested-by: Olivia Mackintosh <livvy@base.nu>
Link: https://lore.kernel.org/r/s5ha6pygqfz.wl-tiwai@suse.de
Link: https://lore.kernel.org/r/20210419153918.450-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoMerge series "ASoC: remove more cppcheck warnings" from Pierre-Louis Bossart <pierre...
Mark Brown [Mon, 19 Apr 2021 15:21:45 +0000 (16:21 +0100)]
Merge series "ASoC: remove more cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

I missed those warnings in the previous rounds, they are mostly
trivial and shouldn't change the behavior.

Pierre-Louis Bossart (5):
  ASoC: soc-acpi: remove useless initialization
  ASoC: soc-core: fix signed/unsigned issue
  ASoC: soc-core: fix always-false condition
  ASoC: codecs: lpass-rx-macro: remove useless return
  ASoC: codecs: rt5682: clarify expression

 sound/soc/codecs/lpass-rx-macro.c | 2 --
 sound/soc/codecs/rt5682.c         | 2 +-
 sound/soc/soc-acpi.c              | 2 +-
 sound/soc/soc-core.c              | 7 +------
 4 files changed, 3 insertions(+), 10 deletions(-)

--
2.25.1

3 years agoASoC: ak4458: check reset control status
Viorel Suman [Mon, 19 Apr 2021 09:54:32 +0000 (17:54 +0800)]
ASoC: ak4458: check reset control status

check the return value of ak4458_rstn_control.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1618826072-29344-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: rt5682: clarify expression
Pierre-Louis Bossart [Fri, 16 Apr 2021 19:11:44 +0000 (14:11 -0500)]
ASoC: codecs: rt5682: clarify expression

cppcheck warning:

sound/soc/codecs/rt5682.c:2404:42: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
   (pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST));
                                         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: codecs: lpass-rx-macro: remove useless return
Pierre-Louis Bossart [Fri, 16 Apr 2021 19:11:43 +0000 (14:11 -0500)]
ASoC: codecs: lpass-rx-macro: remove useless return

cppcheck warning:

sound/soc/codecs/lpass-rx-macro.c:1626:9: warning: Identical condition
and return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/lpass-rx-macro.c:1623:6: note: If condition 'ret' is
true, the function will return/exit
 if (ret)
     ^
sound/soc/codecs/lpass-rx-macro.c:1626:9: note: Returning identical
expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-core: fix always-false condition
Pierre-Louis Bossart [Fri, 16 Apr 2021 19:11:42 +0000 (14:11 -0500)]
ASoC: soc-core: fix always-false condition

cppcheck warning:

sound/soc/soc-core.c:2784:6: style: Condition '!num_routes' is always
false [knownConditionTrueFalse]
 if (!num_routes) {
     ^
sound/soc/soc-core.c:2777:17: note: Assuming that condition
'num_routes<0' is not redundant
 if (num_routes < 0 || num_routes & 1) {
                ^
sound/soc/soc-core.c:2783:2: note: Compound assignment '/=', assigned
value is 0
 num_routes /= 2;
 ^
sound/soc/soc-core.c:2784:6: note: Condition '!num_routes' is always
false
 if (!num_routes) {
     ^

The documentation for of_property_count_string reads

"
 * Returns the number of strings on
 * success, -EINVAL if the property does not exist, -ENODATA if property
 * does not have a value, and -EILSEQ if the string is not null-terminated
 * within the length of the property data.
"

Since the case for num_routes == 0 is not possible, let's remove this
test.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-core: fix signed/unsigned issue
Pierre-Louis Bossart [Fri, 16 Apr 2021 19:11:41 +0000 (14:11 -0500)]
ASoC: soc-core: fix signed/unsigned issue

cppcheck warning:

sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 1)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^
sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 2)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoASoC: soc-acpi: remove useless initialization
Pierre-Louis Bossart [Fri, 16 Apr 2021 19:11:40 +0000 (14:11 -0500)]
ASoC: soc-acpi: remove useless initialization

cppcheck warning:

value that is never used. [unreadVariable]
 acpi_status status = AE_OK;
                    ^

sound/soc/soc-acpi.c:37:21: style: Variable 'status' is assigned a
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 years agoALSA: usb-audio: DJM-750: ensure format is set
Olivia Mackintosh [Sun, 18 Apr 2021 16:59:01 +0000 (17:59 +0100)]
ALSA: usb-audio: DJM-750: ensure format is set

Add case statement to set sample-rate for the DJM-750 Pioneer
mixer. This was included as part of another patch but I think it has
been archived on Patchwork and hasn't been merged.

Signed-off-by: Olivia Mackintosh <livvy@base.nu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210418165901.25776-1-livvy@base.nu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoALSA: hda/realtek: GA503 use same quirks as GA401
Luke D Jones [Mon, 19 Apr 2021 03:04:11 +0000 (15:04 +1200)]
ALSA: hda/realtek: GA503 use same quirks as GA401

The GA503 has almost exactly the same default setup as the GA401
model with the same issues. The GA401 quirks solve all the issues
so we will use the full quirk chain.

Signed-off-by: Luke D Jones <luke@ljones.dev>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210419030411.28304-1-luke@ljones.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agoLinux 5.12-rc8
Linus Torvalds [Sun, 18 Apr 2021 21:45:32 +0000 (14:45 -0700)]
Linux 5.12-rc8

3 years agoMerge tag 'arm-fixes-5.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Linus Torvalds [Sun, 18 Apr 2021 20:23:26 +0000 (13:23 -0700)]
Merge tag 'arm-fixes-5.12-3' of git://git./linux/kernel/git/soc/soc

Pull ARM SoC fixes from Arnd Bergmann:
 "Another smaller set of fixes for three of the Arm platforms:

  TI OMAP:

     Fix swapped mmc device order also for omap3 that got changed with
     the recent PROBE_PREFER_ASYNCHRONOUS changes. While eventually the
     aliases should be board specific, all the mmc device instances are
     all there in the SoC, and we do probe them by default so that PM
     runtime can idle the devices if left enabled from the bootloader.

  Qualcomm Snapdragon:

     This bypasses the recently introduced interconnect handling in
     the GENI (serial engine) driver when running off ACPI, as this
     causes the GENI probe to fail and the Lenovo Yoga C630 to boot
     without keyboard and touchpad.

  Allwinner:

     One 32kHz clock fix for the beelink gs1, a CD polarity fix for the
     SoPine, some MAINTAINERS maintainance, and a clk / reset switch to
     our headers"

* tag 'arm-fixes-5.12-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
  arm64: dts: allwinner: h6: beelink-gs1: Remove ext. 32 kHz osc reference
  MAINTAINERS: Match on allwinner keyword
  MAINTAINERS: Add our new mailing-list
  arm64: dts: allwinner: Fix SD card CD GPIO for SOPine systems
  arm64: dts: allwinner: h6: Switch to macros for RSB clock/reset indices
  ARM: OMAP2+: Fix uninitialized sr_inst
  ARM: dts: Fix swapped mmc order for omap3
  ARM: OMAP2+: Fix warning for omap_init_time_of()
  soc: qcom: geni: shield geni_icc_get() for ACPI boot

3 years agoMerge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 18 Apr 2021 18:55:31 +0000 (11:55 -0700)]
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

 - Halve maximum number of CPUs if DEBUG_KMAP_LOCAL is enabled

 - Fix conversion for_each_membock() to for_each_mem_range()

 - Fix footbridge PCI mapping

 - Avoid uprobes hooking on thumb instructions

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 9071/1: uprobes: Don't hook on thumb instructions
  ARM: footbridge: fix PCI interrupt mapping
  ARM: 9069/1: NOMMU: Fix conversion for_each_membock() to for_each_mem_range()
  ARM: 9063/1: mm: reduce maximum number of CPUs if DEBUG_KMAP_LOCAL is enabled

3 years agoARM: 9071/1: uprobes: Don't hook on thumb instructions
Fredrik Strupe [Mon, 5 Apr 2021 20:52:05 +0000 (21:52 +0100)]
ARM: 9071/1: uprobes: Don't hook on thumb instructions

Since uprobes is not supported for thumb, check that the thumb bit is
not set when matching the uprobes instruction hooks.

The Arm UDF instructions used for uprobes triggering
(UPROBE_SWBP_ARM_INSN and UPROBE_SS_ARM_INSN) coincidentally share the
same encoding as a pair of unallocated 32-bit thumb instructions (not
UDF) when the condition code is 0b1111 (0xf). This in effect makes it
possible to trigger the uprobes functionality from thumb, and at that
using two unallocated instructions which are not permanently undefined.

Signed-off-by: Fredrik Strupe <fredrik@strupe.net>
Cc: stable@vger.kernel.org
Fixes: c7edc9e326d5 ("ARM: add uprobes support")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
3 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 18 Apr 2021 03:25:33 +0000 (20:25 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two fixes: the libsas fix is for a problem that occurs when trying to
  change the cache type of an ATA device and the libiscsi one is a
  regression fix from this merge window"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: libsas: Reset num_scatter if libata marks qc as NODATA
  scsi: iscsi: Fix iSCSI cls conn state

3 years agoMerge tag 'drm-fixes-2021-04-18' of git://anongit.freedesktop.org/drm/drm
Linus Torvalds [Sun, 18 Apr 2021 03:00:36 +0000 (20:00 -0700)]
Merge tag 'drm-fixes-2021-04-18' of git://anongit.freedesktop.org/drm/drm

Pull vmwgfx fixes from Dave Airlie:
 "This contains two regression fixes for vmwgfx, one due to a refactor
  which meant locks were being used before initialisation, and the other
  in fixing up some warnings from the core when destroying pinned
  buffers.

  vmwgfx:

   - fixed unpinning before destruction

   - lockdep init reordering"

* tag 'drm-fixes-2021-04-18' of git://anongit.freedesktop.org/drm/drm:
  drm/vmwgfx: Make sure bo's are unpinned before putting them back
  drm/vmwgfx: Fix the lockdep breakage
  drm/vmwgfx: Make sure we unpin no longer needed buffers

3 years agoMerge tag 'vmwgfx-fixes-2021-04-14' of gitlab.freedesktop.org:zack/vmwgfx into drm...
Dave Airlie [Sat, 17 Apr 2021 23:26:54 +0000 (09:26 +1000)]
Merge tag 'vmwgfx-fixes-2021-04-14' of gitlab.freedesktop.org:zack/vmwgfx into drm-fixes

vmwgfx fixes for regressions in 5.12

Here's a set of 3 patches fixing ugly regressions
in the vmwgfx driver. We broke lock initialization
code and ended up using spinlocks before initialization
breaking lockdep.
Also there was a bit of a fallout from drm changes
which made the core validate that unreferenced buffers
have been unpinned. vmwgfx pinning code predates a lot
of the core drm and wasn't written to account for those
semantics. Fortunately changes required to fix it
are not too intrusive.
The changes have been validated by our internal ci.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f7add0a2-162e-3bd2-b1be-344a94f2acbf@vmware.com
3 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sat, 17 Apr 2021 19:01:51 +0000 (12:01 -0700)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fix from Wolfram Sang:
 "One more driver bugfix for I2C"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: mv64xxx: Fix random system lock caused by runtime PM

3 years agoreaddir: make sure to verify directory entry for legacy interfaces too
Linus Torvalds [Sat, 17 Apr 2021 16:27:04 +0000 (09:27 -0700)]
readdir: make sure to verify directory entry for legacy interfaces too

This does the directory entry name verification for the legacy
"fillonedir" (and compat) interface that goes all the way back to the
dark ages before we had a proper dirent, and the readdir() system call
returned just a single entry at a time.

Nobody should use this interface unless you still have binaries from
1991, but let's do it right.

This came up during discussions about unsafe_copy_to_user() and proper
checking of all the inputs to it, as the networking layer is looking to
use it in a few new places.  So let's make sure the _old_ users do it
all right and proper, before we add new ones.

See also commit 8a23eb804ca4 ("Make filldir[64]() verify the directory
entry filename is valid") which did the proper modern interfaces that
people actually use. It had a note:

    Note that I didn't bother adding the checks to any legacy interfaces
    that nobody uses.

which this now corrects.  Note that we really don't care about POSIX and
the presense of '/' in a directory entry, but verify_dirent_name() also
ends up doing the proper name length verification which is what the
input checking discussion was about.

[ Another option would be to remove the support for this particular very
  old interface: any binaries that use it are likely a.out binaries, and
  they will no longer run anyway since we removed a.out binftm support
  in commit eac616557050 ("x86: Deprecate a.out support").

  But I'm not sure which came first: getdents() or ELF support, so let's
  pretend somebody might still have a working binary that uses the
  legacy readdir() case.. ]

Link: https://lore.kernel.org/lkml/CAHk-=wjbvzCAhAtvG0d81W5o0-KT5PPTHhfJ5ieDFq+bGtgOYg@mail.gmail.com/
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agoMerge tag 'net-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Linus Torvalds [Sat, 17 Apr 2021 16:57:15 +0000 (09:57 -0700)]
Merge tag 'net-5.12-rc8' of git://git./linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
 "Networking fixes for 5.12-rc8, including fixes from netfilter, and
  bpf. BPF verifier changes stand out, otherwise things have slowed
  down.

  Current release - regressions:

   - gro: ensure frag0 meets IP header alignment

   - Revert "net: stmmac: re-init rx buffers when mac resume back"

   - ethernet: macb: fix the restore of cmp registers

  Previous releases - regressions:

   - ixgbe: Fix NULL pointer dereference in ethtool loopback test

   - ixgbe: fix unbalanced device enable/disable in suspend/resume

   - phy: marvell: fix detection of PHY on Topaz switches

   - make tcp_allowed_congestion_control readonly in non-init netns

   - xen-netback: Check for hotplug-status existence before watching

  Previous releases - always broken:

   - bpf: mitigate a speculative oob read of up to map value size by
     tightening the masking window

   - sctp: fix race condition in sctp_destroy_sock

   - sit, ip6_tunnel: Unregister catch-all devices

   - netfilter: nftables: clone set element expression template

   - netfilter: flowtable: fix NAT IPv6 offload mangling

   - net: geneve: check skb is large enough for IPv4/IPv6 header

   - netlink: don't call ->netlink_bind with table lock held"

* tag 'net-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (52 commits)
  netlink: don't call ->netlink_bind with table lock held
  MAINTAINERS: update my email
  bpf: Update selftests to reflect new error states
  bpf: Tighten speculative pointer arithmetic mask
  bpf: Move sanitize_val_alu out of op switch
  bpf: Refactor and streamline bounds check into helper
  bpf: Improve verifier error messages for users
  bpf: Rework ptr_limit into alu_limit and add common error path
  bpf: Ensure off_reg has no mixed signed bounds for all types
  bpf: Move off_reg into sanitize_ptr_alu
  bpf: Use correct permission flag for mixed signed bounds arithmetic
  ch_ktls: do not send snd_una update to TCB in middle
  ch_ktls: tcb close causes tls connection failure
  ch_ktls: fix device connection close
  ch_ktls: Fix kernel panic
  i40e: fix the panic when running bpf in xdpdrv mode
  net/mlx5e: fix ingress_ifindex check in mlx5e_flower_parse_meta
  net/mlx5e: Fix setting of RS FEC mode
  net/mlx5: Fix setting of devlink traps in switchdev mode
  Revert "net: stmmac: re-init rx buffers when mac resume back"
  ...

3 years agoMerge tag 'libnvdimm-fixes-for-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 17 Apr 2021 16:40:44 +0000 (09:40 -0700)]
Merge tag 'libnvdimm-fixes-for-5.12-rc8' of git://git./linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:
 "The largest change is for a regression that landed during -rc1 for
  block-device read-only handling. Vaibhav found a new use for the
  ability (originally introduced by virtio_pmem) to call back to the
  platform to flush data, but also found an original bug in that
  implementation. Lastly, Arnd cleans up some compile warnings in dax.

  This has all appeared in -next with no reported issues.

  Summary:

   - Fix a regression of read-only handling in the pmem driver

   - Fix a compile warning

   - Fix support for platform cache flush commands on powerpc/papr"

* tag 'libnvdimm-fixes-for-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC
  libnvdimm: Notify disk drivers to revalidate region read-only
  dax: avoid -Wempty-body warnings

3 years agoMerge tag 'cxl-fixes-for-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 17 Apr 2021 16:30:58 +0000 (09:30 -0700)]
Merge tag 'cxl-fixes-for-5.12-rc8' of git://git./linux/kernel/git/cxl/cxl

Pull CXL memory class fixes from Dan Williams:
 "A collection of fixes for the CXL memory class driver introduced in
  this release cycle.

  The driver was primarily developed on a work-in-progress QEMU
  emulation of the interface and we have since found a couple places
  where it hid spec compliance bugs in the driver, or had a spec
  implementation bug itself.

  The biggest change here is replacing a percpu_ref with an rwsem to
  cleanup a couple bugs in the error unwind path during ioctl device
  init. Lastly there were some minor cleanups to not export the
  power-management sysfs-ABI for the ioctl device, use the proper sysfs
  helper for emitting values, and prevent subtle bugs as new
  administration commands are added to the supported list.

  The bulk of it has appeared in -next save for the top commit which was
  found today and validated on a fixed-up QEMU model.

  Summary:

   - Fix support for CXL memory devices with registers offset from the
     BAR base.

   - Fix the reporting of device capacity.

   - Fix the driver commands list definition to be disconnected from the
     UAPI command list.

   - Replace percpu_ref with rwsem to fix initialization error path.

   - Fix leaks in the driver initialization error path.

   - Drop the power/ directory from CXL device sysfs.

   - Use the recommended sysfs helper for attribute 'show'
     implementations"

* tag 'cxl-fixes-for-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
  cxl/mem: Fix memory device capacity probing
  cxl/mem: Fix register block offset calculation
  cxl/mem: Force array size of mem_commands[] to CXL_MEM_COMMAND_ID_MAX
  cxl/mem: Disable cxl device power management
  cxl/mem: Do not rely on device_add() side effects for dev_set_name() failures
  cxl/mem: Fix synchronization mechanism for device removal vs ioctl operations
  cxl/mem: Use sysfs_emit() for attribute show routines

3 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Sat, 17 Apr 2021 15:38:23 +0000 (08:38 -0700)]
Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "12 patches.

  Subsystems affected by this patch series: mm (documentation, kasan,
  and pagemap), csky, ia64, gcov, and lib"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  lib: remove "expecting prototype" kernel-doc warnings
  gcov: clang: fix clang-11+ build
  mm: ptdump: fix build failure
  mm/mapping_dirty_helpers: guard hugepage pud's usage
  ia64: tools: remove duplicate definition of ia64_mf() on ia64
  ia64: tools: remove inclusion of ia64-specific version of errno.h header
  ia64: fix discontig.c section mismatches
  ia64: remove duplicate entries in generic_defconfig
  csky: change a Kconfig symbol name to fix e1000 build error
  kasan: remove redundant config option
  kasan: fix hwasan build for gcc
  mm: eliminate "expecting prototype" kernel-doc warnings

3 years agoALSA: usb-audio: Add support for many Roland devices' implicit feedback quirks
Lucas Endres [Fri, 16 Apr 2021 16:50:20 +0000 (11:50 -0500)]
ALSA: usb-audio: Add support for many Roland devices' implicit feedback quirks

It makes USB audio capture and playback possible and pristine on my Roland
INTEGRA-7, Boutique D-05, and R-26, along with many more I've encountered
people having had issues with over the last decade or so.

Signed-off-by: Lucas Endres <jaffa225man@gmail.com>
Link: https://lore.kernel.org/r/CAOsVg8rA61B=005_VyUwpw3piVwA7Bo5fs1GYEB054efyzGjLw@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
3 years agocxl/mem: Fix memory device capacity probing
Dan Williams [Sat, 17 Apr 2021 00:43:30 +0000 (17:43 -0700)]
cxl/mem: Fix memory device capacity probing

The CXL Identify Memory Device output payload emits capacity in 256MB
units. The driver is treating the capacity field as bytes. This was
missed because QEMU reports bytes when it should report bytes / 256MB.

Fixes: 8adaf747c9f0 ("cxl/mem: Find device capabilities")
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Cc: Ben Widawsky <ben.widawsky@intel.com>
Link: https://lore.kernel.org/r/161862021044.3259705.7008520073059739760.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
3 years agonetlink: don't call ->netlink_bind with table lock held
Florian Westphal [Fri, 16 Apr 2021 19:29:13 +0000 (21:29 +0200)]
netlink: don't call ->netlink_bind with table lock held

When I added support to allow generic netlink multicast groups to be
restricted to subscribers with CAP_NET_ADMIN I was unaware that a
genl_bind implementation already existed in the past.

It was reverted due to ABBA deadlock:

1. ->netlink_bind gets called with the table lock held.
2. genetlink bind callback is invoked, it grabs the genl lock.

But when a new genl subsystem is (un)registered, these two locks are
taken in reverse order.

One solution would be to revert again and add a comment in genl
referring 1e82a62fec613, "genetlink: remove genl_bind").

This would need a second change in mptcp to not expose the raw token
value anymore, e.g.  by hashing the token with a secret key so userspace
can still associate subflow events with the correct mptcp connection.

However, Paolo Abeni reminded me to double-check why the netlink table is
locked in the first place.

I can't find one.  netlink_bind() is already called without this lock
when userspace joins a group via NETLINK_ADD_MEMBERSHIP setsockopt.
Same holds for the netlink_unbind operation.

Digging through the history, commit f773608026ee1
("netlink: access nlk groups safely in netlink bind and getname")
expanded the lock scope.

commit 3a20773beeeeade ("net: netlink: cap max groups which will be considered in netlink_bind()")
... removed the nlk->ngroups access that the lock scope
extension was all about.

Reduce the lock scope again and always call ->netlink_bind without
the table lock.

The Fixes tag should be vs. the patch mentioned in the link below,
but that one got squash-merged into the patch that came earlier in the
series.

Fixes: 4d54cc32112d8d ("mptcp: avoid lock_fast usage in accept path")
Link: https://lore.kernel.org/mptcp/20210213000001.379332-8-mathew.j.martineau@linux.intel.com/T/#u
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Sean Tranchetti <stranche@codeaurora.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>