@@ -472,22 +472,91 @@ static void skl_set_base_module_format(struct skl_dev *skl,
472
472
base_cfg -> is_pages = res -> is_pages ;
473
473
}
474
474
475
+ static void fill_pin_params (struct skl_audio_data_format * pin_fmt ,
476
+ struct skl_module_fmt * format )
477
+ {
478
+ pin_fmt -> number_of_channels = format -> channels ;
479
+ pin_fmt -> s_freq = format -> s_freq ;
480
+ pin_fmt -> bit_depth = format -> bit_depth ;
481
+ pin_fmt -> valid_bit_depth = format -> valid_bit_depth ;
482
+ pin_fmt -> ch_cfg = format -> ch_cfg ;
483
+ pin_fmt -> sample_type = format -> sample_type ;
484
+ pin_fmt -> channel_map = format -> ch_map ;
485
+ pin_fmt -> interleaving = format -> interleaving_style ;
486
+ }
487
+
488
+ /*
489
+ * Any module configuration begins with a base module configuration but
490
+ * can be followed by a generic extension containing audio format for all
491
+ * module's pins that are in use.
492
+ */
493
+ static void skl_set_base_ext_module_format (struct skl_dev * skl ,
494
+ struct skl_module_cfg * mconfig ,
495
+ struct skl_base_cfg_ext * base_cfg_ext )
496
+ {
497
+ struct skl_module * module = mconfig -> module ;
498
+ struct skl_module_pin_resources * pin_res ;
499
+ struct skl_module_iface * fmt = & module -> formats [mconfig -> fmt_idx ];
500
+ struct skl_module_res * res = & module -> resources [mconfig -> res_idx ];
501
+ struct skl_module_fmt * format ;
502
+ struct skl_pin_format * pin_fmt ;
503
+ char * params ;
504
+ int i ;
505
+
506
+ base_cfg_ext -> nr_input_pins = res -> nr_input_pins ;
507
+ base_cfg_ext -> nr_output_pins = res -> nr_output_pins ;
508
+ base_cfg_ext -> priv_param_length =
509
+ mconfig -> formats_config [SKL_PARAM_INIT ].caps_size ;
510
+
511
+ for (i = 0 ; i < res -> nr_input_pins ; i ++ ) {
512
+ pin_res = & res -> input [i ];
513
+ pin_fmt = & base_cfg_ext -> pins_fmt [i ];
514
+
515
+ pin_fmt -> pin_idx = pin_res -> pin_index ;
516
+ pin_fmt -> buf_size = pin_res -> buf_size ;
517
+
518
+ format = & fmt -> inputs [pin_res -> pin_index ].fmt ;
519
+ fill_pin_params (& pin_fmt -> audio_fmt , format );
520
+ }
521
+
522
+ for (i = 0 ; i < res -> nr_output_pins ; i ++ ) {
523
+ pin_res = & res -> output [i ];
524
+ pin_fmt = & base_cfg_ext -> pins_fmt [res -> nr_input_pins + i ];
525
+
526
+ pin_fmt -> pin_idx = pin_res -> pin_index ;
527
+ pin_fmt -> buf_size = pin_res -> buf_size ;
528
+
529
+ format = & fmt -> outputs [pin_res -> pin_index ].fmt ;
530
+ fill_pin_params (& pin_fmt -> audio_fmt , format );
531
+ }
532
+
533
+ if (!base_cfg_ext -> priv_param_length )
534
+ return ;
535
+
536
+ params = (char * )base_cfg_ext + sizeof (struct skl_base_cfg_ext );
537
+ params += (base_cfg_ext -> nr_input_pins + base_cfg_ext -> nr_output_pins ) *
538
+ sizeof (struct skl_pin_format );
539
+
540
+ memcpy (params , mconfig -> formats_config [SKL_PARAM_INIT ].caps ,
541
+ mconfig -> formats_config [SKL_PARAM_INIT ].caps_size );
542
+ }
543
+
475
544
/*
476
545
* Copies copier capabilities into copier module and updates copier module
477
546
* config size.
478
547
*/
479
548
static void skl_copy_copier_caps (struct skl_module_cfg * mconfig ,
480
549
struct skl_cpr_cfg * cpr_mconfig )
481
550
{
482
- if (mconfig -> formats_config .caps_size == 0 )
551
+ if (mconfig -> formats_config [ SKL_PARAM_INIT ] .caps_size == 0 )
483
552
return ;
484
553
485
554
memcpy (cpr_mconfig -> gtw_cfg .config_data ,
486
- mconfig -> formats_config .caps ,
487
- mconfig -> formats_config .caps_size );
555
+ mconfig -> formats_config [ SKL_PARAM_INIT ] .caps ,
556
+ mconfig -> formats_config [ SKL_PARAM_INIT ] .caps_size );
488
557
489
558
cpr_mconfig -> gtw_cfg .config_length =
490
- (mconfig -> formats_config .caps_size ) / 4 ;
559
+ (mconfig -> formats_config [ SKL_PARAM_INIT ] .caps_size ) / 4 ;
491
560
}
492
561
493
562
#define SKL_NON_GATEWAY_CPR_NODE_ID 0xFFFFFFFF
@@ -737,28 +806,6 @@ static void skl_set_copier_format(struct skl_dev *skl,
737
806
skl_setup_cpr_gateway_cfg (skl , mconfig , cpr_mconfig );
738
807
}
739
808
740
- /*
741
- * Algo module are DSP pre processing modules. Algo module take base module
742
- * configuration and params
743
- */
744
-
745
- static void skl_set_algo_format (struct skl_dev * skl ,
746
- struct skl_module_cfg * mconfig ,
747
- struct skl_algo_cfg * algo_mcfg )
748
- {
749
- struct skl_base_cfg * base_cfg = (struct skl_base_cfg * )algo_mcfg ;
750
-
751
- skl_set_base_module_format (skl , mconfig , base_cfg );
752
-
753
- if (mconfig -> formats_config .caps_size == 0 )
754
- return ;
755
-
756
- memcpy (algo_mcfg -> params ,
757
- mconfig -> formats_config .caps ,
758
- mconfig -> formats_config .caps_size );
759
-
760
- }
761
-
762
809
/*
763
810
* Mic select module allows selecting one or many input channels, thus
764
811
* acting as a demux.
@@ -781,12 +828,14 @@ static void skl_set_base_outfmt_format(struct skl_dev *skl,
781
828
static u16 skl_get_module_param_size (struct skl_dev * skl ,
782
829
struct skl_module_cfg * mconfig )
783
830
{
831
+ struct skl_module_res * res ;
832
+ struct skl_module * module = mconfig -> module ;
784
833
u16 param_size ;
785
834
786
835
switch (mconfig -> m_type ) {
787
836
case SKL_MODULE_TYPE_COPIER :
788
837
param_size = sizeof (struct skl_cpr_cfg );
789
- param_size += mconfig -> formats_config .caps_size ;
838
+ param_size += mconfig -> formats_config [ SKL_PARAM_INIT ] .caps_size ;
790
839
return param_size ;
791
840
792
841
case SKL_MODULE_TYPE_SRCINT :
@@ -795,22 +844,24 @@ static u16 skl_get_module_param_size(struct skl_dev *skl,
795
844
case SKL_MODULE_TYPE_UPDWMIX :
796
845
return sizeof (struct skl_up_down_mixer_cfg );
797
846
798
- case SKL_MODULE_TYPE_ALGO :
799
- param_size = sizeof (struct skl_base_cfg );
800
- param_size += mconfig -> formats_config .caps_size ;
801
- return param_size ;
802
-
803
847
case SKL_MODULE_TYPE_BASE_OUTFMT :
804
848
case SKL_MODULE_TYPE_MIC_SELECT :
805
- case SKL_MODULE_TYPE_KPB :
806
849
return sizeof (struct skl_base_outfmt_cfg );
807
850
808
- default :
809
- /*
810
- * return only base cfg when no specific module type is
811
- * specified
812
- */
851
+ case SKL_MODULE_TYPE_MIXER :
852
+ case SKL_MODULE_TYPE_KPB :
813
853
return sizeof (struct skl_base_cfg );
854
+
855
+ case SKL_MODULE_TYPE_ALGO :
856
+ default :
857
+ res = & module -> resources [mconfig -> res_idx ];
858
+
859
+ param_size = sizeof (struct skl_base_cfg ) + sizeof (struct skl_base_cfg_ext );
860
+ param_size += (res -> nr_input_pins + res -> nr_output_pins ) *
861
+ sizeof (struct skl_pin_format );
862
+ param_size += mconfig -> formats_config [SKL_PARAM_INIT ].caps_size ;
863
+
864
+ return param_size ;
814
865
}
815
866
816
867
return 0 ;
@@ -851,20 +902,23 @@ static int skl_set_module_format(struct skl_dev *skl,
851
902
skl_set_updown_mixer_format (skl , module_config , * param_data );
852
903
break ;
853
904
854
- case SKL_MODULE_TYPE_ALGO :
855
- skl_set_algo_format (skl , module_config , * param_data );
856
- break ;
857
-
858
905
case SKL_MODULE_TYPE_BASE_OUTFMT :
859
906
case SKL_MODULE_TYPE_MIC_SELECT :
860
- case SKL_MODULE_TYPE_KPB :
861
907
skl_set_base_outfmt_format (skl , module_config , * param_data );
862
908
break ;
863
909
864
- default :
910
+ case SKL_MODULE_TYPE_MIXER :
911
+ case SKL_MODULE_TYPE_KPB :
865
912
skl_set_base_module_format (skl , module_config , * param_data );
866
913
break ;
867
914
915
+ case SKL_MODULE_TYPE_ALGO :
916
+ default :
917
+ skl_set_base_module_format (skl , module_config , * param_data );
918
+ skl_set_base_ext_module_format (skl , module_config ,
919
+ * param_data +
920
+ sizeof (struct skl_base_cfg ));
921
+ break ;
868
922
}
869
923
870
924
dev_dbg (skl -> dev , "Module type=%d id=%d config size: %d bytes\n" ,
@@ -1085,19 +1139,6 @@ int skl_unbind_modules(struct skl_dev *skl,
1085
1139
return ret ;
1086
1140
}
1087
1141
1088
- static void fill_pin_params (struct skl_audio_data_format * pin_fmt ,
1089
- struct skl_module_fmt * format )
1090
- {
1091
- pin_fmt -> number_of_channels = format -> channels ;
1092
- pin_fmt -> s_freq = format -> s_freq ;
1093
- pin_fmt -> bit_depth = format -> bit_depth ;
1094
- pin_fmt -> valid_bit_depth = format -> valid_bit_depth ;
1095
- pin_fmt -> ch_cfg = format -> ch_cfg ;
1096
- pin_fmt -> sample_type = format -> sample_type ;
1097
- pin_fmt -> channel_map = format -> ch_map ;
1098
- pin_fmt -> interleaving = format -> interleaving_style ;
1099
- }
1100
-
1101
1142
#define CPR_SINK_FMT_PARAM_ID 2
1102
1143
1103
1144
/*
0 commit comments