Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
Support multiple compress stream types with same topology#6073
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -35,6 +35,24 @@ enum cadence_api_id { | ||
| #define DEFAULT_CODEC_ID CADENCE_CODEC_WRAPPER_ID | ||
| /* we divide Cadence param id space as follows: | ||
| * - 0x00000000 - 0x7FFFFFFF, Cadence library ids which come | ||
| * from xa_*_dec_api.h | ||
| * - 0x80000000 - 0xFFFFFFFF, SOF remapping of Cadence library ids | ||
| */ | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| #define SOF_CADENCE_PARAM_SPACE_LEN 0x1000 | ||
| #define SOF_CADENCE_WRAPPER_PARAM_ID_START 0x80000000 | ||
| /* see include/sof/audio/cadence/mp3_dec/xa_mp3_dec_api.h */ | ||
| #define SOF_CADENCE_MP3_PARAM_ID_START 0x80001000 | ||
| #define SOF_CADENCE_MP3_PARAM_PCM_WDSZ 0x80001000 | ||
| /* see include/sof/audio/cadence/aac_dec/xa_aac_dec_api.h */ | ||
| #define SOF_CADENCE_AAC_PARAM_ID_START 0x80002000 | ||
| #define SOF_CADENCE_AAC_PARAM_BDOWNSAMPLE 0x80002000 | ||
| /*****************************************************************************/ | ||
| /* Cadence API functions array */ | ||
| /*****************************************************************************/ | ||
| @@ -95,6 +113,46 @@ static struct cadence_api cadence_api_table[] = { | ||
| #endif | ||
| }; | ||
| /* cadence_param_id_fixup - function to support multiple param id spaces. | ||
| * @mod, current processing module | ||
| * @param_id, param id received from Host. | ||
| * | ||
| * param_id are defined by Cadence per codec. Because param_id might | ||
| * overlap we cannot use them in the same topology. | ||
| * in order to fixup this overlap, we introduce a new param id space. | ||
| * | ||
| * 0x0000.0000 - 0x7FFF.FFFF, these are original Cadence param ids which | ||
| * are left 'unfixed' | ||
| * 0x8000.0000 - 0xFFFF.FFFF, remapped param id space | ||
| * see `SOF_CADENCE_<codec>_PARAM_ID_START` macros above. | ||
| */ | ||
| static int cadence_param_id_fixup(struct processing_module *mod, uint32_t param_id) | ||
| { | ||
| uint32_t start; | ||
| struct cadence_codec_data *cd = module_get_private_data(mod); | ||
| /* param_id already in codec Cadence param space, do nothing */ | ||
| if (param_id < SOF_CADENCE_WRAPPER_PARAM_ID_START) | ||
| return param_id; | ||
| /* param id uses remapped value, fixup it up to original Cadence value */ | ||
| switch (cd->api_id) { | ||
| case CADENCE_CODEC_MP3_DEC_ID: | ||
| start = SOF_CADENCE_MP3_PARAM_ID_START; | ||
| break; | ||
| case CADENCE_CODEC_AAC_DEC_ID: | ||
| start = SOF_CADENCE_AAC_PARAM_ID_START; | ||
| break; | ||
| default: | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| return -EINVAL; | ||
| } | ||
| if (param_id < start || param_id >= start + SOF_CADENCE_PARAM_SPACE_LEN) | ||
| return -EINVAL; | ||
| return param_id - start; | ||
| } | ||
| static int cadence_code_get_api_id(uint32_t compress_id) | ||
| { | ||
| /* convert compress id to SOF cadence SOF id */ | ||
| @@ -291,6 +349,20 @@ static int cadence_codec_apply_config(struct processing_module *mod) | ||
| param = data; | ||
| comp_dbg(dev, "cadence_codec_apply_config() applying param %d value %d", | ||
| param->id, param->data[0]); | ||
| ret = cadence_param_id_fixup(mod, param->id); | ||
| /* skip parameter if no fixup found */ | ||
| if (ret < 0) { | ||
| comp_err(dev, "cadence_codec_apply_config() skip param %d value %d", | ||
| param->id, param->data[0]); | ||
| data = (char *)data + param->size; | ||
| size -= param->size; | ||
| continue; | ||
| } | ||
| param->id = ret; | ||
| /* Set read parameter */ | ||
| API_CALL(cd, XA_API_CMD_SET_CONFIG_PARAM, param->id, | ||
| param->data, ret); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # | ||
| # Topology with codec_adapter processing component for i.MX8QM/i.MX8QXP | ||
| # | ||
| # Include topology builder | ||
| include(`utils.m4') | ||
| include(`dai.m4') | ||
| include(`pipeline.m4') | ||
| include(`sai.m4') | ||
| include(`pcm.m4') | ||
| include(`buffer.m4') | ||
| # Include TLV library | ||
| include(`common/tlv.m4') | ||
| # Include Token library | ||
| include(`sof/tokens.m4') | ||
| # Include DSP configuration | ||
| include(`platform/imx/imx8.m4') | ||
| # Post process setup config | ||
| #codec Post Process setup config | ||
| # | ||
| # Define the pipelines | ||
| # | ||
| # PCM0 <----> volume <-----> SAI3 (wm8960) | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # | ||
| DECLARE_SOF_RT_UUID("Cadence Codec", cadence_codec_uuid, 0xd8218443, 0x5ff3, | ||
| 0x4a4c, 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa); | ||
| define(`CA_UUID', cadence_codec_uuid) | ||
| # Post process setup config | ||
| define(`CA_SETUP_CONTROLBYTES', | ||
| `` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x24,0x00,0x00,0x00,0x00,0x10,0x00,0x03,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x07,0x20,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00,0x03,0x20,0x00,0x80,' | ||
| ` 0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,' | ||
| ` 0x00,0x10,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00"'') | ||
| define(`CA_SETUP_CONTROLBYTES_MAX', 300) | ||
| undefine(`DAI_PERIODS') | ||
| define(`DAI_PERIODS', 8) | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| dnl PIPELINE_PCM_ADD(pipeline, | ||
| dnl pipe id, pcm, max channels, format, | ||
| dnl period, priority, core, | ||
| dnl pcm_min_rate, pcm_max_rate, pipeline_rate, | ||
| dnl time_domain, sched_comp) | ||
| # Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le. | ||
| # Set 1000us deadline with priority 0 on core 0 | ||
| PIPELINE_PCM_ADD(sof/pipe-codec-adapter-playback.m4, | ||
| 1, 0, 2, s32le, | ||
| 1000, 0, 0, | ||
| 48000, 48000, 48000) | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # | ||
| # DAIs configuration | ||
| # | ||
| dnl DAI_ADD(pipeline, | ||
| dnl pipe id, dai type, dai_index, dai_be, | ||
| dnl buffer, periods, format, | ||
| dnl period, priority, core, time_domain) | ||
| # playback DAI is SAI3 using 2 periods | ||
| # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 | ||
| DAI_ADD(sof/pipe-dai-playback.m4, | ||
| 1, SAI, 1, sai1-wm8960-hifi, | ||
| PIPELINE_SOURCE_1, 2, s32le, | ||
| 1000, 0, 0, SCHEDULE_TIME_DOMAIN_DMA) | ||
| # PCM Low Latency, id 0 | ||
| dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) | ||
| COMPR_PLAYBACK_ADD(Port0, 0, PIPELINE_PCM_1) | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| dnl DAI_CONFIG(type, idx, link_id, name, sai_config) | ||
| DAI_CONFIG(SAI, 1, 0, sai1-wm8960-hifi, | ||
| SAI_CONFIG(I2S, SAI_CLOCK(mclk, 12288000, codec_mclk_in), | ||
| SAI_CLOCK(bclk, 3072000, codec_master), | ||
| SAI_CLOCK(fsync, 48000, codec_master), | ||
| SAI_TDM(2, 32, 3, 3), | ||
| SAI_CONFIG_DATA(SAI, 1, 0))) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -38,12 +38,14 @@ define(`CA_UUID', cadence_codec_uuid) | ||
| # Post process setup config | ||
| define(`CA_SETUP_CONTROLBYTES', | ||
| `` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00,0x00,0x10,0x00,0x03,' | ||
| ` 0x24,0x00,0x00,0x00,0x00,0x10,0x00,0x03,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x07,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00,0x03,0x00,0x00,0x00,' | ||
| ` 0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00"'' | ||
| ` 0x07,0x20,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00,0x03,0x20,0x00,0x80,' | ||
| ` 0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,' | ||
| ` 0x00,0x10,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00"'' | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ) | ||
| define(`CA_SETUP_CONTROLBYTES_MAX', 300) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # | ||
| # Topology with codec_adapter processing component for i.MX8MP | ||
| # | ||
| # Include topology builder | ||
| include(`utils.m4') | ||
| include(`dai.m4') | ||
| include(`pipeline.m4') | ||
| include(`sai.m4') | ||
| include(`pcm.m4') | ||
| include(`buffer.m4') | ||
| # Include TLV library | ||
| include(`common/tlv.m4') | ||
| # Include Token library | ||
| include(`sof/tokens.m4') | ||
| # Include DSP configuration | ||
| include(`platform/imx/imx8.m4') | ||
| # Post process setup config | ||
| #codec Post Process setup config | ||
| # | ||
| # Define the pipelines | ||
| # | ||
| # PCM0 <----> volume <-----> SAI3 (wm8960) | ||
dbaluta marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # | ||
| DECLARE_SOF_RT_UUID("Cadence Codec", cadence_codec_uuid, 0xd8218443, 0x5ff3, | ||
| 0x4a4c, 0xb3, 0x88, 0x6c, 0xfe, 0x07, 0xb9, 0x56, 0xaa); | ||
| define(`CA_UUID', cadence_codec_uuid) | ||
| # Post process setup config | ||
| define(`CA_SETUP_CONTROLBYTES', | ||
| `` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x24,0x00,0x00,0x00,0x00,0x10,0x00,0x03,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' | ||
| ` 0x07,0x20,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00,0x03,0x20,0x00,0x80,' | ||
| ` 0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,' | ||
| ` 0x00,0x10,0x00,0x80,0x0C,0x00,0x00,0x00,' | ||
| ` 0x18,0x00,0x00,0x00"'' | ||
| ) | ||
| define(`CA_SETUP_CONTROLBYTES_MAX', 300) | ||
| undefine(`DAI_PERIODS') | ||
| define(`DAI_PERIODS', 8) | ||
| dnl PIPELINE_PCM_ADD(pipeline, | ||
| dnl pipe id, pcm, max channels, format, | ||
| dnl period, priority, core, | ||
| dnl pcm_min_rate, pcm_max_rate, pipeline_rate, | ||
| dnl time_domain, sched_comp) | ||
| # Low Latency playback pipeline 1 on PCM 0 using max 2 channels of s32le. | ||
| # Set 1000us deadline with priority 0 on core 0 | ||
| PIPELINE_PCM_ADD(sof/pipe-codec-adapter-playback.m4, | ||
| 1, 0, 2, s32le, | ||
| 1000, 0, 0, | ||
| 48000, 48000, 48000) | ||
| # | ||
| # DAIs configuration | ||
| # | ||
| dnl DAI_ADD(pipeline, | ||
| dnl pipe id, dai type, dai_index, dai_be, | ||
| dnl buffer, periods, format, | ||
| dnl period, priority, core, time_domain) | ||
| # playback DAI is SAI3 using 2 periods | ||
| # Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0 | ||
| DAI_ADD(sof/pipe-dai-playback.m4, | ||
| 1, SAI, 3, sai3-wm8960-hifi, | ||
| PIPELINE_SOURCE_1, 2, s32le, | ||
| 1000, 0, 0, SCHEDULE_TIME_DOMAIN_DMA) | ||
| # PCM Low Latency, id 0 | ||
| dnl PCM_DUPLEX_ADD(name, pcm_id, playback, capture) | ||
| COMPR_PLAYBACK_ADD(Port0, 0, PIPELINE_PCM_1) | ||
| dnl DAI_CONFIG(type, idx, link_id, name, sai_config) | ||
| DAI_CONFIG(SAI, 3, 0, sai3-wm8960-hifi, | ||
| SAI_CONFIG(I2S, SAI_CLOCK(mclk, 12288000, codec_mclk_in), | ||
| SAI_CLOCK(bclk, 3072000, codec_master), | ||
| SAI_CLOCK(fsync, 48000, codec_master), | ||
| SAI_TDM(2, 32, 3, 3), | ||
| SAI_CONFIG_DATA(SAI, 3, 0))) | ||
Uh oh!
There was an error while loading. Please reload this page.