Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions include/sound/sof/ipc4/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ enum sof_ipc4_pipeline_state {
#define SOF_IPC4_GLB_PIPE_EXT_CORE_ID_MASK GENMASK(23, 20)
#define SOF_IPC4_GLB_PIPE_EXT_CORE_ID(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_CORE_ID_SHIFT)

#define SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET_SHIFT 24
#define SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET_SHIFT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOF_IPC4_GLB_PIPE_EXT_DIRECTION_VALID ?


#define SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SHIFT 25
#define SOF_IPC4_GLB_PIPE_EXT_DIRECTION(x) ((x) << SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SHIFT)

/* pipeline set state ipc msg */
#define SOF_IPC4_GLB_PIPE_STATE_ID_SHIFT 16
#define SOF_IPC4_GLB_PIPE_STATE_ID_MASK GENMASK(23, 16)
Expand Down
16 changes: 10 additions & 6 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ static void sof_ipc4_widget_free_comp_process(struct snd_sof_widget *swidget)

static void
sof_ipc4_update_resource_usage(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget,
struct sof_ipc4_base_module_cfg *base_config)
struct sof_ipc4_base_module_cfg *base_config, int dir)
{
struct sof_ipc4_fw_module *fw_module = swidget->module_info;
struct snd_sof_widget *pipe_widget;
Expand Down Expand Up @@ -1313,6 +1313,10 @@ sof_ipc4_update_resource_usage(struct snd_sof_dev *sdev, struct snd_sof_widget *
pipeline = pipe_widget->private;
pipeline->mem_usage += total;

/* set pipeline direction */
pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION_SET(0x1);
pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION(dir);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document what dir value is what direction, I assume playback is 0, capture is 1?
and to be safe with the integer:

	pipeline->msg.extension |= SOF_IPC4_GLB_PIPE_EXT_DIRECTION(!!dir);

Another way to put this could be to
#define SOF_IPC4_GLB_PIPE_EXT_DIR_MASK GENMASK(25, 24)
#define SOF_IPC4_GLB_PIPE_EXT_DIR_SET(dir) ((dir + 1) << 24)

so:
0 means it is not provided
1 means it is playback direction
2 means capture
3 for later use


/* Update base_config->cpc from the module manifest */
sof_ipc4_update_cpc_from_manifest(sdev, fw_module, base_config);

Expand Down Expand Up @@ -2452,7 +2456,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
input_fmt_index, output_fmt_index);

/* update pipeline memory usage */
sof_ipc4_update_resource_usage(sdev, swidget, &copier_data->base_config);
sof_ipc4_update_resource_usage(sdev, swidget, &copier_data->base_config, dir);

/* copy IPC data */
memcpy(*ipc_config_data, (void *)copier_data, sizeof(*copier_data));
Expand Down Expand Up @@ -2515,7 +2519,7 @@ static int sof_ipc4_prepare_gain_module(struct snd_sof_widget *swidget,
input_fmt_index, output_fmt_index);

/* update pipeline memory usage */
sof_ipc4_update_resource_usage(sdev, swidget, &gain->data.base_config);
sof_ipc4_update_resource_usage(sdev, swidget, &gain->data.base_config, dir);

return 0;
}
Expand Down Expand Up @@ -2560,7 +2564,7 @@ static int sof_ipc4_prepare_mixer_module(struct snd_sof_widget *swidget,
input_fmt_index, output_fmt_index);

/* update pipeline memory usage */
sof_ipc4_update_resource_usage(sdev, swidget, &mixer->base_config);
sof_ipc4_update_resource_usage(sdev, swidget, &mixer->base_config, dir);

return 0;
}
Expand Down Expand Up @@ -2626,7 +2630,7 @@ static int sof_ipc4_prepare_src_module(struct snd_sof_widget *swidget,
input_fmt_index, output_fmt_index);

/* update pipeline memory usage */
sof_ipc4_update_resource_usage(sdev, swidget, &src->data.base_config);
sof_ipc4_update_resource_usage(sdev, swidget, &src->data.base_config, dir);

out_audio_fmt = &available_fmt->output_pin_fmts[output_fmt_index].audio_fmt;
src->data.sink_rate = out_audio_fmt->sampling_frequency;
Expand Down Expand Up @@ -2783,7 +2787,7 @@ static int sof_ipc4_prepare_process_module(struct snd_sof_widget *swidget,
input_fmt_index, output_fmt_index);

/* update pipeline memory usage */
sof_ipc4_update_resource_usage(sdev, swidget, &process->base_config);
sof_ipc4_update_resource_usage(sdev, swidget, &process->base_config, dir);

/* ipc_config_data is composed of the base_config followed by an optional extension */
memcpy(cfg, &process->base_config, sizeof(struct sof_ipc4_base_module_cfg));
Expand Down