Commit Graph

6292 Commits

Author SHA1 Message Date
Liam Girdwood 0b0733749c ipc: cavs: dont send IPC ABI reply specific en IPC driver
The IPC handler does this for us already on any IPC failure.
Redundant code so remove it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-07 13:39:00 +01:00
Liam Girdwood 4e436f8570 ipc: split out ipc functions into separate files.
Split out some IPC functions to separate files so that IPC layer
can support more MAJOR ABI versions. Rename handler.c to align with
the IPC MAJOR it supports.

No code changes. One static function became public.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-07 13:28:05 +01:00
Oleksandr Strelchenko d9a7dfd231 audio: codec_adapter: add Waves api
add Waves MaxxEffect API definition.
API is required to build SOF with Waves codec.

Signed-off-by: Oleksandr Strelchenko <oleksandr.strelchenko@waves.com>
2021-04-07 09:09:46 +01:00
Ranjani Sridharan 2c69afc5fd topology: Switch HDA topologies to use dynamic pipelines
Let's start testing dynamic pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-04-06 14:30:55 +01:00
Ranjani Sridharan 8fcacc9fc7 topology: tokens: fix dynamic_pipeline token name
Should be called SOF_TKN_SCHED_DYNAMIC_PIPELINE instead
of SOF_TKN_SCHED_DYNAMIC.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-04-06 14:30:55 +01:00
Ross Chisholm cab7328725 topology: adding support for IIR component
This patch adds IIR support in the tgl-max98373-rt5682 topology to allow
the frequency response of the headset output to be tuned.

Signed-off-by: Ross Chisholm <ross.chisholm@xperi.com>
2021-04-06 14:28:30 +01:00
Daniel Baluta 8530a95224 topology: codec_adapter: Prepare switching to shimmed CA interface
Each codec family is now having its own UUID. We keep the old
codec_adapter UUID to be used with Cadence family codecs.

All other codec families (e.g passthrough, waves) needs to use new
uuids.

The topology files will just need to define CA_UID macro.

e.g for waves codec, topology file should contain:

DECLARE_SOF_RT_UUID("Waves codec", waves_codec_uuid, 0xd944281a, 0xafe9,
		0x4695, 0xa0, 0x43, 0xd7, 0xf6, 0x2b, 0x89, 0x53, 0x8e);

