@@ -272,15 +272,16 @@ static int start_endpoints(struct snd_usb_substream *subs)
272272
273273static void stop_endpoints (struct snd_usb_substream * subs , bool wait )
274274{
275- if (test_and_clear_bit (SUBSTREAM_FLAG_SYNC_EP_STARTED , & subs -> flags ))
275+ if (test_and_clear_bit (SUBSTREAM_FLAG_SYNC_EP_STARTED , & subs -> flags )) {
276276 snd_usb_endpoint_stop (subs -> sync_endpoint );
277+ if (wait )
278+ snd_usb_endpoint_sync_pending_stop (subs -> sync_endpoint );
279+ }
277280
278- if (test_and_clear_bit (SUBSTREAM_FLAG_DATA_EP_STARTED , & subs -> flags ))
281+ if (test_and_clear_bit (SUBSTREAM_FLAG_DATA_EP_STARTED , & subs -> flags )) {
279282 snd_usb_endpoint_stop (subs -> data_endpoint );
280-
281- if (wait ) {
282- snd_usb_endpoint_sync_pending_stop (subs -> sync_endpoint );
283- snd_usb_endpoint_sync_pending_stop (subs -> data_endpoint );
283+ if (wait )
284+ snd_usb_endpoint_sync_pending_stop (subs -> data_endpoint );
284285 }
285286}
286287
@@ -1626,12 +1627,17 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea
16261627
16271628 switch (cmd ) {
16281629 case SNDRV_PCM_TRIGGER_START :
1630+ case SNDRV_PCM_TRIGGER_RESUME :
16291631 subs -> trigger_tstamp_pending_update = true;
16301632 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE :
16311633 subs -> data_endpoint -> prepare_data_urb = prepare_playback_urb ;
16321634 subs -> data_endpoint -> retire_data_urb = retire_playback_urb ;
16331635 subs -> running = 1 ;
16341636 return 0 ;
1637+ case SNDRV_PCM_TRIGGER_SUSPEND :
1638+ stop_endpoints (subs , true);
1639+ subs -> running = 0 ;
1640+ return 0 ;
16351641 case SNDRV_PCM_TRIGGER_STOP :
16361642 stop_endpoints (subs , false);
16371643 subs -> running = 0 ;
@@ -1655,13 +1661,18 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
16551661
16561662 switch (cmd ) {
16571663 case SNDRV_PCM_TRIGGER_START :
1664+ case SNDRV_PCM_TRIGGER_RESUME :
16581665 err = start_endpoints (subs );
16591666 if (err < 0 )
16601667 return err ;
16611668
16621669 subs -> data_endpoint -> retire_data_urb = retire_capture_urb ;
16631670 subs -> running = 1 ;
16641671 return 0 ;
1672+ case SNDRV_PCM_TRIGGER_SUSPEND :
1673+ stop_endpoints (subs , true);
1674+ subs -> running = 0 ;
1675+ return 0 ;
16651676 case SNDRV_PCM_TRIGGER_STOP :
16661677 stop_endpoints (subs , false);
16671678 subs -> running = 0 ;
0 commit comments