Commit Graph

8190 Commits

Author SHA1 Message Date
Guennadi Liakhovetski 529d0cbfc6 waves: fix building with gcc
gcc implements COMPILER_FALLTHROUGH with an __attribute__ so there
must be a semicolon after it. Also remove unused variables.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-04-13 12:37:24 +01:00
Guennadi Liakhovetski 0bf3d3aa10 waves: fix a typo
This fixes an "undefined variable" compilation failure.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2022-04-13 12:37:24 +01:00
Daniel Baluta f32a05698e codec_adapter: cadence: Only apply config is codec is prepared
Obviously this is a bug, but it works now because parameters are known
before prepare is done.

We will be introducing dynamic codec id set at prepare time, so there
will be a problem if apply config is called before codec is prepared.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-13 14:36:39 +03:00
Daniel Baluta aab5d9b0a1 codec_adapter: cadence: Move cadence_resolve_api
Move cadence_codec_resolve_api to cadence_codec_post_init function.
We need this because later the entire cadence_codec_post_init function
will be called later then init.

At init we do not know yet the codec id.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-13 14:36:39 +03:00
Daniel Baluta 453a007be8 codec_adapter: cadence: Introduce cadence_codec_resolve_api
Separate code that finds and assigns API function given an codec_id
into a function.

This makes code cleaner and helps us move finding the api id in another
part of the code.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-13 14:36:39 +03:00
Daniel Baluta 98862784fb codec_adapter: cadence: Introduce cadence_codec_post_init
This new function encapsulates all Cadence API calls at init time. We
introduce this new function because the init API calls need to be
done after we figure out cadence codec api id.

Right now cadence codec api id is hardcoded to DEFAULT_CODEC_ID but
later it will be needed to be determined dyncamically at runtime.

It will be sent from host via sof_ipc_stream_params.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-13 14:36:39 +03:00
Daniel Baluta cf808895cc LICENCE: Add Khronos Group Inc license header
This is introduced with compress_params.h file.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-12 19:41:27 +03:00
Daniel Baluta 4ad833098b LICENCE: Add clarification for dual license files
We often need to include interface files from other projects. When the
projects are dual licensed we always go for the more permissive license.

Suggested-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-12 19:41:27 +03:00
Daniel Baluta 5f52ab9199 include: ipc: Add compress_params interface file
This file is copied 'as is' from the Linux kernel repo
and will be used to have a common interface for passing
compressed stream params.

Notice that Doxygen doesn't recognize markup style for structure
commenting so we had to escape @ symbols.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2022-04-12 19:41:27 +03:00
Tomasz Leman 858eec93ff ipc4: base_fw: return fail for not supported ipc
Base FW is lacking implementation for large config set. Returning 0 is
hiding the existing problem and will lead to false success reports. Tests
using this functionality will fail in later steps, making it difficult to
debug.

However, IPC4_FW_CONFIG have to be exception. All existing tests used by
FW team are using this IPC. Its required to maintain unity of tests for
all platforms.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2022-04-11 21:48:44 +01:00
Seppo Ingalsuo a10ccbdcb2 Tools: Topology: Add a development topology to RUN SRC on UP2
Add this topology to be able to test SRC playback and capture.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2022-04-11 21:45:29 +01:00
Chao Song 5eb94a8a80 audio: comp_ext: workaround XCC compatibility with zephyr logging
Multiple use of static inline functions that call Zephyr logging
API across different C files will result in same symbol names
defined in all of the corresponding object files with XCC,
because XCC compiler emits the same symbol names based on the
source file for those static variables inside functions.

If Zephyr logging is used in SOF, we will have log context
redefinition issue with XCC due to above reason.

This patch workarounds the issue by removing the log calls
in static inline functions that are used across multiple C
files if Zephyr is used.

BugLink: https://github.com/zephyrproject-rtos/zephyr/issues/43786

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2022-04-08 13:43:17 +01:00
Krzysztof Frydryk 27e9635227 ipc4: fix pipeline reset trigger from paused state
When pipeline reset was called from paused state, it was not stopped
beforehand. This resulted in improper device turn-off sequence.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2022-04-08 13:36:34 +01:00
Vamshi Krishna 39f2626c47 topology1: sof-adl-rt1019-rt5682: add new topology
for amplifier rt1019 SSP1 link is used
for headset rt5682 SSP0 link is used

