@@ -69,16 +69,26 @@ struct sof_sink;
6969/**
7070 * \struct module_interface
7171 * \brief 3rd party processing module interface
72+ *
73+ * Module operations can be optimized for performance (default - no action) or
74+ * for memory and power efficiency (opt in using __cold). It is recommended that
75+ * module authors review their modules for non time sensitive code and mark it
76+ * using __cold based on the descriptions below. This will ensure modules
77+ * maintain peak performance and peak power/memory efficiency. Similarly cold
78+ * read-only data can be marked with __cold_rodata. In cases where a subset of
79+ * cold data has to be accessed from hot paths, it can be copied to fast memory,
80+ * using the \c fast_get() API and then released using \c fast_put().
7281 */
7382struct module_interface {
7483 /**
7584 * Module specific initialization procedure, called as part of
76- * module_adapter component creation in .new()
85+ * module_adapter component creation in .new(). Usually can be __cold
7786 */
7887 int (* init )(struct processing_module * mod );
88+
7989 /**
8090 * (optional) Module specific prepare procedure, called as part of module_adapter
81- * component preparation in .prepare()
91+ * component preparation in .prepare(). Usually can be __cold
8292 */
8393 int (* prepare )(struct processing_module * mod ,
8494 struct sof_source * * sources , int num_of_sources ,
@@ -97,7 +107,7 @@ struct module_interface {
97107 * at least IBS bytes of data on first source and at least OBS free space on first sink
98108 *
99109 * In case more sophisticated check is needed the method should be implemented in
100- * the module
110+ * the module. Usually shouldn't be __cold
101111 */
102112 bool (* is_ready_to_process )(struct processing_module * mod ,
103113 struct sof_source * * sources , int num_of_sources ,
@@ -121,6 +131,8 @@ struct module_interface {
121131 * process
122132 * - sources are handlers to source API struct source*[]
123133 * - sinks are handlers to sink API struct sink*[]
134+ *
135+ * Usually shouldn't be __cold
124136 */
125137 int (* process )(struct processing_module * mod ,
126138 struct sof_source * * sources , int num_of_sources ,
@@ -134,6 +146,8 @@ struct module_interface {
134146 * - sinks[].data is a pointer to audio_stream structure
135147 *
136148 * It can be used by modules that support 1:1, 1:N, N:1 sources:sinks configuration.
149+ *
150+ * Usually shouldn't be __cold
137151 */
138152 int (* process_audio_stream )(struct processing_module * mod ,
139153 struct input_stream_buffer * input_buffers ,
@@ -147,6 +161,8 @@ struct module_interface {
147161 * - sources[].data is a pointer to raw audio data
148162 * - sinks are output_stream_buffer[]
149163 * - sinks[].data is a pointer to raw audio data
164+ *
165+ * Usually shouldn't be __cold
150166 */
151167 int (* process_raw_data )(struct processing_module * mod ,
152168 struct input_stream_buffer * input_buffers ,
@@ -162,7 +178,7 @@ struct module_interface {
162178 * In this case the ADSP System will perform multiple calls to SetConfiguration() until
163179 * completion of the configuration message sending.
164180 * \note config_id indicates ID of the configuration message only on the first fragment
165- * sending, otherwise it is set to 0.
181+ * sending, otherwise it is set to 0. Usually can be __cold
166182 */
167183 int (* set_configuration )(struct processing_module * mod ,
168184 uint32_t config_id ,
@@ -178,7 +194,7 @@ struct module_interface {
178194 * In this case the ADSP System will perform multiple calls to GetConfiguration() until
179195 * completion of the configuration message retrieval.
180196 * \note config_id indicates ID of the configuration message only on the first fragment
181- * retrieval, otherwise it is set to 0.
197+ * retrieval, otherwise it is set to 0. Usually can be __cold
182198 */
183199 int (* get_configuration )(struct processing_module * mod ,
184200 uint32_t config_id , uint32_t * data_offset_size ,
@@ -198,26 +214,32 @@ struct module_interface {
198214 /**
199215 * (optional) Module specific reset procedure, called as part of module_adapter component
200216 * reset in .reset(). This should reset all parameters to their initial stage
201- * and free all memory allocated during prepare().
217+ * and free all memory allocated during prepare(). Usually can be __cold
202218 */
203219 int (* reset )(struct processing_module * mod );
220+
204221 /**
205222 * (optional) Module specific free procedure, called as part of module_adapter component
206223 * free in .free(). This should free all memory allocated during module initialization.
224+ * Usually can be __cold
207225 */
208226 int (* free )(struct processing_module * mod );
227+
209228 /**
210- * (optional) Module specific bind procedure, called when modules are bound with each other
229+ * (optional) Module specific bind procedure, called when modules are bound with each other.
230+ * Usually can be __cold
211231 */
212232 int (* bind )(struct processing_module * mod , void * data );
233+
213234 /**
214235 * (optional) Module specific unbind procedure, called when modules are disconnected from
215- * one another
236+ * one another. Usually can be __cold
216237 */
217238 int (* unbind )(struct processing_module * mod , void * data );
218239
219240 /**
220- * (optional) Module specific trigger procedure, called when modules are triggered
241+ * (optional) Module specific trigger procedure, called when modules are triggered. Usually
242+ * can be __cold
221243 */
222244 int (* trigger )(struct processing_module * mod , int cmd );
223245
0 commit comments