Skip to content

Commit a392f67

Browse files
committed
template: rename template_comp to template
Make the template simpler by removing the "_comp" from filenames, API calls, Kconfig, CMakefile and macros. This simplifies usage as there was a mix of template and template_comp and makes it easier to use as a starting point for new modules. Signed-off-by: Liam Girdwood <liam.r.girdwood@intel.com>
1 parent 609a574 commit a392f67

File tree

19 files changed

+145
-145
lines changed

19 files changed

+145
-145
lines changed

src/audio/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
8383
if(CONFIG_COMP_TDFB)
8484
add_subdirectory(tdfb)
8585
endif()
86-
if(CONFIG_COMP_TEMPLATE_COMP)
87-
add_subdirectory(template_comp)
86+
if(CONFIG_COMP_TEMPLATE)
87+
add_subdirectory(template)
8888
endif()
8989
if(CONFIG_COMP_TENSORFLOW)
9090
add_subdirectory(tensorflow)

src/audio/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ rsource "selector/Kconfig"
151151
rsource "smart_amp/Kconfig"
152152
rsource "src/Kconfig"
153153
rsource "tdfb/Kconfig"
154-
rsource "template_comp/Kconfig"
154+
rsource "template/Kconfig"
155155
rsource "tensorflow/Kconfig"
156156
rsource "up_down_mixer/Kconfig"
157157
rsource "volume/Kconfig"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22

3-
if(CONFIG_COMP_TEMPLATE_COMP STREQUAL "m")
4-
add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_comp_llext)
5-
add_dependencies(app template_comp)
3+
if(CONFIG_COMP_TEMPLATE STREQUAL "m")
4+
add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_llext)
5+
add_dependencies(app template)
66
else()
77
add_local_sources(sof template.c)
88
add_local_sources(sof template-generic.c)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# SPDX-License-Identifier: BSD-3-Clause
22

3-
config COMP_TEMPLATE_COMP
4-
tristate "Template_comp example component"
3+
config COMP_TEMPLATE
4+
tristate "Template example component"
55
default y
66
help
7-
Select for template_comp component. Reason for existence
7+
Select for template component. Reason for existence
88
is to provide a minimal component example and use as
99
placeholder in processing pipelines. As example processing
1010
it swaps or reverses the channels when the switch control
File renamed without changes.
File renamed without changes.