Signed-off-by: Vamshi Krishna <vamshi.krishna.gopal@intel.com>
2022-04-08 13:20:13 +01:00
Marc Herbert c9ee109296 xtensa-build-zephyr.py: add cavstool.py to staging directory
This is required to read Zephyr logs.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-08 13:15:38 +01:00
Marc Herbert f9c461009a xtensa-build-zephyr.py: add for loop to install files into staging
Preparation to copy multiple files. Zero functional change.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-08 13:15:38 +01:00
Adrian Bonislawski 5243f0c4ee buffer: dereference before null check fix
This will fix null dereference issue reported by KW

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-04-07 13:49:45 +01:00
Chunxu Li 7b5aa72813 drivers: mtk: refine afe_remove return value
the afe_remove return value is no used, so
change afe_remove return value from int to void

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li 492821a9f7 platform: mtk: add platform dai build support for mt8186
Add platform dai build support
Add platform dai_init

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li eba5396499 platform: mtk: add platform driver support for mt8186
Add support for dai, dma platform driver.

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li 63312ced76 drivers: mtk: add driver compile support for mt8186
compile mt8186 drivers

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li 0a03bef10e drivers: mtk: add afe driver for mt8186
Add AFE driver for memif/sinegen
Add afe-dai.c/afe-drv.c/afe-memif.c for AFE common driver

AFE: Audio Front End

The audio front-end essentially consists of voice and audio data paths.

frontend (memory interface):
 UL (uplink for capture)
 DL (downlink for playback)
backend:
 I2S In/Out etc
interconn:
 inter-connection, connect frontends and backends as DSP path

Note:
TEST_SGEN macro define is just for test

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li b5563511d6 platform: mtk: add afe-platform compile support for mt8186
Add afe-platform compile support for mt8186

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Chunxu Li 529b1d0cc2 platform: mtk: add afe-platform support for mt8186
Add memif data for AFE
Add common and regs header for AFE
Add AFE platform for mt8186 audio/dsp

AFE: the abbreviation for Audio Front End

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
2022-04-05 12:23:39 -07:00
Jyri Sarha ad0d4fb3f8 data_blob: Add single buffer mode to save memory with big configurations
The single blob mode keeps only one configuration blob available at
one time and saves the memory otherwise consumed by the second
blob. The down side of this behaviour is that the audio pipeline must
be stopped for the configuration to be updated.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-04-05 17:47:18 +01:00
Jyri Sarha b81c76f854 component: Split data_blob.[ch] out of component.[ch]
The data blob handler functionality is quite independent from the rest
of the generic component code. The component.c and component.h are
already too big so it is better to split the data blob handler
functionality out before adding more features to it.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2022-04-05 17:47:18 +01:00
Marc Herbert 791efe2094 .github: build again single-threaded and verbose on failure
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings.

To show what actually fails, try to build again with a single thread.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-05 14:37:28 +01:00
Marc Herbert bde4858625 topologies: docker --env USE_XARGS, NO_PROCESSORS and VERBOSE
Building in parallel is much faster but it makes logs unreadable and
build failures impossible to understand. This is especially true when
building with recent ALSA that produces of deprecation warnings, see
examples below. For test topologies the problem is even worse: its
XARGS parallel build provides no log at all.

To find what actually fails, it is required to fall back on a single
threaded and verbose build and this is achieved with the variables
USE_XARGS, NO_PROCESSORS and VERBOSE. Pass these through docker-run.sh
and CMake.

Examples from #5608
https://github.com/thesofproject/sof/runs/5717553555?check_suite_focus=true
https://sof-ci.01.org/sofpr/PR5608/build12556/build/tools.txt

ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...
ALSA pcm.c:1471:(parse_hw_config) deprecated bclk value 'codec_slave',...
ALSA pcm.c:1523:(parse_hw_config) deprecated fsync value 'codec_slave',...

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-05 14:37:28 +01:00
Ranjani Sridharan 3b0fd1e203 topology2: abi: fix size of ABI bytes
The major/minor/patch values are represented with u16 in the FW. So,
change the numbers of bytes to match that of the FW when adding the
ABI to the topology manifest for IPC4. For IPC3, we still only use 3
bytes as there's no clean way to increase the number of bytes without
breaking backwards compatibility with the older kernel. There are no
topologies using topology2 for IPC3 today but it is possible in the
future.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2022-04-05 14:37:05 +01:00
Kai Vehmanen 3fdf92c37b mixer: remove unused code from mixer_trigger_common()
Function returns "ret" in any case, so the additional
check on direction is not needed.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-05 14:34:44 +01:00
Kai Vehmanen 69db9c8715 ipc: run buffer free in context of active pipeline
BUFFER_FREE IPC returns an error if buffer is connected to
two active components.

However it is allowed to free a buffer in the case where either the sink
or the source is no longer active. This happens for example with buffers
that connect two pipelines. If one pipeline is stopped and freed,
the connecting buffer will be also freed.

This does mean pipeline_disconnect() may be run in context
of a pipeline that is running on a different core. This is
fundamentally unsafe and can lead to undefined behaviour
when two cores access the pipeline bsource_list/bsink_list
at the same time on two different cores.

