mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 06:46:35 +01:00
ALSA: usb-audio: scarlett2: Improve driver startup messages
Add separate init function to call the existing controls_create function so a custom error can be displayed if initialisation fails. Use info level instead of error for notifications. Display the VID/PID so device_setup is targeted to the right device. Display "enabled" message to easily confirm that the driver is loaded. Signed-off-by: Geoffrey D. Bennett <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
This commit is contained in:
1 parent
764fa6e686
commit
265d1a90e4
3 files changed
+52
-31
No files matched your search
@@ -3060,7 +3060,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
|
||||
case USB_ID(0x1235, 0x8203): /* Focusrite Scarlett 6i6 2nd Gen */
|
||||
case USB_ID(0x1235, 0x8204): /* Focusrite Scarlett 18i8 2nd Gen */
|
||||
case USB_ID(0x1235, 0x8201): /* Focusrite Scarlett 18i20 2nd Gen */
|
||||
err = snd_scarlett_gen2_controls_create(mixer);
|
||||
err = snd_scarlett_gen2_init(mixer);
|
||||
break;
|
||||
|
||||
case USB_ID(0x041e, 0x323b): /* Creative Sound Blaster E1 */
|
||||
|
||||
@@ -1997,38 +1997,11 @@ static int scarlett2_mixer_status_create(struct usb_mixer_interface *mixer)
|
||||
return usb_submit_urb(mixer->urb, GFP_KERNEL);
|
||||
}
|
||||
|
||||
/* Entry point */
|
||||
int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
|
||||
int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer,
|
||||
const struct scarlett2_device_info *info)
|
||||
{
|
||||
const struct scarlett2_device_info *info;
|
||||
int err;
|
||||
|
||||
/* only use UAC_VERSION_2 */
|
||||
if (!mixer->protocol)
|
||||
return 0;
|
||||
|
||||
switch (mixer->chip->usb_id) {
|
||||
case USB_ID(0x1235, 0x8203):
|
||||
info = &s6i6_gen2_info;
|
||||
break;
|
||||
case USB_ID(0x1235, 0x8204):
|
||||
info = &s18i8_gen2_info;
|
||||
break;
|
||||
case USB_ID(0x1235, 0x8201):
|
||||
info = &s18i20_gen2_info;
|
||||
break;
|
||||
default: /* device not (yet) supported */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(mixer->chip->setup & SCARLETT2_ENABLE)) {
|
||||
usb_audio_err(mixer->chip,
|
||||
"Focusrite Scarlett Gen 2 Mixer Driver disabled; "
|
||||
"use options snd_usb_audio device_setup=1 "
|
||||
"to enable and report any issues to [email protected]");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialise private data, routing, sequence number */
|
||||
err = scarlett2_init_private(mixer, info);
|
||||
if (err < 0)
|
||||
@@ -2073,3 +2046,51 @@ int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer)
|
||||
{
|
||||
struct snd_usb_audio *chip = mixer->chip;
|
||||
const struct scarlett2_device_info *info;
|
||||
int err;
|
||||
|
||||
/* only use UAC_VERSION_2 */
|
||||
if (!mixer->protocol)
|
||||
return 0;
|
||||
|
||||
switch (chip->usb_id) {
|
||||
case USB_ID(0x1235, 0x8203):
|
||||
info = &s6i6_gen2_info;
|
||||
break;
|
||||
case USB_ID(0x1235, 0x8204):
|
||||
info = &s18i8_gen2_info;
|
||||
break;
|
||||
case USB_ID(0x1235, 0x8201):
|
||||
info = &s18i20_gen2_info;
|
||||
break;
|
||||
default: /* device not (yet) supported */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(chip->setup & SCARLETT2_ENABLE)) {
|
||||
usb_audio_info(chip,
|
||||
"Focusrite Scarlett Gen 2 Mixer Driver disabled; "
|
||||
"use options snd_usb_audio vid=0x%04x pid=0x%04x "
|
||||
"device_setup=1 to enable and report any issues "
|
||||
"to [email protected]",
|
||||
USB_ID_VENDOR(chip->usb_id),
|
||||
USB_ID_PRODUCT(chip->usb_id));
|
||||
return 0;
|
||||
}
|
||||
|
||||
usb_audio_info(chip,
|
||||
"Focusrite Scarlett Gen 2 Mixer Driver enabled pid=0x%04x",
|
||||
USB_ID_PRODUCT(chip->usb_id));
|
||||
|
||||
err = snd_scarlett_gen2_controls_create(mixer, info);
|
||||
if (err < 0)
|
||||
usb_audio_err(mixer->chip,
|
||||
"Error initialising Scarlett Mixer Driver: %d",
|
||||
err);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
#ifndef __USB_MIXER_SCARLETT_GEN2_H
|
||||
#define __USB_MIXER_SCARLETT_GEN2_H
|
||||
|
||||
int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer);
|
||||
int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer);
|
||||
|
||||
#endif /* __USB_MIXER_SCARLETT_GEN2_H */
|
||||
Reference in new issue
Block a user