Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org, tiwai@suse.com, perex@perex.cz
Cc: amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org,
	gregkh@linuxfoundation.org, quic_wcheng@quicinc.com,
	mathias.nyman@linux.intel.com,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [RFC 09/15] ALSA: usb: Switch to the two-stage quirk applying
Date: Wed,  9 Apr 2025 13:07:24 +0200	[thread overview]
Message-ID: <20250409110731.3752332-10-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20250409110731.3752332-1-cezary.rojewski@intel.com>

Utilize newly added functions and update existing apply-quirks procedure
for USB Audio-Class (AC) device from one-stage into two-stage process.
In consequence, drop create_uaxx_quirk() and create_autodetect_quirk()
and update existing snd_usb_create_quirk() so that it only creates new
streams, leaving the PCM parsing process to snd_usb_parse_pcms_quirk().

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/usb/quirks.c | 42 ++----------------------------------------
 1 file changed, 2 insertions(+), 40 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 4e402c6406a9..037a45c79fbe 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -412,7 +412,6 @@ static int create_autodetect_pcm_quirk(struct snd_usb_audio *chip,
 	return create_auto_pcm_quirk(chip, iface, driver);
 }
 
-__maybe_unused
 static int create_autodetect_midi_quirk(struct snd_usb_audio *chip,
 					struct usb_interface *iface,
 					struct usb_driver *driver,
@@ -423,19 +422,6 @@ static int create_autodetect_midi_quirk(struct snd_usb_audio *chip,
 	return 1;
 }
 
-static int create_autodetect_quirk(struct snd_usb_audio *chip,
-				   struct usb_interface *iface,
-				   struct usb_driver *driver,
-				   const struct snd_usb_audio_quirk *quirk)
-{
-	int err;
-
-	err = create_auto_pcm_quirk(chip, iface, driver);
-	if (err == -ENODEV)
-		err = create_auto_midi_quirk(chip, iface, driver);
-	return err;
-}
-
 static int create_uaxx_pcm_quirk(struct snd_usb_audio *chip,
 				 struct usb_interface *iface,
 				 struct usb_driver *driver,
@@ -556,30 +542,6 @@ static int create_uaxx_midi_quirk(struct snd_usb_audio *chip,
 				    &chip->num_rawmidis);
 }
 
-static int create_uaxx_quirk(struct snd_usb_audio *chip,
-			     struct usb_interface *iface,
-			     struct usb_driver *driver,
-			     const struct snd_usb_audio_quirk *quirk)
-{
-	struct usb_interface_descriptor *altsd;
-	struct usb_host_interface *alts;
-
-	/* both PCM and MIDI interfaces have 2 or more altsettings */
-	if (iface->num_altsetting < 2)
-		return -ENXIO;
-	alts = &iface->altsetting[1];
-	altsd = get_iface_desc(alts);
-
-	switch (altsd->bNumEndpoints) {
-	case 2:
-		return create_uaxx_midi_quirk(chip, iface, driver, quirk);
-	case 1:
-		return create_uaxx_pcm_quirk(chip, iface, driver, quirk);
-	default:
-		return -ENXIO;
-	}
-}
-
 /*
  * Create a standard mixer for the specified interface.
  */
@@ -652,7 +614,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 	static const quirk_func_t quirk_funcs[] = {
 		[QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
 		[QUIRK_COMPOSITE] = create_composite_quirk,
-		[QUIRK_AUTODETECT] = create_autodetect_quirk,
+		[QUIRK_AUTODETECT] = create_autodetect_midi_quirk,
 		[QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk,
 		[QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk,
 		[QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
@@ -667,7 +629,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_MIDI_CH345] = create_any_midi_quirk,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
-		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
+		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_midi_quirk,
 		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
 	};
 
-- 
2.25.1


  parent reply	other threads:[~2025-04-09 10:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 11:07 [RFC 00/15] ALSA/ASoC: USB Audio Offload Cezary Rojewski
2025-04-09 11:07 ` [RFC 01/15] ALSA: usb: Move media-filters to the media code Cezary Rojewski
2025-04-09 11:07 ` [RFC 02/15] ALSA: usb: Drop private_free() usage for card and pcms Cezary Rojewski
2025-04-09 11:07 ` [RFC 03/15] ALSA: usb: Relocate the usbaudio header file Cezary Rojewski
2025-04-09 11:07 ` [RFC 04/15] ALSA: usb: Implement two-stage quirk applying mechanism Cezary Rojewski
2025-04-09 11:07 ` [RFC 05/15] ALSA: usb: Implement two-stage stream creation mechanism Cezary Rojewski
2025-04-09 11:07 ` [RFC 06/15] ALSA: usb: Implement two-stage chip probing mechanism Cezary Rojewski
2025-04-09 11:07 ` [RFC 07/15] ALSA: usb: Switch to the two-stage chip probing Cezary Rojewski
2025-04-09 11:07 ` [RFC 08/15] ALSA: usb: Switch to the two-stage stream creation Cezary Rojewski
2025-04-09 11:07 ` Cezary Rojewski [this message]
2025-04-09 11:07 ` [RFC 10/15] ALSA: usb: Export PCM operations Cezary Rojewski
2025-04-09 11:07 ` [RFC 11/15] ALSA: usb: Export usb_interface driver operations Cezary Rojewski
2025-04-09 11:07 ` [RFC 12/15] ALSA: usb: Export card-naming procedure Cezary Rojewski
2025-04-09 11:07 ` [RFC 13/15] ALSA: usb: Add getters to obtain endpoint information Cezary Rojewski
2025-04-09 11:07 ` [RFC 14/15] ASoC: codecs: Add USB-Audio driver Cezary Rojewski
2025-04-09 11:07 ` [RFC 15/15] ASoC: Intel: avs: Add USB machine board Cezary Rojewski
2025-04-09 12:10 ` [RFC 00/15] ALSA/ASoC: USB Audio Offload Greg KH
2025-04-09 13:06   ` Cezary Rojewski
2025-04-10 10:10     ` Takashi Iwai
2025-04-10 10:24 ` Takashi Iwai
2025-04-11  9:39   ` Cezary Rojewski
2025-04-15 16:15     ` Takashi Iwai
2025-04-17 10:15       ` Cezary Rojewski
2025-04-22 11:28         ` Pierre-Louis Bossart
2025-04-22 14:15           ` Cezary Rojewski
2025-04-25 16:53             ` Pierre-Louis Bossart
2025-04-11 14:04 ` Greg KH
2025-04-11 16:51   ` Cezary Rojewski

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=20250409110731.3752332-10-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=perex@perex.cz \
    --cc=quic_wcheng@quicinc.com \
    --cc=tiwai@suse.com \
    /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