1515#include <sof/ipc/topology.h>
1616#include <rtos/interrupt.h>
1717#include <rtos/timer.h>
18- #include <rtos/alloc.h>
1918#include <rtos/cache.h>
2019#include <rtos/init.h>
2120#include <sof/lib/memory.h>
@@ -82,13 +81,12 @@ static void mic_privacy_event(void *arg, enum notify_id type, void *data)
8281 }
8382}
8483
85- static int mic_privacy_configure (struct comp_dev * dev , struct copier_data * cd )
84+ static int mic_privacy_configure (struct processing_module * mod , struct copier_data * cd )
8685{
8786 struct mic_privacy_data * mic_priv_data ;
8887 int ret ;
8988
90- mic_priv_data = rzalloc (SOF_MEM_FLAG_USER ,
91- sizeof (struct mic_privacy_data ));
89+ mic_priv_data = mod_zalloc (mod , sizeof (struct mic_privacy_data ));
9290 if (!mic_priv_data )
9391 return - ENOMEM ;
9492
@@ -100,19 +98,20 @@ static int mic_privacy_configure(struct comp_dev *dev, struct copier_data *cd)
10098 uint32_t zeroing_wait_time = (mic_privacy_get_dma_zeroing_wait_time () * 1000 ) /
10199 ADSP_RTC_FREQUENCY ;
102100
103- ret = copier_gain_set_params (dev , & mic_priv_data -> mic_priv_gain_params ,
101+ ret = copier_gain_set_params (mod -> dev , & mic_priv_data -> mic_priv_gain_params ,
104102 zeroing_wait_time , SOF_DAI_INTEL_NONE );
105103 if (ret != 0 ) {
106- rfree ( mic_priv_data );
104+ mod_free ( mod , mic_priv_data );
107105 return ret ;
108106 }
109107
110108 cd -> mic_priv = mic_priv_data ;
111109
112110 ret = notifier_register (cd -> mic_priv , NULL , NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE ,
113111 mic_privacy_event , 0 );
112+
114113 if (ret != 0 )
115- rfree ( mic_priv_data );
114+ mod_free ( mod , mic_priv_data );
116115
117116 return ret ;
118117}
@@ -124,7 +123,7 @@ static void mic_privacy_free(struct copier_data *cd)
124123
125124 notifier_unregister (cd -> mic_priv , NULL , NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE );
126125
127- rfree ( cd -> mic_priv );
126+ mod_free ( mod , cd -> mic_priv );
128127}
129128#endif
130129
@@ -141,7 +140,7 @@ __cold static int copier_init(struct processing_module *mod)
141140
142141 assert_can_be_cold ();
143142
144- cd = rzalloc ( SOF_MEM_FLAG_USER , sizeof (* cd ));
143+ cd = mod_zalloc ( mod , sizeof (* cd ));
145144 if (!cd )
146145 return - ENOMEM ;
147146
@@ -163,8 +162,7 @@ __cold static int copier_init(struct processing_module *mod)
163162 */
164163 if (copier -> gtw_cfg .config_length ) {
165164 gtw_cfg_size = copier -> gtw_cfg .config_length << 2 ;
166- gtw_cfg = rmalloc (SOF_MEM_FLAG_USER ,
167- gtw_cfg_size );
165+ gtw_cfg = mod_alloc (mod , gtw_cfg_size );
168166 if (!gtw_cfg ) {
169167 ret = - ENOMEM ;
170168 goto error_cd ;
@@ -191,15 +189,15 @@ __cold static int copier_init(struct processing_module *mod)
191189 switch (node_id .f .dma_type ) {
192190 case ipc4_hda_host_output_class :
193191 case ipc4_hda_host_input_class :
194- ret = copier_host_create (dev , cd , copier , dev -> pipeline );
192+ ret = copier_host_create (mod , copier , dev -> pipeline );
195193 if (ret < 0 ) {
196194 comp_err (dev , "unable to create host" );
197195 goto error ;
198196 }
199197#if CONFIG_INTEL_ADSP_MIC_PRIVACY
200198 if (cd -> direction == SOF_IPC_STREAM_CAPTURE &&
201199 node_id .f .dma_type == ipc4_hda_host_output_class ) {
202- ret = mic_privacy_configure (dev , cd );
200+ ret = mic_privacy_configure (mod , cd );
203201 if (ret < 0 ) {
204202 comp_err (dev , "unable to configure mic privacy" );
205203 goto error ;
@@ -221,7 +219,7 @@ __cold static int copier_init(struct processing_module *mod)
221219 }
222220#if CONFIG_INTEL_ADSP_MIC_PRIVACY
223221 if (cd -> direction == SOF_IPC_STREAM_CAPTURE ) {
224- ret = mic_privacy_configure (dev , cd );
222+ ret = mic_privacy_configure (mod , cd );
225223 if (ret < 0 ) {
226224 comp_err (dev , "unable to configure mic privacy" );
227225 goto error ;
@@ -232,7 +230,7 @@ __cold static int copier_init(struct processing_module *mod)
232230#if CONFIG_IPC4_GATEWAY
233231 case ipc4_ipc_output_class :
234232 case ipc4_ipc_input_class :
235- ret = copier_ipcgtw_create (dev , cd , copier , dev -> pipeline );
233+ ret = copier_ipcgtw_create (mod , copier , dev -> pipeline );
236234 if (ret < 0 ) {
237235 comp_err (dev , "unable to create IPC gateway" );
238236 goto error ;
@@ -257,9 +255,9 @@ __cold static int copier_init(struct processing_module *mod)
257255 dev -> state = COMP_STATE_READY ;
258256 return 0 ;
259257error :
260- rfree ( gtw_cfg );
258+ mod_free ( mod , gtw_cfg );
261259error_cd :
262- rfree ( cd );
260+ mod_free ( mod , cd );
263261 return ret ;
264262}
265263
@@ -277,10 +275,10 @@ __cold static int copier_free(struct processing_module *mod)
277275 switch (dev -> ipc_config .type ) {
278276 case SOF_COMP_HOST :
279277 if (!cd -> ipc_gtw )
280- copier_host_free (cd );
278+ copier_host_free (mod );
281279 else
282280 /* handle gtw case */
283- copier_ipcgtw_free (cd );
281+ copier_ipcgtw_free (mod );
284282 break ;
285283 case SOF_COMP_DAI :
286284 copier_dai_free (cd );
@@ -290,8 +288,8 @@ __cold static int copier_free(struct processing_module *mod)
290288 }
291289
292290 if (cd )
293- rfree ( cd -> gtw_cfg );
294- rfree ( cd );
291+ mod_free ( mod , cd -> gtw_cfg );
292+ mod_free ( mod , cd );
295293
296294 return 0 ;
297295}
0 commit comments