patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Takashi Iwai <tiwai@suse.de>,
	Joakim Tjernlund <joakim.tjernlund@infinera.com>
Subject: [PATCH 5.15 11/28] ALSA: usb-audio: Fix init call orders for UAC1
Date: Mon,  4 Sep 2023 19:30:42 +0100	[thread overview]
Message-ID: <20230904182945.710728535@linuxfoundation.org> (raw)
In-Reply-To: <20230904182945.178705038@linuxfoundation.org>

5.15-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 5fadc941d07530d681f3b7ec91e56d8445bc3825 upstream.

There have been reports of USB-audio driver spewing errors at the
probe time on a few devices like Jabra and Logitech.  The suggested
fix there couldn't be applied as is, unfortunately, because it'll
likely break other devices.

But, the patch suggested an interesting point: looking at the current
init code in stream.c, one may notice that it does initialize
differently from the device setup in endpoint.c.  Namely, for UAC1, we
should call snd_usb_init_pitch() and snd_usb_init_sample_rate() after
setting the interface, while the init sequence at parsing calls them
before setting the interface blindly.

This patch changes the init sequence at parsing for UAC1 (and other
devices that need a similar behavior) to be aligned with the rest of
the code, setting the interface at first.  And, this fixes the
long-standing problems on a few UAC1 devices like Jabra / Logitech,
as reported, too.

Reported-and-tested-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Closes: https://lore.kernel.org/r/202bbbc0f51522e8545783c4c5577d12a8e2d56d.camel@infinera.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230821111857.28926-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/stream.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -1093,6 +1093,7 @@ static int __snd_usb_parse_audio_interfa
 	int i, altno, err, stream;
 	struct audioformat *fp = NULL;
 	struct snd_usb_power_domain *pd = NULL;
+	bool set_iface_first;
 	int num, protocol;
 
 	dev = chip->dev;
@@ -1223,11 +1224,19 @@ static int __snd_usb_parse_audio_interfa
 				return err;
 		}
 
+		set_iface_first = false;
+		if (protocol == UAC_VERSION_1 ||
+		    (chip->quirk_flags & QUIRK_FLAG_SET_IFACE_FIRST))
+			set_iface_first = true;
+
 		/* try to set the interface... */
 		usb_set_interface(chip->dev, iface_no, 0);
+		if (set_iface_first)
+			usb_set_interface(chip->dev, iface_no, altno);
 		snd_usb_init_pitch(chip, fp);
 		snd_usb_init_sample_rate(chip, fp, fp->rate_max);
-		usb_set_interface(chip->dev, iface_no, altno);
+		if (!set_iface_first)
+			usb_set_interface(chip->dev, iface_no, altno);
 	}
 	return 0;
 }



  parent reply	other threads:[~2023-09-04 18:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 18:30 [PATCH 5.15 00/28] 5.15.131-rc1 review Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 01/28] erofs: ensure that the post-EOF tails are all zeroed Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 02/28] ksmbd: fix wrong DataOffset validation of create context Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 03/28] ksmbd: replace one-element array with flex-array member in struct smb2_ea_info Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 04/28] ARM: pxa: remove use of symbol_get() Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 05/28] mmc: au1xmmc: force non-modular build and remove symbol_get usage Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 06/28] net: enetc: use EXPORT_SYMBOL_GPL for enetc_phc_index Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 07/28] rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 08/28] modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 09/28] USB: serial: option: add Quectel EM05G variant (0x030e) Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 10/28] USB: serial: option: add FOXCONN T99W368/T99W373 product Greg Kroah-Hartman
2023-09-04 18:30 ` Greg Kroah-Hartman [this message]
2023-09-04 18:30 ` [PATCH 5.15 12/28] usb: dwc3: meson-g12a: do post init to fix broken usb after resumption Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 13/28] usb: chipidea: imx: improve logic if samsung,picophy-* parameter is 0 Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 14/28] HID: wacom: remove the battery when the EKR is off Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 15/28] staging: rtl8712: fix race condition Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 16/28] Bluetooth: btsdio: fix use after free bug in btsdio_remove due to " Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 17/28] wifi: mt76: mt7921: do not support one stream on secondary antenna only Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 18/28] serial: qcom-geni: fix opp vote on shutdown Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 19/28] serial: sc16is7xx: fix broken port 0 uart init Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 20/28] serial: sc16is7xx: fix bug when first setting GPIO direction Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 21/28] firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 22/28] fsi: master-ast-cf: Add MODULE_FIRMWARE macro Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 23/28] tcpm: Avoid soft reset when partner does not support get_status Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 24/28] nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers() Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 25/28] nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 26/28] pinctrl: amd: Dont show `Invalid config param` errors Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 27/28] usb: typec: tcpci: move tcpci.h to include/linux/usb/ Greg Kroah-Hartman
2023-09-04 18:30 ` [PATCH 5.15 28/28] usb: typec: tcpci: clear the fault status bit Greg Kroah-Hartman
2023-09-05  0:08 ` [PATCH 5.15 00/28] 5.15.131-rc1 review Joel Fernandes
2023-09-05  1:25 ` SeongJae Park
2023-09-05  9:36 ` Sudip Mukherjee (Codethink)
2023-09-05 10:10 ` Naresh Kamboju
2023-09-05 11:08 ` Jon Hunter
2023-09-05 17:33 ` Florian Fainelli
2023-09-05 19:16 ` Pavel Machek
2023-09-05 21:16 ` Shuah Khan
2023-09-05 23:19 ` Ron Economos
2023-09-06 17:48   ` Allen Pais
2023-09-06  5:20 ` Harshit Mogalapalli
2023-09-06 17:24 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230904182945.710728535@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=joakim.tjernlund@infinera.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).