@@ -582,6 +582,12 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl,
582
582
return ret ;
583
583
}
584
584
585
+ static void skl_tplg_set_pipe_config_idx (struct skl_pipe * pipe , int idx )
586
+ {
587
+ pipe -> cur_config_idx = idx ;
588
+ pipe -> memory_pages = pipe -> configs [idx ].mem_pages ;
589
+ }
590
+
585
591
/*
586
592
* Here, we select pipe format based on the pipe type and pipe
587
593
* direction to determine the current config index for the pipeline.
@@ -600,16 +606,14 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
600
606
int i ;
601
607
602
608
if (pipe -> nr_cfgs == 0 ) {
603
- pipe -> cur_config_idx = 0 ;
609
+ skl_tplg_set_pipe_config_idx ( pipe , 0 ) ;
604
610
return 0 ;
605
611
}
606
612
607
613
if (pipe -> conn_type == SKL_PIPE_CONN_TYPE_NONE || pipe -> nr_cfgs == 1 ) {
608
614
dev_dbg (skl -> dev , "No conn_type or just 1 pathcfg, taking 0th for %d\n" ,
609
615
pipe -> ppl_id );
610
- pipe -> cur_config_idx = 0 ;
611
- pipe -> memory_pages = pconfig -> mem_pages ;
612
-
616
+ skl_tplg_set_pipe_config_idx (pipe , 0 );
613
617
return 0 ;
614
618
}
615
619
@@ -628,10 +632,8 @@ skl_tplg_get_pipe_config(struct skl_dev *skl, struct skl_module_cfg *mconfig)
628
632
629
633
if (CHECK_HW_PARAMS (params -> ch , params -> s_freq , params -> s_fmt ,
630
634
fmt -> channels , fmt -> freq , fmt -> bps )) {
631
- pipe -> cur_config_idx = i ;
632
- pipe -> memory_pages = pconfig -> mem_pages ;
635
+ skl_tplg_set_pipe_config_idx (pipe , i );
633
636
dev_dbg (skl -> dev , "Using pipe config: %d\n" , i );
634
-
635
637
return 0 ;
636
638
}
637
639
}
@@ -1351,7 +1353,7 @@ static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol,
1351
1353
return - EIO ;
1352
1354
1353
1355
if (is_set )
1354
- pipe -> cur_config_idx = ucontrol -> value .enumerated .item [0 ];
1356
+ skl_tplg_set_pipe_config_idx ( pipe , ucontrol -> value .enumerated .item [0 ]) ;
1355
1357
else
1356
1358
ucontrol -> value .enumerated .item [0 ] = pipe -> cur_config_idx ;
1357
1359
0 commit comments