All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 11/15] ALSA: usb-audio: Move autosuspend quirk into quirk_flags
Date: Thu, 29 Jul 2021 09:44:00 +0200	[thread overview]
Message-ID: <20210729074404.19728-2-tiwai@suse.de> (raw)
In-Reply-To: <20210729073855.19043-1-tiwai@suse.de>

The auto-suspend suppression workaround for Lenovo machines are
handled in quirks-table.h.  Now it's more easier to handle with
quirk_flags.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/card.c         |  5 ++++-
 sound/usb/quirks-table.h | 17 -----------------
 sound/usb/quirks.c       | 14 ++++----------
 sound/usb/usbaudio.h     |  5 +++--
 4 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 8c32a784f1e4..d66a3788111c 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -804,6 +804,9 @@ static int usb_audio_probe(struct usb_interface *intf,
 
 	dev_set_drvdata(&dev->dev, chip);
 
+	if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
+		usb_disable_autosuspend(interface_to_usbdev(intf));
+
 	/*
 	 * For devices with more than one control interface, we assume the
 	 * first contains the audio controls. We might need a more specific
@@ -929,7 +932,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)
 		}
 	}
 
-	if (chip->quirk_type == QUIRK_SETUP_DISABLE_AUTOSUSPEND)
+	if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
 		usb_enable_autosuspend(interface_to_usbdev(intf));
 
 	chip->num_interfaces--;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index b5e82363cf47..e03043f7dad3 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -2730,23 +2730,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 	}
 },
 
-/* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */
-{
-	USB_DEVICE(0x17aa, 0x1046),
-	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-		.ifnum = QUIRK_ANY_INTERFACE,
-		.type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
-	}
-},
-/* Lenovo ThinkStation P620 Internal Speaker + Front Headset */
-{
-	USB_DEVICE(0x17aa, 0x104d),
-	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-		.ifnum = QUIRK_ANY_INTERFACE,
-		.type = QUIRK_SETUP_DISABLE_AUTOSUSPEND
-	}
-},
-
 /* Native Instruments MK2 series */
 {
 	/* Komplete Audio 6 */
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index dc667b8c92f2..1cffb87e5026 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -534,15 +534,6 @@ static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
 	return snd_usb_create_mixer(chip, quirk->ifnum, 0);
 }
 
-static int setup_disable_autosuspend(struct snd_usb_audio *chip,
-				       struct usb_interface *iface,
-				       struct usb_driver *driver,
-				       const struct snd_usb_audio_quirk *quirk)
-{
-	usb_disable_autosuspend(interface_to_usbdev(iface));
-	return 1;	/* Continue with creating streams and mixer */
-}
-
 /*
  * audio-interface quirks
  *
@@ -580,7 +571,6 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
 		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
-		[QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend,
 	};
 
 	if (quirk->type < QUIRK_TYPE_COUNT) {
@@ -1855,6 +1845,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
 		   QUIRK_FLAG_IGNORE_CLOCK_SOURCE),
 	DEVICE_FLG(0x1686, 0x00dd, /* Zoom R16/24 */
 		   QUIRK_FLAG_TX_LENGTH | QUIRK_FLAG_CTL_MSG_DELAY_1M),
+	DEVICE_FLG(0x17aa, 0x1046, /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */
+		   QUIRK_FLAG_DISABLE_AUTOSUSPEND),
+	DEVICE_FLG(0x17aa, 0x104d, /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */
+		   QUIRK_FLAG_DISABLE_AUTOSUSPEND),
 	DEVICE_FLG(0x1852, 0x5065, /* Luxman DA-06 */
 		   QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY),
 	DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index ea0e3deb2a23..ce31d58f810f 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -101,8 +101,6 @@ enum quirk_type {
 	QUIRK_AUDIO_FIXED_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,
 	QUIRK_AUDIO_STANDARD_MIXER,
-	QUIRK_SETUP_FMT_AFTER_RESUME,
-	QUIRK_SETUP_DISABLE_AUTOSUSPEND,
 
 	QUIRK_TYPE_COUNT
 };
@@ -157,6 +155,8 @@ extern bool snd_usb_skip_validation;
  *  Add a delay of 50ms at each interface setup
  * QUIRK_FLAG_VALIDATE_RATES:
  *  Perform sample rate validations at probe
+ * QUIRK_FLAG_DISABLE_AUTOSUSPEND:
+ *  Disable runtime PM autosuspend
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE	(1U << 0)
@@ -172,5 +172,6 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_CTL_MSG_DELAY_5M	(1U << 10)
 #define QUIRK_FLAG_IFACE_DELAY		(1U << 11)
 #define QUIRK_FLAG_VALIDATE_RATES	(1U << 12)
+#define QUIRK_FLAG_DISABLE_AUTOSUSPEND	(1U << 13)
 
 #endif /* __USBAUDIO_H */
-- 
2.26.2


  parent reply	other threads:[~2021-07-29 10:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  7:38 [PATCH 00/15] ALSA: usb-audio: Introduce and convert to quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 01/15] ALSA: usb-audio: Introduce quirk_flags field Takashi Iwai
2021-07-29  7:38 ` [PATCH 02/15] ALSA: usb-audio: Move media-controller API quirk into quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 03/15] ALSA: usb-audio: Move txfr_quirk handling to quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 04/15] ALSA: usb-audio: Move tx_length quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 05/15] ALSA: usb-audio: Move playback_first flag into quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 06/15] ALSA: usb-audio: Move clock setup quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 07/15] ALSA: usb-audio: Move ITF-USB DSD quirk handling " Takashi Iwai
2021-07-29  7:38 ` [PATCH 08/15] ALSA: usb-audio: Move control message delay quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 09/15] ALSA: usb-audio: Move interface setup delay " Takashi Iwai
2021-07-29  7:43 ` [PATCH 10/15] ALSA: usb-audio: Move rate validation quirk " Takashi Iwai
2021-07-29  7:44 ` Takashi Iwai [this message]
2021-07-29  7:44 ` [PATCH 12/15] ALSA: usb-audio: Move ignore_ctl_error check " Takashi Iwai
2021-07-29  7:44 ` [PATCH 13/15] ALSA: usb-audio: Move generic DSD raw detection " Takashi Iwai
2021-07-29  7:44 ` [PATCH 14/15] ALSA: usb-audio: Add quirk_flags module option Takashi Iwai
2021-07-29  7:44 ` [PATCH 15/15] ALSA: doc: Add the description of quirk_flags option for snd-usb-audio Takashi Iwai

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=20210729074404.19728-2-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.