Skip to content

Commit

Permalink
Merge branch 'thesofproject:main' into mtl-Es8326+HDMI-In
Browse files Browse the repository at this point in the history
  • Loading branch information
CBala21 committed Dec 5, 2023
2 parents a361530 + cff6a6b commit 12bcb53
Show file tree
Hide file tree
Showing 24 changed files with 277 additions and 138 deletions.
2 changes: 2 additions & 0 deletions src/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ if(CONFIG_IPC_MAJOR_3)
set(eq-fir_sources eq_fir/eq_fir_ipc3.c)
set(tdfb_sources tdfb/tdfb_ipc3.c)
set(tdfb_sources multiband_drc/multiband_drc_ipc3.c)
set(dcblock_sources dcblock/dcblock_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc4.c)
set(src_sources src/src.c src/src_ipc4.c src/src_generic.c)
set(eq-iir_sources eq_iir/eq_iir_ipc4.c eq_iir/eq_iir_generic.c)
set(eq-fir_sources eq_fir/eq_fir_ipc4.c)
set(tdfb_sources tdfb/tdfb_ipc4.c)
set(tdfb_sources multiband_drc/multiband_drc_ipc4.c)
set(dcblock_sources dcblock/dcblock_ipc4.c)
endif()
set(mixer_sources ${mixer_src})
set(asrc_sources asrc/asrc.c asrc/asrc_farrow.c asrc/asrc_farrow_generic.c)
Expand Down
2 changes: 1 addition & 1 deletion src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static int copier_set_configuration(struct processing_module *mod,
case IPC4_COPIER_MODULE_CFG_PARAM_SET_SINK_FORMAT:
return copier_set_sink_fmt(dev, fragment, fragment_size);
case IPC4_COPIER_MODULE_CFG_ATTENUATION:
return set_attenuation(dev, fragment_size, fragment);
return set_attenuation(dev, fragment_size, (const char *)fragment);
default:
return -EINVAL;
}
Expand Down
16 changes: 15 additions & 1 deletion src/audio/copier/dai_copier.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,25 @@ int dai_common_ts_get(struct dai_data *dd, struct comp_dev *dev, struct timestam
int dai_common_get_hw_params(struct dai_data *dd, struct comp_dev *dev,
struct sof_ipc_stream_params *params, int dir);

#if CONFIG_LIBRARY
static inline int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,
struct comp_buffer *multi_endpoint_buffer,
int num_endpoints)
{
return 0;
}

static inline int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data)
{
return 0;
}
#else
int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,
struct comp_buffer *multi_endpoint_buffer,
int num_endpoints);

int dai_zephyr_unbind(struct dai_data *dd, struct comp_dev *dev, void *data);
#endif


struct ipc4_copier_module_cfg;
struct copier_data;
Expand Down
19 changes: 14 additions & 5 deletions src/audio/copier/ipcgtw_copier.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,22 @@ struct ipc4_ipc_gateway_cmd_data_reply {
int copier_ipcgtw_process(const struct ipc4_ipcgtw_cmd *cmd,
void *reply_payload, uint32_t *reply_payload_size);

int copier_ipcgtw_params(struct ipcgtw_data *ipcgtw_data, struct comp_dev *dev,
struct sof_ipc_stream_params *params);

void copier_ipcgtw_reset(struct comp_dev *dev);

int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
const struct ipc4_copier_module_cfg *copier, struct pipeline *pipeline);

#if CONFIG_IPC4_GATEWAY
void copier_ipcgtw_free(struct copier_data *cd);
int copier_ipcgtw_params(struct ipcgtw_data *ipcgtw_data, struct comp_dev *dev,
struct sof_ipc_stream_params *params);

void copier_ipcgtw_reset(struct comp_dev *dev);
#else
static inline void copier_ipcgtw_free(struct copier_data *cd) {}
static inline void copier_ipcgtw_reset(struct comp_dev *dev) {}
static inline int copier_ipcgtw_params(struct ipcgtw_data *ipcgtw_data, struct comp_dev *dev,
struct sof_ipc_stream_params *params)
{
return 0;
}
#endif
#endif /* __SOF_IPCGTW_COPIER_H__ */
6 changes: 6 additions & 0 deletions src/audio/dcblock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ add_local_sources(sof dcblock.c)
add_local_sources(sof dcblock_generic.c)
add_local_sources(sof dcblock_hifi3.c)
add_local_sources(sof dcblock_hifi4.c)

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof dcblock_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof dcblock_ipc4.c)
endif()
53 changes: 4 additions & 49 deletions src/audio/dcblock/dcblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <sof/audio/data_blob.h>
#include <sof/audio/format.h>
#include <sof/audio/pipeline.h>
#include <sof/audio/dcblock/dcblock.h>
#include <sof/audio/ipc-config.h>
#include <sof/common.h>
#include <rtos/panic.h>
Expand All @@ -32,6 +31,8 @@
#include <stddef.h>
#include <stdint.h>

