Commit Graph

6122 Commits

Author SHA1 Message Date
Pin-chih Lin 39285411d3 codec_adapter: Used nested Kconfig of codec adapter codecs
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>
2021-01-12 22:04:47 +00:00
Pin-chih Lin 9b0209ba8b sof: drc: fix drc_sin_fixed function
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>
2021-01-12 21:47:57 +00:00
Keyon Jie d5840a9200 ssp: move mclk request/release to pre_start and post_stop
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>
2021-01-11 16:28:19 +00:00
Keyon Jie b90315f0f0 ssp: mn: clean up the mclk part
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>
2021-01-11 16:28:19 +00:00
Hans de Goede e862e25a9c topology: Add sof-cht-nau8824 topology file
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>
2021-01-11 16:27:47 +00:00
Adrian Bonislawski f45bc1e216 ssp: try to use the same source clock for BCLK and MCLK
This is recommended flow to avoid glitches

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
2021-01-11 16:24:30 +00:00
Marc Herbert c915001ba0 CODEOWNERS -= jajanusz
Left Intel.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-01-11 16:24:06 +00:00
Guennadi Liakhovetski b580a787da zephyr: update for unsupported arch builds
Add some files from src/platform/library/ to generic arch
builds with Zephyr.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-01-11 16:11:42 +00:00
Guennadi Liakhovetski d93692ce80 alloc: pick up allocation start correctly
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>
2021-01-11 16:07:52 +00:00
Daniel Baluta 551bb2d952 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 <daniel.baluta@nxp.com>
2021-01-08 10:27:41 +00:00
Guennadi Liakhovetski 7531d6bd07 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-08 10:24:07 +00:00
Guennadi Liakhovetski 39266cac81 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-08 09:56:07 +00:00
Keyon Jie b50d496958 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 <yang.jie@linux.intel.com>
2021-01-07 14:10:55 +00:00
Karol Trzcinski 5a1078d293 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 <karolx.trzcinski@linux.intel.com>
2021-01-07 12:10:53 +00:00
Karol Trzcinski 5c02bbc283 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 <karolx.trzcinski@linux.intel.com>
2021-01-07 12:10:53 +00:00
Karol Trzcinski 28d06341bc 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 <karolx.trzcinski@linux.intel.com>
2021-01-07 12:10:53 +00:00
Keyon Jie d6b9f1f795 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 <yang.jie@linux.intel.com>
2021-01-07 11:23:48 +00:00
Daniel Baluta 85fd815f86 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 <daniel.baluta@nxp.com>
2021-01-07 07:16:17 +00:00
Guennadi Liakhovetski 3c20133263 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-06 13:20:44 +00:00
Guennadi Liakhovetski ae7f90c468 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-06 13:20:44 +00:00
Guennadi Liakhovetski 6d2e64f608 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-06 13:20:44 +00:00
Daniel Baluta 101912b934 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 <daniel.baluta@nxp.com>
2021-01-05 17:23:26 +00:00
Guennadi Liakhovetski 71b4751600 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-05 17:04:04 +00:00
Seppo Ingalsuo b814953647 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 <seppo.ingalsuo@linux.intel.com>
2021-01-05 17:34:39 +08:00
Guennadi Liakhovetski a2ce9d7f38 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 <guennadi.liakhovetski@linux.intel.com>
2021-01-04 16:46:14 +00:00
Pin-chih Lin 97e0d50f5f tools: testbench: Add Multiband DRC component test
Signed-off-by: Pin-chih Lin <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Pin-chih Lin 9dc85454be 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 <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Pin-chih Lin 691275533d 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 <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Pin-chih Lin eb4b124a9a 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 <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Pin-chih Lin 317a416404 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 <johnylin@google.com>
2020-12-28 13:19:54 -08:00
Marcin Rajwa eaa9a55d0b 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 299ae71771 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 82bddf6cb8 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 2b17a8605d 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 9160351749 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 44137fad6c 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 007e5a2560 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa 9c660ec6a6 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Marcin Rajwa e79893ee02 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 <marcin.rajwa@linux.intel.com>
2020-12-18 16:23:42 +00:00
Adrian Bonislawski 9d1ebecb8f 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 <adrian.bonislawski@linux.intel.com>
2020-12-18 16:18:16 +00:00
Iuliana Prodan 07ef8adbd7 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: 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>
2020-12-18 13:19:27 +00:00
Keyon Jie 83fba37ed7 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 <yang.jie@linux.intel.com>
2020-12-18 13:18:15 +00:00
Keyon Jie d19573e429 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 <yang.jie@linux.intel.com>
2020-12-18 13:18:15 +00:00
Keyon Jie b6c2d6a833 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 <yang.jie@linux.intel.com>
2020-12-18 13:18:15 +00:00
Keyon Jie 1fb72c6b74 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 <yang.jie@linux.intel.com>
2020-12-18 13:18:15 +00:00
Keyon Jie 2638cdc4ca 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 <yang.jie@linux.intel.com>
2020-12-18 13:18:15 +00:00
Jaska Uimonen 589055d38a 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 <jaska.uimonen@intel.com>
2020-12-18 12:44:31 +00:00
Keyon Jie 6d75984f7b 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 <yang.jie@linux.intel.com>
2020-12-17 16:31:50 +00:00
Keyon Jie f5aa594e48 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 <yang.jie@linux.intel.com>
2020-12-17 16:31:50 +00:00
Keyon Jie 3f6465dbd3 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 <yang.jie@linux.intel.com>
2020-12-17 16:31:50 +00:00