Skip to content

Commit

Permalink
Merge pull request thesofproject#4 from nashif/update_1
Browse files Browse the repository at this point in the history
  • Loading branch information
nashif authored Jan 11, 2021
2 parents ed0b4b9 + c340819 commit 9e75cce
Show file tree
Hide file tree
Showing 230 changed files with 2,855 additions and 282 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rimage
15 changes: 14 additions & 1 deletion scripts/xtensa-build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/arch/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions src/arch/xtensa/configs/tgph_defconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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 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
Expand Down
17 changes: 17 additions & 0 deletions src/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -327,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"

Expand Down
4 changes: 4 additions & 0 deletions src/audio/codec_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
21 changes: 18 additions & 3 deletions src/audio/codec_adapter/codec/cadence.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -345,6 +348,7 @@ int cadence_codec_prepare(struct comp_dev *dev)
free:
codec_free_memory(dev, cd->mem_tabs);
err:
done:
return ret;
}

Expand Down Expand Up @@ -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)
Expand Down
83 changes: 83 additions & 0 deletions src/audio/codec_adapter/codec/dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2020 NXP
//
// Author: Daniel Baluta <daniel.baluta@nxp.com>
//
// Dummy codec implementation to demonstrate Codec Adapter API

#include <sof/audio/codec_adapter/codec/generic.h>
#include <sof/audio/codec_adapter/codec/dummy.h>

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;
}
11 changes: 4 additions & 7 deletions src/audio/codec_adapter/codec/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -328,12 +325,12 @@ 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;
}

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;
Expand Down Expand Up @@ -369,8 +366,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;

Expand Down
Loading

0 comments on commit 9e75cce

Please sign in to comment.