Commit Graph

7512 Commits

Author SHA1 Message Date
Jaska Uimonen cdcf283391 rimage: update to the current tip of "main"
Update rimage from bd51ec1 to 0f64a20.

0f64a20 manifest: fix buffer init in resign
3c23242 rimage: refactor and add openssl 3.0 support

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-12-02 14:02:02 +00:00
Jaska Uimonen f9cc0f7a1a logger: rename asprintf and vasprintf
Rename asprintf and vasprintf into log_asprintf and log_vasprintf as the
names could clash with the standard libc ones. These functions are there
originally done because of windows compatibility, but the naming was not
thought through carefully.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-12-02 09:56:25 +00:00
Seppo Ingalsuo cb280c4c59 Audio: pcm_converter: Optimize buffers access in generic version
This code is used in non-HiFi3 platforms and in all gcc builds.
The inefficient audio_stream_read/write_frag_s16/s32() usage is
replaced by block processing with help of function
audio_stream_bytes_without_wrap(). The circular buffers pointers
checks and wraps are done only when necessary.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-12-01 11:03:20 +00:00
ShriramShastry 16002080e0 math: Add power scalar and base 2 log function
fix point math power function having negative and positive values
of base and exponent as function argument. power_int32() support
only integer base and exponential value and it does not support
fractional values for base and exponent.

fix point math base 2 logarithm function using a short lookup
tables

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-12-01 10:42:10 +00:00
Guennadi Liakhovetski 70358b7874 pipeline: set status to ACTIVE on all connected triggered pipelines
This fixes a problem with pipelines, connected over a demultiplexer.
In such cases one of pipelines keeps an inactive status and
terminates during the next scheduler run after a START or a RELEASE.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-30 21:00:12 +00:00
Keyon Jie 7aa588667c edf_schedule: don't assert if there is no extra task to run
There could be no more EDF task to be run if the last one in the list is
finished, we don't need to assert in this case.

If the next EDF task gonna be scheduled, interrupt will be generated
again by calling to schedule_edf() in schedule_edf_task(), so it should
be safe to remove the schedule_edf_task_running() in no pending task
scenarios.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-30 14:57:44 +00:00
fy.tsuo 3ffeb87123 Host component DMA copy the whole copy_bytes.
Host component stops copying bytes at element's end and resumes
copying the remaining bytes in the next round. This leads to jitter
between components of the same pipeline. Such jitter might cause
buffer overwrite for component which processes block by block.

Triggering extra DMA copy until all the copy_bytes are copied can
eliminate the jitter and hence no more buffer overwrite occurs.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-11-26 11:47:25 +00:00
Guennadi Liakhovetski 1f0efba2c8 ll_schedule: schedule with the reference task
Sometimes multiple tasks must be scheduled on the same domain tick.
Use the reference task pointer for such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski d8c9f121a1 ll_schedule: don't adjust periodic tasks to earlier than in a period
Current logic in schedule_ll_domain_set() checks a newly submitted
periodic task if it has to be scheduled before an existing one.
However, when doing this the algorithm might schedule the new task a
whole period earlier than would normally be acceptable. Fix this by
adding the missing period delay.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 0987280f10 pipeline: enforce scheduling order of connected pipelines
Connected pipelines have to be scheduled in a specific order,
depending on the direction of the data flow. Use the new
schedule_task_before() / schedule_task_after() API for that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 9bd130db1c task: add a function to check if a task is active
Tasks currently have 9 states defined for them, but they all can be
divided into two groups: active and passive. We define all tasks on a
scheduler queue as active. All other tasks are passive.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 32b213f271 pipeline: move parts of the pipeline API to pipeline.h
struct pipeline_task and pipeline_task_get() belong to the pipeline
API, not to the scheduler API. Move them to pipeline.h

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 03b24ba660 ll_schedule: implement schedule_task_before and schedule_task_after
Add support for order-enforcing scheduling to the ll-scheduler.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski ae1975660b schedule: add schedule_task_before() and schedule_task_after()
Sometimes multiple tasks have to be scheduled together - one after
another and in a specific order. Add two order-enforcing functions
for that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 66c42af8b7 schedule: verify compulsory operations
schedule_task_cancel, schedule_task_free and schedule_task are
compulsory scheduler operations. Verify them once during scheduler
registration and don't check them afterwards when calling.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski e74e1b3f04 pipeline: don't skip a copying scheduling tick
When processing a PAUSE or a STOP trigger in the pipeline task, if
the pipeline aborts processing of the trigger, it has to proceed
executing the copy() flow instead of skipping the tick.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski b1f8ea84c6 pipeline: start all pipelines on the same timer tick
Currently when a multi-pipeline stream starts, the first scheduler
run will process the START trigger in the context of the first
pipeline, then the next pipeline task within the same scheduler run
will already attempt to copy data. This cannot work because the
first pipeline hasn't copied its data yet. Make sure to skip the
first scheduler run completely on all pipelines.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:01:36 +00:00
Guennadi Liakhovetski 9127902e76 dw_dma: fix free space / available data calculation
The DW DMA driver misinterprets completely free output buffer as full
buffer and completely full input buffer as empty buffer. This is
indeed difficult to distinguish within the current driver flow. This
patch makes such detection more reliable.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 23:00:44 +00:00
Brent Lu f41010d386 topology: sof-adl-max98360a-rt5682-2way: add new topology
Add support for four max98360a speaker amplifiers running in TDM mode
which format is 8 slots with 32 bit slot/sample width on ADL boards.

