The codec config of codec adapter should be placed under
src/audio/codec_adapter. In the future we might add multiple other
types of libraries. So far we support Cadence and Dummy codecs.
Signed-off-by: Pin-chih Lin <johnylin@google.com>
drc_sin_fixed() utilized sin_fixed() while its input range is
non-negative. This commit fixes drc_siz_fixed() for negative input by
using ABS(input) to sin_fixed() and then inverting the output sign.
Signed-off-by: Pin-chih Lin <johnylin@google.com>
For power saving, we should release the mclk when not used, postpone the
requesting to pre_start, and release it at post_stop.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We have 2 mclks in total for cAVS platforms, they share the same clock
source, but have separated dividers.
SSP ports can use either of the 2 mclks, add a ref count to manage the
mclk usage, and release it when not used.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add a topology file for Cherry Trail boards with a NAU8824 codec.
These setups work with the standard settings from sof-byt-codec.m4.
This has been tested on the following devices:
Medion E2215T: stereo speakers, analog mic
Medion E2228T: stereo speakers, stereo digital mics
Cube iWork8 Air: mono speaker, analog mic
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Add some files from src/platform/library/ to generic arch
builds with Zephyr.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When allocating multiple buffers the first free buffer might not
contain a suitably aligned start address. Skip it instead of
allocating it with the others. Also don't add alignment to the
allocation size, but find a suitably aligned start address
instead.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
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 <daniel.baluta@nxp.com>
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 <guennadi.liakhovetski@linux.intel.com>
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 <yang.jie@linux.intel.com>
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 <karolx.trzcinski@linux.intel.com>
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 <karolx.trzcinski@linux.intel.com>
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 <karolx.trzcinski@linux.intel.com>
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 <daniel.baluta@nxp.com>
Replace two instances of open-coded rounding-up division with
DIV_ROUND_UP() calls.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
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 <guennadi.liakhovetski@linux.intel.com>
Multiple locations in the code open-code a round-up division
operation. Add a common macro for it.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
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 <daniel.baluta@nxp.com>
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 <guennadi.liakhovetski@linux.intel.com>
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 <seppo.ingalsuo@linux.intel.com>
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 <guennadi.liakhovetski@linux.intel.com>
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 <johnylin@google.com>
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 <johnylin@google.com>
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 <johnylin@google.com>
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 <johnylin@google.com>
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 <marcin.rajwa@linux.intel.com>
This patch makes codec_free_all_memory() available for codecs so they
can free all memory allocated by themself.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
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 <marcin.rajwa@linux.intel.com>
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 <marcin.rajwa@linux.intel.com>
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 <marcin.rajwa@linux.intel.com>
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 <marcin.rajwa@linux.intel.com>
The runtime_params keeps configuration of codec therefore
codec_data structure is a better place to store it.
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
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 <marcin.rajwa@linux.intel.com>
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 <adrian.bonislawski@linux.intel.com>
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: 647390f75e ("schedule: dma_multi_chan: fix a DMA channel interrupt race")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
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 <yang.jie@linux.intel.com>
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 <yang.jie@linux.intel.com>
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 <yang.jie@linux.intel.com>
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 <yang.jie@linux.intel.com>
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 <jaska.uimonen@intel.com>
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 <yang.jie@linux.intel.com>
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 <yang.jie@linux.intel.com>