ALSA: usb-audio: Move ignore_ctl_error check into quirk_flags
The mixer code has a flag ignore_ctl_error for ignoring the errors returned from the device wrt mixer accesses, and this is set from the entries in mixer_maps.c, as well as ignore_ctl_error module option. Those can be well integrated into the new quirk_flags field, too. Link: https://lore.kernel.org/r/20210729074404.19728-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -804,6 +804,9 @@ static int usb_audio_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
dev_set_drvdata(&dev->dev, chip);
|
dev_set_drvdata(&dev->dev, chip);
|
||||||
|
|
||||||
|
if (ignore_ctl_error)
|
||||||
|
chip->quirk_flags |= QUIRK_FLAG_IGNORE_CTL_ERROR;
|
||||||
|
|
||||||
if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
|
if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
|
||||||
usb_disable_autosuspend(interface_to_usbdev(intf));
|
usb_disable_autosuspend(interface_to_usbdev(intf));
|
||||||
|
|
||||||
@@ -828,7 +831,7 @@ static int usb_audio_probe(struct usb_interface *intf,
|
|||||||
err = snd_usb_create_streams(chip, ifnum);
|
err = snd_usb_create_streams(chip, ifnum);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto __error;
|
goto __error;
|
||||||
err = snd_usb_create_mixer(chip, ifnum, ignore_ctl_error);
|
err = snd_usb_create_mixer(chip, ifnum);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3183,7 +3183,6 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
|
|||||||
state.map = map->map;
|
state.map = map->map;
|
||||||
state.selector_map = map->selector_map;
|
state.selector_map = map->selector_map;
|
||||||
mixer->connector_map = map->connector_map;
|
mixer->connector_map = map->connector_map;
|
||||||
mixer->ignore_ctl_error |= map->ignore_ctl_error;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3508,8 +3507,7 @@ static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
|
||||||
int ignore_error)
|
|
||||||
{
|
{
|
||||||
static const struct snd_device_ops dev_ops = {
|
static const struct snd_device_ops dev_ops = {
|
||||||
.dev_free = snd_usb_mixer_dev_free
|
.dev_free = snd_usb_mixer_dev_free
|
||||||
@@ -3523,7 +3521,7 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
|||||||
if (!mixer)
|
if (!mixer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
mixer->chip = chip;
|
mixer->chip = chip;
|
||||||
mixer->ignore_ctl_error = ignore_error;
|
mixer->ignore_ctl_error = !!(chip->quirk_flags & QUIRK_FLAG_IGNORE_CTL_ERROR);
|
||||||
mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems),
|
mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!mixer->id_elems) {
|
if (!mixer->id_elems) {
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ struct usb_mixer_elem_info {
|
|||||||
void *private_data;
|
void *private_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
|
int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif);
|
||||||
int ignore_error);
|
|
||||||
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer);
|
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer);
|
||||||
|
|
||||||
void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
|
void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ struct usbmix_ctl_map {
|
|||||||
const struct usbmix_name_map *map;
|
const struct usbmix_name_map *map;
|
||||||
const struct usbmix_selector_map *selector_map;
|
const struct usbmix_selector_map *selector_map;
|
||||||
const struct usbmix_connector_map *connector_map;
|
const struct usbmix_connector_map *connector_map;
|
||||||
int ignore_ctl_error;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -432,7 +431,6 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
|
|||||||
{
|
{
|
||||||
.id = USB_ID(0x041e, 0x3000),
|
.id = USB_ID(0x041e, 0x3000),
|
||||||
.map = extigy_map,
|
.map = extigy_map,
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = USB_ID(0x041e, 0x3010),
|
.id = USB_ID(0x041e, 0x3010),
|
||||||
@@ -452,28 +450,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
|
|||||||
.map = audigy2nx_map,
|
.map = audigy2nx_map,
|
||||||
.selector_map = audigy2nx_selectors,
|
.selector_map = audigy2nx_selectors,
|
||||||
},
|
},
|
||||||
{ /* Logitech, Inc. QuickCam Pro for Notebooks */
|
|
||||||
.id = USB_ID(0x046d, 0x0991),
|
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
|
||||||
{ /* Logitech, Inc. QuickCam E 3500 */
|
|
||||||
.id = USB_ID(0x046d, 0x09a4),
|
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
|
||||||
{ /* Plantronics GameCom 780 */
|
{ /* Plantronics GameCom 780 */
|
||||||
.id = USB_ID(0x047f, 0xc010),
|
.id = USB_ID(0x047f, 0xc010),
|
||||||
.map = gamecom780_map,
|
.map = gamecom780_map,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
/* Hercules DJ Console (Windows Edition) */
|
|
||||||
.id = USB_ID(0x06f8, 0xb000),
|
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
/* Hercules DJ Console (Macintosh Edition) */
|
|
||||||
.id = USB_ID(0x06f8, 0xd002),
|
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
/* Hercules Gamesurround Muse Pocket LT
|
/* Hercules Gamesurround Muse Pocket LT
|
||||||
* (USB 5.1 Channel Audio Adapter)
|
* (USB 5.1 Channel Audio Adapter)
|
||||||
@@ -492,7 +472,6 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
|
|||||||
{
|
{
|
||||||
.id = USB_ID(0x08bb, 0x2702),
|
.id = USB_ID(0x08bb, 0x2702),
|
||||||
.map = linex_map,
|
.map = linex_map,
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = USB_ID(0x0a92, 0x0091),
|
.id = USB_ID(0x0a92, 0x0091),
|
||||||
@@ -517,7 +496,6 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
|
|||||||
{
|
{
|
||||||
.id = USB_ID(0x13e5, 0x0001),
|
.id = USB_ID(0x13e5, 0x0001),
|
||||||
.map = scratch_live_map,
|
.map = scratch_live_map,
|
||||||
.ignore_ctl_error = 1,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = USB_ID(0x200c, 0x1018),
|
.id = USB_ID(0x200c, 0x1018),
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
|
|||||||
if (quirk->ifnum < 0)
|
if (quirk->ifnum < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return snd_usb_create_mixer(chip, quirk->ifnum, 0);
|
return snd_usb_create_mixer(chip, quirk->ifnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1796,10 +1796,16 @@ struct usb_audio_quirk_flags_table {
|
|||||||
|
|
||||||
static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
||||||
/* Device matches */
|
/* Device matches */
|
||||||
|
DEVICE_FLG(0x041e, 0x3000, /* Creative SB Extigy */
|
||||||
|
QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
DEVICE_FLG(0x041e, 0x4080, /* Creative Live Cam VF0610 */
|
DEVICE_FLG(0x041e, 0x4080, /* Creative Live Cam VF0610 */
|
||||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||||
DEVICE_FLG(0x046d, 0x084c, /* Logitech ConferenceCam Connect */
|
DEVICE_FLG(0x046d, 0x084c, /* Logitech ConferenceCam Connect */
|
||||||
QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
||||||
|
DEVICE_FLG(0x046d, 0x0991, /* Logitech QuickCam Pro */
|
||||||
|
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
|
DEVICE_FLG(0x046d, 0x09a4, /* Logitech QuickCam E 3500 */
|
||||||
|
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */
|
DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */
|
||||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||||
DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
|
DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
|
||||||
@@ -1823,8 +1829,14 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
|||||||
DEVICE_FLG(0x0644, 0x804a, /* TEAC UD-301 */
|
DEVICE_FLG(0x0644, 0x804a, /* TEAC UD-301 */
|
||||||
QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY |
|
QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY |
|
||||||
QUIRK_FLAG_IFACE_DELAY),
|
QUIRK_FLAG_IFACE_DELAY),
|
||||||
|
DEVICE_FLG(0x06f8, 0xb000, /* Hercules DJ Console (Windows Edition) */
|
||||||
|
QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
|
DEVICE_FLG(0x06f8, 0xd002, /* Hercules DJ Console (Macintosh Edition) */
|
||||||
|
QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */
|
DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */
|
||||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||||
|
DEVICE_FLG(0x08bb, 0x2702, /* LineX FM Transmitter */
|
||||||
|
QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */
|
DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */
|
||||||
QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
QUIRK_FLAG_CTL_MSG_DELAY_1M),
|
||||||
DEVICE_FLG(0x0b0e, 0x0349, /* Jabra 550a */
|
DEVICE_FLG(0x0b0e, 0x0349, /* Jabra 550a */
|
||||||
@@ -1833,6 +1845,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
|||||||
QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
|
QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
|
||||||
DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
|
DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
|
||||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||||
|
DEVICE_FLG(0x13e5, 0x0001, /* Serato Phono */
|
||||||
|
QUIRK_FLAG_IGNORE_CTL_ERROR),
|
||||||
DEVICE_FLG(0x154e, 0x1002, /* Denon DCD-1500RE */
|
DEVICE_FLG(0x154e, 0x1002, /* Denon DCD-1500RE */
|
||||||
QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY),
|
QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY),
|
||||||
DEVICE_FLG(0x154e, 0x1003, /* Denon DA-300USB */
|
DEVICE_FLG(0x154e, 0x1003, /* Denon DA-300USB */
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ extern bool snd_usb_skip_validation;
|
|||||||
* Perform sample rate validations at probe
|
* Perform sample rate validations at probe
|
||||||
* QUIRK_FLAG_DISABLE_AUTOSUSPEND:
|
* QUIRK_FLAG_DISABLE_AUTOSUSPEND:
|
||||||
* Disable runtime PM autosuspend
|
* Disable runtime PM autosuspend
|
||||||
|
* QUIRK_FLAG_IGNORE_CTL_ERROR:
|
||||||
|
* Ignore errors for mixer access
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
|
#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
|
||||||
@@ -173,5 +175,6 @@ extern bool snd_usb_skip_validation;
|
|||||||
#define QUIRK_FLAG_IFACE_DELAY (1U << 11)
|
#define QUIRK_FLAG_IFACE_DELAY (1U << 11)
|
||||||
#define QUIRK_FLAG_VALIDATE_RATES (1U << 12)
|
#define QUIRK_FLAG_VALIDATE_RATES (1U << 12)
|
||||||
#define QUIRK_FLAG_DISABLE_AUTOSUSPEND (1U << 13)
|
#define QUIRK_FLAG_DISABLE_AUTOSUSPEND (1U << 13)
|
||||||
|
#define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)
|
||||||
|
|
||||||
#endif /* __USBAUDIO_H */
|
#endif /* __USBAUDIO_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user