Commit Graph

5891 Commits

Author SHA1 Message Date
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
Keyon Jie 3e2317ef30 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 <yang.jie@linux.intel.com>
2020-12-17 16:31:50 +00:00
Keyon Jie 18e31abd47 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 <yang.jie@linux.intel.com>
2020-12-17 16:31:50 +00:00
Marcin Rajwa fdfebdd8ad 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 <marcin.rajwa@linux.intel.com>
2020-12-17 15:53:38 +00:00
Guennadi Liakhovetski 8d277b5b15 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 <guennadi.liakhovetski@linux.intel.com>
2020-12-15 14:13:33 +00:00
Guennadi Liakhovetski 4316f3c836 alloc: simplify align_ptr()
Simplify the align_ptr() function by re-using an existing ALIGN() macro.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-12-15 14:13:33 +00:00
Guennadi Liakhovetski da073fbf80 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 <guennadi.liakhovetski@linux.intel.com>
2020-12-15 14:13:33 +00:00
Pan Xiuli 5ea80a51eb travis: add tgl-h build
Add tgl-h build check in Travis

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-12-15 14:08:54 +00:00
Seppo Ingalsuo 9c33333cf5 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 <seppo.ingalsuo@linux.intel.com>
2020-12-15 14:07:54 +00:00
Curtis Malainey 918f22c206 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 <cujomalainey@chromium.org>
2020-12-15 13:44:02 +00:00
Seppo Ingalsuo 51b64f460a 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 <seppo.ingalsuo@linux.intel.com>
2020-12-15 13:39:06 +00:00
Jaska Uimonen fc9b89ad8b 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 <jaska.uimonen@intel.com>
2020-12-10 22:30:42 +00:00
Curtis Malainey 6823206761 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 <cujomalainey@chromium.org>
2020-12-10 22:26:25 +00:00
Curtis Malainey 0a7df45e87 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 <cujomalainey@chromium.org>
2020-12-10 22:26:25 +00:00
Curtis Malainey 44c72a4f25 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 <cujomalainey@chromium.org>
2020-12-10 22:26:25 +00:00
Pin-chih Lin 9e0a560746 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 <johnylin@google.com>
2020-12-09 13:52:14 -08:00
Pin-chih Lin 1e3adabd19 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 <johnylin@google.com>
2020-12-09 13:52:14 -08:00
Pan Xiuli 316d4351e1 rimage: Update to commit d1f91efdc1
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 <xiuli.pan@linux.intel.com>
2020-12-09 11:06:31 +00:00
Pan Xiuli c46ed5df30 scripts: add tgl-h support
Add tgl-h build support.
It will generate sof-tgl-h.ri

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
2020-12-09 11:06:31 +00:00
Pan Xiuli c65336f8f7 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 <xiuli.pan@linux.intel.com>
2020-12-09 11:06:31 +00:00
Keyon Jie aeea2b0935 topology: smart_amp: restrict channel number of PCM capabilities
Both the playback and capture PCMs should be restricted to the
corresponding SMART_PB_CH_NUM and SMART_REF_CH_NUM, as running them with
other channel numbers will not work correctly.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2020-12-07 11:44:16 +00:00
Guennadi Liakhovetski a68c756a30 dw-dma: align ILL allocations
ILL entries in the DW DMA driver are accessed both by the controller,
using DMA and by the DSP. For this to work the DSP has to force cache
synchronisation appropriately. Therefore the ILL area has to be
allocated with cache-line size alignment. This isn't the case with the
Zephyr allocator. This patch switches allocation from rmalloc() to
rballoc() to force such alignment. Eventually a generic fix will be
implemented in an SOF wrapper fpr the Zephyr allocator.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-12-07 10:58:36 +00:00
Seppo Ingalsuo cc1cd8a4af Tools: Test: Fix Matlab compatibility in process_test.m
The set of figure property in figure() command is not supported
in Matlab. The separate set() property works for both Octave and
Matlab.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2020-12-03 20:43:31 +00:00
Brent Lu 65217991dd topology: sof-tgl-max98357a-rt5682: support rt1011 amp
Add a macro 'CODEC' to generate topology for rt1011 speaker amp.
Add a macro 'FMT' to seperate speaker dai format: s16le, s24le
Modify both pcm name by 'Speakers'

Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
2020-12-03 10:49:42 +00:00
Marcin Rajwa d08e7779d5 trace: fix missing trace variable for CONFIG_TRACEM
This patch adds missing trace variable for CONFIG_TRACEM.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
2020-12-03 10:46:49 +00:00
Joseph Burt ddd3736634 ipc: Use DMA attribute for min. ptable copy size
This rounds up the page table DMA transfer size to DMA_ATTR_COPY_ALIGNMENT
instead of a hard-coded 4 bytes.

Signed-off-by: Joseph Burt <caseorum@gmail.com>
2020-12-03 10:40:01 +00:00
Joseph Burt 1edfe088ec ipc: Fix page table size calculation
This was too small, causing the ptable to be truncated and the
ptable DMA transfer to fail on BDW for small buffers, where the
minimum transfer is 4 bytes.

Signed-off-by: Joseph Burt <caseorum@gmail.com>
2020-12-03 10:40:01 +00:00
Sathyanarayana Nujella 12ce388775 topology: sof-smart-amplifier: update speaker amp ssp DAI configuration
Speaker amp's SSP tdm & clock is configured for 32-bit, accordingly
update DAI configuration to s32_le.

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
2020-12-02 21:44:16 +00:00
Jaska Uimonen 67f3b06d69 mux: check individual channels and not entire matrix row
Currently we are checking if matrix row contains any 1's (popcount). In
mux case this doesn't tell us if channels are mixed. For example if we
have 2 input matrix in which first row's position 2 and 4 have value 1,
it means that both streams channel 1 is copied to output channels 2 and
4, so not mixed. So change the check to be channel specific.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2020-12-01 14:06:26 +00:00
Guennadi Liakhovetski a25cf0f1ba zephyr: fix breakage after a recent logging extention
Commit fee7d9c660 ("trace: Introduce adaptive
rate-limiting/suppression of repeated messages") broke Zephyr build.
Add the missing parameter.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-12-01 13:58:55 +00:00
Guennadi Liakhovetski c8ae78ab0e zephyr: fix a path to a header, build LPS conditionally
Use a correct path to the cAVS memory.h header, build cAVS LPS
only when the respective Kconfig option is selected.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2020-11-27 16:32:32 +00:00
Artur Kloniecki 4d4a9d7299 trace: Allow bursts of messages pass through flood filter.
Introduce TRACE_BURST_COUNT Kconfig setting, which allows to define amount
of messages that are allowed to pass through the filter before suppression
kicks in.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-11-27 15:10:46 +00:00