Fix this issue by checking for this case, and running
the BUFFER_FREE on the active core.

The change is not sufficient on its own, but is part of the fixes
to address: https://github.com/thesofproject/sof/issues/5469

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-05 14:34:28 +01:00
Marc Herbert 93f20d577c xtensa-build-zephyr.py: forbid shell=True
The entire purpose of replacing the older shell script with Python was
to achieve cross platform compatibility. shell=True would lose that.

See also
https://docs.python.org/3/library/subprocess.html#security-considerations

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-04 16:24:43 +01:00
Kai Vehmanen e4e3dd96fc pipeline: do not reschedule pipe task if already in target state
When processing a trigger action in pipeline_task_cmd(), do
not return SOF_TASK_STATE_RESCHEDULE if the pipeline is already
in requested ACTIVE state.

The unnecessary reschedule can cause scheduling bubbles in
topologies with mixer fed by multiple source pipelines. When
the frontend pipelines are released from pause or started,
the connected pipelines that are already running, need to keep
running. A reschedule will cause a gap in scheduling in
of the downstream pipeline(s) mixer feeds.

This fix is not sufficient on its own, but is part of the fixes
to address: https://github.com/thesofproject/sof/issues/5469

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2022-04-04 16:19:57 +01:00
Peter Ujfalusi 1a8cea9b69 ipc4: handler: Perform platform context save before primary core shutdown
Run the platform_context_save() before we shut down the primary core.
As an implementation detail: the context save implements the code to
prepare for IMR boot on platforms where it is supported.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-04-02 17:53:43 +01:00
Marc Herbert 0bbdbb111f test/topology: make tplg-build.sh callable from anywhere
This removes two layers of indirection when trying to find what fails.
The lack of this proved especially painful when working on #5632 and
similar backports.

Also move outputs to a subdirectory by default. No change when invoked
from CMake which does not use the default output directory.

Also show the exact m4 and alsatplg commands run when not using XARGS
parallelization. Again this is critical when something fails.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-04-02 17:51:04 +01:00
Peter Ujfalusi e043503158 ipc4: handler: Fix compilation with gcc in ipc4_set_pipeline_state()
gcc fails with the following warning (treated as error):
sof/src/ipc/ipc4/handler.c: In function 'ipc_cmd':
sof/src/ipc/ipc4/handler.c:471:5: error: 'status' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  471 |  if (status == COMP_STATE_READY)
      |     ^
sof/src/ipc/ipc4/handler.c:439:11: note: 'status' was declared here
  439 |  uint32_t status;
      |           ^~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:380: CMakeFiles/sof.dir/src/ipc/ipc4/handler.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Based on the code, this is a false warning since ppl_count should never be
0 (unless ppl_data->pipelines_count is 0), but never the less, the firmware
does not compile with gcc.

Fixes: 72394a62de ("ipc4: update component direction when pipeline is complete")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-03-31 11:38:26 +01:00
Ming Jen Tai a5fd52ec43 [RTNR] Fix buffer size calculation
The correct frame length should be calculated by
FRAME_LEN = SAMPLING_RATE * PERIODS / 1000000

The macro COMP_PERIOD_FRAMES does the thing.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Ming Jen Tai <mingjen_tai@realtek.com>
2022-03-30 14:00:16 +01:00
Peter Ujfalusi 3e6fd30aa6 ipc4: base_fw: Simplify firmware version type in basefw_get_dsp_properties
Use the sizeof on the fw_version array to remove the magic number for the
size calculation and drop the address modifier for the data pointer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-03-30 13:58:47 +01:00
Mark Barton b55a2168f2 audio: codec adapter: remove unused variable from dts codec
Enables dts codec to compile cleanly

Signed-off-by: Mark Barton <mark.barton@xperi.com>
2022-03-30 00:05:28 +03:00
Ben Zhang 992b370c8c google_rtc_audio_processing: Make control write reliable
Userspace may write the config control repeatedly in quick succession.
Accept the new config in cmd callback to avoid -EBUSY error and ensure
the last successful control write before prepare/copy is applied.

This patch also fixes an edge case during init where the first non-empty
control write happens after prepare. This patch ensures the config is
applied during copy.

Tested:
1) Writes in quick succession
for i in $(seq 1 100); do
    ./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob0.txt &
    ./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob1.txt &
done

2) Large config requiring multiple ipcs
for i in $(seq 1 1000); do
    ./sof-ctl -n 92 -t 0 -b -r -s /root/large_blob.txt
    ./sof-ctl -n 92 -t 0 -b -r -s /root/test_blob1.txt
done

3) Reboot, write before and after arecord starts
4) Suspend/resume

