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

CPC: fix 0 CPC #9318

Closed
wants to merge 8 commits into from
6 changes: 2 additions & 4 deletions app/boards/intel_adsp_ace15_mtpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CONFIG_DMA_DW_LLI_POOL_SIZE=50
CONFIG_INTEL_MODULES=y
CONFIG_LIBRARY_MANAGER=y
CONFIG_LIBRARY_AUTH_SUPPORT=y
CONFIG_LIBRARY_PIPELINE_FORCE_MIN_LIFETIME=100
CONFIG_INTEL_ADSP_TIMER=y
CONFIG_MM_DRV_INTEL_ADSP_TLB_REMAP_UNUSED_RAM=y
CONFIG_AMS=y
Expand Down Expand Up @@ -86,10 +87,7 @@ CONFIG_MEMORY_WIN_2_SIZE=12288

CONFIG_LLEXT=y
CONFIG_LLEXT_STORAGE_WRITABLE=y

# temporarily disabled to get MTL working again
# https://github.com/thesofproject/sof/issues/9308
CONFIG_MODULES=n
CONFIG_MODULES=y

# Temporary disabled options
CONFIG_TRACE=n
Expand Down
2 changes: 1 addition & 1 deletion app/boards/intel_adsp_cavs25.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CONFIG_LP_MEMORY_BANKS=1
CONFIG_HP_MEMORY_BANKS=30
CONFIG_MM_DRV=y
CONFIG_INTEL_MODULES=y
CONFIG_LIBRARY_MANAGER=y
CONFIG_LIBRARY_MANAGER=n
CONFIG_RIMAGE_SIGNING_SCHEMA="tgl"

CONFIG_DEBUG_COREDUMP=y
Expand Down
2 changes: 1 addition & 1 deletion app/boards/intel_adsp_cavs25_tgph.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CONFIG_LP_MEMORY_BANKS=1
CONFIG_HP_MEMORY_BANKS=30
CONFIG_MM_DRV=y
CONFIG_INTEL_MODULES=y
CONFIG_LIBRARY_MANAGER=y
CONFIG_LIBRARY_MANAGER=n
CONFIG_RIMAGE_SIGNING_SCHEMA="tgl-h"

CONFIG_DEBUG_COREDUMP=y
Expand Down
91 changes: 2 additions & 89 deletions src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ static int copier_init(struct processing_module *mod)