define(`CA_UUID', cadence_codec_uuid)

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-06 14:24:03 +01:00
Daniel Baluta 8ec34b086a codec_adapter: Move to shimmed codec adapter interface
This commit strips the codec adapter as it is more of a
library/layer for codecs to simplify their interface against rather than a
component in and of itself. This gives each codec its own UUID solving the
ID problem while opening an opertunity to register codecs directly for
future multiplexing capabilities.

Old UUID adapter used for codec_adapter is now used for Cadence codecs,
and we add new UUIDs for passthrough and Waves codecs.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-06 14:24:03 +01:00
Curtis Malainey 30ff82efd1 codec_adapter: Adjust logging for lib context
In order to act as a stand in layer for codecs going forward we need to
not log using our comp_driver as that will be removed in the future.
Instead we need to log using the context of comp_dev.

This commit also reduces the verbosity of a lot of the traces and
increases a few.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-06 14:24:03 +01:00
Daniel Baluta 2888212d96 audio: codec_adapter: Fix local_buffer size computation
local buffer is used to store the output of processing function.
So, we need to compute its size based on codec_adapter output buffer
not input buffer.

For non-compressed processing the current code works because input
and output buffer have equal sizes.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-06 14:14:53 +01:00
Daniel Baluta 9c176b8f08 audio: codec_adapter: Updated processed bytes
processed field keeps the total number of processed bytes
from the input buffer. We need to update this field also
for the process_init operation.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-06 14:14:53 +01:00
Marc Herbert 5aeb29b554 zephyr/cmake: stop trying to build removed pipeline_static.c
Fixes commit 093589899a ("pipeline: remove legacy static pipeline
support") that broke zephyr compilation.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-05 11:42:33 +03:00
Mac Chiang 208af04724 Topology: Add support for MAX98390 echo reference capture
codec chip playback loopback to capture stream.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>
2021-04-02 13:39:14 +01:00
Marc Herbert 53ce8b9d9f logger: new relative timestamps option, relative to first entry seen
Add a new sof-logger -e 0/1 relative timestamps option where the
TIMESTAMP column is relative to the first entry seen.

Removes many digits and makes the TIMESTAMP column much more readable in
short logs.

Also stop showing "NaN" as the first DELTA like something went
wrong. Show zero instead.

The new option is off by default when using -r(aw) and on otherwise.

The first entry is kept always absolute.

Before:

         TIMESTAMP              DELTA C# COMPONENT     LOCATION                      CONTENT
[6653843012.343750] (             NaN) c0 dma-trace    src/trace/dma-trace.c:339     ERROR FW ...
[6653843111.510417] (       99.166664) c0 ll-schedule  ./schedule/ll_schedule.c:229  perf ll_work
[6653843309.010417] (      197.500000) c0 ll-schedule  ./schedule/ll_schedule.c:399  task add
[6653843314.166667] (        5.156250) c0 ll-schedule  ./schedule/ll_schedule.c:403  task params
[6653843322.031250] (        7.864583) c0 ll-schedule  ./schedule/ll_schedule.c:309  new added
[6653843327.031250] (        5.000000) c0 ll-schedule  ./schedule/ll_schedule.c:312  num_tasks 2
[6653844109.531250] (      782.500000) c0 sa                    src/lib/agent.c:65   perf sys_load
[6653844155.156250] (       45.625000) c0 ll-schedule  ./schedule/ll_schedule.c:229  perf ll_work
[6653844384.218750] (      229.062500) c0 component       src/audio/component.c:130  comp new host

After:

         TIMESTAMP              DELTA C# COMPONENT     LOCATION                      CONTENT
[686125142.395834] (        0.000000) c0 dma-trace    src/trace/dma-trace.c:339     ERROR FW ...
[       94.270833] (       94.270836) c0 ll-schedule   ./schedule/ll_schedule.c:229  perf ll_work
[      296.770833] (      202.500000) c0 ll-schedule   ./schedule/ll_schedule.c:399  task add
[      301.979167] (        5.208333) c0 ll-schedule   ./schedule/ll_schedule.c:403  task params
[      309.843750] (        7.864583) c0 ll-schedule   ./schedule/ll_schedule.c:309  new added
[      314.843750] (        5.000000) c0 ll-schedule   ./schedule/ll_schedule.c:312  num_tasks 2
[     1092.395833] (      777.552063) c0 sa                     src/lib/agent.c:65   perf sys_load
[     1137.968750] (       45.572918) c0 ll-schedule   ./schedule/ll_schedule.c:229  perf ll_work
[     1850.208333] (      712.239563) c0 component        src/audio/component.c:130  comp new host

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-02 13:35:48 +01:00
Marcin Rajwa 3843dc0ee1 codec_adapter: add mrajwa & dbaluta as code owners
This patch adds two more code owners of codec_adapter.

Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-02 13:34:52 +01:00
Marc Herbert 2e6cafa02f logger: use strerror()
Useful error messages when forgetting to use "sudo" or to change
permissions in udev.

Some places were printing the errno decimal. Others no specific error
at all.

Sample outputs:

error: Unable to open version file /sys/kernel/debug/sof/fw_version: \
                                                       Permission denied

error: Unable to open version file /sys/kernel/debug/sof/fw_version: \
                                               No such file or directory

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 22:04:45 +01:00
Liam Girdwood ddafa071ee pipeline: reorder pipeline.h by feature and expand doxygen comments.
Order the pipeline APIs by feature and expand their doxygen based
comments.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood bcff695554 pipeline: move mailbox metadata lookup table from header.
The pipeline position metadata lookup table is only used by the graph
code so move it there.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood b15ce3cb26 pipeline: move XRUN recovery setting to where it's used.
NO_XRUN_RECOVERY is only used by pipeline xrun logic so move it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood cf453a93f5 pipeline: remove eunused function.
Not used anywhere

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood f8107edba0 pipeline: move some static APIs to where they are used.
Certain static inline APIs are only used in one place so move them there.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood 093589899a pipeline: remove legacy static pipeline support
Statically defined pipelines should be stitched into the FW image as
topology data rather than coded in C. This code was never used after
initial development so can be removed.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood ba3a241e93 pipeline: split out trace APIs int a separate header
Split out the trace APIs from the core pipeline APIs.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood 4875c44609 pipeline: split pipeline up by function.
Split the pipeline logic up into stream, params, graph, scheduling and xrun
so that it easier to follow and understand. This is to help on the TSC work
to integrate the codec adaptor into core logic.

This PR is all mechanical code moves. There are NO functional changes. Some
function that were static are now public.

Followup patches will add more documentation updates alongside.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Liam Girdwood 6b39aded15 testbench: remove build warnings when building testbench.
A side effect of the pipeline splitting work means that testbench is
not building. Provide a temporary fix until Zephyr native APIs are used.

/component.c.o   -c /home/lrg/work/sof/sof/src/audio/component.c
/home/lrg/work/sof/sof/src/audio/component.c: In function ‘get_drv’:
/home/lrg/work/sof/sof/src/audio/component.c:41:2: error: ‘flags’ is used uninitialized in this function [-Werror=uninitialized]
   41 |  irq_local_disable(flags);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
/home/lrg/work/sof/sof/src/audio/component.c: In function ‘comp_register’:
/home/lrg/work/sof/sof/src/audio/component.c:150:2: error: ‘flags’ is used uninitialized in this function [-Werror=uninitialized]
  150 |  irq_local_disable(flags);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
/home/lrg/work/sof/sof/src/audio/component.c: In function ‘comp_unregister’:
/home/lrg/work/sof/sof/src/audio/component.c:163:2: error: ‘flags’ is used uninitialized in this function [-Werror=uninitialized]
  163 |  irq_local_disable(flags);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 21:46:29 +01:00
Curtis Malainey f0ecc7b68a codec_adapter: fix local buffer prepare
We are only setting the parameters on the allocation of the local buffer
which means if the params change on the next run it will not change and
break things.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-04-01 16:44:10 +01:00
Daniel Baluta 0277eb8c2d codec_adapter: Update consumed bytes
After commit ed027d045b ("codec_adapter: Differentiate between consumed/produced bytes")
the codec adapter expects codecs to update consumed / produced bytes separately.

This fixes passthrough and waves codecs.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 16:42:07 +01:00
Daniel Baluta 2b06e80a84 codec_adapter: Add init_process callback
commit e50ae6be8c ("codec_adapter: Initialize processing") uses
the generic function codec_init_process which in turns needs a callback
for each type of codec.

Thus waves and passthrough are broken because there is no .init_process
callback provided. Fix this now.

Notice that the callback is mostly empty, the only thing that needs
to be done is to set codec->cpd.init_done to true.

Fixes: e50ae6be8c ("codec_adapter: Initialize processing")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 16:42:07 +01:00
Daniel Baluta 91da843de0 audio: codec_adapter: Use generic init_process
init_process API is used to initialize the processing phase.
(e.g for Cadence: search for valid header, decode header in order
to get parameters).

init_process needs to have access to the input frames so it will be
called by codec adapter copy() function.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 16:42:07 +01:00
Daniel Baluta 7f975e9c27 codec_adapter: generic: Fail if init_process callback is not provided
In this way we avoid crashing the SOF FW and warn the user that
the callback is missing from the implementation.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 16:42:07 +01:00
Marc Herbert a5899812b7 version.cmake: don't trust CI to record time and versions and log ourselves
In an ideal world, every CI engine records and shares the most important
CI information:
- current date and time in a well identified timezone
- git version of the pull request
- git version of the moving branch the PR is being merged with

In the real world we have multiple CI solutions and they unfortunately
cannot not all be trusted to perform their most basic job
correctly. Fortunately, they all make at least build logs available so
these very few lines of code adding very few lines of output cost near
zero extra build time and solve the problem once for all. I feel stupid
I didn't do this sooner, this would have saved me hours and hours in
vain requests and discussions and in trying to puzzle that information
together.

Sample output:

-- Preparing Xtensa toolchain
version.cmake starting SOF build at 2021-03-31T18:09:46Z UTC
Building git commit with parent(s):
150fd1e4c968 4249bdb1b305 [other parent if merge] (HEAD -> main) cmake: ...
-- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-174-g150fd1e4c968-dirty / 150fd1e4c968

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 16:39:20 +01:00
Marc Herbert b5219d844c version.cmake: do not discard stderr from git commands
Never discard stderr.

Also fix my older, misleading comment and add a warning.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 16:39:20 +01:00
Marc Herbert 9d78c35de9 .gitmodules: use a relative path
Un-hardcoding makes mirroring possible.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 13:03:01 +01:00
Marc Herbert 3e442f5f31 .gitmodules: use default branch
No need to hardcode to "master" or anything else, submodules
don't even use branches anyway

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 13:03:01 +01:00
Marc Herbert 588574c000 ll_schedule.c: fix "uninitialized task_take" warning in CONFIG_TRACEV
Looks like no one ever uses tr_dbg()?

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 12:14:53 +01:00
Marc Herbert 70b9d30414 trace: add Kconfig and trace.h comments
Trying to reduce trial and error.

Pure comments, no functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-01 12:14:53 +01:00
Curtis Malainey f9ffa8d3e8 passthrough: fix interface
oops, forgot to update interface so build was silently not linking the
passthrough interface to the adapter

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-04-01 11:59:36 +01:00
Liam Girdwood 7b334d3ee7 memcpy: remove duplicate memcpy and memset definitions in local string.h
Local string.h already includes C library string.h.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-04-01 11:58:57 +01:00
Marc Herbert eb459078f3 checkpatch: --ignore C99_COMMENT_TOLERANCE
Let's not waste considerable time in code reviews with silly problems
computers can solve.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 16:26:03 +01:00
Marc Herbert fa38c34a7a docker: apt-get install python3-elftools
Required by #3459 / #3975 "elfsize" proof of concept and probably by
other things too in the future - we use both ELF and Python
everywhere; it's surprising they haven't met each other yet.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-31 15:19:14 +01:00
Keyon Jie 65400959ca ll_schedule: add logs about the scheduling point
Add some useful information logs about the task scheduling point with
ll_scheduler, which will help to capture logs once we hit scheduling
issue on some specific task.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-31 09:21:33 +08:00
Marc Herbert d7c8ccc625 .github/pull-request.yml: watch "main" branch instead of master
Will hopefully fix mysterious CI hangs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-30 11:35:27 -07:00
Curtis Malainey 15bd472a81 owners: add cujomalainey as owner of codec adapter
Request for owner has gone unacknowledged, ToT adapter is broken
suggesting we likely need additional reviewers given we have no existing
code owner.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-03-30 11:15:52 +01:00
Marc Herbert 7c08aabbe7 topology/cmake: add missing .m4 dependency, fixes incremental build
There was no [MAIN_]DEPENDS on the .m4 source file, so changes were not
triggering any rebuild.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-26 14:51:33 +00:00
Keyon Jie aee22b07c1 topology: pipe-codec-adapter-playback: fix the blob size
The size of the fallback CA_SETUP_CONTROLBYTES is 20 (0x14), not 0x20,
here correct it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-26 10:25:53 +08:00
Keyon Jie b3e4a71ba5 codec_adapter: accept 0 size library config
There could be some codecs which require 0 byte library configure, e.g.
the passthrough one, change to make this possible.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-03-26 10:25:53 +08:00
Marc Herbert 041c2ef6de version.cmake: add --dirty to git describe command
For at least two reasons:
  - exposes sneaky change(s) performed by automation if/when any
  - solves the mystery of the Source content hash (printed on the next
    line) changing while the git version does not.

Example, at https://sof-ci.01.org/sofpr/PR3941/build8429/build/bdw_gcc.txt

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 91f261ea

whereas at https://github.com/thesofproject/sof/runs/2166298087,
  xtensa-build-all:

 -- Found Git: /usr/bin/git (found version "2.17.1")
 -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-151-g023c4abacde1 / 023c4abac
 -- Source content hash: 67f31697

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-23 12:17:22 +00:00
Marc Herbert 7e19c42404 .github: replace HAVE_CONFIG KConfig hack with an override
Should make git describe --dirty clean.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-23 12:17:22 +00:00
Iuliana Prodan 0a9262ae4b drivers: imx: esai: set private data after allocation
ESAI allocates private data and retrieves this data using
dai_get_drvdata().
But this is never set using dai_set_drvdata() and sometimes
dai_get_drvdata() returns NULL.
So, after private data is allocated, set it using dai_set_drvdata().

Without this fix, on i.MX8QM, on playback we get:
root@imx8qmmek:~# aplay -Dhw:1,0 -f S16_LE -c 2 -r 48000 -d 5 -t raw /dev/urandom
Playing raw data '/dev/urandom' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
[  197.478128] sof-audio-of 556e8000.dsp: error : DSP panic!
[  197.483547] sof-audio-of 556e8000.dsp: error: runtime exception
[  197.489473] sof-audio-of 556e8000.dsp: error: trace point 0dead006
[  197.495658] sof-audio-of 556e8000.dsp: error: panic at :0
[  197.501064] sof-audio-of 556e8000.dsp: error: DSP Firmware Oops
[...]

Fixes: f40222a1ea ("drivers: imx: esai: use rate from topology")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-03-23 09:45:23 +02:00
Marc Herbert 69985365c6 buffer.h: silences warning "flags may be used uninitialized"
buffer_unlock() does not use flags.

Silences this gcc 8.1.0 (and valid) warning in
src/audio/pipeline.c#pipeline_for_each_comp(). For some strange reason
it shows up only with CONFIG_OPTIMIZE_FOR_DEBUG=y. Heuristics?

In file included from sof/src/include/sof/audio/pipeline.h:16,
                 from sof/src/include/sof/audio/buffer.h:12,
                 from sof/src/audio/pipeline.c:8:
src/audio/pipeline.c: In function 'pipeline_for_each_comp':
src/include/sof/spinlock.h:200:38: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/audio/pipeline.c:182:11: note: 'flags' was declared here
  uint32_t flags;
           ^~~~~

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-03-22 21:26:51 +00:00