Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: fix usb camero disconnect issue
@ 2022-11-04  1:32 aichao
  2022-11-04  7:12 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: aichao @ 2022-11-04  1:32 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel; +Cc: aichao, linux-kernel

When current rate is different from the runtime rate,
snd_usb_endpoint stop and close endpoint to resetting rate.
if snd_usb_endpoint close the endpoint, sometimes usb will
 disconnect the device.

Signed-off-by: aichao <aichao@kylinos.cn>
---
 sound/usb/pcm.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 5dc9266180e3..2ae4a55cbaa8 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -517,7 +517,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
 		if (snd_usb_endpoint_compatible(chip, subs->data_endpoint,
 						fmt, hw_params))
 			goto unlock;
-		close_endpoints(chip, subs);
 	}
 
 	subs->data_endpoint = snd_usb_endpoint_open(chip, fmt, hw_params, false);
@@ -546,9 +545,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
 	ret = configure_endpoints(chip, subs);
 
  unlock:
-	if (ret < 0)
-		close_endpoints(chip, subs);
-
 	snd_usb_unlock_shutdown(chip);
  stop_pipeline:
 	if (ret < 0)
@@ -574,7 +570,6 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
 	if (!snd_usb_lock_shutdown(chip)) {
 		if (stop_endpoints(subs))
 			sync_pending_stops(subs);
-		close_endpoints(chip, subs);
 		snd_usb_unlock_shutdown(chip);
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: usb-audio: fix usb camero disconnect issue
  2022-11-04  1:32 [PATCH] ALSA: usb-audio: fix usb camero disconnect issue aichao
@ 2022-11-04  7:12 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2022-11-04  7:12 UTC (permalink / raw)
  To: aichao; +Cc: linux-kernel, alsa-devel, tiwai

On Fri, 04 Nov 2022 02:32:36 +0100,
aichao wrote:
> 
> When current rate is different from the runtime rate,
> snd_usb_endpoint stop and close endpoint to resetting rate.
> if snd_usb_endpoint close the endpoint, sometimes usb will
>  disconnect the device.

What do you mean...?  snd_usb_endpoint_close() never disconnects the
device by itself.

Please elaborate the problem.


Takashi

> 
> Signed-off-by: aichao <aichao@kylinos.cn>
> ---
>  sound/usb/pcm.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index 5dc9266180e3..2ae4a55cbaa8 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -517,7 +517,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
>  		if (snd_usb_endpoint_compatible(chip, subs->data_endpoint,
>  						fmt, hw_params))
>  			goto unlock;
> -		close_endpoints(chip, subs);
>  	}
>  
>  	subs->data_endpoint = snd_usb_endpoint_open(chip, fmt, hw_params, false);
> @@ -546,9 +545,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
>  	ret = configure_endpoints(chip, subs);
>  
>   unlock:
> -	if (ret < 0)
> -		close_endpoints(chip, subs);
> -
>  	snd_usb_unlock_shutdown(chip);
>   stop_pipeline:
>  	if (ret < 0)
> @@ -574,7 +570,6 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
>  	if (!snd_usb_lock_shutdown(chip)) {
>  		if (stop_endpoints(subs))
>  			sync_pending_stops(subs);
> -		close_endpoints(chip, subs);
>  		snd_usb_unlock_shutdown(chip);
>  	}
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-04  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04  1:32 [PATCH] ALSA: usb-audio: fix usb camero disconnect issue aichao
2022-11-04  7:12 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox