From 81a2789d2ea7f52b8a732e7f65f81d1945a6aebc Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Sat, 9 May 2020 11:12:37 +0800 Subject: [PATCH 1/4] ipc: topology: add a generic process component type Add SOF_COMP_PROCESS as generic process component type, which can be used for all process components (e.g. demux, eq, detect_test, smart_amp, ...) in the future. This and the subsequent commits are made to support generic process component as described in: https://github.com/orgs/thesofproject/teams/sof-developers/discussions/32 The corresponding Linux PR is: https://github.com/thesofproject/linux/pull/2129. After this series is applied, all existed process/effect components including mux/demux/eq/kpb/detect_test/selector/smart_amp/dcblock will be switched to this generic process type automatically. The ABI minor will be bumped to 17 to reflect this change. Signed-off-by: Keyon Jie --- src/include/ipc/topology.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/include/ipc/topology.h b/src/include/ipc/topology.h index 58c9074ab0ab..91b754b5c7e2 100644 --- a/src/include/ipc/topology.h +++ b/src/include/ipc/topology.h @@ -47,6 +47,12 @@ enum sof_comp_type { SOF_COMP_ASRC, /**< Asynchronous sample rate converter */ SOF_COMP_DCBLOCK, SOF_COMP_SMART_AMP, /**< smart amplifier component */ + + /* + * No more _COMP_ types to be added. + * Use SOF_COMP_PROCESS from now on. + */ + SOF_COMP_PROCESS = 1000, /**< generic process component */ /* keep FILEREAD/FILEWRITE as the last ones */ SOF_COMP_FILEREAD = 10000, /**< host test based file IO */ SOF_COMP_FILEWRITE = 10001, /**< host test based file IO */ From 361382e6798311c4d3a3e309a6d7b555cd7e8b82 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Sat, 9 May 2020 10:55:43 +0800 Subject: [PATCH 2/4] ipc:: add subtype to sof_ipc_comp Add subtype member to struct sof_ipc_comp, which will be used as flavour of some generic component type like process. Signed-off-by: Keyon Jie --- src/include/ipc/topology.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/include/ipc/topology.h b/src/include/ipc/topology.h index 91b754b5c7e2..10b50c844c4b 100644 --- a/src/include/ipc/topology.h +++ b/src/include/ipc/topology.h @@ -71,8 +71,7 @@ struct sof_ipc_comp { uint32_t pipeline_id; uint32_t core; - /* reserved for future use */ - uint32_t reserved[1]; + uint32_t subtype; /**< flavour for generic component type */ } __attribute__((packed)); /* From 8a053ab5f6e6b43e035a673f580efb188accf90f Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Sat, 9 May 2020 11:18:00 +0800 Subject: [PATCH 3/4] component: add handle to generic process component In comp_new(), match the component driver with comp->type first, if no driver matched (e.g. for SOF_COMP_PROCESS type), will try to match with subtype (e.g. for demux/detect_test/eq/smart_amp...). With this change applied, if the new generic SOF_COMP_PROCESS type and subtype entry address are passed from the driver, we can get the correct driver for it, all these are verified with demux component. Signed-off-by: Keyon Jie --- src/audio/component.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 51d20021b470..d72e64c6dc06 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -65,9 +65,14 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp) /* find the driver for our new component */ drv = get_drv(comp->type); if (!drv) { - tr_err(&comp_tr, "comp_new(): driver not found, comp->type = %u", - comp->type); - return NULL; + tr_info(&comp_tr, "comp_new(), no type %d, fallback to use subtype", + comp->type); + drv = get_drv(comp->subtype); + if (!drv) { + tr_err(&comp_tr, "comp_new(): driver not found, comp->type = %u", + comp->type); + return NULL; + } } /* validate size of ipc config */ From d46ccc6822d017262d50331861d474612b79ffa7 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 21 May 2020 17:18:32 +0800 Subject: [PATCH 4/4] ABI: bump the ABI minor version to 17 Now, generic process/effect component is implemented, bump the ABI minor version to 17 for that. Signed-off-by: Keyon Jie --- src/include/kernel/abi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/kernel/abi.h b/src/include/kernel/abi.h index 792d253fe397..c7f343f355ef 100644 --- a/src/include/kernel/abi.h +++ b/src/include/kernel/abi.h @@ -29,7 +29,7 @@ /** \brief SOF ABI version major, minor and patch numbers */ #define SOF_ABI_MAJOR 3 -#define SOF_ABI_MINOR 16 +#define SOF_ABI_MINOR 17 #define SOF_ABI_PATCH 0 /** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */