@@ -458,10 +458,6 @@ static int catpt_dai_prepare(struct snd_pcm_substream *substream,
458458 if (ret )
459459 return CATPT_IPC_ERROR (ret );
460460
461- ret = catpt_dsp_update_lpclock (cdev );
462- if (ret )
463- return ret ;
464-
465461 ret = catpt_dai_apply_usettings (dai , stream );
466462 if (ret )
467463 return ret ;
@@ -500,18 +496,19 @@ static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd,
500496 case SNDRV_PCM_TRIGGER_RESUME :
501497 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE :
502498 resume_stream :
499+ catpt_dsp_update_lpclock (cdev );
503500 ret = catpt_ipc_resume_stream (cdev , stream -> info .stream_hw_id );
504501 if (ret )
505502 return CATPT_IPC_ERROR (ret );
506503 break ;
507504
508505 case SNDRV_PCM_TRIGGER_STOP :
509506 stream -> prepared = false;
510- catpt_dsp_update_lpclock (cdev );
511507 fallthrough ;
512508 case SNDRV_PCM_TRIGGER_SUSPEND :
513509 case SNDRV_PCM_TRIGGER_PAUSE_PUSH :
514510 ret = catpt_ipc_pause_stream (cdev , stream -> info .stream_hw_id );
511+ catpt_dsp_update_lpclock (cdev );
515512 if (ret )
516513 return CATPT_IPC_ERROR (ret );
517514 break ;
@@ -534,6 +531,8 @@ void catpt_stream_update_position(struct catpt_dev *cdev,
534531
535532 dsppos = bytes_to_frames (r , pos -> stream_position );
536533
534+ if (!stream -> prepared )
535+ goto exit ;
537536 /* only offload is set_write_pos driven */
538537 if (stream -> template -> type != CATPT_STRM_TYPE_RENDER )
539538 goto exit ;
0 commit comments