src/audio/template_comp/template-generic.c renamed to src/audio/template/template-generic.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#if CONFIG_FORMAT_S16LE
1414
/**
15-
* template_comp_s16() - Process S16_LE format.
15+
* template_s16() - Process S16_LE format.
1616
* @mod: Pointer to module data.
1717
* @source: Source for PCM samples data.
1818
* @sink: Sink for PCM samples data.
@@ -24,12 +24,12 @@
2424
*
2525
* Return: Value zero for success, otherwise an error code.
2626
*/
27-
static int template_comp_s16(const struct processing_module *mod,
28-
struct sof_source *source,
29-
struct sof_sink *sink,
30-
uint32_t frames)
27+
static int template_s16(const struct processing_module *mod,
28+
struct sof_source *source,
29+
struct sof_sink *sink,
30+
uint32_t frames)
3131
{
32-
struct template_comp_comp_data *cd = module_get_private_data(mod);
32+
struct template_comp_data *cd = module_get_private_data(mod);
3333
int16_t const *x, *x_start, *x_end;
3434
int16_t *y, *y_start, *y_end;
3535
int x_size, y_size;
@@ -98,7 +98,7 @@ static int template_comp_s16(const struct processing_module *mod,
9898

9999
#if CONFIG_FORMAT_S32LE || CONFIG_FORMAT_S24LE
100100
/**
101-
* template_comp_s32() - Process S32_LE or S24_4LE format.
101+
* template_s32() - Process S32_LE or S24_4LE format.
102102
* @mod: Pointer to module data.
103103
* @source: Source for PCM samples data.
104104
* @sink: Sink for PCM samples data.
@@ -111,12 +111,12 @@ static int template_comp_s16(const struct processing_module *mod,
111111
*
112112
* Return: Value zero for success, otherwise an error code.
113113
*/
114-
static int template_comp_s32(const struct processing_module *mod,
115-
struct sof_source *source,
116-
struct sof_sink *sink,
117-
uint32_t frames)
114+
static int template_s32(const struct processing_module *mod,
115+
struct sof_source *source,
116+
struct sof_sink *sink,
117+
uint32_t frames)
118118
{
119-
struct template_comp_comp_data *cd = module_get_private_data(mod);
119+
struct template_comp_data *cd = module_get_private_data(mod);
120120
int32_t const *x, *x_start, *x_end;
121121
int32_t *y, *y_start, *y_end;
122122
int x_size, y_size;
@@ -186,35 +186,35 @@ static int template_comp_s32(const struct processing_module *mod,
186186
/* This struct array defines the used processing functions for
187187
* the PCM formats
188188
*/
189-
const struct template_comp_proc_fnmap template_comp_proc_fnmap[] = {
189+
const struct template_proc_fnmap template_proc_fnmap[] = {
190190
#if CONFIG_FORMAT_S16LE
191-
{ SOF_IPC_FRAME_S16_LE, template_comp_s16 },
191+
{ SOF_IPC_FRAME_S16_LE, template_s16 },
192192
#endif
193193
#if CONFIG_FORMAT_S24LE
194-
{ SOF_IPC_FRAME_S24_4LE, template_comp_s32 },
194+
{ SOF_IPC_FRAME_S24_4LE, template_s32 },
195195
#endif
196196
#if CONFIG_FORMAT_S32LE
197-
{ SOF_IPC_FRAME_S32_LE, template_comp_s32 },
197+
{ SOF_IPC_FRAME_S32_LE, template_s32 },
198198
#endif
199199
};
200200

201201
/**
202-
* template_comp_find_proc_func() - Find suitable processing function.
202+
* template_find_proc_func() - Find suitable processing function.
203203
* @src_fmt: Enum value for PCM format.
204204
*
205205
* This function finds the suitable processing function to use for
206206
* the used PCM format. If not found, return NULL.
207207
*
208208
* Return: Pointer to processing function for the requested PCM format.
209209
*/
210-
template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt)
210+
template_func template_find_proc_func(enum sof_ipc_frame src_fmt)
211211
{
212212
int i;
213213

214214
/* Find suitable processing function from map */
215-
for (i = 0; i < ARRAY_SIZE(template_comp_proc_fnmap); i++)
216-
if (src_fmt == template_comp_proc_fnmap[i].frame_fmt)
217-
return template_comp_proc_fnmap[i].template_comp_proc_func;
215+
for (i = 0; i < ARRAY_SIZE(template_proc_fnmap); i++)
216+
if (src_fmt == template_proc_fnmap[i].frame_fmt)
217+
return template_proc_fnmap[i].template_proc_func;
218218

219219
return NULL;
220220
}
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
#include <sof/audio/component.h>
77
#include "template.h"
88

9-
LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL);
9+
LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL);
1010

1111
/* This function handles the real-time controls. The ALSA controls have the
1212
* param_id set to indicate the control type. The control ID, from topology,
1313
* is used to separate the controls instances of same type. In control payload
1414
* the num_elems defines to how many channels the control is applied to.
1515
*/
16-
__cold int template_comp_set_config(struct processing_module *mod, uint32_t param_id,
17-
enum module_cfg_fragment_position pos,
18-
uint32_t data_offset_size, const uint8_t *fragment,
19-
size_t fragment_size, uint8_t *response,
20-
size_t response_size)
16+
__cold int template_set_config(struct processing_module *mod, uint32_t param_id,
17+
enum module_cfg_fragment_position pos,
18+
uint32_t data_offset_size, const uint8_t *fragment,
19+
size_t fragment_size, uint8_t *response,
20+
size_t response_size)
2121
{
2222
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
23-
struct template_comp_comp_data *cd = module_get_private_data(mod);
23+
struct template_comp_data *cd = module_get_private_data(mod);
2424
struct comp_dev *dev = mod->dev;
2525

2626
assert_can_be_cold();
2727

28-
comp_dbg(dev, "template_comp_set_config()");
28+
comp_dbg(dev, "template_set_config()");
2929

3030
switch (cdata->cmd) {
3131
case SOF_CTRL_CMD_SWITCH:
@@ -55,17 +55,17 @@ __cold int template_comp_set_config(struct processing_module *mod, uint32_t para
5555
return -EINVAL;
5656
}
5757

58-
__cold int template_comp_get_config(struct processing_module *mod,
59-
uint32_t config_id, uint32_t *data_offset_size,
60-
uint8_t *fragment, size_t fragment_size)
58+
__cold int template_get_config(struct processing_module *mod,
59+
uint32_t config_id, uint32_t *data_offset_size,
60+
uint8_t *fragment, size_t fragment_size)
6161
{
6262
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
63-
struct template_comp_comp_data *cd = module_get_private_data(mod);
63+
struct template_comp_data *cd = module_get_private_data(mod);
6464
struct comp_dev *dev = mod->dev;
6565

6666
assert_can_be_cold();
6767

68-
comp_info(dev, "template_comp_get_config()");
68+
comp_info(dev, "template_get_config()");
6969

7070
switch (cdata->cmd) {
7171
case SOF_CTRL_CMD_SWITCH:
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
#include <sof/audio/component.h>
77
#include "template.h"
88

9-
LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL);
9+
LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL);
1010

1111
/* IPC4 controls handler */
12-
__cold int template_comp_set_config(struct processing_module *mod,
13-
uint32_t param_id,
14-
enum module_cfg_fragment_position pos,
15-
uint32_t data_offset_size,
16-
const uint8_t *fragment,
17-
size_t fragment_size,
18-
uint8_t *response,
19-
size_t response_size)
12+
__cold int template_set_config(struct processing_module *mod,
13+
uint32_t param_id,
14+
enum module_cfg_fragment_position pos,
15+
uint32_t data_offset_size,
16+
const uint8_t *fragment,
17+
size_t fragment_size,
18+
uint8_t *response,
19+
size_t response_size)
2020
{
2121
struct sof_ipc4_control_msg_payload *ctl = (struct sof_ipc4_control_msg_payload *)fragment;
22-
struct template_comp_comp_data *cd = module_get_private_data(mod);
22+
struct template_comp_data *cd = module_get_private_data(mod);
2323
struct comp_dev *dev = mod->dev;
2424

2525
assert_can_be_cold();
@@ -51,9 +51,9 @@ __cold int template_comp_set_config(struct processing_module *mod,
5151
}
5252

5353
/* Not used in IPC4 systems, if IPC4 only component, omit .get_configuration set */
54-
__cold int template_comp_get_config(struct processing_module *mod,
55-
uint32_t config_id, uint32_t *data_offset_size,
56-
uint8_t *fragment, size_t fragment_size)
54+
__cold int template_get_config(struct processing_module *mod,
55+
uint32_t config_id, uint32_t *data_offset_size,
56+
uint8_t *fragment, size_t fragment_size)
5757
{
5858
assert_can_be_cold();
5959
return 0;

0 commit comments

Comments
 (0)