From c65336f8f7a194f99e1304eeacd86ded25a8d13e Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Fri, 4 Dec 2020 04:10:50 +0000 Subject: [PATCH 01/60] config: intel: set different fw_name for tglh To support TGL-H build with different binary name, set CONFIG_RIMAGE_SIGNING_SCHEMA to tgl-h to make sure output file name matches requirement from Linux driver Signed-off-by: Pan Xiuli --- src/arch/xtensa/configs/tgph_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/arch/xtensa/configs/tgph_defconfig b/src/arch/xtensa/configs/tgph_defconfig index 0e49c0b4d328..577c62f4d8c1 100644 --- a/src/arch/xtensa/configs/tgph_defconfig +++ b/src/arch/xtensa/configs/tgph_defconfig @@ -1,4 +1,5 @@ CONFIG_TIGERLAKE=y +CONFIG_RIMAGE_SIGNING_SCHEMA="tgl-h" CONFIG_INTEL_DMIC=y CONFIG_INTEL_SSP=y CONFIG_INTEL_ALH=y From c46ed5df30e768059d35190bb859363cbbdb446b Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Fri, 4 Dec 2020 04:12:52 +0000 Subject: [PATCH 02/60] scripts: add tgl-h support Add tgl-h build support. It will generate sof-tgl-h.ri Signed-off-by: Pan Xiuli --- scripts/xtensa-build-all.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index c5dcef50d974..e810df64d693 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -6,7 +6,7 @@ set -e SUPPORTED_PLATFORMS=(byt cht bdw hsw apl skl kbl cnl sue icl jsl \ - imx8 imx8x imx8m tgl) + imx8 imx8x imx8m tgl tgl-h) BUILD_ROM=no BUILD_DEBUG=no BUILD_FORCE_UP=no @@ -255,6 +255,19 @@ do PRIVATE_KEY_OPTION="-D${SIGNING_TOOL}_PRIVATE_KEY=$pwd/keys/otc_private_key_3k.pem" fi ;; + tgl-h) + PLATFORM="tgph" + ARCH="xtensa-smp" + XTENSA_CORE="cavs2x_LX6HiFi3_2017_8" + HOST="xtensa-cnl-elf" + XTENSA_TOOLS_VERSION="RG-2017.8-linux" + HAVE_ROM='yes' + # default key for TGL + if [ -z "$PRIVATE_KEY_OPTION" ] + then + PRIVATE_KEY_OPTION="-D${SIGNING_TOOL}_PRIVATE_KEY=$pwd/keys/otc_private_key_3k.pem" + fi + ;; jsl) PLATFORM="jasperlake" ARCH="xtensa-smp" From 316d4351e194d152c7ccc057a19e17eb8c532de5 Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Tue, 8 Dec 2020 04:24:40 +0000 Subject: [PATCH 03/60] rimage: Update to commit d1f91efdc1e1 Use an upstream commit instead for developing commit. Included following feature: rimage cavs 2.5 support add verify feature rimage support for TGL-H Signed-off-by: Pan Xiuli --- rimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rimage b/rimage index f3e52cd17e04..d1f91efdc1e1 160000 --- a/rimage +++ b/rimage @@ -1 +1 @@ -Subproject commit f3e52cd17e04dcc703a54501fd26e166c927e55e +Subproject commit d1f91efdc1e19093df9c88f0b9779010b0177616 From 1e3adabd198da7322f847440a2087a63f978b006 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Thu, 12 Nov 2020 15:08:33 +0800 Subject: [PATCH 04/60] sof: crossover/drc: Expose algorithm functions Some algorithm functions of crossover and drc are exposed to share the usage from other components, e.g. a multi-band drc which includes crossover and drc inside. Signed-off-by: Pin-chih Lin --- src/audio/crossover/crossover.c | 9 +++-- src/audio/drc/drc.c | 15 ++++---- src/audio/drc/drc_generic.c | 19 +++++----- .../sof/audio/crossover/crossover_algorithm.h | 24 ++++++++++++ src/include/sof/audio/drc/drc_algorithm.h | 37 +++++++++++++++++++ 5 files changed, 84 insertions(+), 20 deletions(-) create mode 100644 src/include/sof/audio/crossover/crossover_algorithm.h create mode 100644 src/include/sof/audio/drc/drc_algorithm.h diff --git a/src/audio/crossover/crossover.c b/src/audio/crossover/crossover.c index 22474d92bce9..5f8b564b765f 100644 --- a/src/audio/crossover/crossover.c +++ b/src/audio/crossover/crossover.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ static inline void crossover_reset_state_lr4(struct iir_state_df2t *lr4) * \brief Reset the state (coefficients and delay) of the crossover filter * of a single channel. */ -static inline void crossover_reset_state_ch(struct crossover_state *ch_state) +inline void crossover_reset_state_ch(struct crossover_state *ch_state) { int i; @@ -215,9 +216,9 @@ static int crossover_init_coef_lr4(struct sof_eq_iir_biquad_df2t *coef, /** * \brief Initializes the crossover coefficients for one channel */ -static int crossover_init_coef_ch(struct sof_eq_iir_biquad_df2t *coef, - struct crossover_state *ch_state, - int32_t num_sinks) +int crossover_init_coef_ch(struct sof_eq_iir_biquad_df2t *coef, + struct crossover_state *ch_state, + int32_t num_sinks) { int32_t i; int32_t j = 0; diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index cfde39c803fb..1da69b46545c 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,7 @@ DECLARE_SOF_RT_UUID("drc", drc_uuid, 0xb36ee4da, 0x006f, 0x47f9, DECLARE_TR_CTX(drc_tr, SOF_UUID(drc_uuid), LOG_LEVEL_INFO); -static inline void drc_reset_state(struct drc_state *state) +inline void drc_reset_state(struct drc_state *state) { int i; @@ -62,9 +63,9 @@ static inline void drc_reset_state(struct drc_state *state) state->max_attack_compression_diff_db = INT32_MIN; } -static inline int drc_init_pre_delay_buffers(struct drc_state *state, - size_t sample_bytes, - int channels) +inline int drc_init_pre_delay_buffers(struct drc_state *state, + size_t sample_bytes, + int channels) { size_t bytes_per_channel = sample_bytes * DRC_MAX_PRE_DELAY_FRAMES; size_t bytes_total = bytes_per_channel * channels; @@ -86,9 +87,9 @@ static inline int drc_init_pre_delay_buffers(struct drc_state *state, return 0; } -static inline int drc_set_pre_delay_time(struct drc_state *state, - int32_t pre_delay_time, - int32_t rate) +inline int drc_set_pre_delay_time(struct drc_state *state, + int32_t pre_delay_time, + int32_t rate) { int32_t pre_delay_frames; diff --git a/src/audio/drc/drc_generic.c b/src/audio/drc/drc_generic.c index 932b935ba487..78e1945bca04 100644 --- a/src/audio/drc/drc_generic.c +++ b/src/audio/drc/drc_generic.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -69,10 +70,10 @@ static int32_t volume_gain(const struct sof_drc_params *p, int32_t x) } /* Update detector_average from the last input division. */ -static void drc_update_detector_average(struct drc_state *state, - const struct sof_drc_params *p, - int nbyte, - int nch) +void drc_update_detector_average(struct drc_state *state, + const struct sof_drc_params *p, + int nbyte, + int nch) { int32_t detector_average = state->detector_average; /* Q2.30 */ int32_t abs_input_array[DRC_DIVISION_FRAMES]; /* Q1.31 */ @@ -158,7 +159,7 @@ static void drc_update_detector_average(struct drc_state *state, } /* Updates the envelope_rate used for the next division */ -static void drc_update_envelope(struct drc_state *state, const struct sof_drc_params *p) +void drc_update_envelope(struct drc_state *state, const struct sof_drc_params *p) { /* Calculate desired gain */ @@ -251,10 +252,10 @@ static void drc_update_envelope(struct drc_state *state, const struct sof_drc_pa /* Calculate compress_gain from the envelope and apply total_gain to compress * the next output division. */ -static void drc_compress_output(struct drc_state *state, - const struct sof_drc_params *p, - int nbyte, - int nch) +void drc_compress_output(struct drc_state *state, + const struct sof_drc_params *p, + int nbyte, + int nch) { const int div_start = state->pre_delay_read_index; int count = DRC_DIVISION_FRAMES >> 2; diff --git a/src/include/sof/audio/crossover/crossover_algorithm.h b/src/include/sof/audio/crossover/crossover_algorithm.h new file mode 100644 index 000000000000..8ff3bdb09238 --- /dev/null +++ b/src/include/sof/audio/crossover/crossover_algorithm.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2020 Google LLC. All rights reserved. + * + * Author: Pin-chih Lin + */ +#ifndef __SOF_AUDIO_CROSSOVER_CROSSOVER_ALGORITHM_H__ +#define __SOF_AUDIO_CROSSOVER_CROSSOVER_ALGORITHM_H__ + +#include +#include +#include +#include +#include + +/* crossover reset function */ +void crossover_reset_state_ch(struct crossover_state *ch_state); + +/* crossover init function */ +int crossover_init_coef_ch(struct sof_eq_iir_biquad_df2t *coef, + struct crossover_state *ch_state, + int32_t num_sinks); + +#endif // __SOF_AUDIO_CROSSOVER_CROSSOVER_ALGORITHM_H__ diff --git a/src/include/sof/audio/drc/drc_algorithm.h b/src/include/sof/audio/drc/drc_algorithm.h new file mode 100644 index 000000000000..26ef66279202 --- /dev/null +++ b/src/include/sof/audio/drc/drc_algorithm.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2020 Google LLC. All rights reserved. + * + * Author: Pin-chih Lin + */ +#ifndef __SOF_AUDIO_DRC_DRC_ALGORITHM_H__ +#define __SOF_AUDIO_DRC_DRC_ALGORITHM_H__ + +#include +#include +#include +#include + +/* drc reset function */ +void drc_reset_state(struct drc_state *state); + +/* drc init functions */ +int drc_init_pre_delay_buffers(struct drc_state *state, + size_t sample_bytes, + int channels); +int drc_set_pre_delay_time(struct drc_state *state, + int32_t pre_delay_time, + int32_t rate); + +/* drc process functions */ +void drc_update_detector_average(struct drc_state *state, + const struct sof_drc_params *p, + int nbyte, + int nch); +void drc_update_envelope(struct drc_state *state, const struct sof_drc_params *p); +void drc_compress_output(struct drc_state *state, + const struct sof_drc_params *p, + int nbyte, + int nch); + +#endif // __SOF_AUDIO_DRC_DRC_ALGORITHM_H__ From 9e0a56074674cd971c91210992d20a9d3ea90054 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Thu, 12 Nov 2020 15:14:20 +0800 Subject: [PATCH 05/60] sof: multiband_drc: Add Multiband DRC component Multiband DRC is a single-source-single-sink compound component which consists of 4 stages: Emphasis Equalizer, Crossover Filter (from 1-band to 4-band), DRC (per band), and Deemphasis Equalizer of summed stream. The following graph illustrates a 3-band Multiband DRC component: low o----> DRC0 ----o | | 3-WAY |mid | x(n) --> EQ EMP --> CROSSOVER --o----> DRC1 ---(+)--> EQ DEEMP --> y(n) | | |high | o----> DRC2 ----o Signed-off-by: Pin-chih Lin --- CODEOWNERS | 1 + src/audio/CMakeLists.txt | 6 +- src/audio/Kconfig | 9 + src/audio/multiband_drc/CMakeLists.txt | 1 + src/audio/multiband_drc/multiband_drc.c | 577 ++++++++++++++++++ .../sof/audio/multiband_drc/multiband_drc.h | 83 +++ src/include/user/multiband_drc.h | 85 +++ 7 files changed, 761 insertions(+), 1 deletion(-) create mode 100644 src/audio/multiband_drc/CMakeLists.txt create mode 100644 src/audio/multiband_drc/multiband_drc.c create mode 100644 src/include/sof/audio/multiband_drc/multiband_drc.h create mode 100644 src/include/user/multiband_drc.h diff --git a/CODEOWNERS b/CODEOWNERS index 753add6954e6..36a6ab4ff7d0 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -29,6 +29,7 @@ src/audio/dcblock* @cujomalainey @dgreid src/audio/crossover* @cujomalainey @dgreid src/audio/tdfb* @singalsu src/audio/drc/* @johnylin76 @cujomalainey @dgreid +src/audio/multiband_drc/* @johnylin76 @cujomalainey @dgreid # platforms src/platform/baytrail/* @xiulipan diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index c55566f3530e..607742d3f147 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -33,6 +33,9 @@ if(NOT CONFIG_LIBRARY) if(CONFIG_COMP_DRC) add_subdirectory(drc) endif() + if(CONFIG_COMP_MULTIBAND_DRC) + add_subdirectory(multiband_drc) + endif() if(CONFIG_COMP_TONE) add_local_sources(sof tone.c @@ -118,7 +121,7 @@ check_optimization(fma -mfma -DOPS_FMA) check_optimization(hifi2ep -mhifi2ep -DOPS_HIFI2EP) check_optimization(hifi3 -mhifi3 -DOPS_HIFI3) -set(sof_audio_modules volume src asrc eq-fir eq-iir dcblock crossover tdfb drc) +set(sof_audio_modules volume src asrc eq-fir eq-iir dcblock crossover tdfb drc multiband_drc) # sources for each module set(volume_sources volume/volume.c volume/volume_generic.c) @@ -130,6 +133,7 @@ set(dcblock_sources dcblock/dcblock.c dcblock/dcblock_generic.c) set(crossover_sources crossover/crossover.c crossover/crossover_generic.c) set(tdfb_sources tdfb/tdfb.c tdfb/tdfb_generic.c) set(drc_sources drc/drc.c drc/drc_generic.c drc/drc_math_generic.c) +set(multiband_drc_sources multiband_drc/multiband_drc.c crossover/crossover.c drc/drc.c) foreach(audio_module ${sof_audio_modules}) # first compile with no optimizations diff --git a/src/audio/Kconfig b/src/audio/Kconfig index a2b7993e9694..daaa7e673a65 100644 --- a/src/audio/Kconfig +++ b/src/audio/Kconfig @@ -142,6 +142,15 @@ config COMP_DRC to reduce the volume of loud sounds and amplify silent sounds thus compressing an audio signal's dynamic range. +config COMP_MULTIBAND_DRC + depends on COMP_IIR && COMP_CROSSOVER && COMP_DRC + bool "Multiband Dynamic Range Compressor component" + default n + help + Select for Multiband Dynamic Range Compressor (DRC) component. It + consists of Emphasis Equalizer, n-way Crossover Filter, per-band DRC, + and Deemphasis Equalizer. + config COMP_DCBLOCK bool "DC Blocking Filter component" default y diff --git a/src/audio/multiband_drc/CMakeLists.txt b/src/audio/multiband_drc/CMakeLists.txt new file mode 100644 index 000000000000..50b26a17d41d --- /dev/null +++ b/src/audio/multiband_drc/CMakeLists.txt @@ -0,0 +1 @@ +add_local_sources(sof multiband_drc.c) diff --git a/src/audio/multiband_drc/multiband_drc.c b/src/audio/multiband_drc/multiband_drc.c new file mode 100644 index 000000000000..0532c2416e0f --- /dev/null +++ b/src/audio/multiband_drc/multiband_drc.c @@ -0,0 +1,577 @@ +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright(c) 2020 Google LLC. All rights reserved. +// +// Author: Pin-chih Lin + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const struct comp_driver comp_multiband_drc; + +/* 0d9f2256-8e4f-47b3-8448-239a334f1191 */ +DECLARE_SOF_RT_UUID("multiband_drc", multiband_drc_uuid, 0x0d9f2256, 0x8e4f, 0x47b3, + 0x84, 0x48, 0x23, 0x9a, 0x33, 0x4f, 0x11, 0x91); + +DECLARE_TR_CTX(multiband_drc_tr, SOF_UUID(multiband_drc_uuid), LOG_LEVEL_INFO); + +static inline void multiband_drc_iir_reset_state_ch(struct iir_state_df2t *iir) +{ + rfree(iir->coef); + rfree(iir->delay); + + iir->coef = NULL; + iir->delay = NULL; +} + +static inline void multiband_drc_reset_state(struct multiband_drc_state *state) +{ + int i; + + /* Reset emphasis eq-iir state */ + for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) + multiband_drc_iir_reset_state_ch(&state->emphasis[i]); + + /* Reset crossover state */ + for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) + crossover_reset_state_ch(&state->crossover[i]); + + /* Reset drc kernel state */ + for (i = 0; i < SOF_MULTIBAND_DRC_MAX_BANDS; i++) + drc_reset_state(&state->drc[i]); + + /* Reset deemphasis eq-iir state */ + for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) + multiband_drc_iir_reset_state_ch(&state->deemphasis[i]); +} + +static int multiband_drc_eq_init_coef_ch(struct sof_eq_iir_biquad_df2t *coef, + struct iir_state_df2t *eq) +{ + int ret; + + eq->coef = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, + sizeof(struct sof_eq_iir_biquad_df2t) * SOF_EMP_DEEMP_BIQUADS); + if (!eq->coef) + return -ENOMEM; + + /* Coefficients of the first biquad and second biquad */ + ret = memcpy_s(eq->coef, sizeof(struct sof_eq_iir_biquad_df2t) * SOF_EMP_DEEMP_BIQUADS, + coef, sizeof(struct sof_eq_iir_biquad_df2t) * SOF_EMP_DEEMP_BIQUADS); + assert(!ret); + + /* EQ filters are two 2nd order filters, so only need 4 delay slots + * delay[0..1] -> state for first biquad + * delay[2..3] -> state for second biquad + */ + eq->delay = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, + sizeof(uint64_t) * CROSSOVER_NUM_DELAYS_LR4); + if (!eq->delay) + return -ENOMEM; + + eq->biquads = SOF_EMP_DEEMP_BIQUADS; + eq->biquads_in_series = SOF_EMP_DEEMP_BIQUADS; + + return 0; +} + +static int multiband_drc_init_coef(struct multiband_drc_comp_data *cd, int16_t nch, uint32_t rate) +{ + struct sof_eq_iir_biquad_df2t *crossover; + struct sof_eq_iir_biquad_df2t *emphasis; + struct sof_eq_iir_biquad_df2t *deemphasis; + struct sof_multiband_drc_config *config = cd->config; + struct multiband_drc_state *state = &cd->state; + uint32_t sample_bytes = get_sample_bytes(cd->source_format); + int num_bands = cd->config->num_bands; + int i, ch, ret; + + if (!config) { + comp_cl_err(&comp_multiband_drc, "multiband_drc_init_coef(), no config is set"); + return -EINVAL; + } + + /* Sanity checks */ + if (nch > PLATFORM_MAX_CHANNELS) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), invalid channels count(%i)", + nch); + return -EINVAL; + } + if (config->num_bands > SOF_MULTIBAND_DRC_MAX_BANDS) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), invalid bands count(%i)", + config->num_bands); + return -EINVAL; + } + + comp_cl_info(&comp_multiband_drc, + "multiband_drc_init_coef(), initiliazing %i-way crossover", + config->num_bands); + + /* Crossover: collect the coef array and assign it to every channel */ + crossover = config->crossover_coef; + for (ch = 0; ch < nch; ch++) { + ret = crossover_init_coef_ch(crossover, &state->crossover[ch], + config->num_bands); + /* Free all previously allocated blocks in case of an error */ + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), could not assign coeffs to ch %d", + ch); + goto err; + } + } + + comp_cl_info(&comp_multiband_drc, "multiband_drc_init_coef(), initiliazing emphasis_eq"); + + /* Emphasis: collect the coef array and assign it to every channel */ + emphasis = config->emp_coef; + for (ch = 0; ch < nch; ch++) { + ret = multiband_drc_eq_init_coef_ch(emphasis, &state->emphasis[ch]); + /* Free all previously allocated blocks in case of an error */ + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), could not assign coeffs to ch %d", + ch); + goto err; + } + } + + comp_cl_info(&comp_multiband_drc, "multiband_drc_init_coef(), initiliazing deemphasis_eq"); + + /* Deemphasis: collect the coef array and assign it to every channel */ + deemphasis = config->deemp_coef; + for (ch = 0; ch < nch; ch++) { + ret = multiband_drc_eq_init_coef_ch(deemphasis, &state->deemphasis[ch]); + /* Free all previously allocated blocks in case of an error */ + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), could not assign coeffs to ch %d", + ch); + goto err; + } + } + + /* Allocate all DRC pre-delay buffers and set delay time with band number */ + for (i = 0; i < num_bands; i++) { + comp_cl_info(&comp_multiband_drc, + "multiband_drc_init_coef(), initiliazing drc band %d", i); + + ret = drc_init_pre_delay_buffers(&state->drc[i], (size_t)sample_bytes, (int)nch); + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), could not init pre delay buffers"); + goto err; + } + + ret = drc_set_pre_delay_time(&state->drc[i], + cd->config->drc_coef[i].pre_delay_time, rate); + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_init_coef(), could not set pre delay time"); + goto err; + } + } + + return 0; + +err: + multiband_drc_reset_state(state); + return ret; +} + +static int multiband_drc_setup(struct multiband_drc_comp_data *cd, int16_t channels, uint32_t rate) +{ + int ret; + + /* Reset any previous state */ + multiband_drc_reset_state(&cd->state); + + /* Setup Crossover, Emphasis EQ, Deemphasis EQ, and DRC */ + ret = multiband_drc_init_coef(cd, channels, rate); + if (ret < 0) + return ret; + + return 0; +} + +/* + * End of Multiband DRC setup code. Next the standard component methods. + */ + +static struct comp_dev *multiband_drc_new(const struct comp_driver *drv, + struct sof_ipc_comp *comp) +{ + struct comp_dev *dev; + struct multiband_drc_comp_data *cd; + struct sof_ipc_comp_process *ipc_multiband_drc = + (struct sof_ipc_comp_process *)comp; + size_t bs = ipc_multiband_drc->size; + int ret; + + comp_cl_info(&comp_multiband_drc, "multiband_drc_new()"); + + /* Check first before proceeding with dev and cd that coefficients + * blob size is sane. + */ + if (bs > SOF_MULTIBAND_DRC_MAX_BLOB_SIZE) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_new(), error: configuration blob size = %u > %d", + bs, SOF_MULTIBAND_DRC_MAX_BLOB_SIZE); + return NULL; + } + + dev = comp_alloc(drv, COMP_SIZE(struct sof_ipc_comp_process)); + if (!dev) + return NULL; + + ret = memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process), + sizeof(struct sof_ipc_comp_process), ipc_multiband_drc, + sizeof(struct sof_ipc_comp_process)); + assert(!ret); + + cd = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(*cd)); + if (!cd) { + rfree(dev); + return NULL; + } + + comp_set_drvdata(dev, cd); + + cd->multiband_drc_func = NULL; + cd->crossover_split = NULL; + + /* Handler for configuration data */ + cd->model_handler = comp_data_blob_handler_new(dev); + if (!cd->model_handler) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_new(): comp_data_blob_handler_new() failed."); + rfree(dev); + rfree(cd); + return NULL; + } + + /* Get configuration data and reset DRC state */ + ret = comp_init_data_blob(cd->model_handler, bs, ipc_multiband_drc->data); + if (ret < 0) { + comp_cl_err(&comp_multiband_drc, + "multiband_drc_new(): comp_init_data_blob() failed."); + rfree(dev); + rfree(cd); + return NULL; + } + multiband_drc_reset_state(&cd->state); + + dev->state = COMP_STATE_READY; + return dev; +} + +static void multiband_drc_free(struct comp_dev *dev) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + + comp_info(dev, "multiband_drc_free()"); + + comp_data_blob_handler_free(cd->model_handler); + + rfree(cd); + rfree(dev); +} + +static int multiband_drc_params(struct comp_dev *dev, struct sof_ipc_stream_params *params) +{ + int ret; + + comp_dbg(dev, "multiband_drc_params()"); + + comp_dbg(dev, "multiband_drc_verify_params()"); + ret = comp_verify_params(dev, 0, params); + if (ret < 0) { + comp_err(dev, "multiband_drc_params(): comp_verify_params() failed."); + return -EINVAL; + } + + /* All configuration work is postponed to prepare(). */ + return 0; +} + +static int multiband_drc_cmd_get_data(struct comp_dev *dev, + struct sof_ipc_ctrl_data *cdata, + int max_size) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + int ret = 0; + + switch (cdata->cmd) { + case SOF_CTRL_CMD_BINARY: + comp_dbg(dev, "multiband_drc_cmd_get_data(), SOF_CTRL_CMD_BINARY"); + ret = comp_data_blob_get_cmd(cd->model_handler, cdata, max_size); + break; + default: + comp_err(dev, "multiband_drc_cmd_get_data() error: invalid cdata->cmd"); + ret = -EINVAL; + break; + } + return ret; +} + +static int multiband_drc_cmd_set_data(struct comp_dev *dev, + struct sof_ipc_ctrl_data *cdata) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + int ret = 0; + + switch (cdata->cmd) { + case SOF_CTRL_CMD_BINARY: + comp_dbg(dev, "multiband_drc_cmd_set_data(), SOF_CTRL_CMD_BINARY"); + ret = comp_data_blob_set_cmd(cd->model_handler, cdata); + break; + default: + comp_err(dev, "multiband_drc_cmd_set_data() error: invalid cdata->cmd"); + ret = -EINVAL; + break; + } + + return ret; +} + +static int multiband_drc_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_size) +{ + struct sof_ipc_ctrl_data *cdata = data; + int ret = 0; + + comp_dbg(dev, "multiband_drc_cmd()"); + + switch (cmd) { + case COMP_CMD_SET_DATA: + ret = multiband_drc_cmd_set_data(dev, cdata); + break; + case COMP_CMD_GET_DATA: + ret = multiband_drc_cmd_get_data(dev, cdata, max_data_size); + break; + default: + comp_err(dev, "multiband_drc_cmd(), invalid command"); + ret = -EINVAL; + } + + return ret; +} + +static int multiband_drc_trigger(struct comp_dev *dev, int cmd) +{ + int ret; + + comp_dbg(dev, "multiband_drc_trigger()"); + + ret = comp_set_state(dev, cmd); + if (ret == COMP_STATUS_STATE_ALREADY_SET) + ret = PPL_STATUS_PATH_STOP; + + return ret; +} + +static void multiband_drc_process(struct comp_dev *dev, struct comp_buffer *source, + struct comp_buffer *sink, int frames, + uint32_t source_bytes, uint32_t sink_bytes) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + + buffer_invalidate(source, source_bytes); + + cd->multiband_drc_func(dev, &source->stream, &sink->stream, frames); + + buffer_writeback(sink, sink_bytes); + + /* calc new free and available */ + comp_update_buffer_consume(source, source_bytes); + comp_update_buffer_produce(sink, sink_bytes); +} + +static int multiband_drc_copy(struct comp_dev *dev) +{ + struct comp_copy_limits cl; + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + struct comp_buffer *sourceb; + struct comp_buffer *sinkb; + int ret; + + comp_dbg(dev, "multiband_drc_copy()"); + + sourceb = list_first_item(&dev->bsource_list, struct comp_buffer, + sink_list); + sinkb = list_first_item(&dev->bsink_list, struct comp_buffer, + source_list); + + /* Check for changed configuration */ + if (comp_is_new_data_blob_available(cd->model_handler)) { + cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL); + ret = multiband_drc_setup(cd, (int16_t)sourceb->stream.channels, + sourceb->stream.rate); + if (ret < 0) { + comp_err(dev, "multiband_drc_copy(), failed DRC setup"); + return ret; + } + } + + /* Get source, sink, number of frames etc. to process. */ + comp_get_copy_limits_with_lock(sourceb, sinkb, &cl); + + /* Run Multiband DRC function */ + multiband_drc_process(dev, sourceb, sinkb, cl.frames, cl.source_bytes, cl.sink_bytes); + + return 0; +} + +static int multiband_drc_prepare(struct comp_dev *dev) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + struct sof_ipc_comp_config *config = dev_comp_config(dev); + struct comp_buffer *sourceb; + struct comp_buffer *sinkb; + uint32_t sink_period_bytes; + int ret; + + comp_info(dev, "multiband_drc_prepare()"); + + ret = comp_set_state(dev, COMP_TRIGGER_PREPARE); + if (ret < 0) + return ret; + + if (ret == COMP_STATUS_STATE_ALREADY_SET) + return PPL_STATUS_PATH_STOP; + + /* DRC component will only ever have 1 source and 1 sink buffer */ + sourceb = list_first_item(&dev->bsource_list, + struct comp_buffer, sink_list); + sinkb = list_first_item(&dev->bsink_list, + struct comp_buffer, source_list); + + /* get source data format */ + cd->source_format = sourceb->stream.frame_fmt; + + /* Initialize DRC */ + comp_dbg(dev, "multiband_drc_prepare(), source_format=%d, sink_format=%d", + cd->source_format, cd->source_format); + cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL); + if (cd->config) { + ret = multiband_drc_setup(cd, sourceb->stream.channels, sourceb->stream.rate); + if (ret < 0) { + comp_err(dev, "multiband_drc_prepare() error: multiband_drc_setup failed."); + goto err; + } + + cd->multiband_drc_func = multiband_drc_find_proc_func(cd->source_format); + if (!cd->multiband_drc_func) { + comp_err(dev, "multiband_drc_prepare(), No proc func"); + ret = -EINVAL; + goto err; + } + + cd->crossover_split = crossover_find_split_func(cd->config->num_bands); + if (!cd->crossover_split) { + comp_err(dev, "multiband_drc_prepare(), No crossover_split for band num %i", + cd->config->num_bands); + ret = -EINVAL; + goto err; + } + } else { + cd->multiband_drc_func = multiband_drc_find_proc_func_pass(cd->source_format); + if (!cd->multiband_drc_func) { + comp_err(dev, "multiband_drc_prepare(), No proc func passthrough"); + ret = -EINVAL; + goto err; + } + } + + /* validate sink data format and period bytes */ + if (cd->source_format != sinkb->stream.frame_fmt) { + comp_err(dev, + "multiband_drc_prepare(): Source fmt %d and sink fmt %d are different.", + cd->source_format, sinkb->stream.frame_fmt); + ret = -EINVAL; + goto err; + } + + sink_period_bytes = audio_stream_period_bytes(&sinkb->stream, + dev->frames); + + if (sinkb->stream.size < config->periods_sink * sink_period_bytes) { + comp_err(dev, "multiband_drc_prepare(), sink buffer size %d is insufficient", + sinkb->stream.size); + ret = -ENOMEM; + goto err; + } + + return 0; + +err: + comp_set_state(dev, COMP_TRIGGER_RESET); + return ret; +} + +static int multiband_drc_reset(struct comp_dev *dev) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + + comp_info(dev, "multiband_drc_reset()"); + + multiband_drc_reset_state(&cd->state); + + cd->multiband_drc_func = NULL; + cd->crossover_split = NULL; + + comp_set_state(dev, COMP_TRIGGER_RESET); + return 0; +} + +static const struct comp_driver comp_multiband_drc = { + .uid = SOF_RT_UUID(multiband_drc_uuid), + .tctx = &multiband_drc_tr, + .ops = { + .create = multiband_drc_new, + .free = multiband_drc_free, + .params = multiband_drc_params, + .cmd = multiband_drc_cmd, + .trigger = multiband_drc_trigger, + .copy = multiband_drc_copy, + .prepare = multiband_drc_prepare, + .reset = multiband_drc_reset, + }, +}; + +static SHARED_DATA struct comp_driver_info comp_multiband_drc_info = { + .drv = &comp_multiband_drc, +}; + +UT_STATIC void sys_comp_multiband_drc_init(void) +{ + comp_register(platform_shared_get(&comp_multiband_drc_info, + sizeof(comp_multiband_drc_info))); +} + +DECLARE_MODULE(sys_comp_multiband_drc_init); diff --git a/src/include/sof/audio/multiband_drc/multiband_drc.h b/src/include/sof/audio/multiband_drc/multiband_drc.h new file mode 100644 index 000000000000..7c04a3d142ed --- /dev/null +++ b/src/include/sof/audio/multiband_drc/multiband_drc.h @@ -0,0 +1,83 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2020 Google LLC. All rights reserved. + * + * Author: Pin-chih Lin + */ +#ifndef __SOF_AUDIO_MULTIBAND_DRC_MULTIBAND_DRC_H__ +#define __SOF_AUDIO_MULTIBAND_DRC_MULTIBAND_DRC_H__ + +#include +#include +#include +#include +#include +#include +#include + +/** + * Stores the state of the sub-components in Multiband DRC + */ +struct multiband_drc_state { + struct iir_state_df2t emphasis[PLATFORM_MAX_CHANNELS]; + struct crossover_state crossover[PLATFORM_MAX_CHANNELS]; + struct drc_state drc[SOF_MULTIBAND_DRC_MAX_BANDS]; + struct iir_state_df2t deemphasis[PLATFORM_MAX_CHANNELS]; +}; + +typedef void (*multiband_drc_func)(const struct comp_dev *dev, + const struct audio_stream *source, + struct audio_stream *sink, + uint32_t frames); + +/* Multiband DRC component private data */ +struct multiband_drc_comp_data { + struct multiband_drc_state state; /**< compressor state */ + struct comp_data_blob_handler *model_handler; + struct sof_multiband_drc_config *config; /**< pointer to setup blob */ + bool config_ready; /**< set when fully received */ + enum sof_ipc_frame source_format; /**< source frame format */ + multiband_drc_func multiband_drc_func; /**< processing function */ + crossover_split crossover_split; /**< crossover n-way split func */ +}; + +struct multiband_drc_proc_fnmap { + enum sof_ipc_frame frame_fmt; + multiband_drc_func multiband_drc_proc_func; +}; + +extern const struct multiband_drc_proc_fnmap multiband_drc_proc_fnmap[]; +extern const struct multiband_drc_proc_fnmap multiband_drc_proc_fnmap_pass[]; +extern const size_t multiband_drc_proc_fncount; + +/** + * \brief Returns Multiband DRC processing function. + */ +static multiband_drc_func multiband_drc_find_proc_func(enum sof_ipc_frame src_fmt) +{ + int i; + + /* Find suitable processing function from map */ + for (i = 0; i < multiband_drc_proc_fncount; i++) + if (src_fmt == multiband_drc_proc_fnmap[i].frame_fmt) + return multiband_drc_proc_fnmap[i].multiband_drc_proc_func; + + return NULL; +} + +/** + * \brief Returns Multiband DRC passthrough functions. + */ +static multiband_drc_func multiband_drc_find_proc_func_pass(enum sof_ipc_frame src_fmt) +{ + int i; + + /* Find suitable processing function from map */ + for (i = 0; i < drc_proc_fncount; i++) + if (src_fmt == multiband_drc_proc_fnmap_pass[i].frame_fmt) + return multiband_drc_proc_fnmap_pass[i].multiband_drc_proc_func; + + return NULL; +} + +#endif // __SOF_AUDIO_MULTIBAND_DRC_MULTIBAND_DRC_H__ diff --git a/src/include/user/multiband_drc.h b/src/include/user/multiband_drc.h new file mode 100644 index 000000000000..7ed54fa473b0 --- /dev/null +++ b/src/include/user/multiband_drc.h @@ -0,0 +1,85 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2020 Google LLC. All rights reserved. + * + * Author: Pin-chih Lin + */ + +#ifndef __USER_MULTIBAND_DRC_H__ +#define __USER_MULTIBAND_DRC_H__ + +#include +#include +#include +#include + +/* Maximum number of frequency band for Multiband DRC */ +#define SOF_MULTIBAND_DRC_MAX_BANDS SOF_CROSSOVER_MAX_STREAMS + +/* Maximum number of Crossover LR4 highpass and lowpass filters */ +#define SOF_CROSSOVER_MAX_LR4 ((SOF_CROSSOVER_MAX_STREAMS - 1) * 2) + +/* The number of biquads (and biquads in series) of (De)Emphasis Equalizer */ +#define SOF_EMP_DEEMP_BIQUADS 2 + +/* Maximum number allowed of IPC configuration blob size */ +#define SOF_MULTIBAND_DRC_MAX_BLOB_SIZE 1024 + + /* multiband_drc configuration + * Multiband DRC is a single-source-single-sink compound component which + * consists of 4 stages: Emphasis Equalizer, Crossover Filter (from 1-band + * to 4-band), DRC (per band), and Deemphasis Equalizer of summed stream. + * + * The following graph illustrates a 3-band Multiband DRC component: + * + * low + * o----> DRC0 ----o + * | | + * 3-WAY |mid | + * x(n) --> EQ EMP --> CROSSOVER --o----> DRC1 ---(+)--> EQ DEEMP --> y(n) + * | | + * |high | + * o----> DRC2 ----o + * + * uint32_t num_bands <= 4 + * Determines the number of frequency bands, the choice of n-way + * Crossover, and the number of DRC components. + * uint32_t enable_emp_deemp + * 1=enable Emphasis and Deemphasis Equalizer; 0=disable (passthrough) + * struct sof_eq_iir_biquad_df2t emp_coef[2] + * The coefficient data for Emphasis Equalizer, which is a cascade of 2 + * biquad filters. + * struct sof_eq_iir_biquad_df2t deemp_coef[2] + * The coefficient data for Deemphasis Equalizer, which is a cascade of + * 2 biquad filters. + * struct sof_eq_iir_biquad_df2t crossover_coef[6] + * The coefficient data for Crossover LR4 filters. Please refer + * src/include/user/crossover.h for details. Zeros will be filled if + * the entries are useless. For example, when 2-way crossover is used: + * struct sof_drc_params drc_coef[num_bands] + * The parameter data for DRC per band, the number entries of this may + * vary. Please refer src/include/user/drc.h for details. + * + */ +struct sof_multiband_drc_config { + uint32_t size; + uint32_t num_bands; + uint32_t enable_emp_deemp; + + /* reserved */ + uint32_t reserved[8]; + + /* config of emphasis eq-iir */ + struct sof_eq_iir_biquad_df2t emp_coef[SOF_EMP_DEEMP_BIQUADS]; + + /* config of deemphasis eq-iir */ + struct sof_eq_iir_biquad_df2t deemp_coef[SOF_EMP_DEEMP_BIQUADS]; + + /* config of crossover */ + struct sof_eq_iir_biquad_df2t crossover_coef[SOF_CROSSOVER_MAX_LR4]; + + /* config of multi-band drc */ + struct sof_drc_params drc_coef[]; +}; + +#endif // __USER_MULTIBAND_DRC_H__ From 44c72a4f258d02044d1205ec227356da6c737492 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Wed, 14 Oct 2020 15:01:48 -0700 Subject: [PATCH 06/60] library: refactor init sequence The fuzzer is makings its way into a lot places where we assume hw configs exist. Therefore a refactor is needed make it easy to fill in the missing configs. Signed-off-by: Curtis Malainey --- src/platform/library/CMakeLists.txt | 6 ++- .../library/include/platform/lib/dma.h | 2 +- src/platform/library/lib/CMakeLists.txt | 1 + src/platform/library/lib/dai.c | 23 +++++++++ src/platform/library/platform.c | 49 +++++++++++++++++++ tools/oss-fuzz/fuzz_ipc.c | 24 +++------ 6 files changed, 86 insertions(+), 19 deletions(-) create mode 100644 src/platform/library/lib/dai.c create mode 100644 src/platform/library/platform.c diff --git a/src/platform/library/CMakeLists.txt b/src/platform/library/CMakeLists.txt index f50652cab55d..ffc7649998c6 100644 --- a/src/platform/library/CMakeLists.txt +++ b/src/platform/library/CMakeLists.txt @@ -3,4 +3,8 @@ add_subdirectory(lib) add_subdirectory(schedule) -add_local_sources(sof panic.c init.c) +add_local_sources(sof + panic.c + platform.c + init.c +) diff --git a/src/platform/library/include/platform/lib/dma.h b/src/platform/library/include/platform/lib/dma.h index 4a2100b3da59..510df4301d31 100644 --- a/src/platform/library/include/platform/lib/dma.h +++ b/src/platform/library/include/platform/lib/dma.h @@ -2,7 +2,7 @@ * * Copyright(c) 2016 Intel Corporation. All rights reserved. * - * Author: Liam Girdwood + * Author: Curtis Malainey */ #ifdef __SOF_LIB_DMA_H__ diff --git a/src/platform/library/lib/CMakeLists.txt b/src/platform/library/lib/CMakeLists.txt index abcb33c050cf..d057b38341ff 100644 --- a/src/platform/library/lib/CMakeLists.txt +++ b/src/platform/library/lib/CMakeLists.txt @@ -3,6 +3,7 @@ add_local_sources(sof alloc.c clk.c + dai.c pm_runtime.c ) diff --git a/src/platform/library/lib/dai.c b/src/platform/library/lib/dai.c new file mode 100644 index 000000000000..10d491bfbfa9 --- /dev/null +++ b/src/platform/library/lib/dai.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright(c) 2020 Google Inc. All rights reserved. +// +// Author: Curtis Malainey + +#include +#include + +const struct dai_type_info dti[] = { +}; + +const struct dai_info lib_dai = { + .dai_type_array = dti, + .num_dai_types = ARRAY_SIZE(dti) +}; + +int dai_init(struct sof *sof) +{ + sof->dai_info = &lib_dai; + + return 0; +} diff --git a/src/platform/library/platform.c b/src/platform/library/platform.c new file mode 100644 index 000000000000..8094c6dcb8ed --- /dev/null +++ b/src/platform/library/platform.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright(c) 2020 Google Inc. All rights reserved. +// +// Author: Curtis Malainey + +#include +#include +#include +#include +#include +#include + +SHARED_DATA struct timer timer = {}; + +static void platform_clock_init(struct sof *sof) {} + +static int dmac_init(struct sof *sof) +{ + return 0; +} + +int platform_init(struct sof *sof) +{ + sof->platform_timer = &timer; + sof->cpu_timers = &timer; + + platform_clock_init(sof); + + scheduler_init_edf(); + + /* init low latency timer domain and scheduler */ + /* sof->platform_timer_domain = */ + /* timer_domain_init(sof->platform_timer, PLATFORM_DEFAULT_CLOCK, */ + /* CONFIG_SYSTICK_PERIOD); */ + + /* init the system agent */ + sa_init(sof, CONFIG_SYSTICK_PERIOD); + + /* init DMACs */ + dmac_init(sof); + + /* initialise the host IPC mechanisms */ + ipc_init(sof); + + dai_init(sof); + + return 0; +} diff --git a/tools/oss-fuzz/fuzz_ipc.c b/tools/oss-fuzz/fuzz_ipc.c index fccd18f26571..77cf4d393961 100644 --- a/tools/oss-fuzz/fuzz_ipc.c +++ b/tools/oss-fuzz/fuzz_ipc.c @@ -9,8 +9,6 @@ #include #include #include -#include -#include int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); int LLVMFuzzerInitialize(int *argc, char ***argv); @@ -35,26 +33,18 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) int LLVMFuzzerInitialize(int *argc, char ***argv) { + init_system_notify(sof_get()); + + platform_init(sof_get()); + /* init components */ sys_comp_init(sof_get()); + /* init self-registered modules */ + /* sys_module_init(); */ + /* other necessary initializations, todo: follow better SOF init */ pipeline_posn_init(sof_get()); - init_system_notify(sof_get()); - scheduler_init_edf(); - sa_init(sof_get(), CONFIG_SYSTICK_PERIOD); - - /* init IPC */ - if (ipc_init(sof_get()) < 0) { - fprintf(stderr, "error: IPC init\n"); - exit(EXIT_FAILURE); - } - - /* init scheduler */ - if (scheduler_init_edf() < 0) { - fprintf(stderr, "error: edf scheduler init\n"); - exit(EXIT_FAILURE); - } return 0; } From 0a7df45e87fb44ebbdb2c047b97dd549adec44e4 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Thu, 15 Oct 2020 16:23:13 -0700 Subject: [PATCH 07/60] library: add trace and shared memory region Trace is enabled by default for library builds, but the module is not included. This breaks the ipc handler. Therefore lets include it and give it a mocked section of memory to write to. Signed-off-by: Curtis Malainey --- src/CMakeLists.txt | 8 +++--- src/arch/host/CMakeLists.txt | 2 +- src/ipc/CMakeLists.txt | 8 +++--- src/lib/CMakeLists.txt | 1 + .../library/include/platform/lib/mailbox.h | 25 +++++++++---------- .../library/include/platform/lib/memory.h | 9 +++---- src/platform/library/lib/trace.c | 20 --------------- src/platform/library/platform.c | 13 ++++++++++ src/trace/trace.c | 2 +- tools/oss-fuzz/fuzz_ipc.c | 2 ++ 10 files changed, 41 insertions(+), 49 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20c878dd33d0..e9bf2605aee0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,10 @@ endif() add_local_sources(sof spinlock.c) add_subdirectory(drivers) +if (CONFIG_TRACE) + add_subdirectory(trace) +endif() + if(CONFIG_LIBRARY) return() endif() @@ -20,10 +24,6 @@ add_subdirectory(debug) add_subdirectory(init) add_subdirectory(schedule) -if (CONFIG_TRACE) - add_subdirectory(trace) -endif() - if (CONFIG_PROBE) add_subdirectory(probe) endif() diff --git a/src/arch/host/CMakeLists.txt b/src/arch/host/CMakeLists.txt index f738d5f03eb7..1efa0f14536e 100644 --- a/src/arch/host/CMakeLists.txt +++ b/src/arch/host/CMakeLists.txt @@ -6,6 +6,6 @@ target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/sr # C & ASM flags target_compile_options(sof_options INTERFACE -g -O3 -Wall -Werror -Wmissing-prototypes - -Wimplicit-fallthrough -Wpointer-arith -DCONFIG_LIBRARY "-imacros${CONFIG_H_PATH}") + -Wimplicit-fallthrough -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wpointer-arith -DCONFIG_LIBRARY "-imacros${CONFIG_H_PATH}") add_subdirectory(lib) diff --git a/src/ipc/CMakeLists.txt b/src/ipc/CMakeLists.txt index ad3b70a9ef52..9fe847438b80 100644 --- a/src/ipc/CMakeLists.txt +++ b/src/ipc/CMakeLists.txt @@ -5,15 +5,15 @@ add_local_sources(sof handler.c ) -if (CONFIG_LIBRARY) - return() -endif() - if (CONFIG_TRACE) add_local_sources(sof dma-copy.c) endif() +if (CONFIG_LIBRARY) + return() +endif() + if (CONFIG_HOST_PTABLE) add_local_sources(sof ipc-host-ptable.c) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 998ac4e1db31..fd5063570bd2 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -4,6 +4,7 @@ if(CONFIG_LIBRARY) add_local_sources(sof lib.c dai.c + dma.c notifier.c agent.c) return() diff --git a/src/platform/library/include/platform/lib/mailbox.h b/src/platform/library/include/platform/lib/mailbox.h index 0c9367a3d1bb..7d8376561d67 100644 --- a/src/platform/library/include/platform/lib/mailbox.h +++ b/src/platform/library/include/platform/lib/mailbox.h @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright(c) 2016 Intel Corporation. All rights reserved. + * Copyright(c) 2020 Google Inc. All rights reserved. * - * Author: Liam Girdwood + * Author: Curtis Malainey */ #ifdef __SOF_LIB_MAILBOX_H__ @@ -14,20 +14,19 @@ #include #include -#define MAILBOX_HOST_OFFSET 0x144000 +#define MAILBOX_DSPBOX_OFFSET 0x0 +#define MAILBOX_DSPBOX_SIZE 0x400 +#define MAILBOX_DSPBOX_BASE \ + (MAILBOX_BASE + MAILBOX_DSPBOX_OFFSET) -#define MAILBOX_OUTBOX_OFFSET 0x0 -#define MAILBOX_OUTBOX_SIZE 0x400 -#define MAILBOX_OUTBOX_BASE \ - (MAILBOX_BASE + MAILBOX_OUTBOX_OFFSET) - -#define MAILBOX_INBOX_OFFSET MAILBOX_OUTBOX_SIZE -#define MAILBOX_INBOX_SIZE 0x400 -#define MAILBOX_INBOX_BASE \ - (MAILBOX_BASE + MAILBOX_INBOX_OFFSET) +#define MAILBOX_HOSTBOX_OFFSET \ + (MAILBOX_DSPBOX_SIZE + MAILBOX_DSPBOX_OFFSET) +#define MAILBOX_HOSTBOX_SIZE 0x400 +#define MAILBOX_HOSTBOX_BASE \ + (MAILBOX_BASE + MAILBOX_HOSTBOX_OFFSET) #define MAILBOX_EXCEPTION_OFFSET \ - (MAILBOX_INBOX_SIZE + MAILBOX_OUTBOX_SIZE) + (MAILBOX_HOSTBOX_SIZE + MAILBOX_HOSTBOX_OFFSET) #define MAILBOX_EXCEPTION_SIZE 0x100 #define MAILBOX_EXCEPTION_BASE \ (MAILBOX_BASE + MAILBOX_EXCEPTION_OFFSET) diff --git a/src/platform/library/include/platform/lib/memory.h b/src/platform/library/include/platform/lib/memory.h index d96439ff0e00..4dd373da9aa3 100644 --- a/src/platform/library/include/platform/lib/memory.h +++ b/src/platform/library/include/platform/lib/memory.h @@ -17,12 +17,9 @@ #define HEAP_BUFFER_SIZE (1024 * 128) #define SOF_STACK_SIZE 0x1000 -#define MAILBOX_DSPBOX_BASE 0 -#define MAILBOX_DSPBOX_SIZE 0x400 -#define MAILBOX_HOSTBOX_BASE 0 -#define MAILBOX_HOSTBOX_SIZE 0x400 -#define MAILBOX_BASE 0 -#define MAILBOX_BASE_SIZE 0x400 +uint8_t *get_library_mailbox(void); + +#define MAILBOX_BASE get_library_mailbox() #define PLATFORM_HEAP_SYSTEM 1 #define PLATFORM_HEAP_SYSTEM_RUNTIME 1 diff --git a/src/platform/library/lib/trace.c b/src/platform/library/lib/trace.c index 68b2aa9039d7..fdd00b7777b6 100644 --- a/src/platform/library/lib/trace.c +++ b/src/platform/library/lib/trace.c @@ -24,23 +24,3 @@ char *get_trace_class(uint32_t trace_class) */ return "unknown"; } - -struct sof_ipc_trace_filter_elem *trace_filter_fill(struct sof_ipc_trace_filter_elem *elem, - struct sof_ipc_trace_filter_elem *end, - struct trace_filter *filter) -{ - return NULL; -} - -int trace_filter_update(const struct trace_filter *filter) -{ - return 0; -} - -int dma_trace_enable(struct dma_trace_data *d) -{ - return 0; -} - -void trace_off(void) { } -void trace_on(void) { } diff --git a/src/platform/library/platform.c b/src/platform/library/platform.c index 8094c6dcb8ed..3aff98c3be9d 100644 --- a/src/platform/library/platform.c +++ b/src/platform/library/platform.c @@ -10,9 +10,22 @@ #include #include #include +#include SHARED_DATA struct timer timer = {}; +static uint8_t mailbox[MAILBOX_DSPBOX_SIZE + + MAILBOX_HOSTBOX_SIZE + + MAILBOX_EXCEPTION_SIZE + + MAILBOX_DEBUG_SIZE + + MAILBOX_STREAM_SIZE + + MAILBOX_TRACE_SIZE]; + +uint8_t *get_library_mailbox() +{ + return mailbox; +} + static void platform_clock_init(struct sof *sof) {} static int dmac_init(struct sof *sof) diff --git a/src/trace/trace.c b/src/trace/trace.c index e84e4c36e38d..3dd9caa5b25e 100644 --- a/src/trace/trace.c +++ b/src/trace/trace.c @@ -371,7 +371,7 @@ struct sof_ipc_trace_filter_elem *trace_filter_fill(struct sof_ipc_trace_filter_ /* update global components, which tr_ctx is stored inside special section */ static int trace_filter_update_global(int32_t log_level, uint32_t uuid_id) { -#ifndef __ZEPHYR__ +#if !defined(__ZEPHYR__) && !defined(CONFIG_LIBRARY) extern void *_trace_ctx_start; extern void *_trace_ctx_end; struct tr_ctx *ptr = (struct tr_ctx *)&_trace_ctx_start; diff --git a/tools/oss-fuzz/fuzz_ipc.c b/tools/oss-fuzz/fuzz_ipc.c index 77cf4d393961..af048ef03d1c 100644 --- a/tools/oss-fuzz/fuzz_ipc.c +++ b/tools/oss-fuzz/fuzz_ipc.c @@ -35,6 +35,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) { init_system_notify(sof_get()); + trace_init(sof_get()); + platform_init(sof_get()); /* init components */ From 68232067617000d8a69d6d98505565c4b047b005 Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Wed, 9 Dec 2020 18:28:24 -0800 Subject: [PATCH 08/60] oss-fuzz: add seed corpus There are simply a dump of a series of messages from the kernel of messages sent to the firmware. This will be used by the fuzzer to infer inputs to tests against the the firmware. Signed-off-by: Curtis Malainey --- .../000dbd6d7fe5924ffee8319ec71392a55980fb7e | Bin 0 -> 16 bytes .../024f5a55b6a0a2d0aa37a867f3007319fe8d8aab | Bin 0 -> 16 bytes .../03a2e4125e49ee265c06959ecc4e04983c11dcc3 | Bin 0 -> 48 bytes .../04d1e990e7f6f6073bd6560ec0579815b38b76e9 | Bin 0 -> 16 bytes .../06e9c5ae8bf583498da6dca0f08bd4e5f21373a0 | Bin 0 -> 44 bytes .../0999e2a1308637ce377333a9400b5367c79c1c49 | Bin 0 -> 108 bytes .../0b0d4c405976a4bd5858128e889e8ed73d7157c8 | Bin 0 -> 100 bytes .../0b37b80390e031a4d7b0477af41ce2c76ea61b6f | Bin 0 -> 12 bytes .../0e4dea007187b70daeb212a5e5f9055f9a2461ca | Bin 0 -> 44 bytes .../0eb97f636ea5985bf064ca0e96c4904d80d45daf | Bin 0 -> 44 bytes .../0ec8562550df42363ccbf8744e08a9bba1002ba1 | Bin 0 -> 44 bytes .../10b5045fac194f7963f5a4be9a5fefcecc43ed76 | Bin 0 -> 48 bytes .../13b8f112e9829e5b0a2ff0f64f6eeb646bc3f892 | Bin 0 -> 16 bytes .../162b781e04951895debfd7cf310ce60f33b624b2 | Bin 0 -> 148 bytes .../17eadf27a2ab80972f162e017d9ae4ce6499ecef | Bin 0 -> 156 bytes .../1ceb066475c97dc299992377e57891882d5e8042 | Bin 0 -> 12 bytes .../1d316f33ea62302029276fab4aa77afc48272383 | Bin 0 -> 44 bytes .../1e575a4d9e163d9a35f211ec70b18954287436cb | Bin 0 -> 96 bytes .../1e8db4cbd0bdc10e83af243cc3195ec250898bfa | Bin 0 -> 16 bytes .../2129427c5b7bc159be30d45702e6fb5a564957db | Bin 0 -> 12 bytes .../21ae19b1eb764e680cc870f04e101155f3b7192c | Bin 0 -> 16 bytes .../24fcf245cb6e5b80bbeb355e5d35a1d95b58ef22 | Bin 0 -> 16 bytes .../27c614d7d9915070cec6bc60eb2c10084c1cc62a | Bin 0 -> 16 bytes .../2a2b83be983659822829e65ec1698d73cc182e8b | Bin 0 -> 16 bytes .../2c95547f3b4d9837fbe6aa1294a6242a75f311df | Bin 0 -> 92 bytes .../2dbffde98d5997c49a73f5550226d3732ee0f18b | Bin 0 -> 96 bytes .../2f86b1e44285c748c41db6b9326690a80d3a6204 | Bin 0 -> 44 bytes .../3184213ef341e6940f66f2cd362c2f9ceabc2a42 | Bin 0 -> 96 bytes .../3187d342231c367570b9bfe132c0093f4ca4d9bd | Bin 0 -> 44 bytes .../343f52ee362034f099230357e7249ea332d8418e | Bin 0 -> 16 bytes .../35272d2839d93051faa6dab657e2ffbf503aab29 | Bin 0 -> 44 bytes .../355ce0b17a465485fd2fea359abbf3fd592f4cab | Bin 0 -> 216 bytes .../3849223081e37127ee85e614cb1cd1991f7767db | Bin 0 -> 216 bytes .../3970aa6db6ebc1a55fb14522f9f6bb3c0beff791 | Bin 0 -> 44 bytes .../3cc743c8da6f68849a0fe55fa7cd927e8b452315 | Bin 0 -> 44 bytes .../3f23dfed884e1f2d93f30a507d615d601516579f | Bin 0 -> 16 bytes .../40d6636c3ce5fb57c1a93676159c181b50108c14 | Bin 0 -> 216 bytes .../41ce8b0fcc7cbc04074750e52227c6ed641f4f1a | Bin 0 -> 16 bytes .../436f5c7c05eb6fedb2601b5dd4ce4eb6f39eff75 | Bin 0 -> 108 bytes .../477defa36d6b8c1027344047f0fe7de574177235 | Bin 0 -> 16 bytes .../485a1fe8eaa73563d5833d5a99c064c30bbbbce4 | Bin 0 -> 140 bytes .../4a66ce17f49c87f36ce94d8ca9f5450fd628e6d3 | Bin 0 -> 156 bytes .../4a72cb387eeb817b5c3de745ab4b24eaba9e4a14 | Bin 0 -> 100 bytes .../4bd137ef6fdf143d50b0013a36bdee1742b9afa1 | Bin 0 -> 44 bytes .../4c882c4819e15136757b6953f7e9f58af107e0e3 | Bin 0 -> 16 bytes .../4e659c34d50b894405046d47b6a72686b1a1c09a | Bin 0 -> 216 bytes .../4fe0b07c89550b8490bd0b017d3e041d2d1ddd3e | Bin 0 -> 16 bytes .../506e037b0fb18b8d9dcc1baaf6e5107af54b3c89 | Bin 0 -> 12 bytes .../538df3b6469f71c8d24b8f902fbf2d67ac939e6f | Bin 0 -> 48 bytes .../5465bf117b81b5f0831e6fc6520b6ab43a5afe31 | Bin 0 -> 16 bytes .../546d444b0485cffe05b70f32e8bb892fa3f9169f | Bin 0 -> 16 bytes .../5c6d240f266f8ba981618446cbb733ce39cce4ba | Bin 0 -> 12 bytes .../5f7468b131223b1be92d926a3a3dbd254b2ceba8 | Bin 0 -> 16 bytes .../5f8344b603872fae8d662fd141adb6d5a5a29a5c | Bin 0 -> 48 bytes .../60aa86b382f9745796ddc252308476f9f1458da7 | Bin 0 -> 12 bytes .../63557cc6cb735a1177656b45b23fffc58b4a175d | Bin 0 -> 16 bytes .../63fb579839e5419a8f1edcffe34415681a6e57bd | Bin 0 -> 12 bytes .../66ebfa0a1d185551c2c89e812fba00da3894319f | Bin 0 -> 16 bytes .../67e682378b02151cf2e155705bb984279793adf3 | Bin 0 -> 96 bytes .../69eb34e1b3387924cfa914a9fcee01ff3879fe9e | Bin 0 -> 16 bytes .../6fcfd052d0f6d8790c40dfaccded456d61bc2564 | Bin 0 -> 96 bytes .../7038c3d73d7194ffcd506db6e07737421064ab9b | Bin 0 -> 16 bytes .../70a4c387ec37de44de5966267dab7ee415b67b9d | Bin 0 -> 48 bytes .../71df89d7b5bc70bff37a80e6ad467c9898e8bd30 | Bin 0 -> 12 bytes .../73700ed7898804a3320c189a6ba9f2d20100eb4e | Bin 0 -> 96 bytes .../73d1b19c297eac0039ef78869d74999c67e77622 | Bin 0 -> 76 bytes .../740f4253b0bf19ea16a6d13b041caf2835020e18 | Bin 0 -> 140 bytes .../77b94d3c8296d5b7d8c99ebcadd6ee67868b8e1c | Bin 0 -> 44 bytes .../7d1a20552952e47cbf39908c1bffb00b7302169e | Bin 0 -> 44 bytes .../7d9845953f99ea8c396386476ea85e4b5b107969 | Bin 0 -> 12 bytes .../7eb33f788db8ad24e8769e5978b45730f7049ef8 | Bin 0 -> 92 bytes .../7f3fe1f4113cf33bd137cf065e5d3acf82fede7a | Bin 0 -> 96 bytes .../7f8aa82710ffbd9733f0228c2aef8affbd68bb0a | Bin 0 -> 44 bytes .../7fa1ff78ff77a1acffd887d2d1d1b314cbbff7dd | Bin 0 -> 16 bytes .../806ed5c583d7d56ecf1dead586eb9c36e385593a | Bin 0 -> 44 bytes .../843e5c7b5c0134cbf7710a6cad7c4195f34bd911 | Bin 0 -> 44 bytes .../84e49ceb4016f3cec541adcf78311de41ab7f638 | Bin 0 -> 16 bytes .../8533b6c401ae98b3b6eadddce568e34bdada1f56 | Bin 0 -> 92 bytes .../88f9282d86dceb30d53bb9e1f4d784643aa2ba94 | Bin 0 -> 92 bytes .../893d2ace1d754b1588b68f370e0f39dc6df4a944 | Bin 0 -> 16 bytes .../89840b31b6373ed7aa54f3ee0aec8629cbeb716b | Bin 0 -> 92 bytes .../8ad254686dfe5af2d4eddacab07773b518c5aaa5 | Bin 0 -> 100 bytes .../8d1fae7291a89f2328c0ffede5db6b754cd82f70 | Bin 0 -> 108 bytes .../8ef1ccb4fab7ae53db309457275bb0ea29f938d4 | Bin 0 -> 44 bytes .../90d64dad63490c4ac33011d565f2cacdc9ce9d8c | Bin 0 -> 16 bytes .../91ab8ff2cbf88e5b8dbaa1e5dc47a576a722e1a4 | Bin 0 -> 48 bytes .../93063fda9ff7aa467f9f253f56346a2575447229 | Bin 0 -> 16 bytes .../953a6b71c70235334c6cdc6cc5c1e10d7dfa8a0b | Bin 0 -> 16 bytes .../9a3b92151da3d1c4d4e6628caf0d8717203a06a0 | Bin 0 -> 92 bytes .../9aac5d8a1ba4a283680e7f6950824d8a2fedca79 | Bin 0 -> 44 bytes .../9b057f01c05d31bcb3af5fd9ebe2e373df8f11de | Bin 0 -> 44 bytes .../9c02ee0cb2dbb37c817fff2c0bc37a0bd448bb9a | Bin 0 -> 16 bytes .../9cf5d993ce813b4f6e8dbfcedeaa73266b945d97 | Bin 0 -> 124 bytes .../a053735ea619205146eccdafc5d7282b24591b6f | Bin 0 -> 96 bytes .../a4712f3b0fc4d44c261fbd57b5b5d7eb0d807c09 | Bin 0 -> 12 bytes .../a54e5e62124abd54dd9d5e6a58e8a5c67f87a74c | Bin 0 -> 44 bytes .../a73cbe65c7a589a2335d074451a921634c923135 | Bin 0 -> 12 bytes .../a89ae2cf7c6cacf98fc31073edea8ba382f59ec0 | Bin 0 -> 16 bytes .../aa5da635d384a9b700618b3bf16f4a746ea0ae02 | Bin 0 -> 16 bytes .../ac3237f321da5b5afda68331f6280c693e38691f | Bin 0 -> 16 bytes .../ad6629ff824cb4e365f7326f616963441e85f2dd | Bin 0 -> 16 bytes .../b01c77c931b5a815c5e1708c1cb822be2359b920 | Bin 0 -> 16 bytes .../b22a25ff9158654f3d15249cbcf6d40ac6cf41ca | Bin 0 -> 96 bytes .../b6c23a07f722173b38dc4023ad6ccec6881e9e80 | Bin 0 -> 108 bytes .../bafa9c04ffc79d2da4033283ec947a526e4aa3ac | Bin 0 -> 108 bytes .../bddd9a690dca1d9c5dcf71969194c825e9095f1c | Bin 0 -> 164 bytes .../bf3bb8faa80242fe14b91d44847ed991b03196bf | Bin 0 -> 96 bytes .../bfd8bca17218780d1a98daf1723d4ef5521a8590 | Bin 0 -> 92 bytes .../c0a9d76a8bfcca5af2edc9850e16d84e804528ab | Bin 0 -> 16 bytes .../c1c0442be18fae000ab7e6056ce17131d4c811f0 | Bin 0 -> 92 bytes .../c28adb709a71bb331c00090adadff0eb33c78e3e | Bin 0 -> 16 bytes .../c434e648fa1cda6ddf10c6334699bcdaad26bd39 | Bin 0 -> 44 bytes .../c5a91a1353d25c746a2677da2d259ee73e89829a | Bin 0 -> 128 bytes .../c7225f46c138471307ab06407b95f9a2f5bddd3b | Bin 0 -> 216 bytes .../c7b09b124fdeadd9c2ad70c0ba5fa74ffa6f62d9 | Bin 0 -> 48 bytes .../c7cff97cb529670bf6f8757a9de27580a0e1cdc1 | Bin 0 -> 48 bytes .../c9d6ada7c5ac121732efc1d7a21d0ae3d908b29b | Bin 0 -> 92 bytes .../cd2f7b558b99c6c043f40a6b3094023f951edb7c | Bin 0 -> 100 bytes .../cdeed12cfd64ae67614c7ef51b209b9cd539abc7 | Bin 0 -> 16 bytes .../cdfccbfc07a1dccda9d23c4a101773bc004f189b | Bin 0 -> 16 bytes .../ce0807d15997f1495d92237df487dc7110844e7e | Bin 0 -> 16 bytes .../d0967b8c5bbff4e80e2b475ae84e1d3bb375db47 | Bin 0 -> 136 bytes .../d0bf265bcb8b9c9324e21849786d4fd9b92210e7 | Bin 0 -> 16 bytes .../d0e4f629e9d8d85c416b9577dce60e95cd3f8bcc | Bin 0 -> 216 bytes .../d2ac15660b67f3183d915f46ffebe4d11814c483 | Bin 0 -> 100 bytes .../d38a7e262a456117cf25b68166051c646ac5acd7 | Bin 0 -> 216 bytes .../d6b71c4b3ace35284453fcf257b09f1622dcda80 | Bin 0 -> 100 bytes .../d818880901e644d0fbc5d2f2a819c57147d42fc2 | Bin 0 -> 16 bytes .../da39a3ee5e6b4b0d3255bfef95601890afd80709 | 0 .../daef2d805970080c022efb842446e80bf12e9064 | Bin 0 -> 16 bytes .../e2329f312c39d5c88db4a7782c42e8532d6a705a | Bin 0 -> 16 bytes .../e34a2209d7aeae9930612f4c2a25da9ed3757dd0 | Bin 0 -> 216 bytes .../e8245c3a4468316ea7f9c1913431c2675e3d7046 | Bin 0 -> 148 bytes .../e879a5dc16f37cae5480bf63aacab45230b2ea14 | Bin 0 -> 16 bytes .../e9f7159631e0e3348271a87c3a5bcacd857abc78 | Bin 0 -> 44 bytes .../ea95b2435e3ab3d4d13d289f8f7c0ae029276b2d | Bin 0 -> 16 bytes .../eae43cba43779667b313737eb73006b17615b344 | Bin 0 -> 48 bytes .../ee2e51d2ceb5b5b284384597b8a20572d4c9f419 | Bin 0 -> 148 bytes .../ef05ce8ce4e21d0f18d9128dc8f238a4afccac93 | Bin 0 -> 100 bytes .../f3b72df75c2bfd9c3d096f2a531e86175ee54610 | Bin 0 -> 92 bytes .../f4562c1ee8e285a9c8c6db5d56a7f22fd0585f34 | Bin 0 -> 44 bytes .../f55f896f8efc3282c3a361a67a20580b8762d07d | Bin 0 -> 108 bytes .../f99ba9356c00cb0e4d8c678cfa161edb7b7d92fb | Bin 0 -> 48 bytes .../fc153129007f676a5484725e7c0752ecb68184b5 | Bin 0 -> 124 bytes .../fd3db2b2fd33aba155037bfcf8a4c2e07e03f54c | Bin 0 -> 108 bytes .../fe3c323efd1109949dfe07d78a733844265ceee7 | Bin 0 -> 48 bytes .../ffb20a03769e52b39f6a28f9ddb78073d2dccc33 | Bin 0 -> 16 bytes 147 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tools/oss-fuzz/corpus/000dbd6d7fe5924ffee8319ec71392a55980fb7e create mode 100644 tools/oss-fuzz/corpus/024f5a55b6a0a2d0aa37a867f3007319fe8d8aab create mode 100644 tools/oss-fuzz/corpus/03a2e4125e49ee265c06959ecc4e04983c11dcc3 create mode 100644 tools/oss-fuzz/corpus/04d1e990e7f6f6073bd6560ec0579815b38b76e9 create mode 100644 tools/oss-fuzz/corpus/06e9c5ae8bf583498da6dca0f08bd4e5f21373a0 create mode 100644 tools/oss-fuzz/corpus/0999e2a1308637ce377333a9400b5367c79c1c49 create mode 100644 tools/oss-fuzz/corpus/0b0d4c405976a4bd5858128e889e8ed73d7157c8 create mode 100644 tools/oss-fuzz/corpus/0b37b80390e031a4d7b0477af41ce2c76ea61b6f create mode 100644 tools/oss-fuzz/corpus/0e4dea007187b70daeb212a5e5f9055f9a2461ca create mode 100644 tools/oss-fuzz/corpus/0eb97f636ea5985bf064ca0e96c4904d80d45daf create mode 100644 tools/oss-fuzz/corpus/0ec8562550df42363ccbf8744e08a9bba1002ba1 create mode 100644 tools/oss-fuzz/corpus/10b5045fac194f7963f5a4be9a5fefcecc43ed76 create mode 100644 tools/oss-fuzz/corpus/13b8f112e9829e5b0a2ff0f64f6eeb646bc3f892 create mode 100644 tools/oss-fuzz/corpus/162b781e04951895debfd7cf310ce60f33b624b2 create mode 100644 tools/oss-fuzz/corpus/17eadf27a2ab80972f162e017d9ae4ce6499ecef create mode 100644 tools/oss-fuzz/corpus/1ceb066475c97dc299992377e57891882d5e8042 create mode 100644 tools/oss-fuzz/corpus/1d316f33ea62302029276fab4aa77afc48272383 create mode 100644 tools/oss-fuzz/corpus/1e575a4d9e163d9a35f211ec70b18954287436cb create mode 100644 tools/oss-fuzz/corpus/1e8db4cbd0bdc10e83af243cc3195ec250898bfa create mode 100644 tools/oss-fuzz/corpus/2129427c5b7bc159be30d45702e6fb5a564957db create mode 100644 tools/oss-fuzz/corpus/21ae19b1eb764e680cc870f04e101155f3b7192c create mode 100644 tools/oss-fuzz/corpus/24fcf245cb6e5b80bbeb355e5d35a1d95b58ef22 create mode 100644 tools/oss-fuzz/corpus/27c614d7d9915070cec6bc60eb2c10084c1cc62a create mode 100644 tools/oss-fuzz/corpus/2a2b83be983659822829e65ec1698d73cc182e8b create mode 100644 tools/oss-fuzz/corpus/2c95547f3b4d9837fbe6aa1294a6242a75f311df create mode 100644 tools/oss-fuzz/corpus/2dbffde98d5997c49a73f5550226d3732ee0f18b create mode 100644 tools/oss-fuzz/corpus/2f86b1e44285c748c41db6b9326690a80d3a6204 create mode 100644 tools/oss-fuzz/corpus/3184213ef341e6940f66f2cd362c2f9ceabc2a42 create mode 100644 tools/oss-fuzz/corpus/3187d342231c367570b9bfe132c0093f4ca4d9bd create mode 100644 tools/oss-fuzz/corpus/343f52ee362034f099230357e7249ea332d8418e create mode 100644 tools/oss-fuzz/corpus/35272d2839d93051faa6dab657e2ffbf503aab29 create mode 100644 tools/oss-fuzz/corpus/355ce0b17a465485fd2fea359abbf3fd592f4cab create mode 100644 tools/oss-fuzz/corpus/3849223081e37127ee85e614cb1cd1991f7767db create mode 100644 tools/oss-fuzz/corpus/3970aa6db6ebc1a55fb14522f9f6bb3c0beff791 create mode 100644 tools/oss-fuzz/corpus/3cc743c8da6f68849a0fe55fa7cd927e8b452315 create mode 100644 tools/oss-fuzz/corpus/3f23dfed884e1f2d93f30a507d615d601516579f create mode 100644 tools/oss-fuzz/corpus/40d6636c3ce5fb57c1a93676159c181b50108c14 create mode 100644 tools/oss-fuzz/corpus/41ce8b0fcc7cbc04074750e52227c6ed641f4f1a create mode 100644 tools/oss-fuzz/corpus/436f5c7c05eb6fedb2601b5dd4ce4eb6f39eff75 create mode 100644 tools/oss-fuzz/corpus/477defa36d6b8c1027344047f0fe7de574177235 create mode 100644 tools/oss-fuzz/corpus/485a1fe8eaa73563d5833d5a99c064c30bbbbce4 create mode 100644 tools/oss-fuzz/corpus/4a66ce17f49c87f36ce94d8ca9f5450fd628e6d3 create mode 100644 tools/oss-fuzz/corpus/4a72cb387eeb817b5c3de745ab4b24eaba9e4a14 create mode 100644 tools/oss-fuzz/corpus/4bd137ef6fdf143d50b0013a36bdee1742b9afa1 create mode 100644 tools/oss-fuzz/corpus/4c882c4819e15136757b6953f7e9f58af107e0e3 create mode 100644 tools/oss-fuzz/corpus/4e659c34d50b894405046d47b6a72686b1a1c09a create mode 100644 tools/oss-fuzz/corpus/4fe0b07c89550b8490bd0b017d3e041d2d1ddd3e create mode 100644 tools/oss-fuzz/corpus/506e037b0fb18b8d9dcc1baaf6e5107af54b3c89 create mode 100644 tools/oss-fuzz/corpus/538df3b6469f71c8d24b8f902fbf2d67ac939e6f create mode 100644 tools/oss-fuzz/corpus/5465bf117b81b5f0831e6fc6520b6ab43a5afe31 create mode 100644 tools/oss-fuzz/corpus/546d444b0485cffe05b70f32e8bb892fa3f9169f create mode 100644 tools/oss-fuzz/corpus/5c6d240f266f8ba981618446cbb733ce39cce4ba create mode 100644 tools/oss-fuzz/corpus/5f7468b131223b1be92d926a3a3dbd254b2ceba8 create mode 100644 tools/oss-fuzz/corpus/5f8344b603872fae8d662fd141adb6d5a5a29a5c create mode 100644 tools/oss-fuzz/corpus/60aa86b382f9745796ddc252308476f9f1458da7 create mode 100644 tools/oss-fuzz/corpus/63557cc6cb735a1177656b45b23fffc58b4a175d create mode 100644 tools/oss-fuzz/corpus/63fb579839e5419a8f1edcffe34415681a6e57bd create mode 100644 tools/oss-fuzz/corpus/66ebfa0a1d185551c2c89e812fba00da3894319f create mode 100644 tools/oss-fuzz/corpus/67e682378b02151cf2e155705bb984279793adf3 create mode 100644 tools/oss-fuzz/corpus/69eb34e1b3387924cfa914a9fcee01ff3879fe9e create mode 100644 tools/oss-fuzz/corpus/6fcfd052d0f6d8790c40dfaccded456d61bc2564 create mode 100644 tools/oss-fuzz/corpus/7038c3d73d7194ffcd506db6e07737421064ab9b create mode 100644 tools/oss-fuzz/corpus/70a4c387ec37de44de5966267dab7ee415b67b9d create mode 100644 tools/oss-fuzz/corpus/71df89d7b5bc70bff37a80e6ad467c9898e8bd30 create mode 100644 tools/oss-fuzz/corpus/73700ed7898804a3320c189a6ba9f2d20100eb4e create mode 100644 tools/oss-fuzz/corpus/73d1b19c297eac0039ef78869d74999c67e77622 create mode 100644 tools/oss-fuzz/corpus/740f4253b0bf19ea16a6d13b041caf2835020e18 create mode 100644 tools/oss-fuzz/corpus/77b94d3c8296d5b7d8c99ebcadd6ee67868b8e1c create mode 100644 tools/oss-fuzz/corpus/7d1a20552952e47cbf39908c1bffb00b7302169e create mode 100644 tools/oss-fuzz/corpus/7d9845953f99ea8c396386476ea85e4b5b107969 create mode 100644 tools/oss-fuzz/corpus/7eb33f788db8ad24e8769e5978b45730f7049ef8 create mode 100644 tools/oss-fuzz/corpus/7f3fe1f4113cf33bd137cf065e5d3acf82fede7a create mode 100644 tools/oss-fuzz/corpus/7f8aa82710ffbd9733f0228c2aef8affbd68bb0a create mode 100644 tools/oss-fuzz/corpus/7fa1ff78ff77a1acffd887d2d1d1b314cbbff7dd create mode 100644 tools/oss-fuzz/corpus/806ed5c583d7d56ecf1dead586eb9c36e385593a create mode 100644 tools/oss-fuzz/corpus/843e5c7b5c0134cbf7710a6cad7c4195f34bd911 create mode 100644 tools/oss-fuzz/corpus/84e49ceb4016f3cec541adcf78311de41ab7f638 create mode 100644 tools/oss-fuzz/corpus/8533b6c401ae98b3b6eadddce568e34bdada1f56 create mode 100644 tools/oss-fuzz/corpus/88f9282d86dceb30d53bb9e1f4d784643aa2ba94 create mode 100644 tools/oss-fuzz/corpus/893d2ace1d754b1588b68f370e0f39dc6df4a944 create mode 100644 tools/oss-fuzz/corpus/89840b31b6373ed7aa54f3ee0aec8629cbeb716b create mode 100644 tools/oss-fuzz/corpus/8ad254686dfe5af2d4eddacab07773b518c5aaa5 create mode 100644 tools/oss-fuzz/corpus/8d1fae7291a89f2328c0ffede5db6b754cd82f70 create mode 100644 tools/oss-fuzz/corpus/8ef1ccb4fab7ae53db309457275bb0ea29f938d4 create mode 100644 tools/oss-fuzz/corpus/90d64dad63490c4ac33011d565f2cacdc9ce9d8c create mode 100644 tools/oss-fuzz/corpus/91ab8ff2cbf88e5b8dbaa1e5dc47a576a722e1a4 create mode 100644 tools/oss-fuzz/corpus/93063fda9ff7aa467f9f253f56346a2575447229 create mode 100644 tools/oss-fuzz/corpus/953a6b71c70235334c6cdc6cc5c1e10d7dfa8a0b create mode 100644 tools/oss-fuzz/corpus/9a3b92151da3d1c4d4e6628caf0d8717203a06a0 create mode 100644 tools/oss-fuzz/corpus/9aac5d8a1ba4a283680e7f6950824d8a2fedca79 create mode 100644 tools/oss-fuzz/corpus/9b057f01c05d31bcb3af5fd9ebe2e373df8f11de create mode 100644 tools/oss-fuzz/corpus/9c02ee0cb2dbb37c817fff2c0bc37a0bd448bb9a create mode 100644 tools/oss-fuzz/corpus/9cf5d993ce813b4f6e8dbfcedeaa73266b945d97 create mode 100644 tools/oss-fuzz/corpus/a053735ea619205146eccdafc5d7282b24591b6f create mode 100644 tools/oss-fuzz/corpus/a4712f3b0fc4d44c261fbd57b5b5d7eb0d807c09 create mode 100644 tools/oss-fuzz/corpus/a54e5e62124abd54dd9d5e6a58e8a5c67f87a74c create mode 100644 tools/oss-fuzz/corpus/a73cbe65c7a589a2335d074451a921634c923135 create mode 100644 tools/oss-fuzz/corpus/a89ae2cf7c6cacf98fc31073edea8ba382f59ec0 create mode 100644 tools/oss-fuzz/corpus/aa5da635d384a9b700618b3bf16f4a746ea0ae02 create mode 100644 tools/oss-fuzz/corpus/ac3237f321da5b5afda68331f6280c693e38691f create mode 100644 tools/oss-fuzz/corpus/ad6629ff824cb4e365f7326f616963441e85f2dd create mode 100644 tools/oss-fuzz/corpus/b01c77c931b5a815c5e1708c1cb822be2359b920 create mode 100644 tools/oss-fuzz/corpus/b22a25ff9158654f3d15249cbcf6d40ac6cf41ca create mode 100644 tools/oss-fuzz/corpus/b6c23a07f722173b38dc4023ad6ccec6881e9e80 create mode 100644 tools/oss-fuzz/corpus/bafa9c04ffc79d2da4033283ec947a526e4aa3ac create mode 100644 tools/oss-fuzz/corpus/bddd9a690dca1d9c5dcf71969194c825e9095f1c create mode 100644 tools/oss-fuzz/corpus/bf3bb8faa80242fe14b91d44847ed991b03196bf create mode 100644 tools/oss-fuzz/corpus/bfd8bca17218780d1a98daf1723d4ef5521a8590 create mode 100644 tools/oss-fuzz/corpus/c0a9d76a8bfcca5af2edc9850e16d84e804528ab create mode 100644 tools/oss-fuzz/corpus/c1c0442be18fae000ab7e6056ce17131d4c811f0 create mode 100644 tools/oss-fuzz/corpus/c28adb709a71bb331c00090adadff0eb33c78e3e create mode 100644 tools/oss-fuzz/corpus/c434e648fa1cda6ddf10c6334699bcdaad26bd39 create mode 100644 tools/oss-fuzz/corpus/c5a91a1353d25c746a2677da2d259ee73e89829a create mode 100644 tools/oss-fuzz/corpus/c7225f46c138471307ab06407b95f9a2f5bddd3b create mode 100644 tools/oss-fuzz/corpus/c7b09b124fdeadd9c2ad70c0ba5fa74ffa6f62d9 create mode 100644 tools/oss-fuzz/corpus/c7cff97cb529670bf6f8757a9de27580a0e1cdc1 create mode 100644 tools/oss-fuzz/corpus/c9d6ada7c5ac121732efc1d7a21d0ae3d908b29b create mode 100644 tools/oss-fuzz/corpus/cd2f7b558b99c6c043f40a6b3094023f951edb7c create mode 100644 tools/oss-fuzz/corpus/cdeed12cfd64ae67614c7ef51b209b9cd539abc7 create mode 100644 tools/oss-fuzz/corpus/cdfccbfc07a1dccda9d23c4a101773bc004f189b create mode 100644 tools/oss-fuzz/corpus/ce0807d15997f1495d92237df487dc7110844e7e create mode 100644 tools/oss-fuzz/corpus/d0967b8c5bbff4e80e2b475ae84e1d3bb375db47 create mode 100644 tools/oss-fuzz/corpus/d0bf265bcb8b9c9324e21849786d4fd9b92210e7 create mode 100644 tools/oss-fuzz/corpus/d0e4f629e9d8d85c416b9577dce60e95cd3f8bcc create mode 100644 tools/oss-fuzz/corpus/d2ac15660b67f3183d915f46ffebe4d11814c483 create mode 100644 tools/oss-fuzz/corpus/d38a7e262a456117cf25b68166051c646ac5acd7 create mode 100644 tools/oss-fuzz/corpus/d6b71c4b3ace35284453fcf257b09f1622dcda80 create mode 100644 tools/oss-fuzz/corpus/d818880901e644d0fbc5d2f2a819c57147d42fc2 create mode 100644 tools/oss-fuzz/corpus/da39a3ee5e6b4b0d3255bfef95601890afd80709 create mode 100644 tools/oss-fuzz/corpus/daef2d805970080c022efb842446e80bf12e9064 create mode 100644 tools/oss-fuzz/corpus/e2329f312c39d5c88db4a7782c42e8532d6a705a create mode 100644 tools/oss-fuzz/corpus/e34a2209d7aeae9930612f4c2a25da9ed3757dd0 create mode 100644 tools/oss-fuzz/corpus/e8245c3a4468316ea7f9c1913431c2675e3d7046 create mode 100644 tools/oss-fuzz/corpus/e879a5dc16f37cae5480bf63aacab45230b2ea14 create mode 100644 tools/oss-fuzz/corpus/e9f7159631e0e3348271a87c3a5bcacd857abc78 create mode 100644 tools/oss-fuzz/corpus/ea95b2435e3ab3d4d13d289f8f7c0ae029276b2d create mode 100644 tools/oss-fuzz/corpus/eae43cba43779667b313737eb73006b17615b344 create mode 100644 tools/oss-fuzz/corpus/ee2e51d2ceb5b5b284384597b8a20572d4c9f419 create mode 100644 tools/oss-fuzz/corpus/ef05ce8ce4e21d0f18d9128dc8f238a4afccac93 create mode 100644 tools/oss-fuzz/corpus/f3b72df75c2bfd9c3d096f2a531e86175ee54610 create mode 100644 tools/oss-fuzz/corpus/f4562c1ee8e285a9c8c6db5d56a7f22fd0585f34 create mode 100644 tools/oss-fuzz/corpus/f55f896f8efc3282c3a361a67a20580b8762d07d create mode 100644 tools/oss-fuzz/corpus/f99ba9356c00cb0e4d8c678cfa161edb7b7d92fb create mode 100644 tools/oss-fuzz/corpus/fc153129007f676a5484725e7c0752ecb68184b5 create mode 100644 tools/oss-fuzz/corpus/fd3db2b2fd33aba155037bfcf8a4c2e07e03f54c create mode 100644 tools/oss-fuzz/corpus/fe3c323efd1109949dfe07d78a733844265ceee7 create mode 100644 tools/oss-fuzz/corpus/ffb20a03769e52b39f6a28f9ddb78073d2dccc33 diff --git a/tools/oss-fuzz/corpus/000dbd6d7fe5924ffee8319ec71392a55980fb7e b/tools/oss-fuzz/corpus/000dbd6d7fe5924ffee8319ec71392a55980fb7e new file mode 100644 index 0000000000000000000000000000000000000000..2945a62fb85e24779134743c3cd032aed2af8ab1 GIT binary patch literal 16 RcmWe&00CwLQ6MP-!~g@<0BryO literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/024f5a55b6a0a2d0aa37a867f3007319fe8d8aab b/tools/oss-fuzz/corpus/024f5a55b6a0a2d0aa37a867f3007319fe8d8aab new file mode 100644 index 0000000000000000000000000000000000000000..880d6177cc42d52083ab7c0623ae459c6412e432 GIT binary patch literal 16 QcmWe&00CwLMi2?a00Qy=NB{r; literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/03a2e4125e49ee265c06959ecc4e04983c11dcc3 b/tools/oss-fuzz/corpus/03a2e4125e49ee265c06959ecc4e04983c11dcc3 new file mode 100644 index 0000000000000000000000000000000000000000..28d618e8cf81cfb4b782903bf238d4fa90a64f4a GIT binary patch literal 48 hcmXqD0099586e3D#L^%x5WHZ9&>g}M8bmSzF#tQ70yF>s literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/04d1e990e7f6f6073bd6560ec0579815b38b76e9 b/tools/oss-fuzz/corpus/04d1e990e7f6f6073bd6560ec0579815b38b76e9 new file mode 100644 index 0000000000000000000000000000000000000000..58f359af71326ccd4c083610e68e08fc4144a2b2 GIT binary patch literal 16 RcmWe&00CwLRUoMX!~g`A0F3|u literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/06e9c5ae8bf583498da6dca0f08bd4e5f21373a0 b/tools/oss-fuzz/corpus/06e9c5ae8bf583498da6dca0f08bd4e5f21373a0 new file mode 100644 index 0000000000000000000000000000000000000000..7ca0567bcbe1945bb1c3b65ac5919475c771ab2a GIT binary patch literal 44 dcmdO4009L9RUpX&#Oxq03@|e=6vEg*8UP?&0Vx0g literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0999e2a1308637ce377333a9400b5367c79c1c49 b/tools/oss-fuzz/corpus/0999e2a1308637ce377333a9400b5367c79c1c49 new file mode 100644 index 0000000000000000000000000000000000000000..5e2ea62c672d1406ebc3f15ea1e8e4f31e3f4c4c GIT binary patch literal 108 ecmc~{00E`|5Xk`|hy+YTs$*ba1VRvCWB>qB)Bwx? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0b0d4c405976a4bd5858128e889e8ed73d7157c8 b/tools/oss-fuzz/corpus/0b0d4c405976a4bd5858128e889e8ed73d7157c8 new file mode 100644 index 0000000000000000000000000000000000000000..c7947ef2e3ae00036ff7d5dd1d06125439a49d9b GIT binary patch literal 100 zcmYdc00Bk=10cx?#GD{55C{OV3Yf*fzyze3k=Rfsm;%Xx!0`q0VEPx3tV^%k{w2P{ OalOdz6?^x$H30zVXAH3b literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0b37b80390e031a4d7b0477af41ce2c76ea61b6f b/tools/oss-fuzz/corpus/0b37b80390e031a4d7b0477af41ce2c76ea61b6f new file mode 100644 index 0000000000000000000000000000000000000000..1fd152c92434f62bbfb14ceca88b3e3d7f526fc4 GIT binary patch literal 12 Pcmd;K00ChGCm;y`0|o$+ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0e4dea007187b70daeb212a5e5f9055f9a2461ca b/tools/oss-fuzz/corpus/0e4dea007187b70daeb212a5e5f9055f9a2461ca new file mode 100644 index 0000000000000000000000000000000000000000..3dcd516a941e83cf079cc26c0a8e035dd403a6eb GIT binary patch literal 44 dcmdO4009L9Ng&As#H=7L3@|e=6vEg*8UP-30UH1S literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0eb97f636ea5985bf064ca0e96c4904d80d45daf b/tools/oss-fuzz/corpus/0eb97f636ea5985bf064ca0e96c4904d80d45daf new file mode 100644 index 0000000000000000000000000000000000000000..5bd78048109852ac46c1bb837b21c97fb13381d4 GIT binary patch literal 44 dcmdO4009L9W+2G}#Ec*=46rdUIKtRK8UPsD0Mq~g literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/0ec8562550df42363ccbf8744e08a9bba1002ba1 b/tools/oss-fuzz/corpus/0ec8562550df42363ccbf8744e08a9bba1002ba1 new file mode 100644 index 0000000000000000000000000000000000000000..84d4d1e6c4065139ff1a31e9ec6d14cb43a36e72 GIT binary patch literal 44 dcmdO4009L9BOu8G#GD{549GDs6vEg*8UQ2y0aE|~ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/10b5045fac194f7963f5a4be9a5fefcecc43ed76 b/tools/oss-fuzz/corpus/10b5045fac194f7963f5a4be9a5fefcecc43ed76 new file mode 100644 index 0000000000000000000000000000000000000000..a19d45d14cb79ea552b000c1c9101c01b08b946a GIT binary patch literal 48 icmXqD00995At1>N#DX9$5WE0!fS^MdLW4*~AO-+9f&v}@ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/13b8f112e9829e5b0a2ff0f64f6eeb646bc3f892 b/tools/oss-fuzz/corpus/13b8f112e9829e5b0a2ff0f64f6eeb646bc3f892 new file mode 100644 index 0000000000000000000000000000000000000000..91fb8f108293013b084f44ce1fe990252eb798a7 GIT binary patch literal 16 RcmWe&00CwLQy^&s!~g|O0IL81 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/162b781e04951895debfd7cf310ce60f33b624b2 b/tools/oss-fuzz/corpus/162b781e04951895debfd7cf310ce60f33b624b2 new file mode 100644 index 0000000000000000000000000000000000000000..c129889d1f0aa3804a4a6bd716a911f13f3346bc GIT binary patch literal 148 zcmbQj00JxlAd(Tp0%B$mhX9ZuAP1FgBopO%P3tiGc;IpAjg|!pOwJ0hI^Y a#l*-0SDlfu>4<>{pZkJN(Tm6HTcrRSK?sTf literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/1ceb066475c97dc299992377e57891882d5e8042 b/tools/oss-fuzz/corpus/1ceb066475c97dc299992377e57891882d5e8042 new file mode 100644 index 0000000000000000000000000000000000000000..3322a79730f803875c19105dedb6b0eafb6f3fe5 GIT binary patch literal 12 Pcmd;K00ChGB_Ig^0)_x` literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/1d316f33ea62302029276fab4aa77afc48272383 b/tools/oss-fuzz/corpus/1d316f33ea62302029276fab4aa77afc48272383 new file mode 100644 index 0000000000000000000000000000000000000000..080f6e24e614af700c67c3c4b90e6867037e6693 GIT binary patch literal 44 dcmdO4009L9V<5=`#GD{542Uo=6vEg*8UQ1V0ZIS> literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/1e575a4d9e163d9a35f211ec70b18954287436cb b/tools/oss-fuzz/corpus/1e575a4d9e163d9a35f211ec70b18954287436cb new file mode 100644 index 0000000000000000000000000000000000000000..3b5a4446d7a0631eef1c88fc4f5a86815ab83a9d GIT binary patch literal 96 zcmYdb00Bk=K_JNl#LOTr5C{OV3YY~EhcX!$VGJk@* literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/27c614d7d9915070cec6bc60eb2c10084c1cc62a b/tools/oss-fuzz/corpus/27c614d7d9915070cec6bc60eb2c10084c1cc62a new file mode 100644 index 0000000000000000000000000000000000000000..13964042b07ef45d7734c97f76465522d4ea4e7d GIT binary patch literal 16 RcmWe&00CwL0U*f-!~g@90Ac_D literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/2a2b83be983659822829e65ec1698d73cc182e8b b/tools/oss-fuzz/corpus/2a2b83be983659822829e65ec1698d73cc182e8b new file mode 100644 index 0000000000000000000000000000000000000000..999cd82d6efba26b4b91d35caa9fd6ffe972551b GIT binary patch literal 16 RcmWe&00CwLH6W=D!~g`U0FeLy literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/2c95547f3b4d9837fbe6aa1294a6242a75f311df b/tools/oss-fuzz/corpus/2c95547f3b4d9837fbe6aa1294a6242a75f311df new file mode 100644 index 0000000000000000000000000000000000000000..092c482f58412754cb6dd1b0a297913cb2ad14ed GIT binary patch literal 92 xcma!H00Bk=aS#c_tROBB2mrAPn8m=r1f>a4JOXpOD{}iCCoF#Og7reHHUNUN2wDID literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/2dbffde98d5997c49a73f5550226d3732ee0f18b b/tools/oss-fuzz/corpus/2dbffde98d5997c49a73f5550226d3732ee0f18b new file mode 100644 index 0000000000000000000000000000000000000000..d9005970ed6e6bc40fe0616198f56bec3eccd8b8 GIT binary patch literal 96 zcmYdb00Bk=MJ0#$iwL;@ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/2f86b1e44285c748c41db6b9326690a80d3a6204 b/tools/oss-fuzz/corpus/2f86b1e44285c748c41db6b9326690a80d3a6204 new file mode 100644 index 0000000000000000000000000000000000000000..63b892a8006ec3021cb86e452d83651f9ea05c45 GIT binary patch literal 44 dcmdO4009L9DIm!M#H=7L3@|e=6vEg*8UP-d0UQ7T literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/3184213ef341e6940f66f2cd362c2f9ceabc2a42 b/tools/oss-fuzz/corpus/3184213ef341e6940f66f2cd362c2f9ceabc2a42 new file mode 100644 index 0000000000000000000000000000000000000000..47ee0a13ca5363585a24c92bfc3a1934f32ebfb4 GIT binary patch literal 96 zcmYdb00Bk=Rv^g)Vu83oAOOTFU>1Y`$$Rl=ATgM@I`4)$;y(~H>}FtKB3=t!RRRE81qPM? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/3849223081e37127ee85e614cb1cd1991f7767db b/tools/oss-fuzz/corpus/3849223081e37127ee85e614cb1cd1991f7767db new file mode 100644 index 0000000000000000000000000000000000000000..1453805a10e54b555f6751888b4ea9c57188d66f GIT binary patch literal 216 fcmcb?00N8+%pelXCXVVi70{|b50V4na literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/3f23dfed884e1f2d93f30a507d615d601516579f b/tools/oss-fuzz/corpus/3f23dfed884e1f2d93f30a507d615d601516579f new file mode 100644 index 0000000000000000000000000000000000000000..1643aa7dd0434a9ff94a21a000f50b71a2163abc GIT binary patch literal 16 RcmWe&00CwLZ6K)y!~g`|0GR*) literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/40d6636c3ce5fb57c1a93676159c181b50108c14 b/tools/oss-fuzz/corpus/40d6636c3ce5fb57c1a93676159c181b50108c14 new file mode 100644 index 0000000000000000000000000000000000000000..8b6e2bc7b6531aafde4efe3fb8182fc6c9e0735c GIT binary patch literal 216 fcmcb?00N8+%s>)^i3R_GpkX%y0~4_t=&TL^U1qK6aeA? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/477defa36d6b8c1027344047f0fe7de574177235 b/tools/oss-fuzz/corpus/477defa36d6b8c1027344047f0fe7de574177235 new file mode 100644 index 0000000000000000000000000000000000000000..abb939d710f529a715ac577fa507b2a6f7e129d6 GIT binary patch literal 16 RcmWe&00CwLE+EMb!~g?Y09gP4 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/485a1fe8eaa73563d5833d5a99c064c30bbbbce4 b/tools/oss-fuzz/corpus/485a1fe8eaa73563d5833d5a99c064c30bbbbce4 new file mode 100644 index 0000000000000000000000000000000000000000..c778ee076395b163d280697f2bf2b5f6880dc130 GIT binary patch literal 140 zcmeBS00Bk=Mj$B)Vu83oAOOTFU={-d6OaaBY(N5=AetCR4GTz&@jnAe23$Dk>4x! I?r&=X0GtO37ytkO literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/4bd137ef6fdf143d50b0013a36bdee1742b9afa1 b/tools/oss-fuzz/corpus/4bd137ef6fdf143d50b0013a36bdee1742b9afa1 new file mode 100644 index 0000000000000000000000000000000000000000..51ccc7cf5b7a3f9d23ed94d4433d690a8c0ee314 GIT binary patch literal 44 dcmdO4009L979hz3#Ec*=46rdU6vEg*8UPzU0R;d6 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/4c882c4819e15136757b6953f7e9f58af107e0e3 b/tools/oss-fuzz/corpus/4c882c4819e15136757b6953f7e9f58af107e0e3 new file mode 100644 index 0000000000000000000000000000000000000000..28da2c9aa5036645ac1cd395c68ea9246d8eecd6 GIT binary patch literal 16 RcmWe&00CwLaUdxP!~g^O0CWHV literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/4e659c34d50b894405046d47b6a72686b1a1c09a b/tools/oss-fuzz/corpus/4e659c34d50b894405046d47b6a72686b1a1c09a new file mode 100644 index 0000000000000000000000000000000000000000..01f0b4e70c48f2fd45c5b064a3bcf2de5667df35 GIT binary patch literal 216 gcmcb?00N8+%s`R}%qEWb4+IUnNz+4|$<$E=09>60m;e9( literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/4fe0b07c89550b8490bd0b017d3e041d2d1ddd3e b/tools/oss-fuzz/corpus/4fe0b07c89550b8490bd0b017d3e041d2d1ddd3e new file mode 100644 index 0000000000000000000000000000000000000000..1cffa2422e46dfc4b59816f5ff1c103655c50bbb GIT binary patch literal 16 RcmWe&00CwL10ZP(!~g{<0H*)| literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/506e037b0fb18b8d9dcc1baaf6e5107af54b3c89 b/tools/oss-fuzz/corpus/506e037b0fb18b8d9dcc1baaf6e5107af54b3c89 new file mode 100644 index 0000000000000000000000000000000000000000..ff85355bacd21fb54cd40701401cf5faf974bf5a GIT binary patch literal 12 Pcmd;K00ChGF(3&50#*QK literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/538df3b6469f71c8d24b8f902fbf2d67ac939e6f b/tools/oss-fuzz/corpus/538df3b6469f71c8d24b8f902fbf2d67ac939e6f new file mode 100644 index 0000000000000000000000000000000000000000..ca0ffda297688310a965d06ab5cb6e0d58230f02 GIT binary patch literal 48 gcmXqD00995HXz9e#H=7L5WHZ9&>g}M8bpHR0W{hI1ONa4 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/5465bf117b81b5f0831e6fc6520b6ab43a5afe31 b/tools/oss-fuzz/corpus/5465bf117b81b5f0831e6fc6520b6ab43a5afe31 new file mode 100644 index 0000000000000000000000000000000000000000..7470cb20b99f9918ba2f8a4bb9dbb1de56a5326d GIT binary patch literal 16 RcmWe&00CwLMg}M8bmSzF#tb80!{z` literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/60aa86b382f9745796ddc252308476f9f1458da7 b/tools/oss-fuzz/corpus/60aa86b382f9745796ddc252308476f9f1458da7 new file mode 100644 index 0000000000000000000000000000000000000000..73d93d43c3eefbf1ed7431019b374d95bbbbbaa0 GIT binary patch literal 12 Pcmd;K00ChGJs=4H0=58t literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/63557cc6cb735a1177656b45b23fffc58b4a175d b/tools/oss-fuzz/corpus/63557cc6cb735a1177656b45b23fffc58b4a175d new file mode 100644 index 0000000000000000000000000000000000000000..b9366270a9f1dcd9cbbf6b804a986d2d47ff8de5 GIT binary patch literal 16 RcmWe&00CwL79hz8!~g>V07(D< literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/63fb579839e5419a8f1edcffe34415681a6e57bd b/tools/oss-fuzz/corpus/63fb579839e5419a8f1edcffe34415681a6e57bd new file mode 100644 index 0000000000000000000000000000000000000000..0fe3cd7def8031683364a3153cf80475a9929c32 GIT binary patch literal 12 Pcmd;K00ChG4Il{s0-gYP literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/66ebfa0a1d185551c2c89e812fba00da3894319f b/tools/oss-fuzz/corpus/66ebfa0a1d185551c2c89e812fba00da3894319f new file mode 100644 index 0000000000000000000000000000000000000000..a3992c6935923de7930d5904e4026c6ccd77a67e GIT binary patch literal 16 RcmWe&00CwLJ0NKf!~g}#0KotN literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/67e682378b02151cf2e155705bb984279793adf3 b/tools/oss-fuzz/corpus/67e682378b02151cf2e155705bb984279793adf3 new file mode 100644 index 0000000000000000000000000000000000000000..254146793dd2fdc1f6261c7a72336f47401b721b GIT binary patch literal 96 zcmYdb00Bk=bs)(E#Oxq05C{OV3YY~UKyn}eqai#92@+$53aImLIJD<~fa6jrm6*z- GPrU(?uLzz1 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/69eb34e1b3387924cfa914a9fcee01ff3879fe9e b/tools/oss-fuzz/corpus/69eb34e1b3387924cfa914a9fcee01ff3879fe9e new file mode 100644 index 0000000000000000000000000000000000000000..2531769a3f188fc3e999f63743d6abf1fd3be942 GIT binary patch literal 16 RcmWe&00CwLc_1kV!~g_N0D%Ai literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/6fcfd052d0f6d8790c40dfaccded456d61bc2564 b/tools/oss-fuzz/corpus/6fcfd052d0f6d8790c40dfaccded456d61bc2564 new file mode 100644 index 0000000000000000000000000000000000000000..4bf2c8369bdc991222f2d86e5402725447dc9e3f GIT binary patch literal 96 zcmYdb00Bk=Qy|F%#GD{55C{OV3Yf*fzzn596i5v+U<7hN7$&aHyW!BD{{fCmrBq@n Ik3RJV0GUq+t^fc4 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7038c3d73d7194ffcd506db6e07737421064ab9b b/tools/oss-fuzz/corpus/7038c3d73d7194ffcd506db6e07737421064ab9b new file mode 100644 index 0000000000000000000000000000000000000000..1cf977a2bce6a2f09f2edba33c7895bc8f9d7e6c GIT binary patch literal 16 RcmWe&00CwL5g;iH!~g@z0BZmM literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/70a4c387ec37de44de5966267dab7ee415b67b9d b/tools/oss-fuzz/corpus/70a4c387ec37de44de5966267dab7ee415b67b9d new file mode 100644 index 0000000000000000000000000000000000000000..8035aecaa28114b83cb9ad6ad60102358fb0fa0b GIT binary patch literal 48 hcmXqD009959w5mC#M~e*5WHZ9&>g}M8bmSzF#tBM0ucZJ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/71df89d7b5bc70bff37a80e6ad467c9898e8bd30 b/tools/oss-fuzz/corpus/71df89d7b5bc70bff37a80e6ad467c9898e8bd30 new file mode 100644 index 0000000000000000000000000000000000000000..d042add9b361a61be23194b2d61c7a8a7947ee14 GIT binary patch literal 12 Pcmd;K00ChGAs`6=0!9F0 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/73700ed7898804a3320c189a6ba9f2d20100eb4e b/tools/oss-fuzz/corpus/73700ed7898804a3320c189a6ba9f2d20100eb4e new file mode 100644 index 0000000000000000000000000000000000000000..bd647a01306feb9ab5414ab0adebdf71c869668a GIT binary patch literal 96 zcmYdb00Bk=ZXn47#UK#@AXWh}pa3KX0*nv}gM^8z^KLk_=YN3XQYn>~%A-%c0f*-Z AcmMzZ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/73d1b19c297eac0039ef78869d74999c67e77622 b/tools/oss-fuzz/corpus/73d1b19c297eac0039ef78869d74999c67e77622 new file mode 100644 index 0000000000000000000000000000000000000000..2ca220979a68ff874eb2a3c1bedaa67f95a5ba07 GIT binary patch literal 76 QcmeZa00Bk^FhwB&04QPrjsO4v literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/740f4253b0bf19ea16a6d13b041caf2835020e18 b/tools/oss-fuzz/corpus/740f4253b0bf19ea16a6d13b041caf2835020e18 new file mode 100644 index 0000000000000000000000000000000000000000..f1a85f1771fb35e91d63b9647f36737634506054 GIT binary patch literal 140 zcmeBS00Bk=Lm(*t#GD{55P;Y!U={-d6OaaBY(N5=APzB@84Y$2^PO81Z+wpT@!H&x K^N)RJm>vKCw+Xob literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/77b94d3c8296d5b7d8c99ebcadd6ee67868b8e1c b/tools/oss-fuzz/corpus/77b94d3c8296d5b7d8c99ebcadd6ee67868b8e1c new file mode 100644 index 0000000000000000000000000000000000000000..712940d40e50e475c7394afc8576ae1a796c7550 GIT binary patch literal 44 ccmdO4009L9ejv#M#LOTr3;;QWFgB0|036i;4*&oF literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7d1a20552952e47cbf39908c1bffb00b7302169e b/tools/oss-fuzz/corpus/7d1a20552952e47cbf39908c1bffb00b7302169e new file mode 100644 index 0000000000000000000000000000000000000000..3a8108159a348b7124dbb1ef8c068cc6d8d62728 GIT binary patch literal 44 dcmdO4009L96ClY0#GD{542Uo=6vEg*8UQ1(0ZRY? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7d9845953f99ea8c396386476ea85e4b5b107969 b/tools/oss-fuzz/corpus/7d9845953f99ea8c396386476ea85e4b5b107969 new file mode 100644 index 0000000000000000000000000000000000000000..e95c29f0e6bf4e3eec3cca7775873cca42402ac4 GIT binary patch literal 12 Pcmd;K00ChG86XJ&0&W0o literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7eb33f788db8ad24e8769e5978b45730f7049ef8 b/tools/oss-fuzz/corpus/7eb33f788db8ad24e8769e5978b45730f7049ef8 new file mode 100644 index 0000000000000000000000000000000000000000..9e1f1f4b57f3ed3afcc08016b8517c41448203d6 GIT binary patch literal 92 zcma!H00Bk=UJwby%pfih2mrAPm<1u2kl4sfkRBM|5t!Ruk=yS$Vex|(tQT6f0e8xHOHAKY1kuwOE literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7f8aa82710ffbd9733f0228c2aef8affbd68bb0a b/tools/oss-fuzz/corpus/7f8aa82710ffbd9733f0228c2aef8affbd68bb0a new file mode 100644 index 0000000000000000000000000000000000000000..01ec4657fd021673e9242cd9f310863e53738cd5 GIT binary patch literal 44 dcmdO4009L9dmzaJ#M~e*3@|e=6vEg*8UQ490Y?A; literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/7fa1ff78ff77a1acffd887d2d1d1b314cbbff7dd b/tools/oss-fuzz/corpus/7fa1ff78ff77a1acffd887d2d1d1b314cbbff7dd new file mode 100644 index 0000000000000000000000000000000000000000..d4329e35d55119e76cdc49831c8bb180151de15c GIT binary patch literal 16 RcmWe&00CwLJ|M{t!~g?|0ATqMQ~>Az literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/8ef1ccb4fab7ae53db309457275bb0ea29f938d4 b/tools/oss-fuzz/corpus/8ef1ccb4fab7ae53db309457275bb0ea29f938d4 new file mode 100644 index 0000000000000000000000000000000000000000..aa277c694701495f6da841871c64f4dce543cef4 GIT binary patch literal 44 dcmdO4009L9Z6L`5#2g?l3@|e=6vEg*8UP_t0Wbgn literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/90d64dad63490c4ac33011d565f2cacdc9ce9d8c b/tools/oss-fuzz/corpus/90d64dad63490c4ac33011d565f2cacdc9ce9d8c new file mode 100644 index 0000000000000000000000000000000000000000..e3709bcb5d47ee73ad68d644dedc977f0fd4316d GIT binary patch literal 16 RcmWe&00CwLLm+7a!~g|00I2`~ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/91ab8ff2cbf88e5b8dbaa1e5dc47a576a722e1a4 b/tools/oss-fuzz/corpus/91ab8ff2cbf88e5b8dbaa1e5dc47a576a722e1a4 new file mode 100644 index 0000000000000000000000000000000000000000..0beadd5d2c32dc26e31e09f3e35bbea891ab77dd GIT binary patch literal 48 hcmXqD00995B_PQL#EKv;5WHZ9&>g}M8bmSzF#tVo0zm)( literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/93063fda9ff7aa467f9f253f56346a2575447229 b/tools/oss-fuzz/corpus/93063fda9ff7aa467f9f253f56346a2575447229 new file mode 100644 index 0000000000000000000000000000000000000000..57de46fabb509b66d14898b265029a546612bdd3 GIT binary patch literal 16 RcmWe&00CwL4j{<|!~g?E09F71 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/953a6b71c70235334c6cdc6cc5c1e10d7dfa8a0b b/tools/oss-fuzz/corpus/953a6b71c70235334c6cdc6cc5c1e10d7dfa8a0b new file mode 100644 index 0000000000000000000000000000000000000000..bf280df914be404fd6266da87eed9001284750f6 GIT binary patch literal 16 RcmWe&00CwL2_Pv2!~g^a0CoTX literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/9a3b92151da3d1c4d4e6628caf0d8717203a06a0 b/tools/oss-fuzz/corpus/9a3b92151da3d1c4d4e6628caf0d8717203a06a0 new file mode 100644 index 0000000000000000000000000000000000000000..aaccfd71aace6731c78f9415df1db938480606b2 GIT binary patch literal 92 zcma!H00Bk=TM!Av+#oIx2mrAPm<1u2kl4sfkRBM|5t!Ruk=yS$Vex|(tQT6f0g(p? AhX4Qo literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/9aac5d8a1ba4a283680e7f6950824d8a2fedca79 b/tools/oss-fuzz/corpus/9aac5d8a1ba4a283680e7f6950824d8a2fedca79 new file mode 100644 index 0000000000000000000000000000000000000000..77099c55eb9b1bb00e183b1b823bb3eb05c16541 GIT binary patch literal 44 dcmdO4009L9OCZSu#9SaQ42Uo=IKtRK8UP|d0U-bY literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/9b057f01c05d31bcb3af5fd9ebe2e373df8f11de b/tools/oss-fuzz/corpus/9b057f01c05d31bcb3af5fd9ebe2e373df8f11de new file mode 100644 index 0000000000000000000000000000000000000000..13d1bfb39a3f50b6179076646c89aa5bc914328b GIT binary patch literal 44 dcmdO4009L9D0U`hZ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/9c02ee0cb2dbb37c817fff2c0bc37a0bd448bb9a b/tools/oss-fuzz/corpus/9c02ee0cb2dbb37c817fff2c0bc37a0bd448bb9a new file mode 100644 index 0000000000000000000000000000000000000000..7ed4503553c7d7b18c9ad8aaccb64c71ffcd763b GIT binary patch literal 16 RcmWe&00CwLb|A?K!~g?208{_~ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/9cf5d993ce813b4f6e8dbfcedeaa73266b945d97 b/tools/oss-fuzz/corpus/9cf5d993ce813b4f6e8dbfcedeaa73266b945d97 new file mode 100644 index 0000000000000000000000000000000000000000..9a4cd1098cd9b32d53fa3792e0626b0c04c0a002 GIT binary patch literal 124 hcmbF07n1- literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/aa5da635d384a9b700618b3bf16f4a746ea0ae02 b/tools/oss-fuzz/corpus/aa5da635d384a9b700618b3bf16f4a746ea0ae02 new file mode 100644 index 0000000000000000000000000000000000000000..73c701a83facdc52eb733e9bf9152d47c0613326 GIT binary patch literal 16 RcmWe&00CwLSs*D7!~g_B0Du4h literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ac3237f321da5b5afda68331f6280c693e38691f b/tools/oss-fuzz/corpus/ac3237f321da5b5afda68331f6280c693e38691f new file mode 100644 index 0000000000000000000000000000000000000000..96e648c44ae8a795ec207504fa8f6774ece49c68 GIT binary patch literal 16 RcmWe&00CwLWgw{v!~g_}0E_?t literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ad6629ff824cb4e365f7326f616963441e85f2dd b/tools/oss-fuzz/corpus/ad6629ff824cb4e365f7326f616963441e85f2dd new file mode 100644 index 0000000000000000000000000000000000000000..1028fa5730dd020afd465301578a30a6c562888d GIT binary patch literal 16 RcmWe&00CwLO(3Za!~g`+0GI#( literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/b01c77c931b5a815c5e1708c1cb822be2359b920 b/tools/oss-fuzz/corpus/b01c77c931b5a815c5e1708c1cb822be2359b920 new file mode 100644 index 0000000000000000000000000000000000000000..abf14883d5d20cd5a7a3106d6c1043eea87d2cc1 GIT binary patch literal 16 RcmWe&00CwLdmw2G!~g}#0KfnM literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/b22a25ff9158654f3d15249cbcf6d40ac6cf41ca b/tools/oss-fuzz/corpus/b22a25ff9158654f3d15249cbcf6d40ac6cf41ca new file mode 100644 index 0000000000000000000000000000000000000000..7da2cf69339d25b74c85c91ddd131e23014bdfcb GIT binary patch literal 96 zcmYdb00Bk=X&}i2#H=7L5C{OV3YY~UKyn}eqai#5$qZ$x^KLk_=YN3XQYn>~%A-%c E0gkr_jsO4v literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/b6c23a07f722173b38dc4023ad6ccec6881e9e80 b/tools/oss-fuzz/corpus/b6c23a07f722173b38dc4023ad6ccec6881e9e80 new file mode 100644 index 0000000000000000000000000000000000000000..c8fff5c9b72ce125720c88c8d9d1c5cbb78c5d29 GIT binary patch literal 108 ecmc~{00E`|5XlE3hy+YTs$*ba1VRvCWB>qE6adly literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/bafa9c04ffc79d2da4033283ec947a526e4aa3ac b/tools/oss-fuzz/corpus/bafa9c04ffc79d2da4033283ec947a526e4aa3ac new file mode 100644 index 0000000000000000000000000000000000000000..3ad29870264df0f7e8a88f24576fb8c9af61601f GIT binary patch literal 108 ecmc~{00E`|5UB+shy+YTs$*ba1VRvCWB>qOlmPAk literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/bddd9a690dca1d9c5dcf71969194c825e9095f1c b/tools/oss-fuzz/corpus/bddd9a690dca1d9c5dcf71969194c825e9095f1c new file mode 100644 index 0000000000000000000000000000000000000000..d5a9eb17a810d03d5e9244b748b9072cdb95f24c GIT binary patch literal 164 zcmZ3&00JxlAkq%R0%B$mhXBwZAP#2g?l5C{OV3YY~UKyn}eqai#9$qb}G7zEULHyqmYKfrORluAtH H(Wl-3mMaLR literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/bfd8bca17218780d1a98daf1723d4ef5521a8590 b/tools/oss-fuzz/corpus/bfd8bca17218780d1a98daf1723d4ef5521a8590 new file mode 100644 index 0000000000000000000000000000000000000000..4a58d736df9a05ce6f77aea32a4268df02500fa7 GIT binary patch literal 92 xcma!H00Bk=We^F(>>w@>2mrAPn8m=r1f>a4JOXpOD{}iCCoF#Og7reHHUNh^2xtHR literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c0a9d76a8bfcca5af2edc9850e16d84e804528ab b/tools/oss-fuzz/corpus/c0a9d76a8bfcca5af2edc9850e16d84e804528ab new file mode 100644 index 0000000000000000000000000000000000000000..ffa63a2e958968284b8fe12725847a51b410f294 GIT binary patch literal 16 RcmWe&00CwLK_Dpr!~g@P0A&CG literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c1c0442be18fae000ab7e6056ce17131d4c811f0 b/tools/oss-fuzz/corpus/c1c0442be18fae000ab7e6056ce17131d4c811f0 new file mode 100644 index 0000000000000000000000000000000000000000..0f6e132733784c02cbc5cada45d67fe0d2ed8414 GIT binary patch literal 92 zcma!H00Bk=eGm!6oFFa`2mrAPm<1u2kl4sfkRBM|5t!Ruk=yS$Vex|(tQT6f0gKlN AcK`qY literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c28adb709a71bb331c00090adadff0eb33c78e3e b/tools/oss-fuzz/corpus/c28adb709a71bb331c00090adadff0eb33c78e3e new file mode 100644 index 0000000000000000000000000000000000000000..1975fc79e7f9ab23171461db58201aa60526774b GIT binary patch literal 16 RcmWe&00CwL3m|C)!~g|`0JZ=C literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c434e648fa1cda6ddf10c6334699bcdaad26bd39 b/tools/oss-fuzz/corpus/c434e648fa1cda6ddf10c6334699bcdaad26bd39 new file mode 100644 index 0000000000000000000000000000000000000000..2cd96f83611b8ddacf42f41ed44503e5ae73647a GIT binary patch literal 44 dcmdO4009L95g^F}#4I2#46rdU6vEg*8UP*A0T=)P literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c5a91a1353d25c746a2677da2d259ee73e89829a b/tools/oss-fuzz/corpus/c5a91a1353d25c746a2677da2d259ee73e89829a new file mode 100644 index 0000000000000000000000000000000000000000..dc594e460aee5264367aa984239726386a0c9c98 GIT binary patch literal 128 zcmZo*00Bk=3m_>7#9SaQ5C{OV3Yf*fzyzd07#rZhCWs~m(#r@HyV|!RRKoU@TgOMf KXRlsP<_7@Z!wK^M literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c7225f46c138471307ab06407b95f9a2f5bddd3b b/tools/oss-fuzz/corpus/c7225f46c138471307ab06407b95f9a2f5bddd3b new file mode 100644 index 0000000000000000000000000000000000000000..ccb5fbfb92ce2efec51c18961ffb53aa3a751ff8 GIT binary patch literal 216 wcmcb?00N8+j35$-Ssj1`vEYXaW5aHsVj#f*r2YdjKM+d*u>uf-%o`{G04I(Hg8%>k literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c7b09b124fdeadd9c2ad70c0ba5fa74ffa6f62d9 b/tools/oss-fuzz/corpus/c7b09b124fdeadd9c2ad70c0ba5fa74ffa6f62d9 new file mode 100644 index 0000000000000000000000000000000000000000..9ee8042badbd11720b5edf0a099532dfe295ae18 GIT binary patch literal 48 hcmXqD00995Cm_iU#Eu{?5WHZ9&>g}M8bmSzF#ty*0)_wp literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c7cff97cb529670bf6f8757a9de27580a0e1cdc1 b/tools/oss-fuzz/corpus/c7cff97cb529670bf6f8757a9de27580a0e1cdc1 new file mode 100644 index 0000000000000000000000000000000000000000..cc1c37686fafca01bb8b28f9d443b152cd42fdee GIT binary patch literal 48 hcmXqD00995Ga$(c#HJuF5GeRT=ni2B4I&wV7yvhS0q+0+ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/c9d6ada7c5ac121732efc1d7a21d0ae3d908b29b b/tools/oss-fuzz/corpus/c9d6ada7c5ac121732efc1d7a21d0ae3d908b29b new file mode 100644 index 0000000000000000000000000000000000000000..79e17206feb2a56d588288187d54230e9f6ba04b GIT binary patch literal 92 xcma!H00Bk=Sr7@tY#=TW2mrAPn8m=r1f>a4JOXpOD{}iCCoF#Og7reHHUNb82w?yK literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/cd2f7b558b99c6c043f40a6b3094023f951edb7c b/tools/oss-fuzz/corpus/cd2f7b558b99c6c043f40a6b3094023f951edb7c new file mode 100644 index 0000000000000000000000000000000000000000..686ef594e6b74958a59ac0ce7862a1cb65b23a11 GIT binary patch literal 100 zcmYdc00Bk=6(Gq9#Oxq05C{MF1m-r6H^&-Dl J?A_ni1OTVI3ON7( literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/cdeed12cfd64ae67614c7ef51b209b9cd539abc7 b/tools/oss-fuzz/corpus/cdeed12cfd64ae67614c7ef51b209b9cd539abc7 new file mode 100644 index 0000000000000000000000000000000000000000..5ff26db5b2b43fdd4679145047f58a8aad276f6d GIT binary patch literal 16 RcmWe&00CwLDIh5g!~g^u0C@la literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/cdfccbfc07a1dccda9d23c4a101773bc004f189b b/tools/oss-fuzz/corpus/cdfccbfc07a1dccda9d23c4a101773bc004f189b new file mode 100644 index 0000000000000000000000000000000000000000..8fd53935fe0fbbbce869355d6a996181c3ff1a2c GIT binary patch literal 16 RcmWe&00CwLejv#U!~g?|0AK(B literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ce0807d15997f1495d92237df487dc7110844e7e b/tools/oss-fuzz/corpus/ce0807d15997f1495d92237df487dc7110844e7e new file mode 100644 index 0000000000000000000000000000000000000000..f03cf207e764f85fd9479991273a26b055fb9554 GIT binary patch literal 16 RcmWe&00CwLOCV_h!~g|`0JQ)B literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d0967b8c5bbff4e80e2b475ae84e1d3bb375db47 b/tools/oss-fuzz/corpus/d0967b8c5bbff4e80e2b475ae84e1d3bb375db47 new file mode 100644 index 0000000000000000000000000000000000000000..3269ce40a8de70e15ad1068bbbfddcc851d8e84a GIT binary patch literal 136 ucmeBR00EW&5NQEo0WmX(Ljdp)kOxTz`@4Zvfz=9N8p{NfWdy5WU;qHXSOPKt literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d0bf265bcb8b9c9324e21849786d4fd9b92210e7 b/tools/oss-fuzz/corpus/d0bf265bcb8b9c9324e21849786d4fd9b92210e7 new file mode 100644 index 0000000000000000000000000000000000000000..41e7b14aa2930842836fb68140901d5c6d542d0c GIT binary patch literal 16 RcmWe&00CwL2Owz&!~g}>0KxzO literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d0e4f629e9d8d85c416b9577dce60e95cd3f8bcc b/tools/oss-fuzz/corpus/d0e4f629e9d8d85c416b9577dce60e95cd3f8bcc new file mode 100644 index 0000000000000000000000000000000000000000..028b7709b9afd4cb152acec3822f6f2c04525353 GIT binary patch literal 216 zcmcb?00N8+Odt}>CXN89RanT*z+mUe&|nAAqrjlRpuu2+V$KA-hBBh4CC+BzQ~?0? COa!9< literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d2ac15660b67f3183d915f46ffebe4d11814c483 b/tools/oss-fuzz/corpus/d2ac15660b67f3183d915f46ffebe4d11814c483 new file mode 100644 index 0000000000000000000000000000000000000000..8cb7b6648b6decab66cea6aae83a7ed0565182a0 GIT binary patch literal 100 zcmYdc00Bk=IUvaj#B3lg5C{OV3Yf*fzyzd07zAK6gon&$1j~s4CF;`awttE5a9l6) Kd&S=UZA}2BKMFDc literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d38a7e262a456117cf25b68166051c646ac5acd7 b/tools/oss-fuzz/corpus/d38a7e262a456117cf25b68166051c646ac5acd7 new file mode 100644 index 0000000000000000000000000000000000000000..149aa5c881a1a8ad882bcfb4c614b76715ecc6f1 GIT binary patch literal 216 wcmcb?00N8+j9?nba)2_3p?;_^HtYr}oUg*b1f-auSOQ2(0x`@?Ad~I@07x$ZQ1?{Hi%@_WVJ H{cTMEqQeR+ literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/d818880901e644d0fbc5d2f2a819c57147d42fc2 b/tools/oss-fuzz/corpus/d818880901e644d0fbc5d2f2a819c57147d42fc2 new file mode 100644 index 0000000000000000000000000000000000000000..8baf91b3a45621a374cc15ec77914276b2335db9 GIT binary patch literal 16 RcmWe&00CwLNgyc!!~g^a0CfNW literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/da39a3ee5e6b4b0d3255bfef95601890afd80709 b/tools/oss-fuzz/corpus/da39a3ee5e6b4b0d3255bfef95601890afd80709 new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/oss-fuzz/corpus/daef2d805970080c022efb842446e80bf12e9064 b/tools/oss-fuzz/corpus/daef2d805970080c022efb842446e80bf12e9064 new file mode 100644 index 0000000000000000000000000000000000000000..7b989732e946d13ffee8c2bc2e20fefa0f9fbe0a GIT binary patch literal 16 RcmWe&00CwL9U!R-!~g{H0G$8; literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/e2329f312c39d5c88db4a7782c42e8532d6a705a b/tools/oss-fuzz/corpus/e2329f312c39d5c88db4a7782c42e8532d6a705a new file mode 100644 index 0000000000000000000000000000000000000000..e4e3cba3c02e5020b52e31a338f48e81d4520806 GIT binary patch literal 16 RcmWe&00CwLIUuP3!~g_N0D=Gj literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/e34a2209d7aeae9930612f4c2a25da9ed3757dd0 b/tools/oss-fuzz/corpus/e34a2209d7aeae9930612f4c2a25da9ed3757dd0 new file mode 100644 index 0000000000000000000000000000000000000000..bc32b2c5f41e8e456dba14032bab1ea9f0a4dacf GIT binary patch literal 216 zcmcb?00N8+OkkRLf)S`xVIeyMgPkWs!)}N^1qKBM4F($qWV24-HIk75WDYt2iDDB+ ISBH-e09a`SS^xk5 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/e8245c3a4468316ea7f9c1913431c2675e3d7046 b/tools/oss-fuzz/corpus/e8245c3a4468316ea7f9c1913431c2675e3d7046 new file mode 100644 index 0000000000000000000000000000000000000000..718f77f142beec5801c45522fc569a4543e9ddc1 GIT binary patch literal 148 zcmbQj00N8#=0K7kh`B&qAP@jz6)+1zFd?y#nF`1p9BgDYCL9b5%nTA>l^56{8sx98 Sc&%Qs)xGK6y}WYg_2~dGg9~T? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/e879a5dc16f37cae5480bf63aacab45230b2ea14 b/tools/oss-fuzz/corpus/e879a5dc16f37cae5480bf63aacab45230b2ea14 new file mode 100644 index 0000000000000000000000000000000000000000..969a9b621ab4159bf04046ec0e0e043b8f8161ec GIT binary patch literal 16 RcmWe&00CwLW+2H5!~g>d089V? literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/e9f7159631e0e3348271a87c3a5bcacd857abc78 b/tools/oss-fuzz/corpus/e9f7159631e0e3348271a87c3a5bcacd857abc78 new file mode 100644 index 0000000000000000000000000000000000000000..4e658d95517ce007435a60ae98a50881590ebfcd GIT binary patch literal 44 dcmdO4009L9CLqZJ#Ec*=3@|e=6vEg*8UPx}0RR91 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ea95b2435e3ab3d4d13d289f8f7c0ae029276b2d b/tools/oss-fuzz/corpus/ea95b2435e3ab3d4d13d289f8f7c0ae029276b2d new file mode 100644 index 0000000000000000000000000000000000000000..397ef5436623441066ea75dd4887e69cca4af2cc GIT binary patch literal 16 RcmWe&00CwLDg}M8bmSzF#tKn0w(|f literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ee2e51d2ceb5b5b284384597b8a20572d4c9f419 b/tools/oss-fuzz/corpus/ee2e51d2ceb5b5b284384597b8a20572d4c9f419 new file mode 100644 index 0000000000000000000000000000000000000000..9ce881ce5e1119446574156d6e8a0f09a92b70e7 GIT binary patch literal 148 wcmbQj00JxlAkq-T0%B$mhX9ZuAPa4JOXpOD{}iCCoF#Og7reHHUNo#2yXxY literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/f4562c1ee8e285a9c8c6db5d56a7f22fd0585f34 b/tools/oss-fuzz/corpus/f4562c1ee8e285a9c8c6db5d56a7f22fd0585f34 new file mode 100644 index 0000000000000000000000000000000000000000..4f0832edee30c0493591aef4c5d4a2a70b9ced51 GIT binary patch literal 44 dcmdO4009L99U#dA#2g?l3@|e=6vEg*8UP`60Wkmo literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/f55f896f8efc3282c3a361a67a20580b8762d07d b/tools/oss-fuzz/corpus/f55f896f8efc3282c3a361a67a20580b8762d07d new file mode 100644 index 0000000000000000000000000000000000000000..27d2a86229b632d9e81ce314fff7ad61e7507403 GIT binary patch literal 108 ecmc~{00E`|5Ges7hy+YTs$*ba1VRvCWB>qH)BxN7 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/f99ba9356c00cb0e4d8c678cfa161edb7b7d92fb b/tools/oss-fuzz/corpus/f99ba9356c00cb0e4d8c678cfa161edb7b7d92fb new file mode 100644 index 0000000000000000000000000000000000000000..16eba32bf283bde53d3d1f4cb0ead68cfc5b4f4d GIT binary patch literal 48 jcmXqD009958z9LA#HJuF5GeRDFfan?1#KV_0zfPPKgbc0o4Ei literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/fd3db2b2fd33aba155037bfcf8a4c2e07e03f54c b/tools/oss-fuzz/corpus/fd3db2b2fd33aba155037bfcf8a4c2e07e03f54c new file mode 100644 index 0000000000000000000000000000000000000000..cf091a20c621ca8f299d2578953e864b1cb5e96e GIT binary patch literal 108 ecmc~{00E`|5NQA+hy+YTs$*ba1VRvCWB>qQ)ByAV literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/fe3c323efd1109949dfe07d78a733844265ceee7 b/tools/oss-fuzz/corpus/fe3c323efd1109949dfe07d78a733844265ceee7 new file mode 100644 index 0000000000000000000000000000000000000000..7c759f51f75977b468a20da766a9047b4b182414 GIT binary patch literal 48 hcmXqD00995Js`;e#JV6Z5WHZ9&>g}M8bmSzF#tgp0$Tt8 literal 0 HcmV?d00001 diff --git a/tools/oss-fuzz/corpus/ffb20a03769e52b39f6a28f9ddb78073d2dccc33 b/tools/oss-fuzz/corpus/ffb20a03769e52b39f6a28f9ddb78073d2dccc33 new file mode 100644 index 0000000000000000000000000000000000000000..aa48090a6072dc552a45c98e6c9a84dea0bc8833 GIT binary patch literal 16 RcmWe&00CwLJ0Qsd!~g`|0EPen literal 0 HcmV?d00001 From fc9b89ad8b30a5f3a3c8135b16980b159e630940 Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Tue, 8 Sep 2020 16:35:34 +0300 Subject: [PATCH 09/60] topology: add enum control Add m4 macros to generate enumerated control. Usage is similar to mixer and bytes control except enumerated values are specified using separate text section. Signed-off-by: Jaska Uimonen --- tools/topology/m4/enumcontrol.m4 | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tools/topology/m4/enumcontrol.m4 diff --git a/tools/topology/m4/enumcontrol.m4 b/tools/topology/m4/enumcontrol.m4 new file mode 100644 index 000000000000..374ec2e4763a --- /dev/null +++ b/tools/topology/m4/enumcontrol.m4 @@ -0,0 +1,41 @@ +dnl ENUM_CHANNEL(name, reg, shift) +define(`ENUM_CHANNEL', +`channel.STR($1) {' +` reg STR($2)' +` shift STR($3)' +` }') + + +dnl CONTROLENUM_OPS(info, comment, get, put) +define(`CONTROLENUM_OPS', +`ops."ctl" {' +` info STR($1)' +` #$2' +` get STR($3)' +` put STR($4)' +` }') + +dnl CONTROLENUM_LIST(name, enums_list) +define(`CONTROLENUM_LIST', +`SectionText.STR($1) {' +` values [' +` $2' +` ]' +`}') + +dnl C_CONTROLENUM(name, index, ops, ops, enums) +define(`C_CONTROLENUM', +`SectionControlEnum.STR($1) {' +`' +` # control belongs to this index group' +` index STR($2)' +`' +` # enum values as text' +` texts STR($3)' +`' +` # channel register and shift for Front Left/Right' +` $4' +`' +` # control uses bespoke driver get/put/info ID for io ops' +` $5' +`}') From 51b64f460a3720805094cd2d3c2c76dedd49f0db Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Thu, 10 Dec 2020 15:44:43 +0200 Subject: [PATCH 10/60] Tools: Tune: Add variable initialize to EQ blobs plotter This fix adds initialization and declaration of variable f_single to avoid a previously overlooked error when accessing it in the end of script. It produces the plot but with a warning print. Signed-off-by: Seppo Ingalsuo --- tools/tune/eq/eq_blob_plot.m | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tune/eq/eq_blob_plot.m b/tools/tune/eq/eq_blob_plot.m index 9709d4a48fc2..db13a1818103 100644 --- a/tools/tune/eq/eq_blob_plot.m +++ b/tools/tune/eq/eq_blob_plot.m @@ -33,6 +33,7 @@ if nargin < 4 || isempty(f) eq.f = logspace(log10(10),log10(fs/2), 1000); + f_single = []; else % Freqz() needs two frequency points or more if length(f) < 2 From 918f22c2062628342ab7317d7b60c7b3fa1fdaab Mon Sep 17 00:00:00 2001 From: Curtis Malainey Date: Fri, 13 Nov 2020 14:39:57 -0800 Subject: [PATCH 11/60] dai: add fall through markers for clang for some reason the clang version with oss-fuzz doesn't recognize the comments so lets add this attributes in the meantime. XCC does not like them so lets only use them with clang. Signed-off-by: Curtis Malainey --- src/audio/dai.c | 3 ++- src/include/sof/compiler_attributes.h | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/audio/dai.c b/src/audio/dai.c index c9a0717c3c1d..45e19e0f2166 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -692,7 +692,7 @@ static int dai_comp_trigger_internal(struct comp_dev *dev, int cmd) comp_info(dev, "dai_comp_trigger_internal(), XRUN"); dd->xrun = 1; - /* fallthrough */ + COMPILER_FALLTHROUGH; case COMP_TRIGGER_STOP: comp_dbg(dev, "dai_comp_trigger_internal(), STOP"); ret = dma_stop(dd->chan); @@ -702,6 +702,7 @@ static int dai_comp_trigger_internal(struct comp_dev *dev, int cmd) comp_dbg(dev, "dai_comp_trigger_internal(), PAUSE"); ret = dma_pause(dd->chan); dai_trigger(dd->dai, cmd, dev->direction); + break; default: break; } diff --git a/src/include/sof/compiler_attributes.h b/src/include/sof/compiler_attributes.h index 0dbbd0a46c49..0235cbc9bee1 100644 --- a/src/include/sof/compiler_attributes.h +++ b/src/include/sof/compiler_attributes.h @@ -17,3 +17,12 @@ #define __section(x) __attribute__((section(x))) +#ifdef __clang__ + +#define COMPILER_FALLTHROUGH __attribute__((fallthrough)) + +#else + +#define COMPILER_FALLTHROUGH /* fallthrough */ + +#endif From 9c33333cf5a7681fe8113ad8423e8413f228459d Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Thu, 10 Dec 2020 16:42:55 +0200 Subject: [PATCH 12/60] Math: IIR: Fix overflow in DF2T generic C version biquad output With coefficients scaling that creates above 1.0 absolute value internal biquad output before scaling gain and shift there's overflow in variable tmp calculation that is used for output and for recursive a1, a2 coefficients multiplication. Fixes: #3678 Signed-off-by: Seppo Ingalsuo --- src/math/iir_df2t_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/math/iir_df2t_generic.c b/src/math/iir_df2t_generic.c index 7779307c5705..c7bc565a3f30 100644 --- a/src/math/iir_df2t_generic.c +++ b/src/math/iir_df2t_generic.c @@ -65,10 +65,10 @@ int32_t iir_df2t(struct iir_state_df2t *iir, int32_t x) for (i = 0; i < iir->biquads_in_series; i++) { /* Compute output: Delay is Q3.61 * Q2.30 x Q1.31 -> Q3.61 - * Shift Q3.61 to Q3.31 with rounding + * Shift Q3.61 to Q3.31 with rounding, saturate to Q1.31 */ - acc = ((int64_t)iir->coef[c + 4]) * in + iir->delay[d]; - tmp = (int32_t)Q_SHIFT_RND(acc, 61, 31); + acc = ((int64_t)iir->coef[c + 4]) * in + iir->delay[d]; /* Coef b0 */ + tmp = (int32_t)sat_int32(Q_SHIFT_RND(acc, 61, 31)); /* Compute first delay */ acc = iir->delay[d + 1]; From 5ea80a51eb86ab61c33b16f7029509394836b384 Mon Sep 17 00:00:00 2001 From: Pan Xiuli Date: Thu, 10 Dec 2020 05:44:17 +0000 Subject: [PATCH 13/60] travis: add tgl-h build Add tgl-h build check in Travis Signed-off-by: Pan Xiuli --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 6203c6827c4c..ac31d359f3a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,9 @@ jobs: - <<: *build-platform env: PLATFORM='tgl' + - <<: *build-platform + env: PLATFORM='tgl-h' + - name: "./scripts/build-tools.sh Release" before_install: *docker-pull-sof script: CMAKE_BUILD_TYPE=Release ./scripts/docker-run.sh ./scripts/build-tools.sh From da073fbf80aa33858a169cb86ca3aaf50e0bdfa1 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 20 Nov 2020 10:39:25 +0100 Subject: [PATCH 14/60] core: optimise ALIGN_UP() to only use 1 division No need for two divisions for an alignment macro, one is enough. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index 359f908e9f97..0fac6f049606 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -12,7 +12,7 @@ /* Align the number to the nearest alignment value */ #define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0) #define ALIGN_UP(size, alignment) \ - ((size) + (((alignment) - ((size) % (alignment))) % (alignment))) + ((size) + (alignment) - 1 - ((size) + (alignment) - 1) % (alignment)) #define ALIGN_DOWN(size, alignment) \ ((size) - ((size) % (alignment))) #define ALIGN ALIGN_UP From 4316f3c83635b4ae043b9ebc29b8135d49fbbabf Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 20 Nov 2020 10:43:59 +0100 Subject: [PATCH 15/60] alloc: simplify align_ptr() Simplify the align_ptr() function by re-using an existing ALIGN() macro. Signed-off-by: Guennadi Liakhovetski --- src/lib/alloc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/alloc.c b/src/lib/alloc.c index af12515982c7..f99c4d04aba4 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -190,17 +190,14 @@ static void *rmalloc_sys(struct mm_heap *heap, uint32_t flags, int caps, size_t static void *align_ptr(struct mm_heap *heap, uint32_t alignment, void *ptr, struct block_hdr *hdr) { - int mod_align = 0; - /* Save unaligned ptr to block hdr */ hdr->unaligned_ptr = ptr; /* If ptr is not already aligned we calculate alignment shift */ - if (alignment && (uintptr_t)ptr % alignment) - mod_align = alignment - ((uintptr_t)ptr % alignment); + if (alignment <= 1) + return ptr; - /* Calculate aligned pointer */ - return (char *)ptr + mod_align; + return (void *)ALIGN((uintptr_t)ptr, alignment); } /* allocate single block */ From 8d277b5b159e921ae8f03d4f437ef080555a18bf Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 20 Nov 2020 14:06:48 +0100 Subject: [PATCH 16/60] alloc: no need to check the same condition repeatedly alloc_heap_buffer() is trying to allocate memory from a single heap, no need to check its size on each iteration of an internal loop over maps. Signed-off-by: Guennadi Liakhovetski --- src/lib/alloc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/alloc.c b/src/lib/alloc.c index f99c4d04aba4..62db99b831ab 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -809,13 +809,16 @@ static void *alloc_heap_buffer(struct mm_heap *heap, uint32_t flags, platform_shared_commit(map, sizeof(*map)); } - /* size of requested buffer is adjusted for alignment purposes - * since we span more blocks we have to assume worst case scenario - */ - bytes += alignment; - /* request spans > 1 block */ if (!ptr) { + /* size of requested buffer is adjusted for alignment purposes + * since we span more blocks we have to assume worst case scenario + */ + bytes += alignment; + + if (heap->size < bytes) + return NULL; + /* * Find the best block size for request. We know, that we failed * to find a single large enough block, so, skip those. @@ -824,7 +827,7 @@ static void *alloc_heap_buffer(struct mm_heap *heap, uint32_t flags, map = &heap->map[i]; /* allocate if block size is smaller than request */ - if (heap->size >= bytes && map->block_size < bytes) { + if (map->block_size < bytes) { ptr = alloc_cont_blocks(heap, i, caps, bytes, alignment); if (ptr) { @@ -843,8 +846,6 @@ static void *alloc_heap_buffer(struct mm_heap *heap, uint32_t flags, bzero(ptr, temp_bytes); #endif - platform_shared_commit(heap, sizeof(*heap)); - return ptr; } @@ -865,6 +866,7 @@ static void *_balloc_unlocked(uint32_t flags, uint32_t caps, size_t bytes, break; ptr = alloc_heap_buffer(heap, flags, caps, bytes, alignment); + platform_shared_commit(heap, sizeof(*heap)); if (ptr) break; From fdfebdd8ad65608d3b926a267788c153f33b086c Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Tue, 15 Dec 2020 10:52:26 +0100 Subject: [PATCH 17/60] codec_adapter: fix premature free of memory This patch fixes the issue with premature free of runtime parameters memory. Such situation occurs when runtime params are send in few parts, then after the first packet has been copied the memory is freed so the consecutive one no longer has a copy destination. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec_adapter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 2a96adf5887f..3d43374dafaa 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -430,7 +430,6 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da if (ret) { comp_err(dev, "codec_adapter_set_params() error %x: codec runtime config apply failed", ret); - goto done; } else { comp_dbg(dev, "codec_adapter_set_params() apply of runtime config done."); } @@ -443,7 +442,9 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da comp_err(dev, "codec_adapter_set_params(): error: unknown config type."); break; } - } + } else + goto end; + done: if (cd->runtime_params) rfree(cd->runtime_params); From 18e31abd4794056cb441544ff3b010a42d371d13 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Wed, 16 Dec 2020 15:35:28 +0800 Subject: [PATCH 18/60] ssp: mn: log more info for bclk/mclk configuration Log more useful information about bclk/mclk configuration to help track the blck/mclk status. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 31e638c6aa09..0f3c8a30c51f 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -166,6 +166,8 @@ static inline int check_current_mclk_source(uint32_t mclk_rate) struct mn *mn = mn_get(); int ret = 0; + tr_info(&mn_tr, "MCLK %d, source = %d", mclk_rate, mn->mclk_source_clock); + if (ssp_freq[mn->mclk_source_clock].freq % mclk_rate != 0) { tr_err(&mn_tr, "MCLK %d, no valid configuration for already selected source = %d", mclk_rate, mn->mclk_source_clock); @@ -187,6 +189,7 @@ static inline int set_mclk_divider(uint16_t mclk_id, uint32_t mdivr_val) { uint32_t mdivr; + tr_info(&mn_tr, "mclk_id %d mdivr_val %d", mclk_id, mdivr_val); switch (mdivr_val) { case 1: mdivr = 0x00000fff; /* bypass divider for MCLK */ @@ -233,6 +236,9 @@ int mn_set_mclk(uint16_t mclk_id, uint32_t mclk_rate) mn->mclk_sources_used[mclk_id] = true; + tr_info(&mn_tr, "mclk_rate %d, mclk_source_clock %d", + mclk_rate, mn->mclk_source_clock); + ret = set_mclk_divider(mclk_id, ssp_freq[mn->mclk_source_clock].freq / mclk_rate); @@ -271,6 +277,7 @@ static bool find_mn(uint32_t freq, uint32_t bclk, uint32_t m, n, mn_div; uint32_t scr_div = freq / bclk; + tr_info(&mn_tr, "find_mn for freq %d bclk %d", freq, bclk); /* check if just SCR is enough */ if (freq % bclk == 0 && scr_div < (SSCR0_SCR_MASK >> 8) + 1) { *out_scr_div = scr_div; @@ -309,6 +316,7 @@ static bool find_mn(uint32_t freq, uint32_t bclk, *out_m = m; *out_n = n; + tr_info(&mn_tr, "find_mn m %d n %d", m, n); return true; } @@ -518,6 +526,9 @@ int mn_set_bclk(uint32_t dai_index, uint32_t bclk_rate, if (ret >= 0) { mn->bclk_sources[dai_index] = MN_BCLK_SOURCE_MN; + tr_info(&mn_tr, "bclk_rate %d, *out_scr_div %d, m %d, n %d", + bclk_rate, *out_scr_div, m, n); + mn_reg_write(MN_MDIV_M_VAL(dai_index), dai_index, m); mn_reg_write(MN_MDIV_N_VAL(dai_index), dai_index, n); } From 3e2317ef309ee2d329257bfe001b1b577e364285 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 10 Dec 2020 15:34:58 +0800 Subject: [PATCH 19/60] ssp: mn: log useful info when error happen Log the incorrect mdivr_val value when error happen, which could help to identify what has happened. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 0f3c8a30c51f..1e18fbdf88ce 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -204,7 +204,7 @@ static inline int set_mclk_divider(uint16_t mclk_id, uint32_t mdivr_val) mdivr = 0x6; /* 1/8 */ break; default: - tr_err(&mn_tr, "invalid ssp_freq %d", ssp_freq[1].freq); + tr_err(&mn_tr, "invalid mdivr_val %d", mdivr_val); return -EINVAL; } From 3f6465dbd33f56da66a346220e508493d67f0bfa Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Fri, 4 Dec 2020 17:45:23 +0800 Subject: [PATCH 20/60] ssp: mn: return -EINVAL if bclk source not found Use standard errno in find_bclk_source(), return -EINVAL if no matched bclk source found. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 1e18fbdf88ce..f30eed454de1 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -328,7 +328,7 @@ static bool find_mn(uint32_t freq, uint32_t bclk, * \param[out] scr_div SCR divisor. * \param[out] m M value of M/N divider. * \param[out] n N value of M/N divider. - * \return index of suitable clock if could find it, -1 otherwise. + * \return index of suitable clock if could find it, -EINVAL otherwise. */ static int find_bclk_source(uint32_t bclk, uint32_t *scr_div, uint32_t *m, uint32_t *n) @@ -348,7 +348,7 @@ static int find_bclk_source(uint32_t bclk, scr_div, m, n)) return i; - return -1; + return -EINVAL; } /** From f5aa594e488d3207e0577378dab83e343ae9756a Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 10:47:51 +0800 Subject: [PATCH 21/60] ssp: mn: search from index 0 to get a proper one mclk source The ssp.freq is arranged in ascending sequence, to get the smallest matched clock, we should search from index 0. We should not stop the searching if 'mclk < ssp.freq', continue the searching until we get a larger/proper one or fail if all the items are iterated. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index f30eed454de1..3fee67539637 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -121,12 +121,11 @@ static inline int setup_initial_mclk_source(uint32_t mclk_id, int ret = 0; /* searching the smallest possible mclk source */ - for (i = MAX_SSP_FREQ_INDEX; i >= 0; i--) { - if (mclk_rate > ssp_freq[i].freq) - break; - - if (ssp_freq[i].freq % mclk_rate == 0) + for (i = 0; i <= MAX_SSP_FREQ_INDEX; i++) { + if (ssp_freq[i].freq % mclk_rate == 0) { clk_index = i; + break; + } } if (clk_index < 0) { From 6d75984f7bdcbea8594375e5c5f363420a9525f8 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Wed, 16 Dec 2020 16:47:58 +0800 Subject: [PATCH 22/60] ssp: mn: enable more N values in set_mclk_divider According to spec, we can configure more devidier ratios via register MDIVR, in 1/N the N could be 2, 3, 4, 5, 6, 7, 8. Here change to enable these possibilities. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 3fee67539637..1bd72a5a2299 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -193,14 +193,8 @@ static inline int set_mclk_divider(uint16_t mclk_id, uint32_t mdivr_val) case 1: mdivr = 0x00000fff; /* bypass divider for MCLK */ break; - case 2: - mdivr = 0x0; /* 1/2 */ - break; - case 4: - mdivr = 0x2; /* 1/4 */ - break; - case 8: - mdivr = 0x6; /* 1/8 */ + case 2 ... 8: + mdivr = mdivr_val - 2; /* 1/n */ break; default: tr_err(&mn_tr, "invalid mdivr_val %d", mdivr_val); From 589055d38a90884b596a5b98dd144fe7f70f72fb Mon Sep 17 00:00:00 2001 From: Jaska Uimonen Date: Mon, 14 Dec 2020 18:13:48 +0200 Subject: [PATCH 23/60] topology: fix setting mux uuid in m4 Currently the mux/demux uuid setting doesn't work and uuid is always set to "demux". Fix this by quoting the ifelse in 1 line. Signed-off-by: Jaska Uimonen --- tools/topology/m4/muxdemux.m4 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/topology/m4/muxdemux.m4 b/tools/topology/m4/muxdemux.m4 index 68fc23506dca..047e0177e783 100644 --- a/tools/topology/m4/muxdemux.m4 +++ b/tools/topology/m4/muxdemux.m4 @@ -43,9 +43,7 @@ define(`W_MUXDEMUX', `SectionVendorTuples."'N_MUXDEMUX($1)`_tuples_uuid" {' ` tokens "sof_comp_tokens"' ` tuples."uuid" {' -ifelse(`$2', `0', -` SOF_TKN_COMP_UUID' STR(mux_uuid), -` SOF_TKN_COMP_UUID' STR(demux_uuid)) +`ifelse(`$2', `0',` SOF_TKN_COMP_UUID' STR(mux_uuid),` SOF_TKN_COMP_UUID' STR(demux_uuid))' ` }' `}' `SectionData."'N_MUXDEMUX($1)`_data_uuid" {' From 2638cdc4ca52c0e9c3ee433c06846a74fbaeb57c Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 17:24:41 +0800 Subject: [PATCH 24/60] ssp: mn: add helper to get SSP clock index Add a helper to get SSP clock index from the clock source encoded index for cAVS platforms. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 1bd72a5a2299..ee15b5a51bbd 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -344,6 +344,22 @@ static int find_bclk_source(uint32_t bclk, return -EINVAL; } +/** + * \brief Finds index of SSP clock with the given clock source encoded index. + * \return the index in ssp_freq if could find it, -EINVAL otherwise. + */ +static int find_clk_ssp_index(uint32_t src_enc) +{ + int i; + + /* searching for the encode value matched bclk source */ + for (i = 0; i <= MAX_SSP_FREQ_INDEX; i++) + if (ssp_freq_sources[i] == src_enc) + return i; + + return -EINVAL; +} + /** * \brief Checks if given clock is used as source for any BCLK. * \param[in] clk_src Bit clock source. From 1fb72c6b74ddedeb10b893682669b42973915e95 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 17:28:52 +0800 Subject: [PATCH 25/60] ssp: mn: add helper to reset bclk M/N source Add a helper to reset the bclk M/N source (MNDSS), which will help to release the clock source when it is not needed. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index ee15b5a51bbd..3a536baf41c7 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -422,6 +422,35 @@ static inline int setup_initial_bclk_mn_source(uint32_t bclk, uint32_t *scr_div, return 0; } +/** + * \brief Reset M/N source clock for BCLK. + * If no port is using bclk, reset to use SSP_CLOCK_XTAL_OSCILLATOR + * as the default clock source. + */ +static inline void reset_bclk_mn_source(void) +{ + struct mn *mn = mn_get(); + uint32_t mdivc; + int clk_index = find_clk_ssp_index(SSP_CLOCK_XTAL_OSCILLATOR); + + if (clk_index < 0) { + tr_err(&mn_tr, "BCLK reset failed, no SSP_CLOCK_XTAL_OSCILLATOR source!"); + return; + } + + mdivc = mn_reg_read(MN_MDIVCTRL, 0); + + /* reset to use XTAL Oscillator */ + mdivc &= ~MNDSS(MN_SOURCE_CLKS_MASK); + mdivc |= MNDSS(SSP_CLOCK_XTAL_OSCILLATOR); + + mn_reg_write(MN_MDIVCTRL, 0, mdivc); + + mn->bclk_source_mn_clock = clk_index; + + platform_shared_commit(mn, sizeof(*mn)); +} + /** * \brief Finds valid M/(N * SCR) values for source clock that is already locked * because other ports use it. From b6c2d6a8339d35e94f1f476b8ebb4cc223544191 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 17:31:51 +0800 Subject: [PATCH 26/60] ssp: mn: release the M/N clock source when not used During mn_release_bclk(), check if there is still any SSP which is holding the M/N clock source, if no, release the clock source for power saving. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/mn.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/drivers/intel/ssp/mn.c b/src/drivers/intel/ssp/mn.c index 3a536baf41c7..ee8dfba53fe8 100644 --- a/src/drivers/intel/ssp/mn.c +++ b/src/drivers/intel/ssp/mn.c @@ -582,10 +582,16 @@ int mn_set_bclk(uint32_t dai_index, uint32_t bclk_rate, void mn_release_bclk(uint32_t dai_index) { struct mn *mn = mn_get(); + bool mn_in_use; spin_lock(&mn->lock); mn->bclk_sources[dai_index] = MN_BCLK_SOURCE_NONE; platform_shared_commit(mn, sizeof(*mn)); + + mn_in_use = is_bclk_source_in_use(MN_BCLK_SOURCE_MN); + /* release the M/N clock source if not used */ + if (!mn_in_use) + reset_bclk_mn_source(); spin_unlock(&mn->lock); } From d19573e4292f7b554598ee92552aad2b967d4725 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 17:35:54 +0800 Subject: [PATCH 27/60] ssp: add helpers to handle runtime ssp configuration Create ssp_pre_start/stop() helpers to do kinds of runtime configuration, and do the bclk request/release there to make sure the bclk source is hold only when the DAI is active, this will help for power saving at SSP idle. Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/ssp.c | 87 +++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/src/drivers/intel/ssp/ssp.c b/src/drivers/intel/ssp/ssp.c index 478e4faab366..313cdf43d1e1 100644 --- a/src/drivers/intel/ssp/ssp.c +++ b/src/drivers/intel/ssp/ssp.c @@ -659,6 +659,93 @@ static int ssp_set_config(struct dai *dai, return ret; } +/* + * Portion of the SSP configuration should be applied just before the + * SSP dai is activated, for either power saving or params runtime + * configurable flexibility. + */ +static int ssp_pre_start(struct dai *dai) +{ + struct ssp_pdata *ssp = dai_get_drvdata(dai); + struct sof_ipc_dai_config *config = &ssp->config; + uint32_t sscr0; + uint32_t mdiv; + bool need_ecs = false; + + int ret = 0; + + dai_info(dai, "ssp_pre_start()"); + + /* SSP active means bclk already configured. */ + if (ssp->state[SOF_IPC_STREAM_PLAYBACK] == COMP_STATE_ACTIVE || + ssp->state[SOF_IPC_STREAM_CAPTURE] == COMP_STATE_ACTIVE) + return 0; + + sscr0 = ssp_read(dai, SSCR0); + +#if CONFIG_INTEL_MN + /* BCLK config */ + ret = mn_set_bclk(config->dai_index, config->ssp.bclk_rate, + &mdiv, &need_ecs); + if (ret < 0) { + dai_err(dai, "invalid bclk_rate = %d for dai_index = %d", + config->ssp.bclk_rate, config->dai_index); + goto out; + } +#else + if (ssp_freq[SSP_DEFAULT_IDX].freq % config->ssp.bclk_rate != 0) { + dai_err(dai, "invalid bclk_rate = %d for dai_index = %d", + config->ssp.bclk_rate, config->dai_index); + goto out; + } + + mdiv = ssp_freq[SSP_DEFAULT_IDX].freq / config->ssp.bclk_rate; +#endif + + if (need_ecs) + sscr0 |= SSCR0_ECS; + + /* clock divisor is SCR + 1 */ + mdiv -= 1; + + /* divisor must be within SCR range */ + if (mdiv > (SSCR0_SCR_MASK >> 8)) { + dai_err(dai, "ssp_pre_start(): divisor %d is not within SCR range", + mdiv); + ret = -EINVAL; + goto out; + } + + /* set the SCR divisor */ + sscr0 &= ~SSCR0_SCR_MASK; + sscr0 |= SSCR0_SCR(mdiv); + + ssp_write(dai, SSCR0, sscr0); + + dai_info(dai, "ssp_set_config(), sscr0 = 0x%08x", sscr0); +out: + platform_shared_commit(ssp, sizeof(*ssp)); + + return ret; +} + +/* + * For power saving, we should do kinds of power release when the SSP + * dai is changed to inactive, though the runtime param configuration + * don't have to be reset. + */ +static void ssp_post_stop(struct dai *dai) +{ +#if CONFIG_INTEL_MN + struct ssp_pdata *ssp = dai_get_drvdata(dai); + + /* release bclk if SSP is inactive */ + if (ssp->state[SOF_IPC_STREAM_PLAYBACK] != COMP_STATE_ACTIVE && + ssp->state[SOF_IPC_STREAM_CAPTURE] != COMP_STATE_ACTIVE) + mn_release_bclk(dai->index); +#endif +} + /* get SSP hw params */ static int ssp_get_hw_params(struct dai *dai, struct sof_ipc_stream_params *params, int dir) From 83fba37ed7d56aee21b035ca67f44188fc5decfd Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Thu, 19 Nov 2020 17:39:11 +0800 Subject: [PATCH 28/60] ssp: do bclk request/release at pre_start and post_stop To reduce the power consumption, we should request the clock source for bclk only when SSP is active. This means we need to postpone the clock request from ssp_set_config() to ssp_pre_start() and release it at ssp_post_stop(). Signed-off-by: Keyon Jie --- src/drivers/intel/ssp/ssp.c | 43 +++++-------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/src/drivers/intel/ssp/ssp.c b/src/drivers/intel/ssp/ssp.c index 313cdf43d1e1..c910633b50b2 100644 --- a/src/drivers/intel/ssp/ssp.c +++ b/src/drivers/intel/ssp/ssp.c @@ -140,7 +140,6 @@ static int ssp_set_config(struct dai *dai, uint32_t ssrsa; uint32_t ssto; uint32_t ssioc; - uint32_t mdiv; uint32_t bdiv; uint32_t data_size; uint32_t frame_end_padding; @@ -157,7 +156,6 @@ static int ssp_set_config(struct dai *dai, bool inverted_frame = false; bool cfs = false; bool start_delay = false; - bool need_ecs = false; int ret = 0; @@ -332,42 +330,6 @@ static int ssp_set_config(struct dai *dai, goto out; } -#if CONFIG_INTEL_MN - /* BCLK config */ - ret = mn_set_bclk(config->dai_index, config->ssp.bclk_rate, - &mdiv, &need_ecs); - if (ret < 0) { - dai_err(dai, "invalid bclk_rate = %d for dai_index = %d", - config->ssp.bclk_rate, config->dai_index); - goto out; - } -#else - if (ssp_freq[SSP_DEFAULT_IDX].freq % config->ssp.bclk_rate != 0) { - dai_err(dai, "invalid bclk_rate = %d for dai_index = %d", - config->ssp.bclk_rate, config->dai_index); - goto out; - } - - mdiv = ssp_freq[SSP_DEFAULT_IDX].freq / config->ssp.bclk_rate; -#endif - - if (need_ecs) - sscr0 |= SSCR0_ECS; - - /* clock divisor is SCR + 1 */ - mdiv -= 1; - - /* divisor must be within SCR range */ - if (mdiv > (SSCR0_SCR_MASK >> 8)) { - dai_err(dai, "ssp_set_config(): divisor %d is not within SCR range", - mdiv); - ret = -EINVAL; - goto out; - } - - /* set the SCR divisor */ - sscr0 |= SSCR0_SCR(mdiv); - /* calc frame width based on BCLK and rate - must be divisable */ if (config->ssp.bclk_rate % config->ssp.fsync_rate) { dai_err(dai, "ssp_set_config(): BCLK %d is not divisable by rate %d", @@ -785,6 +747,9 @@ static void ssp_start(struct dai *dai, int direction) spin_lock(&dai->lock); + /* request mclk/bclk */ + ssp_pre_start(dai); + /* enable port */ ssp_update_bits(dai, SSCR0, SSCR0_SSE, SSCR0_SSE); ssp->state[direction] = COMP_STATE_ACTIVE; @@ -851,6 +816,8 @@ static void ssp_stop(struct dai *dai, int direction) dai_info(dai, "ssp_stop(), SSP port disabled"); } + ssp_post_stop(dai); + spin_unlock(&dai->lock); } From 07ef8adbd7e0c03707a073fb4d7aa8f495c4795a Mon Sep 17 00:00:00 2001 From: Iuliana Prodan Date: Wed, 16 Dec 2020 12:26:06 +0200 Subject: [PATCH 29/60] schedule: dma_multi_chan: fix null pointer when scanning for tasks When scanning all channels for a certain task we end up comparing with a null task. That's because we have multiple channels (e.g. 32 for i.MX) but only some of them are used in certain scenarios. For example, for simultaneous playback/capture we use only 2 DMA channels. To fix this, validate task before using it. Fixes #3690 Fixes: 647390f75e6a ("schedule: dma_multi_chan: fix a DMA channel interrupt race") Signed-off-by: Daniel Baluta Signed-off-by: Iuliana Prodan --- src/schedule/dma_multi_chan_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/schedule/dma_multi_chan_domain.c b/src/schedule/dma_multi_chan_domain.c index 81ad9d7dcccb..284fd3753c24 100644 --- a/src/schedule/dma_multi_chan_domain.c +++ b/src/schedule/dma_multi_chan_domain.c @@ -293,7 +293,8 @@ static bool dma_multi_chan_domain_is_pending(struct ll_schedule_domain *domain, continue; *comp = dma_domain->data[i][j].task->sched_comp; - } else if (dma_domain->data[i][j].task->sched_comp != *comp) { + } else if (!dma_domain->data[i][j].task || + dma_domain->data[i][j].task->sched_comp != *comp) { continue; } From 9d1ebecb8f09cd8c6c611e6106f74caca22a9c21 Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Thu, 26 Nov 2020 10:36:37 +0100 Subject: [PATCH 30/60] kpb: check pm_is_active and dont enable it at the end of draining This patch will prevent from enabling pm_runtime dsp at the end of draining to avoid enabling it when already received disable ipc during draining Signed-off-by: Adrian Bonislawski --- src/audio/kpb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/audio/kpb.c b/src/audio/kpb.c index 7f9caa152505..2b6b1ce6244f 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -1176,11 +1176,15 @@ static enum task_state kpb_draining_task(void *arg) size_t *rt_stream_update = &draining_data->buffered_while_draining; struct comp_data *kpb = comp_get_drvdata(draining_data->dev); bool sync_mode_on = draining_data->sync_mode_on; + bool pm_is_active; uint32_t flags; comp_cl_info(&comp_kpb, "kpb_draining_task(), start."); - pm_runtime_disable(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID); + pm_is_active = pm_runtime_is_active(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID); + + if (!pm_is_active) + pm_runtime_disable(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID); /* Change KPB internal state to DRAINING */ kpb_change_state(kpb, KPB_STATE_DRAINING); @@ -1294,8 +1298,6 @@ static enum task_state kpb_draining_task(void *arg) comp_cl_info(&comp_kpb, "KPB: kpb_draining_task(), done. %u drained in > %u ms", drained, UINT_MAX); - pm_runtime_enable(PM_RUNTIME_DSP, PLATFORM_PRIMARY_CORE_ID); - return SOF_TASK_STATE_COMPLETED; } From e79893ee02d88ffeb8f6beed7bbd38bc11f13dae Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 23 Nov 2020 17:25:18 +0100 Subject: [PATCH 31/60] codec_adapter: update .params() method This patch updates the .params() method with verification of runtime parameters and stores them in component data for future use. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec_adapter.c | 15 ++++++++++++++- .../sof/audio/codec_adapter/codec/generic.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 3d43374dafaa..c8591f40e1c0 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -225,8 +225,21 @@ static int codec_adapter_prepare(struct comp_dev *dev) static int codec_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params) { - comp_dbg(dev, "codec_adapter_params(): codec_adapter doesn't support .params() method."); + int ret; + struct comp_data *cd = comp_get_drvdata(dev); + + ret = comp_verify_params(dev, 0, params); + if (ret < 0) { + comp_err(dev, "codec_adapter_params(): comp_verify_params() failed."); + return ret; + } + + ret = memcpy_s(&cd->stream_params, sizeof(struct sof_ipc_stream_params), + params, sizeof(struct sof_ipc_stream_params)); + assert(!ret); + cd->period_bytes = params->sample_container_bytes * + params->channels * params->rate / 1000; return 0; } diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index fd757703c867..52c359076fbe 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -183,6 +183,8 @@ struct comp_data { struct comp_buffer *ca_sink; struct comp_buffer *ca_source; void *runtime_params; + struct sof_ipc_stream_params stream_params; + uint32_t period_bytes; /** pipeline period bytes */ }; /*****************************************************************************/ From 9c660ec6a67f3c47388b63eee2f14d05f0bb98f7 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 23 Nov 2020 17:21:04 +0100 Subject: [PATCH 32/60] codec_adapter: move runtime params to codec_data The runtime_params keeps configuration of codec therefore codec_data structure is a better place to store it. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec/generic.c | 4 ++-- src/audio/codec_adapter/codec_adapter.c | 23 ++++++++++--------- .../sof/audio/codec_adapter/codec/generic.h | 4 ++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/audio/codec_adapter/codec/generic.c b/src/audio/codec_adapter/codec/generic.c index f0d3d08ff913..1aa6f90b2614 100644 --- a/src/audio/codec_adapter/codec/generic.c +++ b/src/audio/codec_adapter/codec/generic.c @@ -369,8 +369,8 @@ int codec_free(struct comp_dev *dev) codec->r_cfg.size = 0; rfree(codec->r_cfg.data); rfree(codec->s_cfg.data); - if (cd->runtime_params) - rfree(cd->runtime_params); + if (codec->runtime_params) + rfree(codec->runtime_params); codec->state = CODEC_DISABLED; diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index c8591f40e1c0..3795ff1aa267 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -358,6 +358,7 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da static uint32_t size; uint32_t offset; struct comp_data *cd = comp_get_drvdata(dev); + struct codec_data *codec = &cd->codec; comp_dbg(dev, "codec_adapter_set_params(): start: num_of_elem %d, elem remain %d msg_index %u", cdata->num_elems, cdata->elems_remaining, cdata->msg_index); @@ -366,7 +367,7 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da if (cdata->msg_index == 0) { size = cdata->num_elems + cdata->elems_remaining; /* Check that there is no work-in-progress on previous request */ - if (cd->runtime_params) { + if (codec->runtime_params) { comp_err(dev, "codec_adapter_set_params() error: busy with previous request"); ret = -EBUSY; goto end; @@ -388,22 +389,22 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da } /* Allocate buffer for new params */ - cd->runtime_params = rballoc(0, SOF_MEM_CAPS_RAM, size); - if (!cd->runtime_params) { + codec->runtime_params = rballoc(0, SOF_MEM_CAPS_RAM, size); + if (!codec->runtime_params) { comp_err(dev, "codec_adapter_set_params(): space allocation for new params failed"); ret = -ENOMEM; goto end; } - memset(cd->runtime_params, 0, size); - } else if (!cd->runtime_params) { + memset(codec->runtime_params, 0, size); + } else if (!codec->runtime_params) { comp_err(dev, "codec_adapter_set_params() error: no memory available for runtime params in consecutive load"); ret = -EIO; goto end; } offset = size - (cdata->num_elems + cdata->elems_remaining); - dst = (char *)cd->runtime_params + offset; + dst = (char *)codec->runtime_params + offset; src = (char *)cdata->data->data; ret = memcpy_s(dst, size - offset, src, cdata->num_elems); @@ -415,7 +416,7 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da if (!cdata->elems_remaining) { switch (type) { case CODEC_CFG_SETUP: - ret = load_setup_config(dev, cd->runtime_params, size); + ret = load_setup_config(dev, codec->runtime_params, size); if (ret) { comp_err(dev, "codec_adapter_set_params(): error %d: load of setup config failed.", ret); @@ -425,7 +426,7 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da break; case CODEC_CFG_RUNTIME: - ret = codec_load_config(dev, cd->runtime_params, size, + ret = codec_load_config(dev, codec->runtime_params, size, CODEC_CFG_RUNTIME); if (ret) { comp_err(dev, "codec_adapter_set_params() error %d: load of runtime config failed.", @@ -459,9 +460,9 @@ static int codec_adapter_set_params(struct comp_dev *dev, struct sof_ipc_ctrl_da goto end; done: - if (cd->runtime_params) - rfree(cd->runtime_params); - cd->runtime_params = NULL; + if (codec->runtime_params) + rfree(codec->runtime_params); + codec->runtime_params = NULL; return ret; end: return ret; diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index 52c359076fbe..affb018de982 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -167,10 +167,11 @@ struct codec_processing_data { struct codec_data { uint32_t id; enum codec_state state; + void *private; /**< self object, memory tables etc here */ + void *runtime_params; struct codec_config s_cfg; /**< setup config */ struct codec_config r_cfg; /**< runtime config */ struct codec_interface *ops; /**< codec specific operations */ - void *private; /**< self object, memory tables etc here */ struct codec_memory memory; /**< memory allocated by codec */ struct codec_processing_data cpd; /**< shared data comp <-> codec */ }; @@ -182,7 +183,6 @@ struct comp_data { struct codec_data codec; /**< codec private data */ struct comp_buffer *ca_sink; struct comp_buffer *ca_source; - void *runtime_params; struct sof_ipc_stream_params stream_params; uint32_t period_bytes; /** pipeline period bytes */ }; From 007e5a2560555a5a8a42d19d117d9714231acbd3 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 23 Nov 2020 15:43:07 +0100 Subject: [PATCH 33/60] codec_adapter: check if deep buffering is needed This patch introduces deep buffering for codec adapter. This is needed when codec input buffer is not a natural multiple of pipeline buffer. In such situation codec adapter won't be able to produce samples every n period. Hence we "deep buffer" samples during startup (typically few periods, depending on the difference between pipeline buff and codec buff) so once we gathered enough samples to regularly produce output we start processing. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec_adapter.c | 25 +++++++++++++++++++ .../sof/audio/codec_adapter/codec/generic.h | 1 + 2 files changed, 26 insertions(+) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 3795ff1aa267..4b9e118dcdda 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -180,6 +180,8 @@ static int codec_adapter_prepare(struct comp_dev *dev) { int ret; struct comp_data *cd = comp_get_drvdata(dev); + struct codec_data *codec = &cd->codec; + uint32_t buff_periods; /* number of deep buffering periods */ comp_info(dev, "codec_adapter_prepare() start"); @@ -216,6 +218,29 @@ static int codec_adapter_prepare(struct comp_dev *dev) return -EIO; } + /* Codec is prepared, now we need to configure processing settings. + * If codec internal buffer is not equal to natural multiple of pipeline + * buffer we have a situation where CA have to deep buffer certain amount + * of samples on its start (typically few periods) in order to regularly + * generate output once started (same situation happens for compress streams + * as well). + */ + if (codec->cpd.in_buff_size != cd->period_bytes) { + if (codec->cpd.in_buff_size > cd->period_bytes) { + buff_periods = (codec->cpd.in_buff_size % cd->period_bytes) ? + (codec->cpd.in_buff_size / cd->period_bytes) + 2 : + (codec->cpd.in_buff_size / cd->period_bytes) + 1; + } else { + buff_periods = (cd->period_bytes % codec->cpd.in_buff_size) ? + (cd->period_bytes / codec->cpd.in_buff_size) + 2 : + (cd->period_bytes / codec->cpd.in_buff_size) + 1; + } + + cd->deep_buff_bytes = cd->period_bytes * buff_periods; + } else { + cd->deep_buff_bytes = 0; + } + comp_info(dev, "codec_adapter_prepare() done"); cd->state = PP_STATE_PREPARED; diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index affb018de982..21a385f8dce4 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -185,6 +185,7 @@ struct comp_data { struct comp_buffer *ca_source; struct sof_ipc_stream_params stream_params; uint32_t period_bytes; /** pipeline period bytes */ + uint32_t deep_buff_bytes; /**< copy start threshold */ }; /*****************************************************************************/ From 44137fad6c4a8e5dbf4ae8a959885086f3a81748 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 23 Nov 2020 17:50:34 +0100 Subject: [PATCH 34/60] codec_adapter: add local buffer This patch adds local buffer to codec adapter. The aim of this buffer is to damp any irregularity between pipeline and codec. The difference in buffer sizes is one of the examples here - thanks to additional local buffer we can call codec processing several times during one period or we can store several pipeline periods in local buffer and process them once. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec_adapter.c | 32 +++++++++++++++++-- .../sof/audio/codec_adapter/codec/generic.h | 1 + 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 4b9e118dcdda..20cd62d79d1d 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -181,7 +181,10 @@ static int codec_adapter_prepare(struct comp_dev *dev) int ret; struct comp_data *cd = comp_get_drvdata(dev); struct codec_data *codec = &cd->codec; - uint32_t buff_periods; /* number of deep buffering periods */ + uint32_t buff_periods = 2; /* default periods of local buffer, + * may change if case of deep buffering + */ + uint32_t buff_size; /* size of local buffer */ comp_info(dev, "codec_adapter_prepare() start"); @@ -241,8 +244,30 @@ static int codec_adapter_prepare(struct comp_dev *dev) cd->deep_buff_bytes = 0; } - comp_info(dev, "codec_adapter_prepare() done"); + /* Allocate local buffer */ + buff_size = MAX(cd->period_bytes, codec->cpd.in_buff_size) * buff_periods; + if (cd->local_buff) { + ret = buffer_set_size(cd->local_buff, buff_size); + if (ret < 0) { + comp_err(dev, "codec_adapter_prepare(): buffer_set_size() failed, buff_size = %u", + buff_size); + return ret; + } + } else { + cd->local_buff = buffer_alloc(buff_size, SOF_MEM_CAPS_RAM, + PLATFORM_DCACHE_ALIGN); + if (!cd->local_buff) { + comp_err(dev, "codec_adapter_prepare(): failed to allocate local buffer"); + return -ENOMEM; + } + + buffer_set_params(cd->local_buff, &cd->stream_params, + BUFFER_UPDATE_FORCE); + } + buffer_reset_pos(cd->local_buff, NULL); + cd->state = PP_STATE_PREPARED; + comp_info(dev, "codec_adapter_prepare() done"); return 0; } @@ -594,7 +619,7 @@ static int codec_adapter_reset(struct comp_dev *dev) comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): error %d, codec reset has failed", ret); } - + buffer_zero(cd->local_buff); cd->state = PP_STATE_CREATED; comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): done"); @@ -614,6 +639,7 @@ static void codec_adapter_free(struct comp_dev *dev) comp_cl_info(&comp_codec_adapter, "codec_adapter_reset(): error %d, codec reset has failed", ret); } + buffer_free(cd->local_buff); rfree(cd); rfree(dev); diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index 21a385f8dce4..62fcbd524d6f 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -183,6 +183,7 @@ struct comp_data { struct codec_data codec; /**< codec private data */ struct comp_buffer *ca_sink; struct comp_buffer *ca_source; + struct comp_buffer *local_buff; struct sof_ipc_stream_params stream_params; uint32_t period_bytes; /** pipeline period bytes */ uint32_t deep_buff_bytes; /**< copy start threshold */ From 916035174967d5eae169e39265f2e04072797926 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 23 Nov 2020 20:28:07 +0100 Subject: [PATCH 35/60] codec_adapter: rework copy function to use local buffer This patch refactor codec adapter's .copy() function so it makes use of local buffer and the deep buffering feature. Now, whenever deep buffering is needed we perform processing as usual but store it in local buffer until we gather enough samples to start copying them down/up the pipeline. The important new feature, introduced by this commit is zeroes generator during deep buffering time. This is needed so the next processing component won't classify our buffering time as an XRUN. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec_adapter.c | 70 +++++++++++++++++++++---- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/src/audio/codec_adapter/codec_adapter.c b/src/audio/codec_adapter/codec_adapter.c index 20cd62d79d1d..5ce1a18bd57b 100644 --- a/src/audio/codec_adapter/codec_adapter.c +++ b/src/audio/codec_adapter/codec_adapter.c @@ -338,22 +338,46 @@ codec_adapter_copy_from_lib_to_sink(const struct codec_processing_data *cpd, (char *)cpd->out_buff + head_size, tail_size); } +/** + * \brief Generate zero samples of "bytes" size for the sink. + * \param[in] sink - a pointer to sink buffer. + * \param[in] bytes - number of zero bytes to produce. + * + * \return: none. + */ +static void generate_zeroes(struct comp_buffer *sink, uint32_t bytes) +{ + uint32_t tmp, copy_bytes = bytes; + void *ptr; + + while (copy_bytes) { + ptr = audio_stream_wrap(&sink->stream, sink->stream.w_ptr); + tmp = audio_stream_bytes_without_wrap(&sink->stream, + ptr); + tmp = MIN(tmp, copy_bytes); + ptr = (char *)ptr + tmp; + copy_bytes -= tmp; + } + comp_update_buffer_produce(sink, bytes); +} + static int codec_adapter_copy(struct comp_dev *dev) { int ret = 0; - uint32_t bytes_to_process, processed = 0; + uint32_t bytes_to_process, copy_bytes, processed = 0; struct comp_data *cd = comp_get_drvdata(dev); struct codec_data *codec = &cd->codec; struct comp_buffer *source = cd->ca_source; struct comp_buffer *sink = cd->ca_sink; uint32_t codec_buff_size = codec->cpd.in_buff_size; + struct comp_buffer *local_buff = cd->local_buff; struct comp_copy_limits cl; - comp_get_copy_limits_with_lock(source, sink, &cl); + comp_get_copy_limits_with_lock(source, local_buff, &cl); bytes_to_process = cl.frames * cl.source_frame_bytes; - comp_dbg(dev, "codec_adapter_copy() start: codec_buff_size: %d, sink free: %d source avail %d", - codec_buff_size, sink->stream.free, source->stream.avail); + comp_dbg(dev, "codec_adapter_copy() start: codec_buff_size: %d, local_buff free: %d source avail %d", + codec_buff_size, local_buff->stream.free, source->stream.avail); while (bytes_to_process) { /* Proceed only if we have enough data to fill the lib buffer @@ -361,14 +385,13 @@ static int codec_adapter_copy(struct comp_dev *dev) * the lib won't process it. */ if (bytes_to_process < codec_buff_size) { - comp_dbg(dev, "codec_adapter_copy(): processed %d in this call %d bytes left for next period", - processed, bytes_to_process); + comp_dbg(dev, "codec_adapter_copy(): source has less data than codec buffer size - processing terminated."); break; } + buffer_invalidate(source, codec_buff_size); codec_adapter_copy_from_source_to_lib(&source->stream, &codec->cpd, codec_buff_size); - buffer_invalidate(source, codec_buff_size); codec->cpd.avail = codec_buff_size; ret = codec_process(dev); if (ret) { @@ -381,22 +404,47 @@ static int codec_adapter_copy(struct comp_dev *dev) ret); break; } - codec_adapter_copy_from_lib_to_sink(&codec->cpd, &sink->stream, + codec_adapter_copy_from_lib_to_sink(&codec->cpd, &local_buff->stream, codec->cpd.produced); - buffer_writeback(sink, codec->cpd.produced); bytes_to_process -= codec->cpd.produced; processed += codec->cpd.produced; } - if (!processed) { + if (!processed && !cd->deep_buff_bytes) { comp_dbg(dev, "codec_adapter_copy(): nothing processed in this call"); goto end; + } else if (!processed && cd->deep_buff_bytes) { + goto db_verify; } - comp_update_buffer_produce(sink, processed); + audio_stream_produce(&local_buff->stream, processed); comp_update_buffer_consume(source, processed); + +db_verify: + if (cd->deep_buff_bytes) { + if (cd->deep_buff_bytes >= audio_stream_get_avail_bytes(&local_buff->stream)) { + generate_zeroes(sink, cd->period_bytes); + goto end; + } else { + comp_dbg(dev, "codec_adapter_copy(): deep buffering has ended after gathering %d bytes of processed data", + audio_stream_get_avail_bytes(&local_buff->stream)); + cd->deep_buff_bytes = 0; + } + } + + comp_get_copy_limits_with_lock(local_buff, sink, &cl); + copy_bytes = cl.frames * cl.source_frame_bytes; + audio_stream_copy(&local_buff->stream, 0, + &sink->stream, 0, + copy_bytes / cd->stream_params.sample_container_bytes); + buffer_writeback(sink, copy_bytes); + + comp_update_buffer_produce(sink, copy_bytes); + comp_update_buffer_consume(local_buff, copy_bytes); end: + comp_dbg(dev, "codec_adapter_copy(): processed %d in this call %d bytes left for next period", + processed, bytes_to_process); return ret; } From 2b17a8605dba93872033e76354a91e474967c36a Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Fri, 27 Nov 2020 14:53:04 +0100 Subject: [PATCH 36/60] topology: add missing C_CONTROLBYTES for post processing This patch adds C_CONTROLBYTES for runtime parameters of post processing topology. Signed-off-by: Marcin Rajwa --- tools/topology/sof/pipe-processing-playback.m4 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/topology/sof/pipe-processing-playback.m4 b/tools/topology/sof/pipe-processing-playback.m4 index f252d82af000..7ab3d426d0e4 100644 --- a/tools/topology/sof/pipe-processing-playback.m4 +++ b/tools/topology/sof/pipe-processing-playback.m4 @@ -57,6 +57,15 @@ CONTROLBYTES_PRIV(PP_RUNTIME_PARAMS, ` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"' ) +# Post process Bytes control for runtime config +C_CONTROLBYTES(Post Process Runtime Params, PIPELINE_ID, + CONTROLBYTES_OPS(bytes), + CONTROLBYTES_EXTOPS(void, 258, 258), + , , , + CONTROLBYTES_MAX(void, 157), + , + PP_RUNTIME_PARAMS) + # # Components and Buffers # From 82bddf6cb8eef731071a7f11a44787e4838cd017 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Fri, 27 Nov 2020 14:54:43 +0100 Subject: [PATCH 37/60] topology: increase buffer sizes off post processing This patch increases buffer periods of all components on a post processing pipeline. This is needed because post processing may introduce deep buffering and hence needs more space in its buffers. Signed-off-by: Marcin Rajwa --- tools/topology/sof/pipe-processing-playback.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/topology/sof/pipe-processing-playback.m4 b/tools/topology/sof/pipe-processing-playback.m4 index 7ab3d426d0e4..925a70d9565a 100644 --- a/tools/topology/sof/pipe-processing-playback.m4 +++ b/tools/topology/sof/pipe-processing-playback.m4 @@ -14,6 +14,8 @@ include(`codec_adapter.m4') include(`bytecontrol.m4') ifdef(`PP_CORE',`', `define(`PP_CORE', 1)') +undefine(`DAI_PERIODS') +define(`DAI_PERIODS', 8) # # Controls From 299ae7177130c23b057f0d7ac067155c51674a34 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Fri, 27 Nov 2020 13:46:47 +0100 Subject: [PATCH 38/60] codec_adapter: make free_all_memory() interface available for codecs This patch makes codec_free_all_memory() available for codecs so they can free all memory allocated by themself. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec/generic.c | 2 +- src/include/sof/audio/codec_adapter/codec/generic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/codec_adapter/codec/generic.c b/src/audio/codec_adapter/codec/generic.c index 1aa6f90b2614..0cf0e1eb5f68 100644 --- a/src/audio/codec_adapter/codec/generic.c +++ b/src/audio/codec_adapter/codec/generic.c @@ -333,7 +333,7 @@ int codec_reset(struct comp_dev *dev) return 0; } -static void codec_free_all_memory(struct comp_dev *dev) +void codec_free_all_memory(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); struct codec_memory *mem; diff --git a/src/include/sof/audio/codec_adapter/codec/generic.h b/src/include/sof/audio/codec_adapter/codec/generic.h index 62fcbd524d6f..6a7f804a6526 100644 --- a/src/include/sof/audio/codec_adapter/codec/generic.h +++ b/src/include/sof/audio/codec_adapter/codec/generic.h @@ -198,6 +198,7 @@ int codec_init(struct comp_dev *dev); void *codec_allocate_memory(struct comp_dev *dev, uint32_t size, uint32_t alignment); int codec_free_memory(struct comp_dev *dev, void *ptr); +void codec_free_all_memory(struct comp_dev *dev); int codec_prepare(struct comp_dev *dev); int codec_process(struct comp_dev *dev); int codec_apply_runtime_config(struct comp_dev *dev); From eaa9a55d0b844d93dc861fff727d0782886f6d66 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Tue, 24 Nov 2020 21:14:54 +0100 Subject: [PATCH 39/60] codec_adapter: fix for CADENCE codec reset Codecs which apply to CADENCE API don't have any means of reset, therefore we need to rework the reset procedure so cadence codecs can remove all memory allocated by itself and re-initialize again. Signed-off-by: Marcin Rajwa --- src/audio/codec_adapter/codec/cadence.c | 21 ++++++++++++++++++--- src/audio/codec_adapter/codec/generic.c | 5 +---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/audio/codec_adapter/codec/cadence.c b/src/audio/codec_adapter/codec/cadence.c index 5692b6a181fe..1a889bf9d1a9 100644 --- a/src/audio/codec_adapter/codec/cadence.c +++ b/src/audio/codec_adapter/codec/cadence.c @@ -254,12 +254,15 @@ static int init_memory_tables(struct comp_dev *dev) int cadence_codec_prepare(struct comp_dev *dev) { - int ret, mem_tabs_size, lib_init_status; + int ret = 0, mem_tabs_size, lib_init_status; struct codec_data *codec = comp_get_codec(dev); struct cadence_codec_data *cd = codec->private; comp_dbg(dev, "cadence_codec_prepare() start"); + if (codec->state == CODEC_PREPARED) + goto done; + API_CALL(cd, XA_API_CMD_INIT, XA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS, NULL, ret); if (ret != LIB_NO_ERROR) { @@ -345,6 +348,7 @@ int cadence_codec_prepare(struct comp_dev *dev) free: codec_free_memory(dev, cd->mem_tabs); err: +done: return ret; } @@ -391,8 +395,19 @@ int cadence_codec_apply_config(struct comp_dev *dev) int cadence_codec_reset(struct comp_dev *dev) { - /* Nothing to do */ - return 0; + int ret; + /* Current CADENCE API doesn't support reset of codec's + * runtime parameters therefore we need to free all the resources + * and start over. + */ + codec_free_all_memory(dev); + ret = cadence_codec_init(dev); + if (ret) { + comp_err(dev, "cadence_codec_reset() error %x: could not reinitialize codec after reset", + ret); + } + + return ret; } int cadence_codec_free(struct comp_dev *dev) diff --git a/src/audio/codec_adapter/codec/generic.c b/src/audio/codec_adapter/codec/generic.c index 0cf0e1eb5f68..d295b8d0b7f5 100644 --- a/src/audio/codec_adapter/codec/generic.c +++ b/src/audio/codec_adapter/codec/generic.c @@ -217,9 +217,6 @@ int codec_prepare(struct comp_dev *dev) comp_dbg(dev, "codec_prepare() start"); - /* After reset the codec should remain prepared, hence there - * is no need to re-prepare it again. - */ if (cd->codec.state == CODEC_PREPARED) return 0; if (cd->codec.state < CODEC_INITIALIZED) @@ -328,7 +325,7 @@ int codec_reset(struct comp_dev *dev) /* Codec reset itself to the initial condition after prepare() * so let's change its state to reflect that. */ - codec->state = CODEC_PREPARED; + codec->state = CODEC_INITIALIZED; return 0; } From 317a4164041b4a945ba326d23713df34660289d4 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Thu, 24 Dec 2020 12:55:02 +0800 Subject: [PATCH 40/60] sof: multiband_drc: fix testbench build error Fixed the build error of multiband_drc_find_proc_func_pass and multiband_drc_find_proc_func defined but not used. Signed-off-by: Pin-chih Lin --- src/include/sof/audio/multiband_drc/multiband_drc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/sof/audio/multiband_drc/multiband_drc.h b/src/include/sof/audio/multiband_drc/multiband_drc.h index 7c04a3d142ed..480767ea4fa8 100644 --- a/src/include/sof/audio/multiband_drc/multiband_drc.h +++ b/src/include/sof/audio/multiband_drc/multiband_drc.h @@ -53,7 +53,7 @@ extern const size_t multiband_drc_proc_fncount; /** * \brief Returns Multiband DRC processing function. */ -static multiband_drc_func multiband_drc_find_proc_func(enum sof_ipc_frame src_fmt) +static inline multiband_drc_func multiband_drc_find_proc_func(enum sof_ipc_frame src_fmt) { int i; @@ -68,7 +68,7 @@ static multiband_drc_func multiband_drc_find_proc_func(enum sof_ipc_frame src_fm /** * \brief Returns Multiband DRC passthrough functions. */ -static multiband_drc_func multiband_drc_find_proc_func_pass(enum sof_ipc_frame src_fmt) +static inline multiband_drc_func multiband_drc_find_proc_func_pass(enum sof_ipc_frame src_fmt) { int i; From eb4b124a9a6d29daa69220cbcee4caa0f64e3738 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Tue, 1 Dec 2020 18:33:43 +0800 Subject: [PATCH 41/60] tools: topology: Add Multiband DRC topology files This commit adds the topology files for the multiband_drc component. The control bytes are generated by the tools in tune/multiband_drc. Signed-off-by: Pin-chih Lin --- tools/test/topology/tplg-build.sh | 2 +- tools/topology/m4/multiband_drc.m4 | 65 +++++++++++++++ .../topology/m4/multiband_drc_coef_default.m4 | 81 ++++++++++++++++++ .../sof/pipe-multiband-drc-capture.m4 | 75 +++++++++++++++++ .../sof/pipe-multiband-drc-playback.m4 | 82 +++++++++++++++++++ 5 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 tools/topology/m4/multiband_drc.m4 create mode 100644 tools/topology/m4/multiband_drc_coef_default.m4 create mode 100644 tools/topology/sof/pipe-multiband-drc-capture.m4 create mode 100644 tools/topology/sof/pipe-multiband-drc-playback.m4 diff --git a/tools/test/topology/tplg-build.sh b/tools/test/topology/tplg-build.sh index cc343be68611..9f7bab8222ec 100755 --- a/tools/test/topology/tplg-build.sh +++ b/tools/test/topology/tplg-build.sh @@ -227,7 +227,7 @@ done # for processing algorithms -ALG_SINGLE_MODE_TESTS=(asrc eq-fir eq-iir src dcblock tdfb drc) +ALG_SINGLE_MODE_TESTS=(asrc eq-fir eq-iir src dcblock tdfb drc multiband-drc) ALG_SINGLE_SIMPLE_TESTS=(test-capture test-playback) ALG_MULTI_MODE_TESTS=(crossover) ALG_MULTI_SIMPLE_TESTS=(test-playback) diff --git a/tools/topology/m4/multiband_drc.m4 b/tools/topology/m4/multiband_drc.m4 new file mode 100644 index 000000000000..031f5e05d9b1 --- /dev/null +++ b/tools/topology/m4/multiband_drc.m4 @@ -0,0 +1,65 @@ +divert(-1) + +dnl Define macro for Multiband DRC widget +DECLARE_SOF_RT_UUID("multiband_drc", multiband_drc_uuid, 0x0d9f2256, 0x8e4f, 0x47b3, + 0x84, 0x48, 0x23, 0x9a, 0x33, 0x4f, 0x11, 0x91); + +dnl N_MULTIBAND_DRC(name) +define(`N_MULTIBAND_DRC', `MULTIBAND_DRC'PIPELINE_ID`.'$1) + +dnl W_MULTIBAND_DRC(name, format, periods_sink, periods_source, core, kcontrol_list) +define(`W_MULTIBAND_DRC', +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_uuid" {' +` tokens "sof_comp_tokens"' +` tuples."uuid" {' +` SOF_TKN_COMP_UUID' STR(multiband_drc_uuid) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_uuid" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_uuid"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_w" {' +` tokens "sof_comp_tokens"' +` tuples."word" {' +` SOF_TKN_COMP_PERIOD_SINK_COUNT' STR($3) +` SOF_TKN_COMP_PERIOD_SOURCE_COUNT' STR($4) +` SOF_TKN_COMP_CORE_ID' STR($5) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_w" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_w"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_str" {' +` tokens "sof_comp_tokens"' +` tuples."string" {' +` SOF_TKN_COMP_FORMAT' STR($2) +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_str" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_str"' +`}' +`SectionVendorTuples."'N_MULTIBAND_DRC($1)`_tuples_str_type" {' +` tokens "sof_process_tokens"' +` tuples."string" {' +` SOF_TKN_PROCESS_TYPE' "MULTIBAND_DRC" +` }' +`}' +`SectionData."'N_MULTIBAND_DRC($1)`_data_str_type" {' +` tuples "'N_MULTIBAND_DRC($1)`_tuples_str_type"' +`}' +`SectionWidget."'N_MULTIBAND_DRC($1)`" {' +` index "'PIPELINE_ID`"' +` type "effect"' +` no_pm "true"' +` data [' +` "'N_MULTIBAND_DRC($1)`_data_uuid"' +` "'N_MULTIBAND_DRC($1)`_data_w"' +` "'N_MULTIBAND_DRC($1)`_data_str"' +` "'N_MULTIBAND_DRC($1)`_data_str_type"' +` ]' +` bytes [' + $6 +` ]' +`}') + +divert(0)dnl diff --git a/tools/topology/m4/multiband_drc_coef_default.m4 b/tools/topology/m4/multiband_drc_coef_default.m4 new file mode 100644 index 000000000000..d6df36639e5e --- /dev/null +++ b/tools/topology/m4/multiband_drc_coef_default.m4 @@ -0,0 +1,81 @@ +# Exported Control Bytes 15-Dec-2020 +CONTROLBYTES_PRIV(MULTIBAND_DRC_priv, +` bytes "0x53,0x4f,0x46,0x00,0x00,0x00,0x00,0x00,' +` 0x4c,0x02,0x00,0x00,0x01,0x20,0x01,0x03,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x4c,0x02,0x00,0x00,0x03,0x00,0x00,0x00,' +` 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0x00,0x7b,0x8e,0x88,0xfe,' +` 0x36,0x79,0x57,0x17,0x5f,0x19,0x6f,0x06,' +` 0xe8,0x79,0x67,0xd4,0x00,0x00,0x00,0x40,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x5f,0x6d,0x19,0xe7,0x39,0xc4,0xd4,0x50,' +` 0x0c,0x9b,0x09,0x24,0xad,0x76,0x82,0x9f,' +` 0x00,0x00,0x00,0x40,0xff,0xff,0xff,0xff,' +` 0x43,0x72,0x00,0x00,0xa1,0xe6,0x90,0xf9,' +` 0x18,0x86,0x98,0x2b,0xe3,0x32,0xef,0x00,' +` 0x4b,0xf7,0x20,0xf1,0x18,0x69,0xc6,0x28,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0xf4,0x64,0xf6,0xdb,0x53,0x89,0x7d,0x60,' +` 0x5c,0x14,0xf2,0x0a,0x84,0x0d,0x78,0xdc,' +` 0xda,0xef,0x21,0x1c,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x6f,0x82,0x53,0xc2,' +` 0x3e,0x77,0xa1,0x7d,0x95,0xc1,0x02,0x00,' +` 0x2a,0x83,0x05,0x00,0x95,0xc1,0x02,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x6f,0x82,0x53,0xc2,0x3e,0x77,0xa1,0x7d,' +` 0x34,0x7d,0xd3,0x3e,0x99,0x05,0x59,0x82,' +` 0x34,0x7d,0xd3,0x3e,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x42,0xa6,0xbf,0xcc,' +` 0x61,0x1a,0xd5,0x71,0xd7,0xcf,0x5a,0x00,' +` 0xaf,0x9f,0xb5,0x00,0xd7,0xcf,0x5a,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x42,0xa6,0xbf,0xcc,0x61,0x1a,0xd5,0x71,' +` 0x08,0x5d,0x45,0x39,0xf0,0x45,0x75,0x8d,' +` 0x08,0x5d,0x45,0x39,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x42,0xa6,0xbf,0xcc,' +` 0x61,0x1a,0xd5,0x71,0xd7,0xcf,0x5a,0x00,' +` 0xaf,0x9f,0xb5,0x00,0xd7,0xcf,0x5a,0x00,' +` 0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,' +` 0x42,0xa6,0xbf,0xcc,0x61,0x1a,0xd5,0x71,' +` 0x08,0x5d,0x45,0x39,0xf0,0x45,0x75,0x8d,' +` 0x08,0x5d,0x45,0x39,0x00,0x00,0x00,0x00,' +` 0x00,0x40,0x00,0x00,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe3,0x00,0x00,0x00,0x03,' +` 0xdf,0x4f,0xad,0x06,0xd3,0x4d,0x62,0x00,' +` 0x86,0x53,0x45,0x02,0xef,0xcb,0x95,0x09,' +` 0x5f,0x5e,0xe2,0x08,0x58,0xe2,0x0a,0x00,' +` 0x08,0xce,0xe8,0xfe,0x95,0xd4,0x0c,0x00,' +` 0x00,0x17,0x2c,0x04,0x56,0x79,0x4c,0x02,' +` 0x11,0x11,0x11,0x00,0x77,0x77,0x77,0xff,' +` 0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,' +` 0x00,0x00,0x36,0x00,0xdf,0x97,0x03,0x00,' +` 0xe7,0x3e,0x1e,0x00,0xdf,0x97,0x07,0x00,' +` 0x5b,0x91,0x00,0x00,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x17,' +` 0x00,0x00,0x00,0x0c,0xd3,0x4d,0x62,0x00,' +` 0x27,0x8c,0x9b,0x01,0x55,0x55,0x55,0x05,' +` 0x5f,0xc0,0xaf,0x00,0x6f,0xbc,0x1d,0x00,' +` 0x0c,0x4a,0xe1,0xff,0x0d,0xd5,0x5a,0x00,' +` 0x34,0x41,0xef,0x07,0x0e,0x08,0xcb,0x03,' +` 0x11,0x11,0x11,0x00,0x77,0x77,0x77,0xff,' +` 0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,' +` 0x00,0x00,0x36,0x00,0xdf,0x97,0x03,0x00,' +` 0xe7,0x3e,0x1e,0x00,0xdf,0x97,0x07,0x00,' +` 0x5b,0x91,0x00,0x00,0x01,0x00,0x00,0x00,' +` 0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x1e,' +` 0x00,0x00,0x00,0x01,0xd3,0x4d,0x62,0x00,' +` 0xb1,0xc2,0x09,0x04,0x00,0x00,0x00,0x40,' +` 0xa6,0x99,0x01,0x00,0xce,0xd8,0x0f,0x0a,' +` 0x1f,0x1a,0xf0,0xf5,0x83,0xc9,0xfe,0x01,' +` 0xdf,0x30,0x61,0x3a,0xcb,0x83,0x0e,0x01,' +` 0x55,0x55,0x55,0x01,0x77,0x77,0x77,0xff,' +` 0xd8,0x77,0x1f,0x00,0x05,0x00,0x00,0x00,' +` 0x00,0x00,0x0e,0x01,0x5c,0xf7,0x11,0x00,' +` 0x82,0x3a,0x97,0x00,0x5c,0xf7,0x25,0x00,' +` 0xc6,0xd6,0x02,0x00"' +) diff --git a/tools/topology/sof/pipe-multiband-drc-capture.m4 b/tools/topology/sof/pipe-multiband-drc-capture.m4 new file mode 100644 index 000000000000..7900e8c7731f --- /dev/null +++ b/tools/topology/sof/pipe-multiband-drc-capture.m4 @@ -0,0 +1,75 @@ +# Multiband DRC with volume Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P <-- B0 <-- MULTIBAND_DRC <-- B1 <-- sink DAI + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`bytecontrol.m4') +include(`pipeline.m4') +include(`multiband_drc.m4') + +# +# Components and Buffers +# + +# Host "Multiband DRC Capture" PCM +# with 0 sink and 3 source periods +W_PCM_CAPTURE(PCM_ID, Multiband DRC Capture, 0, 3, SCHEDULE_CORE) + +define(MULTIBAND_DRC_priv, concat(`multiband_drc_bytes_', PIPELINE_ID)) +define(MY_MULTIBAND_DRC_CTRL, concat(`multiband_drc_control_', PIPELINE_ID)) +include(`multiband_drc_coef_default.m4') +C_CONTROLBYTES(MY_MULTIBAND_DRC_CTRL, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258), + CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258), + , , , + CONTROLBYTES_MAX(, 1024), + , + MULTIBAND_DRC_priv) + +# "MULTIBAND_DRC" has 2 sink periods and 2 source periods +W_MULTIBAND_DRC(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE, + LIST(` ', "MY_MULTIBAND_DRC_CTRL")) + +# Capture Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(3, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P <-- B0 <-- MULTIBAND_DRC <-- B1 <-- sink DAI + +P_GRAPH(pipe-pass-multiband-drc-capture-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_PCMC(PCM_ID), N_BUFFER(0))', + `dapm(N_BUFFER(0), N_MULTIBAND_DRC(0))', + `dapm(N_MULTIBAND_DRC(0), N_BUFFER(1))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SINK_', PIPELINE_ID), N_BUFFER(1)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Multiband DRC Capture PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Multiband DRC Capture PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), + PCM_MIN_RATE, PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, + 16384, 65536, 65536) + +undefine(`MY_MULTIBAND_DRC_CTRL') +undefine(`MULTIBAND_DRC_priv') diff --git a/tools/topology/sof/pipe-multiband-drc-playback.m4 b/tools/topology/sof/pipe-multiband-drc-playback.m4 new file mode 100644 index 000000000000..d97090ba2e0a --- /dev/null +++ b/tools/topology/sof/pipe-multiband-drc-playback.m4 @@ -0,0 +1,82 @@ +# Multiband DRC with volume Pipeline and PCM +# +# Pipeline Endpoints for connection are :- +# +# host PCM_P --> B0 --> MULTIBAND_DRC --> B1 --> sink DAI0 + +# Include topology builder +include(`utils.m4') +include(`buffer.m4') +include(`pcm.m4') +include(`dai.m4') +include(`bytecontrol.m4') +include(`pipeline.m4') +include(`multiband_drc.m4') + +# +# Controls +# + +# +# Components and Buffers +# + +# Host "Multiband DRC Playback" PCM +# with 2 sink and 0 source periods +W_PCM_PLAYBACK(PCM_ID, Multiband DRC Playback, 2, 0, SCHEDULE_CORE) + +# +# Multiband DRC Configuration +# + +define(MULTIBAND_DRC_priv, concat(`multiband_drc_bytes_', PIPELINE_ID)) +define(MY_MULTIBAND_DRC_CTRL, concat(`multiband_drc_control_', PIPELINE_ID)) +include(`multiband_drc_coef_default.m4') +C_CONTROLBYTES(MY_MULTIBAND_DRC_CTRL, PIPELINE_ID, + CONTROLBYTES_OPS(bytes, 258 binds the control to bytes get/put handlers, 258, 258), + CONTROLBYTES_EXTOPS(258 binds the control to bytes get/put handlers, 258, 258), + , , , + CONTROLBYTES_MAX(, 1024), + , + MULTIBAND_DRC_priv) + +# "MULTIBAND_DRC" has 2 sink periods and 2 source periods +W_MULTIBAND_DRC(0, PIPELINE_FORMAT, 2, 2, SCHEDULE_CORE, + LIST(` ', "MY_MULTIBAND_DRC_CTRL")) + +# Playback Buffers +W_BUFFER(0, COMP_BUFFER_SIZE(2, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_HOST_MEM_CAP) +W_BUFFER(1, COMP_BUFFER_SIZE(DAI_PERIODS, + COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, + COMP_PERIOD_FRAMES(PCM_MAX_RATE, SCHEDULE_PERIOD)), + PLATFORM_DAI_MEM_CAP) + +# +# Pipeline Graph +# +# host PCM_P --> B0 --> MULTIBAND_DRC --> B1 --> sink DAI0 + +P_GRAPH(pipe-multiband-drc-playback-PIPELINE_ID, PIPELINE_ID, + LIST(` ', + `dapm(N_BUFFER(0), N_PCMP(PCM_ID))', + `dapm(N_MULTIBAND_DRC(0), N_BUFFER(0))', + `dapm(N_BUFFER(1), N_MULTIBAND_DRC(0))')) + +# +# Pipeline Source and Sinks +# +indir(`define', concat(`PIPELINE_SOURCE_', PIPELINE_ID), N_BUFFER(1)) +indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Multiband DRC Playback PCM_ID) + +# +# PCM Configuration +# + +PCM_CAPABILITIES(Multiband DRC Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), PCM_MIN_RATE, + PCM_MAX_RATE, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536) + +undefine(`MY_MULTIBAND_DRC_CTRL') +undefine(`MULTIBAND_DRC_priv') From 691275533d4c2ddae97a014d3f47c1c601aa6413 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Tue, 1 Dec 2020 18:36:21 +0800 Subject: [PATCH 42/60] sof: multiband_drc: Implement multiband_drc_generic This commit implements multiband_drc_generic for sample processing. Multiband DRC is a single-source-single-sink compound component which consists of 4 stages: Emphasis Equalizer, Crossover Filter (from 1-band to 4-band), DRC (per band), and Deemphasis Equalizer of summed stream. Signed-off-by: Pin-chih Lin --- src/audio/CMakeLists.txt | 2 +- src/audio/multiband_drc/CMakeLists.txt | 1 + .../multiband_drc/multiband_drc_generic.c | 409 ++++++++++++++++++ 3 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 src/audio/multiband_drc/multiband_drc_generic.c diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 607742d3f147..2c53495c4226 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -133,7 +133,7 @@ set(dcblock_sources dcblock/dcblock.c dcblock/dcblock_generic.c) set(crossover_sources crossover/crossover.c crossover/crossover_generic.c) set(tdfb_sources tdfb/tdfb.c tdfb/tdfb_generic.c) set(drc_sources drc/drc.c drc/drc_generic.c drc/drc_math_generic.c) -set(multiband_drc_sources multiband_drc/multiband_drc.c crossover/crossover.c drc/drc.c) +set(multiband_drc_sources multiband_drc/multiband_drc.c multiband_drc/multiband_drc_generic.c crossover/crossover.c crossover/crossover_generic.c drc/drc.c drc/drc_generic.c drc/drc_math_generic.c) foreach(audio_module ${sof_audio_modules}) # first compile with no optimizations diff --git a/src/audio/multiband_drc/CMakeLists.txt b/src/audio/multiband_drc/CMakeLists.txt index 50b26a17d41d..202b9d6eecb6 100644 --- a/src/audio/multiband_drc/CMakeLists.txt +++ b/src/audio/multiband_drc/CMakeLists.txt @@ -1 +1,2 @@ add_local_sources(sof multiband_drc.c) +add_local_sources(sof multiband_drc_generic.c) diff --git a/src/audio/multiband_drc/multiband_drc_generic.c b/src/audio/multiband_drc/multiband_drc_generic.c new file mode 100644 index 000000000000..cfb2b55dcf40 --- /dev/null +++ b/src/audio/multiband_drc/multiband_drc_generic.c @@ -0,0 +1,409 @@ +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright(c) 2020 Intel Corporation. All rights reserved. +// +// Author: Pin-chih Lin + +#include +#include +#include +#include +#include +#include + +static void multiband_drc_default_pass(const struct comp_dev *dev, + const struct audio_stream *source, + struct audio_stream *sink, + uint32_t frames) +{ + audio_stream_copy(source, 0, sink, 0, source->channels * frames); +} + +static void multiband_drc_process_emp_crossover(struct multiband_drc_state *state, + crossover_split split_func, + int32_t *buf_src, + int32_t *buf_sink, + int enable_emp, + int nch, + int nband) +{ + struct iir_state_df2t *emp_s; + struct crossover_state *crossover_s; + int32_t *buf_sink_band; + int ch, band; + int32_t emp_out; + int32_t crossover_out[nband]; + + for (ch = 0; ch < nch; ch++) { + emp_s = &state->emphasis[ch]; + crossover_s = &state->crossover[ch]; + + if (enable_emp) + emp_out = iir_df2t(emp_s, *buf_src); + else + emp_out = *buf_src; + + split_func(emp_out, crossover_out, crossover_s); + buf_sink_band = buf_sink; + for (band = 0; band < nband; band++) { + *buf_sink_band = crossover_out[band]; + buf_sink_band += PLATFORM_MAX_CHANNELS; + } + + buf_src++; + buf_sink++; + } +} + +#if CONFIG_FORMAT_S16LE +static void multiband_drc_s16_process_drc(struct drc_state *state, + const struct sof_drc_params *p, + int32_t *buf_src, + int32_t *buf_sink, + int nch) +{ + int16_t *pd_write; + int16_t *pd_read; + int ch; + int pd_write_index; + int pd_read_index; + + if (p->enabled && !state->processed) { + drc_update_envelope(state, p); + drc_compress_output(state, p, 2, nch); + state->processed = 1; + } + + pd_write_index = state->pre_delay_write_index; + pd_read_index = state->pre_delay_read_index; + + for (ch = 0; ch < nch; ++ch) { + pd_write = (int16_t *)state->pre_delay_buffers[ch] + pd_write_index; + pd_read = (int16_t *)state->pre_delay_buffers[ch] + pd_read_index; + *pd_write = sat_int16(Q_SHIFT_RND(*buf_src, 31, 15)); + *buf_sink = *pd_read << 16; + + buf_src++; + buf_sink++; + } + + pd_write_index = (pd_write_index + 1) & DRC_MAX_PRE_DELAY_FRAMES_MASK; + pd_read_index = (pd_read_index + 1) & DRC_MAX_PRE_DELAY_FRAMES_MASK; + state->pre_delay_write_index = pd_write_index; + state->pre_delay_read_index = pd_read_index; + + /* Only perform delay frames by early return here if not enabled */ + if (!p->enabled) + return; + + /* Process the input division (32 frames). */ + if (!(pd_write_index & DRC_DIVISION_FRAMES_MASK)) { + drc_update_detector_average(state, p, 2, nch); + drc_update_envelope(state, p); + drc_compress_output(state, p, 2, nch); + } +} +#endif /* CONFIG_FORMAT_S16LE */ + +#if CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE +static void multiband_drc_s32_process_drc(struct drc_state *state, + const struct sof_drc_params *p, + int32_t *buf_src, + int32_t *buf_sink, + int nch) +{ + int32_t *pd_write; + int32_t *pd_read; + int ch; + int pd_write_index; + int pd_read_index; + + if (p->enabled && !state->processed) { + drc_update_envelope(state, p); + drc_compress_output(state, p, 4, nch); + state->processed = 1; + } + + pd_write_index = state->pre_delay_write_index; + pd_read_index = state->pre_delay_read_index; + + for (ch = 0; ch < nch; ++ch) { + pd_write = (int32_t *)state->pre_delay_buffers[ch] + pd_write_index; + pd_read = (int32_t *)state->pre_delay_buffers[ch] + pd_read_index; + *pd_write = *buf_src; + *buf_sink = *pd_read; + + buf_src++; + buf_sink++; + } + + pd_write_index = (pd_write_index + 1) & DRC_MAX_PRE_DELAY_FRAMES_MASK; + pd_read_index = (pd_read_index + 1) & DRC_MAX_PRE_DELAY_FRAMES_MASK; + state->pre_delay_write_index = pd_write_index; + state->pre_delay_read_index = pd_read_index; + + /* Only perform delay frames by early return here if not enabled */ + if (!p->enabled) + return; + + /* Process the input division (32 frames). */ + if (!(pd_write_index & DRC_DIVISION_FRAMES_MASK)) { + drc_update_detector_average(state, p, 4, nch); + drc_update_envelope(state, p); + drc_compress_output(state, p, 4, nch); + } +} +#endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE */ + +static void multiband_drc_process_deemp(struct multiband_drc_state *state, + int32_t *buf_src, + int32_t *buf_sink, + int enable_deemp, + int nch, + int nband) +{ + struct iir_state_df2t *deemp_s; + int32_t *buf_src_band; + int ch, band; + int32_t mix_out; + + for (ch = 0; ch < nch; ch++) { + deemp_s = &state->deemphasis[ch]; + + buf_src_band = buf_src; + mix_out = 0; + for (band = 0; band < nband; band++) { + mix_out = sat_int32((int64_t)mix_out + *buf_src_band); + buf_src_band += PLATFORM_MAX_CHANNELS; + } + + if (enable_deemp) + *buf_sink = iir_df2t(deemp_s, mix_out); + else + *buf_sink = mix_out; + + buf_src++; + buf_sink++; + } +} + + /* This graph illustrates the buffers declared in the following default functions, as the example + * of a 3-band Multiband DRC: + * + * :buf_src[nch] :buf_drc_sink[nch*nband] + * : : + * : o-[]-> DRC0 -[]--o + * : | : : | + * : 3-WAY | : : | + * source -[]-> EQ EMP --> CROSSOVER --o-[]-> DRC1 -[]-(+)--> EQ DEEMP -[]-> sink + * | : : | : + * | : : | : + * o-[]-> DRC2 -[]--o : + * : : + * :buf_drc_src[nch*nband] :buf_sink[nch] + */ +#if CONFIG_FORMAT_S16LE +static void multiband_drc_s16_default(const struct comp_dev *dev, + const struct audio_stream *source, + struct audio_stream *sink, + uint32_t frames) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + struct multiband_drc_state *state = &cd->state; + int32_t buf_src[PLATFORM_MAX_CHANNELS]; + int32_t buf_sink[PLATFORM_MAX_CHANNELS]; + int32_t buf_drc_src[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t buf_drc_sink[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t *band_buf_drc_src; + int32_t *band_buf_drc_sink; + int16_t *x; + int16_t *y; + int idx_src = 0; + int idx_sink = 0; + int ch; + int band; + int i; + int nch = source->channels; + int nband = cd->config->num_bands; + int enable_emp_deemp = cd->config->enable_emp_deemp; + + for (i = 0; i < frames; ++i) { + for (ch = 0; ch < nch; ch++) { + x = audio_stream_read_frag_s16(source, idx_src); + buf_src[ch] = *x << 16; + idx_src++; + } + + multiband_drc_process_emp_crossover(state, cd->crossover_split, + buf_src, buf_drc_src, + enable_emp_deemp, nch, nband); + + band_buf_drc_src = buf_drc_src; + band_buf_drc_sink = buf_drc_sink; + for (band = 0; band < nband; ++band) { + multiband_drc_s16_process_drc(&state->drc[band], + &cd->config->drc_coef[band], + band_buf_drc_src, band_buf_drc_sink, nch); + band_buf_drc_src += PLATFORM_MAX_CHANNELS; + band_buf_drc_sink += PLATFORM_MAX_CHANNELS; + } + + multiband_drc_process_deemp(state, buf_drc_sink, buf_sink, + enable_emp_deemp, nch, nband); + + for (ch = 0; ch < nch; ch++) { + y = audio_stream_write_frag_s16(sink, idx_sink); + *y = sat_int16(Q_SHIFT_RND(buf_sink[ch], 31, 15)); + idx_sink++; + } + } +} +#endif /* CONFIG_FORMAT_S16LE */ + +#if CONFIG_FORMAT_S24LE +static void multiband_drc_s24_default(const struct comp_dev *dev, + const struct audio_stream *source, + struct audio_stream *sink, + uint32_t frames) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + struct multiband_drc_state *state = &cd->state; + int32_t buf_src[PLATFORM_MAX_CHANNELS]; + int32_t buf_sink[PLATFORM_MAX_CHANNELS]; + int32_t buf_drc_src[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t buf_drc_sink[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t *band_buf_drc_src; + int32_t *band_buf_drc_sink; + int32_t *x; + int32_t *y; + int idx_src = 0; + int idx_sink = 0; + int ch; + int band; + int i; + int nch = source->channels; + int nband = cd->config->num_bands; + int enable_emp_deemp = cd->config->enable_emp_deemp; + + for (i = 0; i < frames; ++i) { + for (ch = 0; ch < nch; ch++) { + x = audio_stream_read_frag_s32(source, idx_src); + buf_src[ch] = *x << 8; + idx_src++; + } + + multiband_drc_process_emp_crossover(state, cd->crossover_split, + buf_src, buf_drc_src, + enable_emp_deemp, nch, nband); + + band_buf_drc_src = buf_drc_src; + band_buf_drc_sink = buf_drc_sink; + for (band = 0; band < nband; ++band) { + multiband_drc_s32_process_drc(&state->drc[band], + &cd->config->drc_coef[band], + band_buf_drc_src, band_buf_drc_sink, nch); + band_buf_drc_src += PLATFORM_MAX_CHANNELS; + band_buf_drc_sink += PLATFORM_MAX_CHANNELS; + } + + multiband_drc_process_deemp(state, buf_drc_sink, buf_sink, + enable_emp_deemp, nch, nband); + + for (ch = 0; ch < nch; ch++) { + y = audio_stream_write_frag_s32(sink, idx_sink); + *y = sat_int24(Q_SHIFT_RND(buf_sink[ch], 31, 23)); + idx_sink++; + } + } +} +#endif /* CONFIG_FORMAT_S24LE */ + +#if CONFIG_FORMAT_S32LE +static void multiband_drc_s32_default(const struct comp_dev *dev, + const struct audio_stream *source, + struct audio_stream *sink, + uint32_t frames) +{ + struct multiband_drc_comp_data *cd = comp_get_drvdata(dev); + struct multiband_drc_state *state = &cd->state; + int32_t buf_src[PLATFORM_MAX_CHANNELS]; + int32_t buf_sink[PLATFORM_MAX_CHANNELS]; + int32_t buf_drc_src[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t buf_drc_sink[PLATFORM_MAX_CHANNELS * SOF_MULTIBAND_DRC_MAX_BANDS]; + int32_t *band_buf_drc_src; + int32_t *band_buf_drc_sink; + int32_t *x; + int32_t *y; + int idx_src = 0; + int idx_sink = 0; + int ch; + int band; + int i; + int nch = source->channels; + int nband = cd->config->num_bands; + int enable_emp_deemp = cd->config->enable_emp_deemp; + + for (i = 0; i < frames; ++i) { + for (ch = 0; ch < nch; ch++) { + x = audio_stream_read_frag_s32(source, idx_src); + buf_src[ch] = *x; + idx_src++; + } + + multiband_drc_process_emp_crossover(state, cd->crossover_split, + buf_src, buf_drc_src, + enable_emp_deemp, nch, nband); + + band_buf_drc_src = buf_drc_src; + band_buf_drc_sink = buf_drc_sink; + for (band = 0; band < nband; ++band) { + multiband_drc_s32_process_drc(&state->drc[band], + &cd->config->drc_coef[band], + band_buf_drc_src, band_buf_drc_sink, nch); + band_buf_drc_src += PLATFORM_MAX_CHANNELS; + band_buf_drc_sink += PLATFORM_MAX_CHANNELS; + } + + multiband_drc_process_deemp(state, buf_drc_sink, buf_sink, + enable_emp_deemp, nch, nband); + + for (ch = 0; ch < nch; ch++) { + y = audio_stream_write_frag_s32(sink, idx_sink); + *y = buf_sink[ch]; + idx_sink++; + } + } +} +#endif /* CONFIG_FORMAT_S32LE */ + +const struct multiband_drc_proc_fnmap multiband_drc_proc_fnmap[] = { +/* { SOURCE_FORMAT , PROCESSING FUNCTION } */ +#if CONFIG_FORMAT_S16LE + { SOF_IPC_FRAME_S16_LE, multiband_drc_s16_default }, +#endif /* CONFIG_FORMAT_S16LE */ + +#if CONFIG_FORMAT_S24LE + { SOF_IPC_FRAME_S24_4LE, multiband_drc_s24_default }, +#endif /* CONFIG_FORMAT_S24LE */ + +#if CONFIG_FORMAT_S32LE + { SOF_IPC_FRAME_S32_LE, multiband_drc_s32_default }, +#endif /* CONFIG_FORMAT_S32LE */ +}; + +const struct multiband_drc_proc_fnmap multiband_drc_proc_fnmap_pass[] = { +/* { SOURCE_FORMAT , PROCESSING FUNCTION } */ +#if CONFIG_FORMAT_S16LE + { SOF_IPC_FRAME_S16_LE, multiband_drc_default_pass }, +#endif /* CONFIG_FORMAT_S16LE */ + +#if CONFIG_FORMAT_S24LE + { SOF_IPC_FRAME_S24_4LE, multiband_drc_default_pass }, +#endif /* CONFIG_FORMAT_S24LE */ + +#if CONFIG_FORMAT_S32LE + { SOF_IPC_FRAME_S32_LE, multiband_drc_default_pass }, +#endif /* CONFIG_FORMAT_S32LE */ +}; + +const size_t multiband_drc_proc_fncount = ARRAY_SIZE(multiband_drc_proc_fnmap); From 9dc85454bedc8029166d5aa9af3dbb78a33e7258 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Tue, 1 Dec 2020 18:47:25 +0800 Subject: [PATCH 43/60] tools: tune: Add tools to generate ctrl bytes for Multiband DRC This commit adds the tools to generate the control bytes for the multiband_drc component. To generate the control bytes, run the example_multiband_drc.m script. To tweak the parameters modify the values in example_multiband_drc.m and run it. Signed-off-by: Pin-chih Lin --- .../multiband_drc/crossover_gen_quant_coefs.m | 62 +++++++++ .../tune/multiband_drc/drc_gen_quant_coefs.m | 12 ++ .../multiband_drc/example_multiband_drc.m | 122 ++++++++++++++++++ .../tune/multiband_drc/iir_gen_quant_coefs.m | 117 +++++++++++++++++ .../multiband_drc/multiband_drc_build_blob.m | 105 +++++++++++++++ 5 files changed, 418 insertions(+) create mode 100644 tools/tune/multiband_drc/crossover_gen_quant_coefs.m create mode 100644 tools/tune/multiband_drc/drc_gen_quant_coefs.m create mode 100644 tools/tune/multiband_drc/example_multiband_drc.m create mode 100644 tools/tune/multiband_drc/iir_gen_quant_coefs.m create mode 100644 tools/tune/multiband_drc/multiband_drc_build_blob.m diff --git a/tools/tune/multiband_drc/crossover_gen_quant_coefs.m b/tools/tune/multiband_drc/crossover_gen_quant_coefs.m new file mode 100644 index 000000000000..e07490447752 --- /dev/null +++ b/tools/tune/multiband_drc/crossover_gen_quant_coefs.m @@ -0,0 +1,62 @@ +function crossover_coefs = crossover_gen_quant_coefs(num_bands, sample_rate, + fc_low, fc_med, fc_high); + +% De-normalize cutoff frequencies in respect to nyquist (half of sample rate) +fc_low = fc_low * sample_rate / 2; +fc_med = fc_med * sample_rate / 2; +fc_high = fc_high * sample_rate / 2; + +addpath ../crossover + +filter_len = 3; +crossover.lp = cell(1:filter_len); +crossover.hp = cell(1:filter_len); +% Generate zeros, poles and gain for crossover with the given frequencies +% Extend the length of lp and hp to 3 (filter_len) by flat_filter if necessary +if (num_bands == 1) + % Pass-through + crossover.lp = [flat_filter() flat_filter() flat_filter()]; + crossover.hp = [flat_filter() flat_filter() flat_filter()]; +elseif (num_bands == 2) + % 2-way crossover + crossover = crossover_gen_coefs(sample_rate, fc_low); + crossover.lp = [crossover.lp(1) flat_filter() flat_filter()]; + crossover.hp = [crossover.hp(1) flat_filter() flat_filter()]; +elseif (num_bands == 3) + % 3-way crossover + crossover = crossover_gen_coefs(sample_rate, fc_low, fc_med); +else % (num_bands == 4) + % 4-way crossover + crossover = crossover_gen_coefs(sample_rate, fc_low, fc_med, fc_high); +endif + +assert(length(crossover.lp) == filter_len && length(crossover.hp) == filter_len); + +% Print crossover +for i = 1:filter_len + crossover.lp(i) + crossover.hp(i) +end + +% Convert the [a,b] coefficients to values usable with SOF +crossover_bqs = crossover_coef_quant(crossover.lp, crossover.hp); + +rmpath ../crossover + +j = 1; +k = 1; +for i = 1:filter_len + crossover_coefs(k:k+6) = crossover_bqs.lp_coef(j:j+6); k = k + 7; + crossover_coefs(k:k+6) = crossover_bqs.hp_coef(j:j+6); k = k + 7; + j = j + 7; +end + +end + +function flat = flat_filter(); + +% Flat response y[n] = x[n] (only b0=1.0) +flat.b = [1.0, 0, 0]; +flat.a = [0, 0, 0]; + +end diff --git a/tools/tune/multiband_drc/drc_gen_quant_coefs.m b/tools/tune/multiband_drc/drc_gen_quant_coefs.m new file mode 100644 index 000000000000..446287399213 --- /dev/null +++ b/tools/tune/multiband_drc/drc_gen_quant_coefs.m @@ -0,0 +1,12 @@ +function drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, params); + +addpath ../drc + +for i = 1:num_bands + coefs = drc_gen_coefs(params(i), sample_rate); + drc_coefs(i) = drc_generate_config(coefs); +end + +rmpath ../drc + +end diff --git a/tools/tune/multiband_drc/example_multiband_drc.m b/tools/tune/multiband_drc/example_multiband_drc.m new file mode 100644 index 000000000000..da8c43460129 --- /dev/null +++ b/tools/tune/multiband_drc/example_multiband_drc.m @@ -0,0 +1,122 @@ +function example_multiband_drc(); + +% Set the parameters here +tplg_fn = "../../topology/m4/multiband_drc_coef_default.m4"; % Control Bytes File +% Use those files with sof-ctl to update the component's configuration +blob_fn = "../../ctl/multiband_drc_coef.blob"; % Blob binary file +alsa_fn = "../../ctl/multiband_drc_coef.txt"; % ALSA CSV format file + +endian = "little"; + +sample_rate = 48000; +nyquist = sample_rate / 2; + +% Number of bands, valid values: 1,2,3,4 +num_bands = 3; + +% 1 to enable Emphasis/Deemphasis filter, 0 to disable it +enable_emp_deemp = 1; + +% The parameters of Emphasis IIR filter +% stage_gain: The gain of each emphasis filter stage +iir_params.stage_gain = 4.4; +% stage_ratio: The frequency ratio for each emphasis filter stage to the +% previous stage +iir_params.stage_ratio = 2; +% anchor: The frequency of the first emphasis filter, in normalized frequency +% (in [0, 1], relative to half of the sample rate) +iir_params.anchor = 15000 / nyquist; + +% The parameters of the DRC compressor +% enabled: 1 to enable the compressor, 0 to disable it +% threshold: The value above which the compression starts, in dB +% knee: The value above which the knee region starts, in dB +% ratio: The input/output dB ratio after the knee region +% attack: The time to reduce the gain by 10dB, in seconds +% release: The time to increase the gain by 10dB, in seconds +% pre_delay: The lookahead time for the compressor, in seconds +% release_zone[4]: The adaptive release curve parameters +% release_spacing: The value of spacing per frame while releasing, in dB +% post_gain: The static boost value in output, in dB +% band_lower_freq: The lower frequency of the band, in normalized frequency +% (in [0, 1], relative to half of the sample rate) + +% Band 1 DRC parameter +drc_params(1).enabled = 0; +drc_params(1).threshold = -24; +drc_params(1).knee = 30; +drc_params(1).ratio = 12; +drc_params(1).attack = 0.003; +drc_params(1).release = 0.2; +drc_params(1).pre_delay = 0.006; +drc_params(1).release_zone = [0.09 0.16 0.42 0.98]; +drc_params(1).release_spacing = 5; +drc_params(1).post_gain = 0; +drc_params(1).band_lower_freq = 0; + +% Band 2 DRC parameter (only valid if num_bands > 1) +drc_params(2).enabled = 0; +drc_params(2).threshold = -24; +drc_params(2).knee = 30; +drc_params(2).ratio = 12; +drc_params(2).attack = 0.003; +drc_params(2).release = 0.2; +drc_params(2).pre_delay = 0.006; +drc_params(2).release_zone = [0.09 0.16 0.42 0.98]; +drc_params(2).release_spacing = 5; +drc_params(2).post_gain = 0; +drc_params(2).band_lower_freq = 200 / nyquist; + +% Band 3 DRC parameter (only valid if num_bands > 2) +drc_params(3).enabled = 0; +drc_params(3).threshold = -24; +drc_params(3).knee = 30; +drc_params(3).ratio = 12; +drc_params(3).attack = 0.003; +drc_params(3).release = 0.2; +drc_params(3).pre_delay = 0.006; +drc_params(3).release_zone = [0.09 0.16 0.42 0.98]; +drc_params(3).release_spacing = 5; +drc_params(3).post_gain = 0; +drc_params(3).band_lower_freq = 2000 / nyquist; + +% Band 4 DRC parameter (only valid if num_bands > 3) +drc_params(4).enabled = 0; +drc_params(4).threshold = -24; +drc_params(4).knee = 30; +drc_params(4).ratio = 12; +drc_params(4).attack = 0.003; +drc_params(4).release = 0.2; +drc_params(4).pre_delay = 0.006; +drc_params(4).release_zone = [0.09 0.16 0.42 0.98]; +drc_params(4).release_spacing = 5; +drc_params(4).post_gain = 0; +drc_params(4).band_lower_freq = 10000 / nyquist; + +% Generate Emphasis/Deemphasis IIR filter quantized coefs struct from parameters +[emp_coefs, deemp_coefs] = iir_gen_quant_coefs(iir_params); + +% Generate Crossover quantized coefs struct from parameters +crossover_coefs = crossover_gen_quant_coefs(num_bands, sample_rate, + drc_params(2).band_lower_freq, + drc_params(3).band_lower_freq, + drc_params(4).band_lower_freq); + +% Generate DRC quantized coefs struct from parameters +drc_coefs = drc_gen_quant_coefs(num_bands, sample_rate, drc_params); + +% Convert quantized coefs structs to binary blob +blob8 = multiband_drc_build_blob(num_bands, enable_emp_deemp, emp_coefs, + deemp_coefs, crossover_coefs, drc_coefs, + endian); + +% Generate output files +addpath ../common + +tplg_write(tplg_fn, blob8, "MULTIBAND_DRC"); +blob_write(blob_fn, blob8); +alsactl_write(alsa_fn, blob8); + +rmpath ../common + +endfunction diff --git a/tools/tune/multiband_drc/iir_gen_quant_coefs.m b/tools/tune/multiband_drc/iir_gen_quant_coefs.m new file mode 100644 index 000000000000..425a7513bba5 --- /dev/null +++ b/tools/tune/multiband_drc/iir_gen_quant_coefs.m @@ -0,0 +1,117 @@ +function [emp_coefs, deemp_coefs] = iir_gen_quant_coefs(params); + +stage_gain = params.stage_gain; +stage_ratio = params.stage_ratio; +anchor_freq = params.anchor; + +emp = cell(1, 2); +deemp = cell(1, 2); +% Generate the coefficients of (de)emphasis for the 1-st stage of biquads +[emp(1), deemp(1)] = emp_deemp_stage_biquad(stage_gain, anchor_freq, + anchor_freq / stage_ratio); + +anchor_freq = anchor_freq / (stage_ratio * stage_ratio); + +% Generate the coefficients of (de)emphasis for the 2-nd stage of biquads +[emp(2), deemp(2)] = emp_deemp_stage_biquad(stage_gain, anchor_freq, + anchor_freq / stage_ratio); + +% Adjust the stage gain (push gains to the last stage) of emphasis filter +[emp(1), emp(2)] = stage_gain_adjust(emp(1), emp(2)); + +% Print emp and deemp +emp +deemp + +% Convert the coefficients to values usable with SOF +emp_coefs = iir_coef_quant(emp); +deemp_coefs = iir_coef_quant(deemp); + +end + +function [emp, deemp] = emp_deemp_stage_biquad(gain, f1, f2); + +[z1, p1] = emp_stage_roots(gain, f1); +[z2, p2] = emp_stage_roots(gain, f2); + +b0 = 1; +b1 = -(z1 + z2); +b2 = z1 * z2; +a0 = 1; +a1 = -(p1 + p2); +a2 = p1 * p2; + +% Gain compensation to make 0dB at 0Hz +% For emphasis filter, alpha should be > 1. Record the alpha gain and then we +% will do the stage gain adjustment afterwards. +alpha = (a0 + a1 + a2) / (b0 + b1 + b2); + +% [ a2 a1 b2 b1 b0 shift gain] +emp = [-a2, -a1, b2, b1, b0, 0, alpha]; + +% For deemphasis filter, beta should be < 1. Multiply beta directly to b coeffs +% to have a healthy scaling of biquads internally. +beta = (b0 + b1 + b2) / (a0 + a1 + a2); + +% [ a2 a1 b2 b1 b0 shift gain] +deemp = [-b2, -b1, a2 * beta, a1 * beta, a0 * beta, 0, 1.0]; + +end + +function [zero, pole] = emp_stage_roots(gain, normalized_freq); + +gk = 1 - gain / 20; +f1 = normalized_freq * gk; +f2 = normalized_freq / gk; +zero = exp(-f1 * pi); +pole = exp(-f2 * pi); + +end + +function quant_coefs = iir_coef_quant(coefs); + +bits_iir = 32; % Q2.30 +qf_iir = 30; + +bits_gain = 16; % Q2.14 +qf_gain = 14; + +addpath ../eq + +quant_coefs = cell(1, 2); +for i = 1:length(coefs) + coef = cell2mat(coefs(i)); + quant_ab = eq_coef_quant(coef(1:5), bits_iir, qf_iir); + quant_gain = eq_coef_quant(coef(7), bits_gain, qf_gain); + quant_coefs(i) = [quant_ab coef(6) quant_gain]; +end + +quant_coefs = cell2mat(quant_coefs); + +rmpath ../eq + +end + +function [bq1, bq2] = stage_gain_adjust(prev_bq1, prev_bq2); + +prev_bq1 = cell2mat(prev_bq1); +prev_bq2 = cell2mat(prev_bq2); + +[rshift, gain] = decompose_gain(prev_bq1(7) * prev_bq2(7)); +bq1 = [prev_bq1(1:5) 0 1.0]; +bq2 = [prev_bq2(1:5) rshift gain]; + +end + +function [rshift, gain] = decompose_gain(prev_gain); + +max_abs_val = 2; % Q2.14 +rshift = 0; +gain = prev_gain; + +while (abs(gain) >= max_abs_val) + gain = gain / 2; + rshift--; % left-shift in shift stage +endwhile + +end diff --git a/tools/tune/multiband_drc/multiband_drc_build_blob.m b/tools/tune/multiband_drc/multiband_drc_build_blob.m new file mode 100644 index 000000000000..00ebaab55440 --- /dev/null +++ b/tools/tune/multiband_drc/multiband_drc_build_blob.m @@ -0,0 +1,105 @@ +function blob8 = multiband_drc_build_blob(num_bands, enable_emp_deemp, + emp_coefs, deemp_coefs, + crossover_coefs, drc_coefs, + endian); + +if nargin < 7 + endian = 'little' +endif + +%% Shift values for little/big endian +switch lower(endian) + case 'little' + sh = [0 -8 -16 -24]; + case 'big' + sh = [-24 -16 -8 0]; + otherwise + error('Unknown endiannes'); +end + +%% Build Blob +% refer to sof/src/include/user/multiband_drc.h for the config struct. +emp_data_num = numel(emp_coefs); +deemp_data_num = numel(deemp_coefs); +crossover_data_num = numel(crossover_coefs); +drc_data_num = numel(fieldnames(drc_coefs(1))) * length(drc_coefs); +data_size = 4 * (1 + 1 + 1 + 8 + emp_data_num + deemp_data_num + crossover_data_num + drc_data_num); +[abi_bytes, abi_size] = multiband_drc_get_abi(data_size); + +blob_size = data_size + abi_size; +blob8 = uint8(zeros(1, blob_size)); + +% Pack Blob data +% Insert ABI Header +blob8(1:abi_size) = abi_bytes; +j = abi_size + 1; + +% Insert Data +blob8(j:j+3) = word2byte(data_size, sh); j=j+4; % size +blob8(j:j+3) = word2byte(num_bands, sh); j=j+4; % num_bands +blob8(j:j+3) = word2byte(enable_emp_deemp, sh); j=j+4; % enable_emp_deemp +for i = 1:8 + blob8(j:j+3) = word2byte(0, sh); j=j+4; % reserved +end +for i = 1:length(emp_coefs) + blob8(j:j+3) = word2byte(emp_coefs(i), sh); j=j+4; % emp_coef +end +for i = 1:length(deemp_coefs) + blob8(j:j+3) = word2byte(deemp_coefs(i), sh); j=j+4; % deemp_coef +end +for i = 1:length(crossover_coefs) + blob8(j:j+3) = word2byte(crossover_coefs(i), sh); j=j+4; % crossover_coef +end +for i = 1:length(drc_coefs) % drc_coef + blob8(j:j+3) = word2byte(drc_coefs(i).enabled, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).db_threshold, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).db_knee, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).ratio, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).pre_delay_time, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).linear_threshold, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).slope, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).K, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).knee_alpha, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).knee_beta, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).knee_threshold, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).ratio_base, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).master_linear_gain, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).one_over_attack_frames, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).sat_release_frames_inv_neg, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).sat_release_rate_at_neg_two_db, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kSpacingDb, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kA, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kB, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kC, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kD, sh); j=j+4; + blob8(j:j+3) = word2byte(drc_coefs(i).kE, sh); j=j+4; +end + +endfunction + +function bytes = word2byte(word, sh) +bytes = uint8(zeros(1,4)); +bytes(1) = bitand(bitshift(word, sh(1)), 255); +bytes(2) = bitand(bitshift(word, sh(2)), 255); +bytes(3) = bitand(bitshift(word, sh(3)), 255); +bytes(4) = bitand(bitshift(word, sh(4)), 255); +end + +function [bytes, nbytes] = multiband_drc_get_abi(setsize) + +%% Return current SOF ABI header +%% Use sof-ctl to write ABI header into a file +abifn = 'multiband_drc_get_abi.bin'; +cmd = sprintf('sof-ctl -g %d -b -o %s', setsize, abifn); +system(cmd); + +%% Read file and delete it +fh = fopen(abifn, 'r'); +if fh < 0 + error("Failed to get ABI header. Is sof-ctl installed?"); +end +[bytes, nbytes] = fread(fh, inf, 'uint8'); +fclose(fh); +delete(abifn); + +end From 97e0d50f5f0c9e661f3d9d21c6a026d6b1dd1341 Mon Sep 17 00:00:00 2001 From: Pin-chih Lin Date: Tue, 1 Dec 2020 18:49:11 +0800 Subject: [PATCH 44/60] tools: testbench: Add Multiband DRC component test Signed-off-by: Pin-chih Lin --- tools/testbench/include/testbench/common_test.h | 2 +- tools/testbench/testbench.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testbench/include/testbench/common_test.h b/tools/testbench/include/testbench/common_test.h index c02db2bffa6e..915fac836f55 100644 --- a/tools/testbench/include/testbench/common_test.h +++ b/tools/testbench/include/testbench/common_test.h @@ -23,7 +23,7 @@ #define MAX_OUTPUT_FILE_NUM 4 /* number of widgets types supported in testbench */ -#define NUM_WIDGETS_SUPPORTED 10 +#define NUM_WIDGETS_SUPPORTED 11 struct testbench_prm { char *tplg_file; /* topology file to use */ diff --git a/tools/testbench/testbench.c b/tools/testbench/testbench.c index 20a3672a6c41..2df97b1afba1 100644 --- a/tools/testbench/testbench.c +++ b/tools/testbench/testbench.c @@ -33,6 +33,9 @@ DECLARE_SOF_TB_UUID("tdfb", tdfb_uuid, 0xdd511749, 0xd9fa, 0x455c, DECLARE_SOF_TB_UUID("drc", drc_uuid, 0xb36ee4da, 0x006f, 0x47f9, 0xa0, 0x6d, 0xfe, 0xcb, 0xe2, 0xd8, 0xb6, 0xce); +DECLARE_SOF_TB_UUID("multiband_drc", multiband_drc_uuid, 0x0d9f2256, 0x8e4f, 0x47b3, + 0x84, 0x48, 0x23, 0x9a, 0x33, 0x4f, 0x11, 0x91); + #define TESTBENCH_NCH 2 /* Stereo */ /* shared library look up table */ @@ -47,6 +50,7 @@ struct shared_lib_table lib_table[NUM_WIDGETS_SUPPORTED] = { {"crossover", "libsof_crossover.so", SOF_COMP_NONE, SOF_TB_UUID(crossover_uuid), 0, NULL}, {"tdfb", "libsof_tdfb.so", SOF_COMP_NONE, SOF_TB_UUID(tdfb_uuid), 0, NULL}, {"drc", "libsof_drc.so", SOF_COMP_NONE, SOF_TB_UUID(drc_uuid), 0, NULL}, + {"multiband_drc", "libsof_multiband_drc.so", SOF_COMP_NONE, SOF_TB_UUID(multiband_drc_uuid), 0, NULL}, }; /* compatible variables, not used */ From a2ce9d7f38f43bd99ff5807821a8b7adcb1c7adc Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Mon, 21 Dec 2020 17:06:20 +0100 Subject: [PATCH 45/60] tgl: fix a compilation warning lp_sram_unpack() is currently only built for Tigerlake targets, it contains a wrong type cast from "uintptr_t *" to "uint32_t *" and a superfluous cast from "uint32_t" to itself. Fix both. Signed-off-by: Guennadi Liakhovetski --- src/init/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init/init.c b/src/init/init.c index 9995ed69dd6b..b89e874f4f11 100644 --- a/src/init/init.c +++ b/src/init/init.c @@ -54,8 +54,8 @@ static inline void lp_sram_unpack(void) uint32_t *src, *dst; uint32_t size, i; - uint32_t *ptr = (uintptr_t *)&_loader_storage_manifest_start; - uint32_t entries = (uint32_t)*ptr++; + uint32_t *ptr = (uint32_t *)&_loader_storage_manifest_start; + uint32_t entries = *ptr++; for (i = 0; i < entries; i++) { src = (uint32_t *)*ptr++; From b81495364738affa24dfae67e83545667140c2e1 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 4 Jan 2021 12:04:27 +0200 Subject: [PATCH 46/60] Tools: Topology: Change volume demux playback ramp length to 20 ms The earlier length 250 ms is quite long and makes very short UI tones etc. quite silent. The 20 ms long ramp with zero crossings detect is used in rest of this topology for playback so this is changed to similar. The topologies those use the changed macro are: sof-icl-rt711-rt1308-rt715-hdmi.m4, sof-apl-demux-pcm512x.m4, sof-tgl-max98357a-rt5682.m4, sof-cml-demux-rt5682.m4, and sof-tgl-nocodec-ci.m4. Fixes: #3707 Signed-off-by: Seppo Ingalsuo --- tools/topology/sof/pipe-volume-demux-playback.m4 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/topology/sof/pipe-volume-demux-playback.m4 b/tools/topology/sof/pipe-volume-demux-playback.m4 index 61dc883e9f26..409e1281e7cd 100644 --- a/tools/topology/sof/pipe-volume-demux-playback.m4 +++ b/tools/topology/sof/pipe-volume-demux-playback.m4 @@ -43,11 +43,14 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, # Volume configuration # -W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, -LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' - ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) +define(DEF_PGA_TOKENS, concat(`pga_tokens_', PIPELINE_ID)) +define(DEF_PGA_CONF, concat(`pga_conf_', PIPELINE_ID)) -W_DATA(playback_pga_conf, playback_pga_tokens) +W_VENDORTUPLES(DEF_PGA_TOKENS, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "2"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "20"')) + +W_DATA(DEF_PGA_CONF, DEF_PGA_TOKENS) # # Components and Buffers @@ -58,7 +61,7 @@ W_DATA(playback_pga_conf, playback_pga_tokens) W_PCM_PLAYBACK(PCM_ID, Low Latency Playback, 2, 0, SCHEDULE_CORE) # "Master Playback Volume" has 2 source and x sink periods for DAI ping-pong -W_PGA(1, PIPELINE_FORMAT, DAI_PERIODS, 2, playback_pga_conf, SCHEDULE_CORE, +W_PGA(1, PIPELINE_FORMAT, DAI_PERIODS, 2, DEF_PGA_CONF, SCHEDULE_CORE, LIST(` ', "PIPELINE_ID Master Playback Volume")) # Mux 0 has 2 sink and source periods. @@ -103,3 +106,5 @@ indir(`define', concat(`PIPELINE_PCM_', PIPELINE_ID), Low Latency Playback PCM_I # PCM capabilities supported by FW PCM_CAPABILITIES(Low Latency Playback PCM_ID, CAPABILITY_FORMAT_NAME(PIPELINE_FORMAT), 48000, 48000, 2, PIPELINE_CHANNELS, 2, 16, 192, 16384, 65536, 65536) +undefine(`DEF_PGA_TOKENS') +undefine(`DEF_PGA_CONF') From 71b475160081f57905594452f2678c64f361fa8b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 31 Dec 2020 08:23:15 +0100 Subject: [PATCH 47/60] cavs: add a missing sanity check in a mask calculation cavs_pm_memory_hp_sram_mask_get() checks starting and ending bank indices against the requested segment range incompletely. Add the missing end segment check. Signed-off-by: Guennadi Liakhovetski --- src/platform/intel/cavs/include/cavs/lib/pm_memory.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/platform/intel/cavs/include/cavs/lib/pm_memory.h b/src/platform/intel/cavs/include/cavs/lib/pm_memory.h index f194a1ea78cf..a34f504df0d8 100644 --- a/src/platform/intel/cavs/include/cavs/lib/pm_memory.h +++ b/src/platform/intel/cavs/include/cavs/lib/pm_memory.h @@ -50,11 +50,13 @@ static inline uint32_t cavs_pm_memory_hp_sram_mask_get(uint32_t start_bank, if (start_bank > last_in_segment || end_bank < first_in_segment) return 0; - if (start_bank >= first_in_segment) - return MASK(MIN(end_bank, last_in_segment) - first_in_segment, - start_bank - first_in_segment); + if (start_bank < first_in_segment) + start_bank = first_in_segment; - return MASK(end_bank - first_in_segment, 0); + if (end_bank > last_in_segment) + end_bank = last_in_segment; + + return MASK(end_bank - first_in_segment, start_bank - first_in_segment); } /** From 101912b93493bd45dedd4ce0833e1e8a94970c02 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Tue, 29 Dec 2020 10:45:02 +0200 Subject: [PATCH 48/60] logger: Reduce one level of indentation There is one extra level of identation for all the code inside format_file_name function. Remove that to enhance readability. Signed-off-by: Daniel Baluta --- tools/logger/convert.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/logger/convert.c b/tools/logger/convert.c index d9894da55aed..5f8e3c91a562 100644 --- a/tools/logger/convert.c +++ b/tools/logger/convert.c @@ -344,29 +344,29 @@ static const char *get_component_name(uint32_t trace_class, uint32_t uid_ptr) /* remove superfluous leading file path and shrink to last 20 chars */ static char *format_file_name(char *file_name_raw, int full_name) { - char *name; - int len; + char *name; + int len; - /* most/all string should have "src" */ - name = strstr(file_name_raw, "src"); - if (!name) - name = file_name_raw; + /* most/all string should have "src" */ + name = strstr(file_name_raw, "src"); + if (!name) + name = file_name_raw; - if (full_name) - return name; - /* keep the last 24 chars */ - len = strlen(name); - if (len > 24) { - char *sep_pos = NULL; - - name += (len - 24); - sep_pos = strchr(name, '/'); - if (!sep_pos) - return name; - while (--sep_pos >= name) - *sep_pos = '.'; - } + if (full_name) return name; + /* keep the last 24 chars */ + len = strlen(name); + if (len > 24) { + char *sep_pos = NULL; + + name += (len - 24); + sep_pos = strchr(name, '/'); + if (!sep_pos) + return name; + while (--sep_pos >= name) + *sep_pos = '.'; + } + return name; } static void print_entry_params(const struct log_entry_header *dma_log, From 6d2e64f6085c8ad257990df3aa1a070f07c0f094 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 31 Dec 2020 07:59:09 +0100 Subject: [PATCH 49/60] common: add a macro for a rounded-up division Multiple locations in the code open-code a round-up division operation. Add a common macro for it. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index 0fac6f049606..fb08bcb56177 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -16,6 +16,7 @@ #define ALIGN_DOWN(size, alignment) \ ((size) - ((size) % (alignment))) #define ALIGN ALIGN_UP +#define DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div)) #ifndef __ASSEMBLER__ From ae7f90c468f3d6d69f6ba5d9d7afd688b699c019 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 31 Dec 2020 08:03:57 +0100 Subject: [PATCH 50/60] common: make common.h invisible to linker scripts common.h defines an ALIGN() macro, which would conflict with the identically named linker builtin function. At the moment common.h isn't included in linker scripts, but it might get included via a different header. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/common.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index fb08bcb56177..c41a07a5b5be 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -9,6 +9,8 @@ #ifndef __SOF_COMMON_H__ #define __SOF_COMMON_H__ +#if !defined(LINKER) + /* Align the number to the nearest alignment value */ #define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0) #define ALIGN_UP(size, alignment) \ @@ -18,7 +20,7 @@ #define ALIGN ALIGN_UP #define DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div)) -#ifndef __ASSEMBLER__ +#if !defined(__ASSEMBLER__) #include #include @@ -84,4 +86,5 @@ #endif /* __XCC__ */ #endif /* __ASSEMBLER__ */ +#endif /* LINKER */ #endif /* __SOF_COMMON_H__ */ From 3c20133263d5588de2769c0e9f87a1266daaceb9 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 31 Dec 2020 08:09:36 +0100 Subject: [PATCH 51/60] common: use DIV_ROUND_UP() instead of open-coding Replace two instances of open-coded rounding-up division with DIV_ROUND_UP() calls. Signed-off-by: Guennadi Liakhovetski --- src/platform/intel/cavs/boot_loader.c | 4 +--- src/platform/intel/cavs/include/cavs/lib/memory.h | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/platform/intel/cavs/boot_loader.c b/src/platform/intel/cavs/boot_loader.c index 4c79ddb65ff4..87d22bf72256 100644 --- a/src/platform/intel/cavs/boot_loader.c +++ b/src/platform/intel/cavs/boot_loader.c @@ -178,9 +178,7 @@ static uint32_t hp_sram_power_memory(uint32_t memory_size, bool enable) /* calculate total number of used SRAM banks (EBB) * to power up only necessary banks */ - ebb_in_use = (!(memory_size % SRAM_BANK_SIZE)) ? - (memory_size / SRAM_BANK_SIZE) : - (memory_size / SRAM_BANK_SIZE) + 1; + ebb_in_use = DIV_ROUND_UP(memory_size, SRAM_BANK_SIZE); start_bank = enable ? 0 : ebb_in_use; end_bank = (enable ? ebb_in_use : PLATFORM_HPSRAM_EBB_COUNT) - 1; diff --git a/src/platform/intel/cavs/include/cavs/lib/memory.h b/src/platform/intel/cavs/include/cavs/lib/memory.h index a39e0cd5ef02..edd6f082b701 100644 --- a/src/platform/intel/cavs/include/cavs/lib/memory.h +++ b/src/platform/intel/cavs/include/cavs/lib/memory.h @@ -10,6 +10,7 @@ #ifndef __CAVS_LIB_MEMORY_H__ #define __CAVS_LIB_MEMORY_H__ +#include #include #if !defined(__ASSEMBLER__) && !defined(LINKER) #include @@ -45,8 +46,8 @@ #define HP_SRAM_SIZE \ (CONFIG_HP_MEMORY_BANKS * SRAM_BANK_SIZE) -#define PLATFORM_HPSRAM_SEGMENTS ((PLATFORM_HPSRAM_EBB_COUNT \ - + EBB_BANKS_IN_SEGMENT - 1) / EBB_BANKS_IN_SEGMENT) +#define PLATFORM_HPSRAM_SEGMENTS DIV_ROUND_UP(PLATFORM_HPSRAM_EBB_COUNT, \ + EBB_BANKS_IN_SEGMENT) #if defined(__ASSEMBLER__) #define LPSRAM_MASK(ignored) ((1 << PLATFORM_LPSRAM_EBB_COUNT) - 1) From 85fd815f86c577877bf0385a3e0e438a177e2ea1 Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Wed, 6 Jan 2021 13:34:36 +0200 Subject: [PATCH 52/60] tools: Add cmake toolchain file for cross compilation on arm64 We need this to cross-compile sof-logger for arm64. Steps: * download and install cross-compiler * (e.g on Ubuntu: sudo apt-get install gcc-aarch64-linux-gnu) * mkdir tools/build/ * cd tools/build/ * cmake .. -DCMAKE_TOOLCHAIN_FILE=../scripts//cross-arch64.cmake * make sof-logger Signed-off-by: Daniel Baluta --- tools/scripts/cross-arch64.cmake | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tools/scripts/cross-arch64.cmake diff --git a/tools/scripts/cross-arch64.cmake b/tools/scripts/cross-arch64.cmake new file mode 100644 index 000000000000..a9721f4ec13c --- /dev/null +++ b/tools/scripts/cross-arch64.cmake @@ -0,0 +1,23 @@ +# +# CMake Toolchain file for crosscompiling on arm64 +# +# This can be used when running cmake in the following way: +# cd build/ +# cmake .. -DCMAKE_TOOLCHAIN_FILE=../scripts/cross-arch64.cmake +# + +# Target operating system name. +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) + +# Name of C compiler. +set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc") +set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++") + +# Adjust the default behavior of the FIND_XXX() commands: +# search programs in the host environment only. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + +# Search headers and libraries in the target environment only. +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) From d6b9f1f7954150339056287a6e26b42574b7f955 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Tue, 5 Jan 2021 17:23:37 +0800 Subject: [PATCH 53/60] smart_amp_maxim_dsm: log warning for zero frame copy Change to comp_warn() when zero fram is copied, which really requires attention on. Signed-off-by: Keyon Jie --- src/audio/smart_amp/smart_amp_maxim_dsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/smart_amp/smart_amp_maxim_dsm.c b/src/audio/smart_amp/smart_amp_maxim_dsm.c index cad3227669e6..cee0e08bfdf4 100644 --- a/src/audio/smart_amp/smart_amp_maxim_dsm.c +++ b/src/audio/smart_amp/smart_amp_maxim_dsm.c @@ -689,7 +689,7 @@ int smart_amp_ff_copy(struct comp_dev *dev, uint32_t frames, int ret; if (frames == 0) { - comp_dbg(dev, "[DSM] feed forward frame size zero warning."); + comp_warn(dev, "[DSM] feed forward frame size zero warning."); return 0; } @@ -749,7 +749,7 @@ int smart_amp_fb_copy(struct comp_dev *dev, uint32_t frames, int ret; if (frames == 0) { - comp_dbg(dev, "[DSM] feedback frame size zero warning."); + comp_warn(dev, "[DSM] feedback frame size zero warning."); return 0; } From 28d06341bc317898dd607b01b3d58d38ecd3948b Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Tue, 15 Dec 2020 16:48:41 +0100 Subject: [PATCH 54/60] ext_man: Remove dictionary elements counter from ABI for ext_man_config_data This value shouldn't be included in any ABI header, because it may vary between firmware configurations. This change makes header file more similar to version provided by kernel. Signed-off-by: Karol Trzcinski --- src/include/kernel/ext_manifest.h | 2 +- src/init/ext_manifest.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/include/kernel/ext_manifest.h b/src/include/kernel/ext_manifest.h index 4963428733ae..17fd262fd885 100644 --- a/src/include/kernel/ext_manifest.h +++ b/src/include/kernel/ext_manifest.h @@ -95,7 +95,7 @@ struct ext_man_dbg_abi { struct ext_man_config_data { struct ext_man_elem_header hdr; - struct config_elem elems[EXT_MAN_CONFIG_LAST_ELEM]; + struct config_elem elems[]; } __packed; #endif /* __KERNEL_EXT_MANIFEST_H__ */ diff --git a/src/init/ext_manifest.c b/src/init/ext_manifest.c index 2e9b5b5574f5..6568ffebf419 100644 --- a/src/init/ext_manifest.c +++ b/src/init/ext_manifest.c @@ -85,10 +85,14 @@ const struct ext_man_dbg_abi ext_man_dbg_info }, }; +/* increment this value after adding any element to ext_man_config dictionary */ +#define CONFIG_ELEM_CNT (EXT_MAN_CONFIG_LAST_ELEM - 1) + const struct ext_man_config_data ext_man_config __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_CONFIG_DATA, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_config_data), + .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_config_data) + + sizeof(struct config_elem) * CONFIG_ELEM_CNT, EXT_MAN_ALIGN), .elems = { {EXT_MAN_CONFIG_IPC_MSG_SIZE, SOF_IPC_MSG_MAX_SIZE}, From 5c02bbc2830fe74587afc680f78ae4f89ca1fcd1 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Tue, 15 Dec 2020 16:52:50 +0100 Subject: [PATCH 55/60] ext_man: cavs: Always include EXT_MAN_CAVS_CONFIG_LPRO element to manifest This value should be included to output image with proper value instead of including only for some configurations. It will reduce dictionary element counting complexity. Signed-off-by: Karol Trzcinski --- src/platform/intel/cavs/ext_manifest.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platform/intel/cavs/ext_manifest.c b/src/platform/intel/cavs/ext_manifest.c index b8b2dec715bf..c671421e5410 100644 --- a/src/platform/intel/cavs/ext_manifest.c +++ b/src/platform/intel/cavs/ext_manifest.c @@ -16,9 +16,7 @@ const struct ext_man_cavs_config_data ext_man_cavs_config .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data), EXT_MAN_ALIGN), .elems = { -#if CONFIG_CAVS_LPRO_ONLY - {EXT_MAN_CAVS_CONFIG_LPRO, CONFIG_CAVS_LPRO_ONLY}, -#endif + {EXT_MAN_CAVS_CONFIG_LPRO, IS_ENABLED(CONFIG_CAVS_LPRO_ONLY)}, {EXT_MAN_CAVS_CONFIG_OUTBOX_SIZE, SRAM_OUTBOX_SIZE}, {EXT_MAN_CAVS_CONFIG_INBOX_SIZE, SRAM_INBOX_SIZE}, }, From 5a1078d29356425ad93040cb6c43e69b9eceaeb8 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Mon, 21 Dec 2020 09:32:59 +0100 Subject: [PATCH 56/60] ext_man: Remove dictionary elements counter from ABI for ext_man_cavs_config_data This value shouldn't be included in any ABI header, because it may vary between firmware configurations. This change makes header file more similar to version provided by kernel. Signed-off-by: Karol Trzcinski --- src/platform/intel/cavs/ext_manifest.c | 6 +++++- src/platform/intel/cavs/include/cavs/ext_manifest.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/platform/intel/cavs/ext_manifest.c b/src/platform/intel/cavs/ext_manifest.c index c671421e5410..4325c46aca2c 100644 --- a/src/platform/intel/cavs/ext_manifest.c +++ b/src/platform/intel/cavs/ext_manifest.c @@ -10,10 +10,14 @@ #include #include +/* Describes elements counter from ext_man_cavs_config dictionary */ +#define CAVS_CONFIG_ELEM_CNT (EXT_MAN_CAVS_CONFIG_LAST_ELEM - 1) + const struct ext_man_cavs_config_data ext_man_cavs_config __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_PLATFORM_CONFIG_DATA, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data), + .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data) + + sizeof(struct config_elem) * CAVS_CONFIG_ELEM_CNT, EXT_MAN_ALIGN), .elems = { {EXT_MAN_CAVS_CONFIG_LPRO, IS_ENABLED(CONFIG_CAVS_LPRO_ONLY)}, diff --git a/src/platform/intel/cavs/include/cavs/ext_manifest.h b/src/platform/intel/cavs/include/cavs/ext_manifest.h index 305b29463273..3eaf2d3d6c49 100644 --- a/src/platform/intel/cavs/include/cavs/ext_manifest.h +++ b/src/platform/intel/cavs/include/cavs/ext_manifest.h @@ -22,7 +22,7 @@ enum cavs_config_elem_type { struct ext_man_cavs_config_data { struct ext_man_elem_header hdr; - struct config_elem elems[EXT_MAN_CAVS_CONFIG_LAST_ELEM]; + struct config_elem elems[]; } __packed; #endif /* __KERNEL_EXT_MANIFEST_H__ */ From b50d49695895e70110f61987ce2f2bd3177c21c8 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Wed, 6 Jan 2021 18:20:33 +0800 Subject: [PATCH 57/60] topology: sof-tgl-max98373-rt5682: use 32bit dai and 24.576MHz mclk To align with maxim 98373 12.288MHz bclk requirement, change rt5682 to 32bit with BCLK 3.072MHz. To follow the rule that the MCLK should use the same clock source with BCLK, change the mclk to 24.576MHz. Signed-off-by: Keyon Jie --- tools/topology/sof-tgl-max98373-rt5682.m4 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/topology/sof-tgl-max98373-rt5682.m4 b/tools/topology/sof-tgl-max98373-rt5682.m4 index c04e077a7e0f..8be0d4110f01 100644 --- a/tools/topology/sof-tgl-max98373-rt5682.m4 +++ b/tools/topology/sof-tgl-max98373-rt5682.m4 @@ -48,7 +48,7 @@ define(`SMART_SSP_NAME', concat(concat(`SSP', AMP_SSP),`-Codec')) #define BE dai_link ID define(`SMART_BE_ID', 7) #define SSP mclk -define(`SSP_MCLK', 19200000) +define(`SSP_MCLK', 24576000) # Playback related define(`SMART_PB_PPL_ID', 1) define(`SMART_PB_CH_NUM', 2) @@ -147,14 +147,14 @@ dnl frames, deadline, priority, core) # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-playback.m4, 2, SSP, 0, SSP0-Codec, - PIPELINE_SOURCE_2, 2, s24le, + PIPELINE_SOURCE_2, 2, s32le, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # capture DAI is SSP0 using 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0 DAI_ADD(sof/pipe-dai-capture.m4, 3, SSP, 0, SSP0-Codec, - PIPELINE_SINK_3, 2, s24le, + PIPELINE_SINK_3, 2, s32le, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER) # playback DAI is iDisp1 using 2 periods @@ -208,10 +208,10 @@ dnl ssp1-maxmspk, ssp0-RTHeadset #SSP 0 (ID: 0) DAI_CONFIG(SSP, 0, 0, SSP0-Codec, SSP_CONFIG(I2S, SSP_CLOCK(mclk, SSP_MCLK, codec_mclk_in), - SSP_CLOCK(bclk, 2400000, codec_slave), + SSP_CLOCK(bclk, 3072000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), - SSP_TDM(2, 25, 3, 3), - SSP_CONFIG_DATA(SSP, 0, 24))) + SSP_TDM(2, 32, 3, 3), + SSP_CONFIG_DATA(SSP, 0, 32))) # 4 HDMI/DP outputs (ID: 3,4,5,6) DAI_CONFIG(HDA, 0, 3, iDisp1, From 39266cac81f4297f78d83cfc6996fcd37aec00c8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 4 Dec 2020 18:46:24 +0100 Subject: [PATCH 58/60] core: assure alignment is only done on power of 2 values Alignment should always be done on powers of 2. Enforcing this rule also allows the use of binary AND for alignment instead of much slower division. Also add compile-time checks where possible. At the moment no non-power-of-2 alignment cases are known in SOF, but a complete verification is difficult, therefore we add compile- and runtime checks, enabled by default for now. After a period of time (one or two releases) this verification option can be converted to an off by default configuration parameter. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/common.h | 68 ++++++++++++++++++++++++-- src/init/ext_manifest.c | 22 ++++----- src/platform/baytrail/platform.c | 2 +- src/platform/haswell/platform.c | 2 +- src/platform/imx8/platform.c | 2 +- src/platform/imx8m/platform.c | 2 +- src/platform/intel/cavs/ext_manifest.c | 6 +-- src/platform/intel/cavs/platform.c | 2 +- 8 files changed, 83 insertions(+), 23 deletions(-) diff --git a/src/include/sof/common.h b/src/include/sof/common.h index c41a07a5b5be..8db626b178a5 100644 --- a/src/include/sof/common.h +++ b/src/include/sof/common.h @@ -13,10 +13,70 @@ /* Align the number to the nearest alignment value */ #define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0) -#define ALIGN_UP(size, alignment) \ - ((size) + (alignment) - 1 - ((size) + (alignment) - 1) % (alignment)) -#define ALIGN_DOWN(size, alignment) \ - ((size) - ((size) % (alignment))) + +#define is_non0_power_of_2(x) ((x) && !((x) & ((x) - 1))) + +#define compile_fail_zero_or_true(x) (sizeof(struct{int _f : 1 - !(x); })) +#define compile_fail_zero_or_false_fn(x) ({int _f[(x) - 1]; 0 & _f[0]; }) + +#define ALIGN_UP_INTERNAL(val, align) (((val) + (align) - 1) & ~((align) - 1)) + +#define VERIFY_ALIGN +#ifdef VERIFY_ALIGN + +/* For data initializers etc. */ +#define ALIGN_UP_COMPILE(size, alignment) \ + (compile_fail_zero_or_true(is_non0_power_of_2(alignment)) ? \ + ALIGN_UP_INTERNAL(size, alignment) : 0) + +#ifdef __XCC__ + +/* + * xcc doesn't support __builtin_constant_p() so we can only do run-time + * verification + */ + +#define ALIGN_UP(size, alignment) ({ \ + if (!is_non0_power_of_2(alignment)) \ + panic(SOF_IPC_PANIC_ASSERT); \ + ALIGN_UP_INTERNAL(size, alignment); \ +}) + +#define ALIGN_DOWN(size, alignment) ({ \ + if (!is_non0_power_of_2(alignment)) \ + panic(SOF_IPC_PANIC_ASSERT); \ + (size) & ~((alignment) - 1); \ +}) + +#else + +#define COMPILE_TIME_ALIGNED(align) (!__builtin_constant_p(align) || \ + is_non0_power_of_2(align)) + +#define ALIGN_UP(size, alignment) ({ \ + if (compile_fail_zero_or_false_fn(COMPILE_TIME_ALIGNED(alignment)) || \ + !is_non0_power_of_2(alignment)) \ + panic(SOF_IPC_PANIC_ASSERT); \ + ALIGN_UP_INTERNAL(size, alignment); \ +}) + +#define ALIGN_DOWN(size, alignment) ({ \ + if (compile_fail_zero_or_false_fn(COMPILE_TIME_ALIGNED(alignment)) || \ + !is_non0_power_of_2(alignment)) \ + panic(SOF_IPC_PANIC_ASSERT); \ + (size) & ~((alignment) - 1); \ +}) + +#endif + +#else + +#define ALIGN_UP(size, alignment) ALIGN_UP_INTERNAL(size, alignment) +#define ALIGN_UP_COMPILE ALIGN_UP +#define ALIGN_DOWN(size, alignment) ((size) & ~((alignment) - 1)) + +#endif + #define ALIGN ALIGN_UP #define DIV_ROUND_UP(val, div) (((val) + (div) - 1) / (div)) diff --git a/src/init/ext_manifest.c b/src/init/ext_manifest.c index 6568ffebf419..9a8a33fd6bba 100644 --- a/src/init/ext_manifest.c +++ b/src/init/ext_manifest.c @@ -17,8 +17,8 @@ const struct ext_man_fw_version ext_man_fw_ver __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_FW_VERSION, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_fw_version), - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_fw_version), + EXT_MAN_ALIGN), .version = { .hdr.size = sizeof(struct sof_ipc_fw_version), .micro = SOF_MICRO, @@ -40,8 +40,8 @@ const struct ext_man_fw_version ext_man_fw_ver const struct ext_man_cc_version ext_man_cc_ver __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_CC_VERSION, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cc_version), - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_cc_version), + EXT_MAN_ALIGN), .cc_version = { .ext_hdr.hdr.size = sizeof(struct sof_ipc_cc_version), .ext_hdr.hdr.cmd = SOF_IPC_FW_READY, @@ -59,8 +59,8 @@ const struct ext_man_cc_version ext_man_cc_ver const struct ext_man_probe_support ext_man_probe __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_PROBE_INFO, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_probe_support), - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_probe_support), + EXT_MAN_ALIGN), .probe = { .ext_hdr.hdr.size = sizeof(struct sof_ipc_probe_support), .ext_hdr.hdr.cmd = SOF_IPC_FW_READY, @@ -75,8 +75,8 @@ const struct ext_man_probe_support ext_man_probe const struct ext_man_dbg_abi ext_man_dbg_info __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_DBG_ABI, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_dbg_abi), - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_dbg_abi), + EXT_MAN_ALIGN), .dbg_abi = { .ext_hdr.hdr.size = sizeof(struct sof_ipc_user_abi_version), .ext_hdr.hdr.cmd = SOF_IPC_FW_READY, @@ -91,9 +91,9 @@ const struct ext_man_dbg_abi ext_man_dbg_info const struct ext_man_config_data ext_man_config __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_CONFIG_DATA, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_config_data) + - sizeof(struct config_elem) * CONFIG_ELEM_CNT, - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_config_data) + + sizeof(struct config_elem) * CONFIG_ELEM_CNT, + EXT_MAN_ALIGN), .elems = { {EXT_MAN_CONFIG_IPC_MSG_SIZE, SOF_IPC_MSG_MAX_SIZE}, {EXT_MAN_CONFIG_MEMORY_USAGE_SCAN, IS_ENABLED(CONFIG_DEBUG_MEMORY_USAGE_SCAN)}, diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index e04888fbb433..c0e54fb3eefc 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -83,7 +83,7 @@ const struct ext_man_windows xsram_window __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { .hdr = { .type = EXT_MAN_ELEM_WINDOW, - .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), + .elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, .window = { .ext_hdr = { diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index 47f43a5c32b9..6bcd0e36819d 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -69,7 +69,7 @@ const struct ext_man_windows xsram_window __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { .hdr = { .type = EXT_MAN_ELEM_WINDOW, - .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), + .elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, .window = { .ext_hdr = { diff --git a/src/platform/imx8/platform.c b/src/platform/imx8/platform.c index 67f4f0ef8834..e5232549feb8 100644 --- a/src/platform/imx8/platform.c +++ b/src/platform/imx8/platform.c @@ -68,7 +68,7 @@ const struct ext_man_windows xsram_window __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { .hdr = { .type = EXT_MAN_ELEM_WINDOW, - .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), + .elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, .window = { .ext_hdr = { diff --git a/src/platform/imx8m/platform.c b/src/platform/imx8m/platform.c index 349baabedb72..9175e742cf86 100644 --- a/src/platform/imx8m/platform.c +++ b/src/platform/imx8m/platform.c @@ -67,7 +67,7 @@ const struct ext_man_windows xsram_window __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { .hdr = { .type = EXT_MAN_ELEM_WINDOW, - .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), + .elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, .window = { .ext_hdr = { diff --git a/src/platform/intel/cavs/ext_manifest.c b/src/platform/intel/cavs/ext_manifest.c index 4325c46aca2c..50309a734770 100644 --- a/src/platform/intel/cavs/ext_manifest.c +++ b/src/platform/intel/cavs/ext_manifest.c @@ -16,9 +16,9 @@ const struct ext_man_cavs_config_data ext_man_cavs_config __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { .hdr.type = EXT_MAN_ELEM_PLATFORM_CONFIG_DATA, - .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data) + - sizeof(struct config_elem) * CAVS_CONFIG_ELEM_CNT, - EXT_MAN_ALIGN), + .hdr.elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_cavs_config_data) + + sizeof(struct config_elem) * CAVS_CONFIG_ELEM_CNT, + EXT_MAN_ALIGN), .elems = { {EXT_MAN_CAVS_CONFIG_LPRO, IS_ENABLED(CONFIG_CAVS_LPRO_ONLY)}, {EXT_MAN_CAVS_CONFIG_OUTBOX_SIZE, SRAM_OUTBOX_SIZE}, diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 53f866718222..ae85a8bca227 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -82,7 +82,7 @@ const struct ext_man_windows xsram_window __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { .hdr = { .type = EXT_MAN_ELEM_WINDOW, - .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), + .elem_size = ALIGN_UP_COMPILE(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, .window = { .ext_hdr = { From 7531d6bd073e103f9ca86eb9eb3d0ec95738e5a8 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 7 Jan 2021 12:23:50 +0100 Subject: [PATCH 59/60] zephyr: add a cache variable with a rimage configuration path zephyr needs a path to rimage configuration files, add it to cmake cache. Signed-off-by: Guennadi Liakhovetski --- zephyr/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 06f6fb2b8d90..cf38f46d0a03 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -51,6 +51,12 @@ set(SOF_DEBUG_PATH "${SOF_SRC_PATH}/debug") set(SOF_MATH_PATH "${SOF_SRC_PATH}/math") set(SOF_TRACE_PATH "${SOF_SRC_PATH}/trace") +# Save path to rimage configuration files in cmake cache for later use by +# rimage during the "west sign" stage +get_filename_component(RIMAGE_CONFIG "../rimage/config" ABSOLUTE) +set(RIMAGE_CONFIG_PATH ${RIMAGE_CONFIG} CACHE PATH + " Path to rimage board configuration files") + # default SOF includes target_include_directories(SOF INTERFACE ../rimage/src/include) target_include_directories(SOF INTERFACE ../zephyr/include) From 551bb2d9525c050946262246ef7224e38d6e421d Mon Sep 17 00:00:00 2001 From: Daniel Baluta Date: Wed, 6 Jan 2021 18:50:27 +0200 Subject: [PATCH 60/60] codec: Add dummy codec implementation This is useful to test codec adapter component and generic codec code. Our dummy codec has 1 input buffer and 1 output buffer and in its initial implementation just copies input to output without any processing on the data. Signed-off-by: Daniel Baluta --- src/audio/Kconfig | 8 ++ src/audio/codec_adapter/CMakeLists.txt | 4 + src/audio/codec_adapter/codec/dummy.c | 83 +++++++++++++++++++ .../sof/audio/codec_adapter/codec/dummy.h | 18 ++++ .../sof/audio/codec_adapter/interfaces.h | 17 ++++ 5 files changed, 130 insertions(+) create mode 100644 src/audio/codec_adapter/codec/dummy.c create mode 100644 src/include/sof/audio/codec_adapter/codec/dummy.h diff --git a/src/audio/Kconfig b/src/audio/Kconfig index daaa7e673a65..38c482f9df09 100644 --- a/src/audio/Kconfig +++ b/src/audio/Kconfig @@ -336,6 +336,14 @@ config CADENCE_CODEC Select for codecs which conforms to the Cadence API. This will cause codec adapter component to include header files specific to CADENCE base codecs. + +config DUMMY_CODEC + bool "Dummy codec" + default n + help + Select for a dummy API codec implementation. + This will cause codec adapter component to include header + files specific to DUMMY base codecs. endif endmenu # "Audio components" diff --git a/src/audio/codec_adapter/CMakeLists.txt b/src/audio/codec_adapter/CMakeLists.txt index 418ef8122d06..b1200b797002 100644 --- a/src/audio/codec_adapter/CMakeLists.txt +++ b/src/audio/codec_adapter/CMakeLists.txt @@ -4,3 +4,7 @@ add_local_sources(sof codec_adapter.c codec/generic.c) if(CONFIG_CADENCE_CODEC) add_local_sources(sof codec/cadence.c) endif() + +if(CONFIG_DUMMY_CODEC) +add_local_sources(sof codec/dummy.c) +endif() diff --git a/src/audio/codec_adapter/codec/dummy.c b/src/audio/codec_adapter/codec/dummy.c new file mode 100644 index 000000000000..6aceb7ab682a --- /dev/null +++ b/src/audio/codec_adapter/codec/dummy.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: BSD-3-Clause +// +// Copyright 2020 NXP +// +// Author: Daniel Baluta +// +// Dummy codec implementation to demonstrate Codec Adapter API + +#include +#include + +int dummy_codec_init(struct comp_dev *dev) +{ + comp_info(dev, "dummy_codec_init() start"); + return 0; +} + +int dummy_codec_prepare(struct comp_dev *dev) +{ + struct codec_data *codec = comp_get_codec(dev); + struct comp_data *cd = comp_get_drvdata(dev); + + comp_info(dev, "dummy_codec_process()"); + + codec->cpd.in_buff = rballoc(0, SOF_MEM_CAPS_RAM, cd->period_bytes); + if (!codec->cpd.in_buff) { + comp_err(dev, "dummy_codec_prepare(): Failed to alloc in_buff"); + return -ENOMEM; + } + codec->cpd.in_buff_size = cd->period_bytes; + + codec->cpd.out_buff = rballoc(0, SOF_MEM_CAPS_RAM, cd->period_bytes); + if (!codec->cpd.out_buff) { + comp_err(dev, "dummy_codec_prepare(): Failed to alloc out_buff"); + rfree(codec->cpd.in_buff); + return -ENOMEM; + } + codec->cpd.out_buff_size = cd->period_bytes; + + return 0; +} + +int dummy_codec_process(struct comp_dev *dev) +{ + struct codec_data *codec = comp_get_codec(dev); + struct comp_data *cd = comp_get_drvdata(dev); + + comp_dbg(dev, "dummy_codec_process()"); + + memcpy_s(codec->cpd.out_buff, codec->cpd.out_buff_size, + codec->cpd.in_buff, codec->cpd.in_buff_size); + codec->cpd.produced = cd->period_bytes; + + return 0; +} + +int dummy_codec_apply_config(struct comp_dev *dev) +{ + comp_info(dev, "dummy_codec_apply_config()"); + + /* nothing to do */ + return 0; +} + +int dummy_codec_reset(struct comp_dev *dev) +{ + comp_info(dev, "dummy_codec_reset()"); + + /* nothing to do */ + return 0; +} + +int dummy_codec_free(struct comp_dev *dev) +{ + struct codec_data *codec = comp_get_codec(dev); + + comp_info(dev, "dummy_codec_free()"); + + rfree(codec->cpd.in_buff); + rfree(codec->cpd.out_buff); + + return 0; +} diff --git a/src/include/sof/audio/codec_adapter/codec/dummy.h b/src/include/sof/audio/codec_adapter/codec/dummy.h new file mode 100644 index 000000000000..1489f2461334 --- /dev/null +++ b/src/include/sof/audio/codec_adapter/codec/dummy.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2020 NXP + * + * Author: Daniel Baluta + */ + +#ifndef __SOF_AUDIO_DUMMY_CODEC__ +#define __SOF_AUDIO_DUMMY_CODEC__ + +int dummy_codec_init(struct comp_dev *dev); +int dummy_codec_prepare(struct comp_dev *dev); +int dummy_codec_process(struct comp_dev *dev); +int dummy_codec_apply_config(struct comp_dev *dev); +int dummy_codec_reset(struct comp_dev *dev); +int dummy_codec_free(struct comp_dev *dev); + +#endif /* __SOF_AUDIO_DUMMY_CODEC__ */ diff --git a/src/include/sof/audio/codec_adapter/interfaces.h b/src/include/sof/audio/codec_adapter/interfaces.h index e223f32c68a4..ccf265d5454b 100644 --- a/src/include/sof/audio/codec_adapter/interfaces.h +++ b/src/include/sof/audio/codec_adapter/interfaces.h @@ -15,7 +15,12 @@ #include #endif /* CONFIG_CADENCE_CODEC */ +#if CONFIG_DUMMY_CODEC +#include +#endif + #define CADENCE_ID 0xCADE01 +#define DUMMY_ID 0xD03311 /*****************************************************************************/ /* Linked codecs interfaces */ @@ -32,6 +37,18 @@ static struct codec_interface interfaces[] = { .free = cadence_codec_free }, #endif /* CONFIG_CADENCE_CODEC */ + +#ifdef CONFIG_DUMMY_CODEC + { + .id = DUMMY_ID, /** dummy interface */ + .init = dummy_codec_init, + .prepare = dummy_codec_prepare, + .process = dummy_codec_process, + .apply_config = dummy_codec_apply_config, + .reset = dummy_codec_reset, + .free = dummy_codec_free + }, +#endif /* CONFIG_DUMMY_CODEC */ }; #endif /* __SOF_AUDIO_CODEC_INTERFACES__ */