Skip to content

Commit 9902b30

Browse files
committed
ALSA: usb-audio: Avoid unnecessary interface change at EP close
We toggle USB interface at PCM prepare and reset at close. When the PCM isn't prepared, resetting again makes little sense. Check the current altset and avoid unnecessary interface reset at EP close. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 556a11a commit 9902b30

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sound/usb/endpoint.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct snd_usb_iface_ref {
3232
unsigned char iface;
3333
bool need_setup;
3434
int opened;
35+
int altset;
3536
struct list_head list;
3637
};
3738

@@ -899,6 +900,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
899900
int altset = set ? ep->altsetting : 0;
900901
int err;
901902

903+
if (ep->iface_ref->altset == altset)
904+
return 0;
905+
902906
usb_audio_dbg(chip, "Setting usb interface %d:%d for EP 0x%x\n",
903907
ep->iface, altset, ep->ep_num);
904908
err = usb_set_interface(chip->dev, ep->iface, altset);
@@ -910,6 +914,7 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
910914

911915
if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY)
912916
msleep(50);
917+
ep->iface_ref->altset = altset;
913918
return 0;
914919
}
915920

0 commit comments

Comments
 (0)