Signed-off-by: Ben Zhang <benzh@chromium.org>
2022-03-28 10:51:29 -07:00
Rander Wang f6d83ba510 ipc4: skip component in the incomplete pipeline
Fix a error found by ipc4 Linux driver. Some component
pipeline may be incomplete, so the pipeline is not
updated to the component. Skip this pipeline and
return dai of null.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-28 16:25:49 +01:00
Rander Wang 421f3b6006 ipc4: mixer: refine path stop logic for ipc4
In ipc4 pipeline can't be reset when the source
and current component is in the same pipeline
and it is active. This is different with ipc3.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-28 16:25:49 +01:00
Rander Wang c6574f9c0d ipc4: use correct log for pipeline state change
Currently error is reported for both active and paused state when
pipeline is set to reset. For ipc4 case, it is good to switch from
pause to reset. The switch from active to reset is not permitted for
both ipc3 and ipc4. This patch uses different log for active and paused
state.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-28 16:25:49 +01:00
Rander Wang eb674d1dac ipc4: check direction to choose pcm format conversion function
For alh, link dma and host gateway, the conversion function is
based on direction. For example to convert s24c32 to s32c32 with
alh, it should be function of convert_s24_to_s32 for playback,
but it is a simple copy function for capture since the valid
sample bits are set in msb 24bits like 0xdddddd00 for alh gateway.

The combination of all conditions is very huge but only part
of them are used in real case. This patch only supports some
patterns in our test case and is not complete. It will be enhanced
in future.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-28 16:25:49 +01:00
Rander Wang 72394a62de ipc4: update component direction when pipeline is complete
In ipc3 path, host driver sends pcm_hw_param message to fw and
direction is included. The direction is set to each component
after pipeline is complete. There is no such ipc message for
ipc4 path and direction can only be figured out from dai gateway
type if there is one. Ipc4 path gets direction from dai component
and set it to each component after connected pipeline are complete.
We skip the host copier to host copier case.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2022-03-28 16:25:49 +01:00
Peter Ujfalusi 5cdabe5b76 ipc4: base_fw: Fix firmware version type in basefw_config IPC
The firmware version numbers should use u16 type, not u32.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-03-28 16:21:07 +01:00
Peter Ujfalusi 9a39672f8f volume: ipc4: Fix compilation due to unused gain_uuid_ldc
Fixes the following compilation failure with gcc:

In file included from src/include/sof/audio/buffer.h:18,
                 from src/include/sof/audio/component.h:19,
                 from src/include/sof/audio/component_ext.h:19,
                 from src/audio/volume/volume.c:18:
src/audio/volume/volume.c:60:29: error: 'gain_uuid_ldc' defined but not used [-Werror=unused-const-variable=]
   60 | DECLARE_SOF_RT_UUID("gain", gain_uuid, 0x61bca9a8, 0x18d0, 0x4a18,
      |                             ^~~~~~~~~
src/include/sof/lib/uuid.h:94:37: note: in definition of macro 'DECLARE_SOF_UUID'
   94 |  static const struct sof_uuid_entry uuid_name ## _ldc = { \
      |                                     ^~~~~~~~~
src/audio/volume/volume.c:60:1: note: in expansion of macro 'DECLARE_SOF_RT_UUID'
   60 | DECLARE_SOF_RT_UUID("gain", gain_uuid, 0x61bca9a8, 0x18d0, 0x4a18,
      | ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:534: CMakeFiles/sof.dir/src/audio/volume/volume.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-03-28 16:15:00 +01:00
Peter Ujfalusi d5aa222e5d ipc4: helper: Remove unused sink_cfg from ipc4_create_buffer()
Compilation fails with gcc:

src/ipc/ipc4/helper.c: In function 'ipc4_create_buffer':
src/ipc/ipc4/helper.c:210:41: error: variable 'sink_cfg' set but not used [-Werror=unused-but-set-variable]
  210 |  struct ipc4_base_module_cfg *src_cfg, *sink_cfg;
      |                                         ^~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/sof.dir/build.make:394: CMakeFiles/sof.dir/src/ipc/ipc4/helper.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2042: CMakeFiles/sof.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2022-03-28 16:15:00 +01:00
Joe.Cheng 04ff2f99e2 config:ADL:Add DTS config
Enable DTS SDK and SOF EQ IIR on ADL platform

Signed-off-by: Joe.Cheng <joe.cheng@xperi.com>
2022-03-28 16:14:04 +01:00
Joe.Cheng 64378c57f0 topology1:ADL:add DTS topology
The DTS Codec can be conditionally added to the sof-adl-nau8825 topology
on those pipelines intended for headphone and speaker output.

Signed-off-by: Joe.Cheng <joe.cheng@xperi.com>
2022-03-28 16:14:04 +01:00