The configuration names with _2017 are a consequence of the way I did
the internal configuration update. To keep it simple I update these
build scripts.
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
Implement a kwd function based on small
neural network able to detect yes/no
keywords. This represents an alternative
to the default kwd function and is
implemented in a separate file. Enabling
the usage of this kwd nn functionality is
done by enabling KWD_NN_SAMPLE_KEYPHRASE.
The inference function of the neural network
operates on 990 ms which are gathered in the
acquisition input buffer exposed by the detection
component.
Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
Define & allocate acquisition buffer where
collecting the necessary amount of input data
required by the detection algorithm. In our
case the kwd_nn detection algorithm requires
~1s of data once which is more than what
the current configuration of the pipeline
offers once: 20ms of data.
Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
Expose detect_test_notify function for
other modules which would implement
an alternative of default kwd detection
Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
GCC configuration for ct-NG uses newlibc libc versions of common
memcpy() and memset(). Check this in makefile and lib.c so we can use
the correct versions.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Following move of open source to remove oppressive language from open
source, dummy is one of the terms to avoid. Also the term does a poor
job of describing what the adapter actually does.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
During the initialization of a decoder, the initialization task reads the
input stream to discover the parameters of the encoding.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This function should be called before processing. It searches
for a valid header, does header decoding to get the parameters
and initializes state and configuration structures.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
We need to save initialization status to a persistent (between calls)
variable in order to check it each time we want to do processing.
Initialization only takes place once before first frames are decoded.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Init process function searches for valid header, does header
decoding to get the parameters and initializes state and configuration
structures.
In order for this to work we need to set the input bytes and also
update consumed bytes.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Initialization of the processing shouldn't be done in the prepare
function as the decoder needs some input frames in order to figure
out decoding parameters.
First step is to just factour out the init process code into
a function and move it to the proper place later.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
With decoders, usually, consumed bytes is not equal
with produced bytes. We need to take this into account
in order to copy the entire produced bytes by the processing algorithm.
- consumed bytes -> number of bytes consumed from the input buffer.
- produced bytes -> number of bytes produced into the output buffer.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Looking at the timestamps from sof-logger it looks like
the DSP core frequency on i.MX8X is wrong.
Documentation confirms this. It should be 640Mhz.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Adapt the apl KWD topology to imx8m by switching to
SCHEDULE_TIME_DOMAIN_DMA on capture pipeline and
creating a no LP capture file for KFBM component.
Signed-off-by: Cristina Feies (ilie) <cristina.ilie@nxp.com>
On start W1C the Work Start Flag, Sync Error Flag and
FIFO Error Flag.
Write a logic 1 to this field to clear each of this
flags and have a clean start for SAI.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
For SAI, we have the synchronous mode enabled: the transmitter is
configured for asynchronous operation and the receiver for
synchronous operation.
In this case, transmitter bit clock and frame sync are used by both
the transmitter and receiver. So, when enabling RX we need to enable TX
(if not already enabled).
Therefore, for a clear start, we first do a software reset for the current
direction, but checking the state of RX and TX.
This will reset the internal transmitter/receiver logic including the FIFO
pointers.
For capture we can disable the receiver data channel, but on playback,
we can disable the transmitter only if the RX has the DMA requests
disabled.
Also, for capture, there's no need to enable the transmit data channel.
It's sufficient to enable only the transmitter, which enables the bit
clock (shared with RX).
On stop, we just need to disable the DMA request, the transmit/receive data
channel, the interrupts and the receiver and/or the transmitter.
Fixes: #3809
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Set SAI watermark only once, on sai_set_config().
There is no need to set it each time, on start().
SAI watermark is kept on half FIFO size.
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
To stop/suspend an active DMA channel:
1. Stop the DMA service request at the peripheral first (stop the DAI);
2. Disable the hardware service request on the appropriate DMA channel.
For start/resume:
1. Enable the DMA service request on the appropriate channel;
2. Enable the DMA service request at the peripheral (enable DAI).
When the start/stop order for DMA and DAI is different, on multiple
start/stop runs for playback or record or combined, we get an
underrun/overflow.
That's because the DAI makes a DMA request, before the DMA channel is
enabled.
Some platforms cannot just simple disable DMA channel during
the transfer, because it will hang the whole DMA controller.
Therefore, for DMA_SUSPEND_DRAIN, stop the DMA first
and let the DAI drain the FIFO in order to stop the channel
as soon as possible.
Fixes: #3809
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
In kpb force_copy_type is declared as enum comp_copy_type,
but later on is initialized and compared with an integer
constant.
We should use everywhere only enum comp_copy_type.
Therefore add an invalid copy_type, COMP_COPY_INVALID in
enum comp_copy_type.
Use this one to initialize and compare force_copy_type.
Fixes: 7e46996c96 ("kpb: Introduce force_copy_type")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Building "sof" does not rebuild the .ri firmware file. Switch to the
"bin" target which is what ./scripts/xtensa-build-all.sh builds.
Fixes: 479809663e ("installer: (re)build firmware, topologies and user
space tools)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Gets the length of a no-op "make topologies" from 380 down to 140
lines. From 300 to 200 for one "make signed" platform.
Ninja is more quiet by default.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
XTOBJCOPY and XTOBJDUMP were added in June 2018 by
commit 27795ece0f ("scripts: fix xt-xcc build with wrong config") for
`./configure CC=$XCC OBJCOPY=$XTOBJCOPY OBJDUMP=$XTOBJDUMP ...` that was
used at the time.
The build system was switched to CMake in January 2019, notably with
commit 9840ecbbfe ("cmake: update xtensa-build-all.sh") and
commit 0fd97adfb0 ("cmake: add utility scripts") that defined
CMAKE_OBJCOPY and CMAKE_OBJDUMP)
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
$ARCH was introduced in 2018 by commit b5af84deaa ("scripts: add smp
builds to xtensa-build-all.sh"). At the time used autotools and
`./configure --with-arch=$ARCH` were used.
In January 2019 the build system was migrated to CMake over several
commits, notably commit 9840ecbbfe ("cmake: update
xtensa-build-all.sh") that switched xtensa-build-all.sh to CMake and
removed its only use of ARCH. Also note commit 82b4da291b ("cmake:
defconfigs support") which added a few CONFIG_SMP defconfigs and
commit 905bad4252 ("scripts: xtensa-build-all: Add support to force
build UP Arch") using override.config.
Much more recently in June 2020: commit fd506970cc ("zephyr: kconfig:
rename CONFIG_SMP -> CONFIG_MULTICORE")
Zawinski's Law of Software Envelopment: adding lines of code is much
easier than removing the same amount and would be very impractical
without git. This one was easy enough.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
As CMake forks one compiler process for each source file, the XTensa
compiler spends much more time idle waiting for the license server over
the network than actually using CPU or disk.
On my VM with 16 virtual cores, rebuilding one platform from scratch
with this commit goes down from 12s to less than 9s: more than 25%
faster. With Ninja it goes down from 11s to less than 8s. My license
server is 25ms away: a closer server does not need as many threads while
a more distant server would obviously benefit for even more
threads... while already getting an even better improvement than 25%
from just 3 times more threads! It's complicated and we probably don't
want to start the build by measuring latency to the license server.
The entire, purely local _gcc_ build is so fast (~ 1s) that observing any
the difference between -j nproc and -j nproc*N is practically impossible
so let's not waste RAM when building with gcc.
Also: log the $XTENSA_SYSTEM variable as it is required for incremental
builds; remove one apostrophe in the here-doc usage as it breaks the
parser of some editor (jed).
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Notably:
- Log error and default MEU_OFFSET when meu -ver is not found.
- Explain rimage -s option
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Avoids the following redirection and warning:
warning: redirecting to https://github.com/thesofproject/sof/
Fixes: f59bb62e31 (".github: add shallow checkpatch to Github
Actions")
Also try to fix the display of one step name in the web UI.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Cadence library comes with various codecs. In order to support one
codec we need to initialize the API member of cadence_api with exported
library function.
This patch adds Cadence exported functions for aac, bsac, dabplus, drm
and mp3 codecs.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This config symbol adds the cadence_api_function wrapper in the list of
supported Cadence APIs.
This is usually a wrapper over an actual Cadence API function and we
need it in several cases:
- there is no explicit agreement with Cadence over adding a symbol name
to SOF.
- use as a wildcard so that we can easily plugin a codec without
changing the topology.
In this case, one will create a separate binary that will assign to
cadence_api_function the address of the Cadence entry point function
which shouldn't be exposed in SOF code.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
KPB_FORCE_COPY_TYPE forces kpb draining mode to normal. Anyhow,
dummy-dma used by the Host on IMXes doesn't support normal copy mode.
So, by disabling this config we keep the copy mode unchanged.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Some platforms need to force dma copy_type for reasons
mentioned in
commit 9ba1814d1d ("kpb: change draining copy type to normal")
Some platform's DMA controllers (like dummy-dma on IMX does not support
normal copy type).
So, this patch forces the copy type to normal only when
CONFIG_KPB_FORCE_COPY_TYPE_NORMAL is set, otherwise it keeps the existing dma
copy-type.
Also, add Kconfig entry for KPB_FORCE_COPY_TYPE_NORMAL and set it default to y
to keep bisectability up!
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This is used to retrieve the 'value' of a certain 'type' attribute.
First specific implementation for get_attribute is inside Host
component.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
The driver configures a lowest feasible bus clock to save power.
Since the 48 kHz and 16 kHz DMIC DAI can now be instantiated in the
runtime there is possibility that the min. 500 kHz clock allowed could
be too low for a new 48 kHz capture when existing 16 kHz capture is
running.
The topologies those define a 48 kHz DMIC DAI need to increase the min.
clock to a sufficient rate. This patch changes every 500 kHz value to
2.4 MHz. This change does not change the external microphone clock in
any platform. The lower than 2.4 MHz clock rates never happened in
previous version to due to the 48 kHz DAI request in these topologies.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes FIR decimation factors preference from
"2, 3, 4, 5, 6, 8, 10, 12" to "2, 3, 4, 6, 5, 8, 12, 10".
The prime number factor 5 and 10 (2*5) are less preferred because
when used for decimate for fist started FIR they restrict more the
configuration choices for the second FIR. If e.g. capture at 16 kHz
is started first with decimation factor 6, the 48 kHz stream can be
decimated from common 96 kHz CIC rate by 2.
Earlier the driver selected decimation by 5 to 16 kHz. There is no
integer decimation factor to decimate from 80 kHz to 48 kHz.
Similarly if decimate to 8 kHz programmed FIR to decimate by 10, the
same 80 kHz rate prevents 48 kHz for the other DAI. Decimation factor
12 sets up CIC to 96 kHz that is compatible with many other sample
rates.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch changes the logic in function select_mode() to use
the defined FIR decimation filters as order of preference for
FIR decimation factors. The earlier logic was simply to select the
lowest decimation factor. It can be used to e.g. prefer decimation
factor 6 over 5 when both are possible.
The driver mode select behavior is not yet changed in this patch. The
filters are presented in increasing decimation factor order in the
header file. The preference order is changed in other patch.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The maximum length supported by HW is 250 while the existing decimate
by 5 set is 251. Load attempt of it failed always. However it was
needed only in a rare 8 and 16 kHz FIFOs configuration request.
The new coefficients set fixes the issue. Also an alternate decimate
by 3 set is removed as unnecessary and a decimate by 10 set is added.
The DMIC filters design tool was updated for including to SOF tools.
The specification adjust iteration in FIR design was improved to use
finer step for bandwidth (the two four digits numbers in file name
are band frequencies relative to sample rate) so many of the
coefficients are changed. The CIC response estimation gives slightly
different result depending on for which sample rate the decimation factor
is. That is another reason for changed coefficients.
This set is used to have the reference generate script available that
creates these coefficients exactly.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch separates from function configure_registers() the write
of FIFO A, FIFO B, and common functions initialization. The change
allows the DMIC DAI type to be instantiated when the streaming starts
and removed after streaming ends. The driver for was designed to
configure the HW in firmware initialization. It didn't support DAI
initialization at streaming start and remove at end. The start of second
DAI stopped the first. Also the decimation factors selection made
choices those prevented the second DAI to find suitable integer
decimation factors.
The key change is that common functions like CIC are programmed for
first instantiating. The FIR A and the FIFO are set up for FIFO A
connected DAI and FIR B related for FIFO B connected DAI.
The dmic_remove() is changed to pass the common resources stop and
free if there's still a running FIFO left.
The traced registers configuration are changed to 32 bit hex for easier
manual decode of bit fields when debugging.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
The error can be replicated with two interactive mode arecord commands.
After launch press space key to pause both captures and then ctrl-c to
stop both. E.g.
arecord -i -Dhw:0,6 -f S16_LE -c 4 -r 48000 rec06.wav
arecord -i -Dhw:0,7 -f S16_LE -c 4 -r 16000 rec07.wav
The error happened due to no handling for pause state in DMIC DAI type.
The device was set to prepared state instead of pause that conflicted
with power management when resumed. The patch updates dmic_start() to
properly track the active FIFOs count with check of dmic->state before
setting it to COMP_STATE_ACTIVE. Start for active DMIC should no increase
it.
The dmic_stop() is updated to handle pause by removal of state setting.
The set of state is moved to dmic_trigger() to be able to use same stop
function. The dmic_irq_handler() FIFO stop is edit to set prepared
state for stopping it.
The patch alters the external PDM bus function when paused. The
clocks as feature of this patch remain active. Previously stop and
pause were the same. Since the pause is not used for capture so the
small additional power consumption of active microphone is no issue.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
In some cases we need to change dai configuration in firmware. ASoC
supports already setting multiple hw_configs, but sof M4 scripts lack
the mechanism to do this. Thus enable defining multiple config items in
the dai. Enable now support only for SSP by defining new
SSP_MULTI_CONFIG macros that should not clash with the single dai config.
Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
This patch is based on sof-cml-rt1011-rt5682.m4 but omits the
hard coded keyword pipeline and replaces it with a generic
16 kHz capture pipeline. The use of intel-generic-dmic.m4 to
set up the capture pipeline simplifies the topology a lot. This
change makes the topology for CML I2S quite similar to sof-hda-generic
to add audio processing.
All endpoint processing can be defined from top level CMakeLists.txt
with macros HSMICPROC, HSEARPROC, SPKPROC, DMICPROC, DMIC16KPROC.
A sample topology with equalizers in headset and speaker paths is
added.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Fixes:
rm -rf staging ; make aliases
ln: failed to create symbolic link 'staging/sof/sof-glk.ri': No such
file or directory
This also happens on a brand new checkout when building in parallel with
make -j because symbolic links don't have any dependency. Example at:
https://github.com/marc-hb/sof/runs/2036288013
Signed-off-by: Marc Herbert <marc.herbert@intel.com>