@@ -1063,6 +1063,51 @@ static int sof_ipc4_widget_setup_comp_mixer(struct snd_sof_widget *swidget)
10631063 return ret ;
10641064}
10651065
1066+ static int sof_ipc4_widget_setup_comp_siggen (struct snd_sof_widget * swidget )
1067+ {
1068+ struct snd_soc_component * scomp = swidget -> scomp ;
1069+ struct snd_sof_pipeline * spipe = swidget -> spipe ;
1070+ struct sof_ipc4_siggen * siggen ;
1071+ int ret ;
1072+
1073+ dev_dbg (scomp -> dev , "Updating IPC structure for %s\n" , swidget -> widget -> name );
1074+
1075+ siggen = kzalloc (sizeof (* siggen ), GFP_KERNEL );
1076+ if (!siggen )
1077+ return - ENOMEM ;
1078+
1079+ swidget -> private = siggen ;
1080+
1081+ ret = sof_ipc4_get_audio_fmt (scomp , swidget , & siggen -> available_fmt , & siggen -> data .base_config );
1082+ if (ret )
1083+ goto err ;
1084+
1085+ spipe -> core_mask |= BIT (swidget -> core );
1086+
1087+ ret = sof_ipc4_widget_setup_msg (swidget , & siggen -> msg );
1088+ if (ret )
1089+ goto err ;
1090+
1091+ return 0 ;
1092+ err :
1093+ sof_ipc4_free_audio_fmt (& siggen -> available_fmt );
1094+ kfree (siggen );
1095+ swidget -> private = NULL ;
1096+ return ret ;
1097+ }
1098+
1099+ static void sof_ipc4_widget_free_comp_siggen (struct snd_sof_widget * swidget )
1100+ {
1101+ struct sof_ipc4_siggen * siggen = swidget -> private ;
1102+
1103+ if (!siggen )
1104+ return ;
1105+
1106+ sof_ipc4_free_audio_fmt (& siggen -> available_fmt );
1107+ kfree (swidget -> private );
1108+ swidget -> private = NULL ;
1109+ }
1110+
10661111static int sof_ipc4_widget_setup_comp_src (struct snd_sof_widget * swidget )
10671112{
10681113 struct snd_soc_component * scomp = swidget -> scomp ;
@@ -2479,6 +2524,33 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
24792524 return 0 ;
24802525}
24812526
2527+ static int sof_ipc4_prepare_siggen_module (struct snd_sof_widget * swidget ,
2528+ struct snd_pcm_hw_params * fe_params ,
2529+ struct snd_sof_platform_stream_params * platform_params ,
2530+ struct snd_pcm_hw_params * pipeline_params , int dir )
2531+ {
2532+ struct snd_soc_component * scomp = swidget -> scomp ;
2533+ struct snd_sof_dev * sdev = snd_soc_component_get_drvdata (scomp );
2534+ struct sof_ipc4_siggen * siggen = swidget -> private ;
2535+ struct sof_ipc4_available_audio_format * available_fmt = & siggen -> available_fmt ;
2536+ struct sof_ipc4_audio_format * out_fmt ;
2537+
2538+ /* use the first available output format to set the base config audio format */
2539+ if (available_fmt -> num_output_formats != 1 ) {
2540+ dev_err (sdev -> dev , "siggen should only have one available output format" );
2541+ return - EINVAL ;
2542+ }
2543+ out_fmt = & available_fmt -> output_pin_fmts [0 ].audio_fmt ;
2544+ /* copy input format */
2545+ memcpy (& siggen -> data .base_config .audio_fmt , out_fmt , sizeof (struct sof_ipc4_audio_format ));
2546+ siggen -> data .base_config .obs = available_fmt -> output_pin_fmts [0 ].buffer_size ;
2547+
2548+ /* update pipeline memory usage */
2549+ sof_ipc4_update_resource_usage (sdev , swidget , & siggen -> data .base_config , dir );
2550+
2551+ return 0 ;
2552+ }
2553+
24822554static int sof_ipc4_prepare_gain_module (struct snd_sof_widget * swidget ,
24832555 struct snd_pcm_hw_params * fe_params ,
24842556 struct snd_sof_platform_stream_params * platform_params ,
@@ -3162,6 +3234,16 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
31623234 msg = & asrc -> msg ;
31633235 break ;
31643236 }
3237+ case snd_soc_dapm_siggen :
3238+ {
3239+ struct sof_ipc4_siggen * siggen = swidget -> private ;
3240+
3241+ ipc_size = sizeof (siggen -> data );
3242+ ipc_data = & siggen -> data ;
3243+
3244+ msg = & siggen -> msg ;
3245+ break ;
3246+ }
31653247 case snd_soc_dapm_effect :
31663248 {
31673249 struct sof_ipc4_process * process = swidget -> private ;
@@ -3852,6 +3934,13 @@ static enum sof_tokens mixer_token_list[] = {
38523934 SOF_COMP_EXT_TOKENS ,
38533935};
38543936
3937+ static enum sof_tokens siggen_token_list [] = {
3938+ SOF_COMP_TOKENS ,
3939+ SOF_AUDIO_FMT_NUM_TOKENS ,
3940+ SOF_OUT_AUDIO_FORMAT_TOKENS ,
3941+ SOF_COMP_EXT_TOKENS ,
3942+ };
3943+
38553944static enum sof_tokens src_token_list [] = {
38563945 SOF_COMP_TOKENS ,
38573946 SOF_SRC_TOKENS ,
@@ -3924,6 +4013,10 @@ static const struct sof_ipc_tplg_widget_ops tplg_ipc4_widget_ops[SND_SOC_DAPM_TY
39244013 process_token_list , ARRAY_SIZE (process_token_list ),
39254014 NULL , sof_ipc4_prepare_process_module ,
39264015 NULL },
4016+ [snd_soc_dapm_siggen ] = {sof_ipc4_widget_setup_comp_siggen ,
4017+ sof_ipc4_widget_free_comp_siggen ,
4018+ siggen_token_list , ARRAY_SIZE (siggen_token_list ), NULL ,
4019+ sof_ipc4_prepare_siggen_module , NULL },
39274020};
39284021
39294022const struct sof_ipc_tplg_ops ipc4_tplg_ops = {
0 commit comments