#include "dcblock.h"

LOG_MODULE_REGISTER(dcblock, CONFIG_SOF_LOG_LEVEL);

/* b809efaf-5681-42b1-9ed6-04bb012dd384 */
Expand Down Expand Up @@ -143,19 +144,7 @@ static int dcblock_get_config(struct processing_module *mod,
uint32_t config_id, uint32_t *data_offset_size,
uint8_t *fragment, size_t fragment_size)
{
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_get_config()");

#if CONFIG_IPC_MAJOR_3
if (cdata->cmd != SOF_CTRL_CMD_BINARY) {
comp_err(mod->dev, "dcblock_get_config(), invalid command");
return -EINVAL;
}
#endif

return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size);
return dcblock_get_ipc_config(mod, fragment, fragment_size);
}

/**
Expand All @@ -166,20 +155,8 @@ static int dcblock_set_config(struct processing_module *mod, uint32_t config_id,
const uint8_t *fragment, size_t fragment_size, uint8_t *response,
size_t response_size)
{
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_set_config()");

#if CONFIG_IPC_MAJOR_3
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;

if (cdata->cmd != SOF_CTRL_CMD_BINARY) {
comp_err(mod->dev, "dcblock_set_config(), invalid command %i", cdata->cmd);
return -EINVAL;
}
#endif
return comp_data_blob_set(cd->model_handler, pos, data_offset_size, fragment,
fragment_size);
return dcblock_set_ipc_config(mod, pos, data_offset_size, fragment, fragment_size);
}

/**
Expand Down Expand Up @@ -217,26 +194,6 @@ static inline void dcblock_set_frame_alignment(struct audio_stream *source,
audio_stream_init_alignment_constants(byte_align, frame_align_req, sink);
}

#if CONFIG_IPC_MAJOR_4
static void dcblock_params(struct processing_module *mod)
{
struct sof_ipc_stream_params *params = mod->stream_params;
struct comp_buffer *sinkb, *sourceb;
struct comp_dev *dev = mod->dev;

comp_dbg(dev, "dcblock_params()");

ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
ipc4_update_buffer_format(sinkb, &mod->priv.cfg.base_cfg.audio_fmt);

sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
ipc4_update_buffer_format(sourceb, &mod->priv.cfg.base_cfg.audio_fmt);
}
#endif /* CONFIG_IPC_MAJOR_4 */

/**
* \brief Prepares DC Blocking Filter component for processing.
* \param[in,out] dev DC Blocking Filter base component device.
Expand All @@ -252,9 +209,7 @@ static int dcblock_prepare(struct processing_module *mod,

comp_info(dev, "dcblock_prepare()");

#if CONFIG_IPC_MAJOR_4
dcblock_params(mod);
#endif

/* DC Filter component will only ever have one source and sink buffer */
sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <sof/platform.h>
#include <ipc/stream.h>
#include <sof/compiler_info.h>
#include <module/module/base.h>
#include <module/module/interface.h>

/* __XCC__ is both for xt_xcc and xt_clang */
#if defined(__XCC__)
Expand Down Expand Up @@ -93,4 +95,11 @@ static inline dcblock_func dcblock_find_func(enum sof_ipc_frame src_fmt)
return NULL;
}

int dcblock_get_ipc_config(struct processing_module *mod,
uint8_t *fragment, size_t fragment_size);
int dcblock_set_ipc_config(struct processing_module *mod,
enum module_cfg_fragment_position pos, uint32_t data_offset_size,
const uint8_t *fragment, size_t fragment_size);
void dcblock_params(struct processing_module *mod);

#endif /* __SOF_AUDIO_DCBLOCK_DCBLOCK_H__ */
3 changes: 2 additions & 1 deletion src/audio/dcblock/dcblock_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <stdint.h>
#include <sof/audio/component.h>
#include <sof/audio/format.h>
#include <sof/audio/dcblock/dcblock.h>

#include "dcblock.h"

#ifdef DCBLOCK_GENERIC

Expand Down
3 changes: 2 additions & 1 deletion src/audio/dcblock/dcblock_hifi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <stdint.h>
#include <sof/audio/component.h>
#include <sof/audio/format.h>
#include <sof/audio/dcblock/dcblock.h>

#include "dcblock.h"

#ifdef DCBLOCK_HIFI3

Expand Down
3 changes: 2 additions & 1 deletion src/audio/dcblock/dcblock_hifi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include <stdint.h>
#include <sof/audio/component.h>
#include <sof/audio/format.h>
#include <sof/audio/dcblock/dcblock.h>