dev->direction_set = true;
} else {
cd->gtw_type = ipc4_gtw_none;

/* set max sink count for module copier */
mod->max_sinks = IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT;
}
Expand Down Expand Up @@ -246,7 +244,7 @@ static int copier_prepare(struct processing_module *mod,
*/
cd->converter[0] = get_converter_func(&cd->config.base.audio_fmt,
&cd->config.out_fmt, ipc4_gtw_none,
ipc4_bidirection, DUMMY_CHMAP);
ipc4_bidirection);
if (!cd->converter[0]) {
comp_err(dev, "can't support for in format %d, out format %d",
cd->config.base.audio_fmt.depth, cd->config.out_fmt.depth);
Expand Down Expand Up @@ -661,7 +659,6 @@ static int copier_set_sink_fmt(struct comp_dev *dev, const void *data,
const struct ipc4_copier_config_set_sink_format *sink_fmt = data;
struct processing_module *mod = comp_mod(dev);
struct copier_data *cd = module_get_private_data(mod);
uint32_t chmap;

if (max_data_size < sizeof(*sink_fmt)) {
comp_err(dev, "error: max_data_size %d should be bigger than %d", max_data_size,
Expand All @@ -687,15 +684,9 @@ static int copier_set_sink_fmt(struct comp_dev *dev, const void *data,
}

cd->out_fmt[sink_fmt->sink_id] = sink_fmt->sink_fmt;

if (cd->endpoint_num > 0 && dev->ipc_config.type == SOF_COMP_DAI)
chmap = cd->dd[0]->chmap;
else
chmap = DUMMY_CHMAP;

cd->converter[sink_fmt->sink_id] = get_converter_func(&sink_fmt->source_fmt,
&sink_fmt->sink_fmt, ipc4_gtw_none,
ipc4_bidirection, chmap);
ipc4_bidirection);

return 0;
}
Expand Down Expand Up @@ -735,82 +726,6 @@ static int set_attenuation(struct comp_dev *dev, uint32_t data_offset, const cha
return 0;
}

static int set_chmap(struct comp_dev *dev, const void *data, size_t data_size)
{
const struct ipc4_copier_config_channel_map *chmap_cfg = data;
struct processing_module *mod = comp_mod(dev);
struct copier_data *cd = module_get_private_data(mod);
enum ipc4_direction_type dir;
struct ipc4_audio_format in_fmt = cd->config.base.audio_fmt;
struct ipc4_audio_format out_fmt = cd->config.out_fmt;
pcm_converter_func process;
pcm_converter_func converters[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];
int i;
uint32_t irq_flags;

if (data_size < sizeof(*chmap_cfg)) {
comp_err(dev, "Wrong payload size: %d", data_size);
return -EINVAL;
}

if (cd->endpoint_num == 0 || dev->ipc_config.type != SOF_COMP_DAI) {
comp_err(dev, "Only DAI gateway supports changing chmap");
return -EINVAL;
}

comp_info(dev, "New chmap requested: %x", chmap_cfg->channel_map);

if (!cd->dd[0]->dma_buffer) {
/* DMA buffer not yet created. Remember the chmap, it will be used
* later in .params() handler.
*
* The assignment should be atomic as LL thread can preempt this IPC thread.
*/
cd->dd[0]->chmap = chmap_cfg->channel_map;
return 0;
}

copier_dai_adjust_params(cd, &in_fmt, &out_fmt);

dir = (cd->direction == SOF_IPC_STREAM_PLAYBACK) ?
ipc4_playback : ipc4_capture;

process = get_converter_func(&in_fmt, &out_fmt, cd->gtw_type, dir, chmap_cfg->channel_map);

if (!process) {
comp_err(dev, "No gtw converter func found!");
return -EINVAL;
}

/* Channel map is same for all sinks. However, as sinks allowed to have different
* sample formats, get new convert/remap function for each sink.
*/
for (i = 0; i < IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; i++) {
if (cd->converter[i]) {
converters[i] = get_converter_func(&in_fmt, &cd->out_fmt[i],
ipc4_gtw_none, ipc4_bidirection,
chmap_cfg->channel_map);
/* Do not report an error if converter not found as sinks could be
* bound/unbound on a fly and out_fmt[i] may contain obsolete data.
*/
} else {
converters[i] = NULL;
}
}

/* Atomically update chmap, process and converters */
irq_local_disable(irq_flags);

cd->dd[0]->chmap = chmap_cfg->channel_map;
cd->dd[0]->process = process;
for (i = 0; i < IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; i++)
cd->converter[i] = converters[i];

irq_local_enable(irq_flags);

return 0;
}

static int copier_set_configuration(struct processing_module *mod,
uint32_t config_id,
enum module_cfg_fragment_position pos,
Expand All @@ -828,8 +743,6 @@ static int copier_set_configuration(struct processing_module *mod,
return copier_set_sink_fmt(dev, fragment, fragment_size);
case IPC4_COPIER_MODULE_CFG_ATTENUATION:
return set_attenuation(dev, fragment_size, (const char *)fragment);
case IPC4_COPIER_MODULE_CFG_PARAM_CHANNEL_MAP:
return set_chmap(dev, fragment, fragment_size);
default:
return -EINVAL;
}
Expand Down
18 changes: 2 additions & 16 deletions src/audio/copier/copier.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,7 @@ enum ipc4_copier_module_config_params {
* uint32_t. Config is only allowed when output pin is set up for 32bit and
* source is connected to Gateway
*/
IPC4_COPIER_MODULE_CFG_ATTENUATION = 6,
/* Use LARGE_CONFIG_SET to setup new channel map, which allows to map channels
* from gateway buffer to copier with any order.
* Same mapping will be applied for all copier sinks.
*/
IPC4_COPIER_MODULE_CFG_PARAM_CHANNEL_MAP = 7
IPC4_COPIER_MODULE_CFG_ATTENUATION = 6
};

struct ipc4_copier_config_timestamp_init_data {
Expand All @@ -206,13 +201,6 @@ struct ipc4_copier_config_set_sink_format {
struct ipc4_audio_format sink_fmt;
} __attribute__((packed, aligned(4)));

struct ipc4_copier_config_channel_map {
/* Each half-byte of the channel map is an index of the DMA stream channel that
* should be copied to the position determined by this half-byte index.
*/
uint32_t channel_map;
} __attribute__((packed, aligned(4)));

#define IPC4_COPIER_DATA_SEGMENT_DISABLE (0 << 0)
#define IPC4_COPIER_DATA_SEGMENT_ENABLE (1 << 0)
#define IPC4_COPIER_DATA_SEGMENT_RESTART (1 << 1)
Expand Down Expand Up @@ -244,7 +232,6 @@ 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;
Expand Down Expand Up @@ -280,8 +267,7 @@ int apply_attenuation(struct comp_dev *dev, struct copier_data *cd,
pcm_converter_func get_converter_func(const struct ipc4_audio_format *in_fmt,
const struct ipc4_audio_format *out_fmt,
enum ipc4_gateway_type type,
enum ipc4_direction_type dir,
uint32_t chmap);
enum ipc4_direction_type dir);

struct comp_ipc_config;
int create_endpoint_buffer(struct comp_dev *dev,
Expand Down
Loading