@@ -99,17 +99,16 @@ sof_pcm_setup_connected_widgets(struct snd_sof_dev *sdev, struct snd_soc_pcm_run
9999 ret = snd_soc_dapm_dai_get_connected_widgets (dai , dir , & list ,
100100 dpcm_end_walk_at_be );
101101 if (ret < 0 ) {
102- dev_err ( sdev -> dev , "error: dai %s has no valid %s path\n", dai -> name ,
103- snd_pcm_direction_name (dir ));
102+ spcm_err ( spcm , dir , " dai %s has no valid %s path\n" ,
103+ dai -> name , snd_pcm_direction_name (dir ));
104104 return ret ;
105105 }
106106
107107 spcm -> stream [dir ].list = list ;
108108
109109 ret = sof_widget_list_setup (sdev , spcm , params , platform_params , dir );
110110 if (ret < 0 ) {
111- dev_err (sdev -> dev , "error: failed widget list set up for pcm %d dir %d\n" ,
112- spcm -> pcm .pcm_id , dir );
111+ spcm_err (spcm , dir , "Widget list set up failed\n" );
113112 spcm -> stream [dir ].list = NULL ;
114113 snd_soc_dapm_dai_free_widgets (& list );
115114 return ret ;
@@ -139,6 +138,8 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
139138 if (!spcm )
140139 return - EINVAL ;
141140
141+ spcm_dbg (spcm , substream -> stream , "Entry: hw_params\n" );
142+
142143 /*
143144 * Handle repeated calls to hw_params() without free_pcm() in
144145 * between. At least ALSA OSS emulation depends on this.
@@ -151,12 +152,9 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
151152 spcm -> prepared [substream -> stream ] = false;
152153 }
153154
154- dev_dbg (component -> dev , "pcm: hw params stream %d dir %d\n" ,
155- spcm -> pcm .pcm_id , substream -> stream );
156-
157155 ret = snd_sof_pcm_platform_hw_params (sdev , substream , params , & platform_params );
158156 if (ret < 0 ) {
159- dev_err ( component -> dev , "platform hw params failed\n" );
157+ spcm_err ( spcm , substream -> stream , "platform hw params failed\n" );
160158 return ret ;
161159 }
162160
@@ -210,8 +208,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
210208 if (pcm_ops && pcm_ops -> hw_free ) {
211209 ret = pcm_ops -> hw_free (sdev -> component , substream );
212210 if (ret < 0 ) {
213- dev_err ( sdev -> dev , "%s: pcm_ops hw_free failed %d\n" ,
214- __func__ , ret );
211+ spcm_err ( spcm , substream -> stream ,
212+ "pcm_ops->hw_free failed %d\n" , ret );
215213 err = ret ;
216214 }
217215 }
@@ -223,8 +221,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
223221 /* reset the DMA */
224222 ret = snd_sof_pcm_platform_hw_free (sdev , substream );
225223 if (ret < 0 ) {
226- dev_err ( sdev -> dev , "%s: platform hw free failed %d\n" ,
227- __func__ , ret );
224+ spcm_err ( spcm , substream -> stream ,
225+ "platform hw free failed %d\n" , ret );
228226 if (!err )
229227 err = ret ;
230228 }
@@ -233,8 +231,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
233231 if (free_widget_list ) {
234232 ret = sof_widget_list_free (sdev , spcm , dir );
235233 if (ret < 0 ) {
236- dev_err ( sdev -> dev , "%s: sof_widget_list_free failed %d\n" ,
237- __func__ , ret );
234+ spcm_err ( spcm , substream -> stream ,
235+ "sof_widget_list_free failed %d\n" , ret );
238236 if (!err )
239237 err = ret ;
240238 }
@@ -285,8 +283,7 @@ static int sof_pcm_hw_free(struct snd_soc_component *component,
285283 if (!spcm )
286284 return - EINVAL ;
287285
288- dev_dbg (component -> dev , "pcm: free stream %d dir %d\n" ,
289- spcm -> pcm .pcm_id , substream -> stream );
286+ spcm_dbg (spcm , substream -> stream , "Entry: hw_free\n" );
290287
291288 ret = sof_pcm_stream_free (sdev , substream , spcm , substream -> stream , true);
292289
@@ -311,6 +308,8 @@ static int sof_pcm_prepare(struct snd_soc_component *component,
311308 if (!spcm )
312309 return - EINVAL ;
313310
311+ spcm_dbg (spcm , substream -> stream , "Entry: prepare\n" );
312+
314313 if (spcm -> prepared [substream -> stream ]) {
315314 if (!spcm -> pending_stop [substream -> stream ])
316315 return 0 ;
@@ -324,15 +323,12 @@ static int sof_pcm_prepare(struct snd_soc_component *component,
324323 return ret ;
325324 }
326325
327- dev_dbg (component -> dev , "pcm: prepare stream %d dir %d\n" ,
328- spcm -> pcm .pcm_id , substream -> stream );
329-
330326 /* set hw_params */
331327 ret = sof_pcm_hw_params (component ,
332328 substream , & spcm -> params [substream -> stream ]);
333329 if (ret < 0 ) {
334- dev_err ( component -> dev ,
335- "error: set pcm hw_params after resume\n" );
330+ spcm_err ( spcm , substream -> stream ,
331+ "failed to set hw_params after resume\n" );
336332 return ret ;
337333 }
338334
@@ -362,8 +358,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
362358 if (!spcm )
363359 return - EINVAL ;
364360
365- dev_dbg (component -> dev , "pcm: trigger stream %d dir %d cmd %d\n" ,
366- spcm -> pcm .pcm_id , substream -> stream , cmd );
361+ spcm_dbg (spcm , substream -> stream , "Entry: trigger (cmd: %d)\n" , cmd );
367362
368363 spcm -> pending_stop [substream -> stream ] = false;
369364
@@ -412,7 +407,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
412407 reset_hw_params = true;
413408 break ;
414409 default :
415- dev_err ( component -> dev , "Unhandled trigger cmd %d\n" , cmd );
410+ spcm_err ( spcm , substream -> stream , "Unhandled trigger cmd %d\n" , cmd );
416411 return - EINVAL ;
417412 }
418413
@@ -514,9 +509,7 @@ static int sof_pcm_open(struct snd_soc_component *component,
514509 if (!spcm )
515510 return - EINVAL ;
516511
517- dev_dbg (component -> dev , "pcm: open stream %d dir %d\n" ,
518- spcm -> pcm .pcm_id , substream -> stream );
519-
512+ spcm_dbg (spcm , substream -> stream , "Entry: open\n" );
520513
521514 caps = & spcm -> pcm .caps [substream -> stream ];
522515
@@ -546,18 +539,16 @@ static int sof_pcm_open(struct snd_soc_component *component,
546539
547540 ret = snd_sof_pcm_platform_open (sdev , substream );
548541 if (ret < 0 ) {
549- dev_err (component -> dev , "error: pcm open failed %d\n" , ret );
542+ spcm_err (spcm , substream -> stream ,
543+ "platform pcm open failed %d\n" , ret );
550544 return ret ;
551545 }
552546
553- dev_dbg (component -> dev , "period bytes min %zd, max %zd\n" ,
554- runtime -> hw .period_bytes_min ,
555- runtime -> hw .period_bytes_max );
556- dev_dbg (component -> dev , "period count min %d, max %d\n" ,
557- runtime -> hw .periods_min ,
558- runtime -> hw .periods_max );
559- dev_dbg (component -> dev , "buffer bytes max %zd\n" ,
560- runtime -> hw .buffer_bytes_max );
547+ spcm_dbg (spcm , substream -> stream , "period bytes min %zd, max %zd\n" ,
548+ runtime -> hw .period_bytes_min , runtime -> hw .period_bytes_max );
549+ spcm_dbg (spcm , substream -> stream , "period count min %d, max %d\n" ,
550+ runtime -> hw .periods_min , runtime -> hw .periods_max );
551+ spcm_dbg (spcm , substream -> stream , "buffer bytes max %zd\n" , runtime -> hw .buffer_bytes_max );
561552
562553 return 0 ;
563554}
@@ -578,13 +569,12 @@ static int sof_pcm_close(struct snd_soc_component *component,
578569 if (!spcm )
579570 return - EINVAL ;
580571
581- dev_dbg (component -> dev , "pcm: close stream %d dir %d\n" ,
582- spcm -> pcm .pcm_id , substream -> stream );
572+ spcm_dbg (spcm , substream -> stream , "Entry: close\n" );
583573
584574 err = snd_sof_pcm_platform_close (sdev , substream );
585575 if (err < 0 ) {
586- dev_err ( component -> dev , "error: pcm close failed %d\n" ,
587- err );
576+ spcm_err ( spcm , substream -> stream ,
577+ "platform pcm close failed %d\n" , err );
588578 /*
589579 * keep going, no point in preventing the close
590580 * from happening
@@ -618,24 +608,24 @@ static int sof_pcm_new(struct snd_soc_component *component,
618608 return 0 ;
619609 }
620610
621- dev_dbg (component -> dev , "creating new PCM %s\n" , spcm -> pcm .pcm_name );
611+ dev_dbg (spcm -> scomp -> dev , "pcm%u (%s): Entry: pcm_construct\n" ,
612+ spcm -> pcm .pcm_id , spcm -> pcm .pcm_name );
622613
623614 /* do we need to pre-allocate playback audio buffer pages */
624615 if (!spcm -> pcm .playback )
625616 goto capture ;
626617
627618 caps = & spcm -> pcm .caps [stream ];
628619
629- /* pre-allocate playback audio buffer pages */
630- dev_dbg (component -> dev ,
631- "spcm: allocate %s playback DMA buffer size 0x%x max 0x%x\n" ,
632- caps -> name , caps -> buffer_size_min , caps -> buffer_size_max );
633-
634620 if (!pcm -> streams [stream ].substream ) {
635- dev_err ( component -> dev , "error: NULL playback substream!\n" );
621+ spcm_err ( spcm , stream , " NULL playback substream!\n" );
636622 return - EINVAL ;
637623 }
638624
625+ /* pre-allocate playback audio buffer pages */
626+ spcm_dbg (spcm , stream , "allocate %s playback DMA buffer size 0x%x max 0x%x\n" ,
627+ caps -> name , caps -> buffer_size_min , caps -> buffer_size_max );
628+
639629 snd_pcm_set_managed_buffer (pcm -> streams [stream ].substream ,
640630 SNDRV_DMA_TYPE_DEV_SG , sdev -> dev ,
641631 0 , le32_to_cpu (caps -> buffer_size_max ));
@@ -648,16 +638,15 @@ static int sof_pcm_new(struct snd_soc_component *component,
648638
649639 caps = & spcm -> pcm .caps [stream ];
650640
651- /* pre-allocate capture audio buffer pages */
652- dev_dbg (component -> dev ,
653- "spcm: allocate %s capture DMA buffer size 0x%x max 0x%x\n" ,
654- caps -> name , caps -> buffer_size_min , caps -> buffer_size_max );
655-
656641 if (!pcm -> streams [stream ].substream ) {
657- dev_err ( component -> dev , "error: NULL capture substream!\n" );
642+ spcm_err ( spcm , stream , " NULL capture substream!\n" );
658643 return - EINVAL ;
659644 }
660645
646+ /* pre-allocate capture audio buffer pages */
647+ spcm_dbg (spcm , stream , "allocate %s capture DMA buffer size 0x%x max 0x%x\n" ,
648+ caps -> name , caps -> buffer_size_min , caps -> buffer_size_max );
649+
661650 snd_pcm_set_managed_buffer (pcm -> streams [stream ].substream ,
662651 SNDRV_DMA_TYPE_DEV_SG , sdev -> dev ,
663652 0 , le32_to_cpu (caps -> buffer_size_max ));
0 commit comments