#include "dcblock.h"

#ifdef DCBLOCK_HIFI4

Expand Down
66 changes: 66 additions & 0 deletions src/audio/dcblock/dcblock_ipc3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2020 Google LLC. All rights reserved.
//
// Author: Sebastiano Carlucci <[email protected]>

#include <sof/audio/module_adapter/module/generic.h>
#include <sof/trace/trace.h>
#include <module/module/base.h>
#include <ipc/control.h>
#include <sof/audio/component.h>
#include <sof/audio/data_blob.h>
#include <module/module/interface.h>
#include <ipc/stream.h>
#include <sof/audio/buffer.h>
#include <errno.h>

#include "dcblock.h"

LOG_MODULE_DECLARE(dcblock, CONFIG_SOF_LOG_LEVEL);

/**
* \brief Handles incoming get commands for DC Blocking Filter component.
*/
int dcblock_get_ipc_config(struct processing_module *mod,
uint8_t *fragment, size_t fragment_size)
{
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_get_config()");

if (cdata->cmd != SOF_CTRL_CMD_BINARY) {
comp_err(mod->dev, "dcblock_get_config(), invalid command");
return -EINVAL;
}

return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size);
}

/**
* \brief Handles incoming set commands for DC Blocking Filter component.
*/
int dcblock_set_ipc_config(struct processing_module *mod,
enum module_cfg_fragment_position pos, uint32_t data_offset_size,
const uint8_t *fragment, size_t fragment_size)
{
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_set_config()");

struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;

if (cdata->cmd != SOF_CTRL_CMD_BINARY) {
comp_err(mod->dev, "dcblock_set_config(), invalid command %i", cdata->cmd);
return -EINVAL;
}

return comp_data_blob_set(cd->model_handler, pos, data_offset_size, fragment,
fragment_size);
}

void dcblock_params(struct processing_module *mod)
{
}

70 changes: 70 additions & 0 deletions src/audio/dcblock/dcblock_ipc4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2020 Google LLC. All rights reserved.
//
// Author: Sebastiano Carlucci <[email protected]>

#include <sof/audio/module_adapter/module/generic.h>
#include <sof/trace/trace.h>
#include <module/module/base.h>
#include <ipc/control.h>
#include <sof/audio/component.h>
#include <sof/audio/data_blob.h>
#include <module/module/interface.h>
#include <ipc/stream.h>
#include <sof/audio/buffer.h>
#include <module/ipc4/base-config.h>
#include <sof/list.h>
#include <errno.h>

#include "dcblock.h"

LOG_MODULE_DECLARE(dcblock, CONFIG_SOF_LOG_LEVEL);

/**
* \brief Handles incoming get commands for DC Blocking Filter component.
*/
int dcblock_get_ipc_config(struct processing_module *mod,
uint8_t *fragment, size_t fragment_size)
{
struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment;
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_get_ipc_config()");

return comp_data_blob_get_cmd(cd->model_handler, cdata, fragment_size);
}

/**
* \brief Handles incoming set commands for DC Blocking Filter component.
*/
int dcblock_set_ipc_config(struct processing_module *mod,
enum module_cfg_fragment_position pos, uint32_t data_offset_size,
const uint8_t *fragment, size_t fragment_size)
{
struct comp_data *cd = module_get_private_data(mod);

comp_info(mod->dev, "dcblock_set_ipc_config()");

return comp_data_blob_set(cd->model_handler, pos, data_offset_size, fragment,
fragment_size);
}

void dcblock_params(struct processing_module *mod)
{
struct sof_ipc_stream_params *params = mod->stream_params;
struct comp_buffer *sinkb, *sourceb;
struct comp_dev *dev = mod->dev;

comp_dbg(dev, "dcblock_params()");

ipc4_base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params);
component_set_nearest_period_frames(dev, params->rate);

sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
ipc4_update_buffer_format(sinkb, &mod->priv.cfg.base_cfg.audio_fmt);

sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
ipc4_update_buffer_format(sourceb, &mod->priv.cfg.base_cfg.audio_fmt);
}

2 changes: 1 addition & 1 deletion src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ struct comp_ops {
int (*dai_config)(struct dai_data *dd, struct comp_dev *dev,
struct ipc_config_dai *dai_config, const void *dai_spec_config);

#if CONFIG_IPC_MAJOR_3
#if CONFIG_IPC_MAJOR_3 || CONFIG_LIBRARY
/**
* Used to pass standard and bespoke commands (with optional data).
* @param dev Component device.
Expand Down
Loading

0 comments on commit 12bcb53

Please sign in to comment.