To implement the 2-way woofer/tweeter speaker function in SOF, there
is a demux to create 4-channel audio data with EQ on each channel for
band-split function.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-11-25 16:41:37 +00:00
Brent Lu e2bb2602e1 pipe-demux-eq-iir-playback: support eq coef customization
Topology file could use PIPELINE_FILTER1 macro to include a m4 file
with eq coefficient. If macro is not defined, eq_iir_coef_bandsplit.m4
will be included.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-11-25 16:41:37 +00:00
Brent Lu 8ed1e90b5c topology: pipe-demux-eq-iir-playback: change slot mapping
Change the default slot mapping from L_lo-L_hi-R_lo-R_hi to
L_lo-R_lo-L_hi-R_hi so slot 0/1 is for woofer and slot 2/3 is for
tweeter.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-11-25 16:41:37 +00:00
Brent Lu 771c2bb318 topology: pipe-demux-eq-iir-playback: remove macro 'matrix1
The demux routing matrix and config are removed for two reasons: 1.
the config 'demux_priv_1' is hardcoded for pipeline 1 only. 2. other
m4 file with demux compoenet like pipe-volume-demux-playback has the
matrix and config defined in the topology file.

The topology which implement this pipeline should define the routing
matrx and config named as 'demux_priv_<pipeline id>' before including
this m4 file.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-11-25 16:41:37 +00:00
Guennadi Liakhovetski 4b44330607 pipeline: remove a wrong warning
PPL_STATUS_PATH_STOP is not necessarily an indication of an xrun,
it can also be returned by pipeline_trigger_run() in other perfectly
normal cases. Remove the misleading left-over warning.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-25 16:38:14 +00:00
Marc Herbert ae36fa5c91 xtensa-build-zephyr: build ICL by default again
ICL linking overlap issue has been fixed by
https://github.com/zephyrproject-rtos/zephyr/pull/39603

