Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: usb-audio: Always set up the parameters after resume

The commit 92adc96f8eec ("ALSA: usb-audio: set the interface format
after resume on Dell WD19") introduced the workaround for the broken
setup after the resume specifically on a Dell dock model. However,
the full setup should have been performed after the resume on all
devices, as we can't guarantee the same state. So this patch removes
the conditional check and applies the workaround always.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+6 -34
+6 -14
sound/usb/pcm.c
··· 1835 1835 subs); 1836 1836 subs->running = 1; 1837 1837 return 0; 1838 + case SNDRV_PCM_TRIGGER_SUSPEND: 1839 + subs->need_setup_fmt = true; 1840 + fallthrough; 1838 1841 case SNDRV_PCM_TRIGGER_STOP: 1839 1842 stop_endpoints(subs); 1840 1843 snd_usb_endpoint_set_callback(subs->data_endpoint, ··· 1852 1849 subs); 1853 1850 subs->running = 0; 1854 1851 return 0; 1855 - case SNDRV_PCM_TRIGGER_SUSPEND: 1856 - if (subs->stream->chip->setup_fmt_after_resume_quirk) { 1857 - stop_endpoints(subs); 1858 - subs->need_setup_fmt = true; 1859 - return 0; 1860 - } 1861 - break; 1862 1852 } 1863 1853 1864 1854 return -EINVAL; ··· 1875 1879 subs); 1876 1880 subs->running = 1; 1877 1881 return 0; 1882 + case SNDRV_PCM_TRIGGER_SUSPEND: 1883 + subs->need_setup_fmt = true; 1884 + fallthrough; 1878 1885 case SNDRV_PCM_TRIGGER_STOP: 1879 1886 stop_endpoints(subs); 1880 1887 fallthrough; ··· 1886 1887 NULL, NULL, NULL); 1887 1888 subs->running = 0; 1888 1889 return 0; 1889 - case SNDRV_PCM_TRIGGER_SUSPEND: 1890 - if (subs->stream->chip->setup_fmt_after_resume_quirk) { 1891 - stop_endpoints(subs); 1892 - subs->need_setup_fmt = true; 1893 - return 0; 1894 - } 1895 - break; 1896 1890 } 1897 1891 1898 1892 return -EINVAL;
-8
sound/usb/quirks-table.h
··· 3256 3256 } 3257 3257 } 3258 3258 }, 3259 - /* Dell WD19 Dock */ 3260 - { 3261 - USB_DEVICE(0x0bda, 0x402e), 3262 - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 3263 - .ifnum = QUIRK_ANY_INTERFACE, 3264 - .type = QUIRK_SETUP_FMT_AFTER_RESUME 3265 - } 3266 - }, 3267 3259 /* MOTU Microbook II */ 3268 3260 { 3269 3261 USB_DEVICE_VENDOR_SPEC(0x07fd, 0x0004),
-11
sound/usb/quirks.c
··· 508 508 return snd_usb_create_mixer(chip, quirk->ifnum, 0); 509 509 } 510 510 511 - 512 - static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip, 513 - struct usb_interface *iface, 514 - struct usb_driver *driver, 515 - const struct snd_usb_audio_quirk *quirk) 516 - { 517 - chip->setup_fmt_after_resume_quirk = 1; 518 - return 1; /* Continue with creating streams and mixer */ 519 - } 520 - 521 511 static int setup_disable_autosuspend(struct snd_usb_audio *chip, 522 512 struct usb_interface *iface, 523 513 struct usb_driver *driver, ··· 555 565 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 556 566 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, 557 567 [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, 558 - [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, 559 568 [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend, 560 569 }; 561 570
-1
sound/usb/usbaudio.h
··· 35 35 wait_queue_head_t shutdown_wait; 36 36 unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ 37 37 unsigned int tx_length_quirk:1; /* Put length specifier in transfers */ 38 - unsigned int setup_fmt_after_resume_quirk:1; /* setup the format to interface after resume */ 39 38 unsigned int need_delayed_register:1; /* warn for delayed registration */ 40 39 int num_interfaces; 41 40 int num_suspended_intf;