Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipc4: copier: unused code cleanup #9701

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ static uint64_t copier_get_processed_data(struct comp_dev *dev, uint32_t stream_
ret = cd->dd[0]->total_data_processed;
break;
default:
ret = comp_get_total_data_processed(cd->endpoint[stream_no],
0, input);
comp_err(dev, "Unexpected gateway type encountered: %d",
dev->ipc_config.type);
break;
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/audio/copier/copier.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,9 @@ struct copier_data {
struct ipc4_copier_module_cfg config;
void *gtw_cfg;
enum ipc4_gateway_type gtw_type;
struct comp_dev *endpoint[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];
struct comp_buffer *endpoint_buffer[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];
uint32_t endpoint_num;

/* buffer to mux/demux data from/to multiple endpoint buffers for ALH multi-gateway case */
/* buffer to mux/demux data from/to multiple endpoints for ALH multi-gateway case */
struct comp_buffer *multi_endpoint_buffer;

bool bsource_buffer;
Expand Down Expand Up @@ -284,10 +282,9 @@ pcm_converter_func get_converter_func(const struct ipc4_audio_format *in_fmt,
uint32_t chmap);

struct comp_ipc_config;
int create_endpoint_buffer(struct comp_dev *dev,
struct copier_data *cd,
const struct ipc4_copier_module_cfg *copier_cfg,
bool create_multi_endpoint_buffer);
int create_multi_endpoint_buffer(struct comp_dev *dev,
struct copier_data *cd,
const struct ipc4_copier_module_cfg *copier_cfg);

enum sof_ipc_stream_direction
get_gateway_direction(enum ipc4_connector_node_id_type node_id_type);
Expand Down
2 changes: 1 addition & 1 deletion src/audio/copier/copier_dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,

/* create multi_endpoint_buffer for ALH multi-gateway case */
if (dai_count > 1) {
ret = create_endpoint_buffer(dev, cd, copier, true);
ret = create_multi_endpoint_buffer(dev, cd, copier);
if (ret < 0)
return ret;
}
Expand Down
12 changes: 4 additions & 8 deletions src/audio/copier/copier_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,9 @@ void copier_update_params(struct copier_data *cd, struct comp_dev *dev,
}
}

int create_endpoint_buffer(struct comp_dev *dev,
struct copier_data *cd,
const struct ipc4_copier_module_cfg *copier_cfg,
bool create_multi_endpoint_buffer)
int create_multi_endpoint_buffer(struct comp_dev *dev,
struct copier_data *cd,
const struct ipc4_copier_module_cfg *copier_cfg)
{
struct comp_ipc_config *config = &dev->ipc_config;
enum sof_ipc_frame in_frame_fmt, out_frame_fmt;
Expand Down Expand Up @@ -438,10 +437,7 @@ int create_endpoint_buffer(struct comp_dev *dev,

audio_buffer_set_hw_params_configured(&buffer->audio_buffer);

if (create_multi_endpoint_buffer)
cd->multi_endpoint_buffer = buffer;
else
cd->endpoint_buffer[cd->endpoint_num] = buffer;
cd->multi_endpoint_buffer = buffer;

return 0;
}
Expand Down
28 changes: 5 additions & 23 deletions src/audio/copier/copier_ipcgtw.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,31 +223,22 @@ int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,

cd->ipc_gtw = true;

/* create_endpoint_buffer() uses this value to choose between input and
* output formats in copier config to setup buffer. For this purpose
* IPC gateway should be handled similarly as host gateway.
*/
/* The IPC gateway is treated as a host gateway */
config->type = SOF_COMP_HOST;
cd->gtw_type = ipc4_gtw_host;

ret = create_endpoint_buffer(dev, cd, copier, false);
if (ret < 0)
return ret;

ipcgtw_data = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*ipcgtw_data));
if (!ipcgtw_data) {
ret = -ENOMEM;
goto e_buf;
}
if (!ipcgtw_data)
return -ENOMEM;
serhiy-katsyuba-intel marked this conversation as resolved.
Show resolved Hide resolved

ipcgtw_data->node_id = gtw_cfg->node_id;
ipcgtw_data->dev = dev;

blob = (const struct ipc4_ipc_gateway_config_blob *)
((const struct ipc4_gateway_config_data *)gtw_cfg->config_data)->config_blob;

/* Endpoint buffer is created in copier with size specified in copier config. That buffer
* will be resized to size specified in IPC gateway blob later in ipcgtw_params().
/* The buffer connected to the IPC gateway will be resized later in ipcgtw_params()
* to the size specified in the IPC gateway blob.
*/
comp_dbg(dev, "ipcgtw_create(): buffer_size: %u", blob->buffer_size);
ipcgtw_data->buf_size = blob->buffer_size;
Expand All @@ -264,15 +255,9 @@ int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,
}

if (cd->direction == SOF_IPC_STREAM_PLAYBACK) {
comp_buffer_connect(dev, config->core,
cd->endpoint_buffer[cd->endpoint_num],
PPL_CONN_DIR_COMP_TO_BUFFER);
cd->bsource_buffer = false;
pipeline->source_comp = dev;
} else {
comp_buffer_connect(dev, config->core,
cd->endpoint_buffer[cd->endpoint_num],
PPL_CONN_DIR_BUFFER_TO_COMP);
cd->bsource_buffer = true;
pipeline->sink_comp = dev;
}
Expand All @@ -285,14 +270,11 @@ int copier_ipcgtw_create(struct comp_dev *dev, struct copier_data *cd,

e_ipcgtw:
rfree(ipcgtw_data);
e_buf:
buffer_free(cd->endpoint_buffer[cd->endpoint_num]);
return ret;
}

void copier_ipcgtw_free(struct copier_data *cd)
{
list_item_del(&cd->ipcgtw_data->item);
rfree(cd->ipcgtw_data);
buffer_free(cd->endpoint_buffer[0]);
}
Loading