This is a logical revert of commit d4b8a01f20 ("xtensa-build-zephyr:
temporarily exclude ICL")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Marc Herbert 9f13849fa3 xtensa-build-zephyr: fix error message "not a zephyr project"
Echo the user argument instead of $WEST_TOP which is typically empty at
this point.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-25 09:59:56 +00:00
Liam Girdwood a824c1fc7e arch: string.h: use memset_s for all bzero uses.
Safer and fixes the following GCC11 warning

In file included from /home/lrg/work/sof/sof/src/include/sof/string.h:11,
                 from /home/lrg/work/sof/sof/src/include/sof/debug/debug.h:17,
                 from /home/lrg/work/sof/sof/src/platform/baytrail/platform.c:9:
/home/lrg/work/sof/sof/src/platform/baytrail/platform.c: In function 'platform_init':
/home/lrg/work/sof/sof/src/arch/xtensa/include/arch/string.h:22:9: error: 'memset' offset [0, 4095] is out of the bounds [0, 0] [-Werror=array-bounds]
   22 |         memset(ptr, 0, size)
      |         ^~~~~~~~~~~~~~~~~~~~
/home/lrg/work/sof/sof/src/include/sof/lib/alloc.h:160:9: note: in expansion of macro 'arch_bzero'
  160 |         arch_bzero(ptr, size)
      |         ^~~~~~~~~~
/home/lrg/work/sof/sof/src/platform/baytrail/platform.c:198:9: note: in expansion of macro 'bzero'
  198 |         bzero((void *)MAILBOX_BASE, MAILBOX_SIZE);
      |         ^~~~~

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-11-24 15:28:54 +00:00
Liam Girdwood c99ae6fd87 cht: align gcc defconfig with xcc config
Don't build TONE and optimise for size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-11-24 15:28:54 +00:00
Liam Girdwood 218ab6d071 byt: align gcc defconfig with xcc config
Don't build TONE and optimise for size.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-11-24 15:28:54 +00:00
Ming Jen Tai d959089d8e Modify RTNR to work with KWD on TGL and ADL.
Modify RTNR to work with KWD on TGL and ADL.
Remove unused RTNR 16kHz topology.
Add RTNR support to max98390 on ADL.

Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2021-11-23 13:22:11 +00:00
Ming Jen Tai dda9d0f9fc Add RTNR support in intel-generic-dmic-kwd.m4.
Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2021-11-23 09:57:10 +00:00
Guennadi Liakhovetski 175672b9ab cherrytrail: fix build failure
Disable CONFIG_COMP_TONE on CHT gcc builds to fix insufficient .txt
space.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-22 16:44:08 +00:00
Seppo Ingalsuo 132e648280 Math: Build library functions if enabled from Kconfig
This patch adds src/math/Kconfig with items CORDIC_TRIGONOMETRY_FIXED,
NUMBERS_GCD, NUMBERS_NORM, NUMBERS_VECTOR_FIND, MATH_DECIBELS, MATH_FFT,
MATH_FIR, and MATH_IIR_DF2T.

Configuration FIR and FFT were previously in src/audio/Kconfig but they
were moved to new math location for simplicity.

The build of trig.c was simplified by remove of unused UNIT_CORDIC_TEST
and CONFIG_CORDIC_TRIGONOMETRY_FIXED.

All but build details of numbers.c are handled by src/math/CMakeList.txt
if(CONFIG_X) additions. There was need to add "-DCONFIG_NUMBERS_x" into
target_compile_definitions() in test/cmocka/CMakeLists.txt because
the platforms those drop most features e.g. BYT would fail in test
case build.

Tone generator build is disabled for all platforms. It avoids select of
triginometric functions and saves RAM.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-21 22:41:43 +00:00
Marc Herbert 2c208b52fb sof_ri_info: add JSL Intel prod key to list of known keys
Extracted from
https://github.com/thesofproject/sof-bin/blob/main/v1.9.x/sof-v1.9.2/intel-signed/sof-jsl.ri

Note previous sof-jsl.ri releases were signed with the ICL key:
https://github.com/thesofproject/sof/issues/4916

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-21 22:38:23 +00:00
Marc Herbert e14ec39124 sof_ri_info: change "Other" to "Unknown key"
Now grepping for 'key' always works.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-21 22:38:23 +00:00
Marc Herbert 4c6ecb2172 xtensa-build-zephyr: guess CMake successes and failures better
Recent commit b9fcc4156e ("xtensa-build-zephyr: fix incremental build,
pass CMAKE_ARGS only once") fixed incremental builds. For this it first
needs to guess whether the most recent CMake configuration step failed
or succeeded so it knows what is the current "checkpoint" and what is
the next west command to run. Merely testing whether the build directory
already exists is a very bad guess because that directory could have
been created by some other person or script, or - much worse - it could
have been created by a failed CMake configuration step!

The latter situation makes debugging CMake failures very tedious because
it requires manually deleting the build directory after each CMake
configuration failure.

Fix this by not merely looking for a build directory but by looking
whether there is either a build.ninja or a Makefile is found in that
directory. This is a much better indication that the CMake configuration
succeeded.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-21 22:35:22 +00:00
Guennadi Liakhovetski cd48b895eb rimage: update to the current tip of "main"
Update rimage from 9a26e45 to bd51ec1

bd51ec1 (HEAD, origin/main) rimage: add functionality to resign fw image
bcbcec7 cmake: drop binutils-specific '-Wl,-EL' option
ecb9212 cmake: drop '3' from -Wimplicit-fallthrough=3, it's the default value
0c66aa9 (origin/rimage_test) css.c: add __func__  to "completing manifest" log
c038d62 README.md: add warning that forks must be created using Github
8960097 Revert "ext_manifest: Fix incorrect signature"
0d7f2d4 Do not exit(0) on invalid options or parameters
6e22944 README.md: explain how to run SOF tests on new rimage code
a9faf85 remove '-x' option
241af31 ext_manifest: Fix incorrect signature
4823e87 pkcs: quote the name of key file when logging it
dcfcef8 config: Remove unused, platform specific, memory region definitions
fc4d7b8 rimage: Fix error message content after adsp malloc fail
3e20076 config: Return error value in parse_uint32_* functions when key is not found
ada30c1 config: Explicit state return value for error cases in parse_uint32_* functions
de9177b config: Adjust return type with function name
c4a7456 config: Remove machine_id field
916fc2c config: Remove unused adsp structs
9bf46d3 rimage: Add support for mt8195
aea1969 adsp_config: fix potential overflow in strtol()
9716e10 config: Add imx8ulp.toml
b28b993 fixing incorrect data offset in ri_manifest_sign_v1_5
d1553e9 config: add rn toml file to support renoir build
246ea64 config: skl: change image_size to the real SRAM size
9c9e07c config: kbl: change image_size to the real SRAM size
44b37d1 config: sue: change image_size to the real SRAM size
580e4d6 config: tgl-cavs: change image_size to the real SRAM size

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-19 15:28:30 +00:00
Rander Wang 92645cc53d ipc4: update llp register in memory window 0
Host driver checks llp register data in memory window 0
to update stream position to audio framework.
This patch update this memory location when dma channel
is allocated, released and dma copy is done.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-19 13:49:59 +00:00
Ranjani Sridharan b66010f0fa topology2: Add the passthrough and mixin-mixout topologies for cavs HDA
Add the passthrough and mixin-mixout versions for HDA topologies.

They can be built as follows:

For HDMI only passthrough topology:
alsatplg -p -c cavs-passthrough-hdmi.conf -o cavs-passthrough-hdmi.tplg

For passthrough HDA topology:
alsatplg -D HDA_CONFIG="passthrough" -p -c cavs-passthrough-hdmi.conf
-o cavs-passthrough-hda.tplg

For mixin-mixout HDA topology
alsatplg -D HDA_CONFIG="mix" -p -c cavs-passthrough-hdmi.conf
-o cavs-mixin-mixout-hda.tplg

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 13dc7812eb topology2: mixin/mixout: Add cpc attribute
And set default values.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan c3fdf30364 topology2: pipelines: Add the other mixin/mixout pipelines
Add all the missing mixin/mixout pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan d69ab6e6f1 topology2: mixin-playback: Add the copier->mixin route
Add the route from the host copier to the mixin widget in the class
definition so it doesnt have to set in the top-level topology everytime.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 5a0d1df4a6 topology: copier: change default cpc
To match the cavs production topology value. It can be overwritten
in the kernel.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan cfc467c242 topology2: tokens: fix tuple for CPC copier token
Align with the kernel definition.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 6ed84e4a16 topology2: cavs-gain-hda: Add option to build HDMI only topology
Add an argument to specify if we want to build the HDMI only topology.
To build the HDMI only topology, use the following command:

alsatplg -p -c cavs-gain-hdmi.conf -o cavs-gain-hdmi.tplg

To build the HDA topology use the following command:

alsatplg -D HDA_CONFIG="gain" -p -c cavs-gain-hdami.conf -o
cavs-gain-hda.tplg

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 1c4fb7ce64 topology2: cavs-gain-hda: fix pipelines and PCM instances
Make them unique and incremental.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 0d542ae87e topology2: cavs-gain-hda: clean up routes
Add the host<->gain route in the gain-playback/gain-capture
pipeline and keep only the top-level routes in the top-level topology
file.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan abce00d224 topology2: cavs-gain-hda: clean up includes
Add search directories and trim the includes.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Ranjani Sridharan 428c654f62 topology2: cavs-gain-hda: fix routes
Fix the typos in the routes to fix the DAPM graphs.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-11-19 11:20:50 +00:00
Marc Herbert dda2b385f0 zephyr/atomic.h: add a no-op cast: (long)atomic_read()
Zephyr commit 174cb7f9f183 switched 'atomic_t' from 'int' to
'long' and broke SOF compilation as shown below.

Recent SOF commit 970d7d61ec ("zephyr: update print messages for
64-bit atomics") switched all atomic_read() logs to "%ld" instead of
"%d" which fixed compilation with Zephyr after the switch but broke it
with Zephyr _before_ the switch.

This no-op (long) cast makes SOF compatible with Zephyr both before and
after the switch.

Note the sof-logger does not make any difference between %ld and %d and
does not care.

Sample failure:

src/lib/dma.c: In function 'dma_get': sof/src/include/sof/trace/trace.h:290
 error: format '%d' expects argument of type 'int', but
 argument 5 has type 'atomic_val_t' {aka 'long int'} [-Werror=format=]

 290 |   printk("%llu " format "\n", platform_timer_get(NULL), \
     |                 ^~~~~~~

sof/src/lib/dma.c:119:2: note: in expansion of macro 'tr_info'

 119 |  tr_info(&dma_tr, "..., busy channels = %d", atomic_read(...))

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-19 11:16:50 +00:00
Keyon Jie 3685b74c03 ll_schedule: add task state machine documentation
Add ASCII art to document the task state transition when scheduled by
the LL scheduler.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-19 11:16:17 +00:00