Commit Graph

6255 Commits

Author SHA1 Message Date
Piotr Makaruk d850d94b0c hda: enable xrun handling in chain dma
Enable detection of under/overruns and report it by sending notification.

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-03-08 15:07:37 +01:00
Guennadi Liakhovetski b637889efb platform: remove support for cAVS 2.0 platforms
Remove all support for cAVS 2.0 platformsm including Ice Lake and
Jasper Lake, they aren't supported any more.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-07 14:02:18 +02:00
Guennadi Liakhovetski 5cbbde7986 clock: replace per-clock locks with a global one
select_cpu_clock() on cAVS currently takes all the clock locks while
adjusting them. And that function is called from clock_set_freq()
which also takes one of those locks, which leads to a recursive
spin-lock. To fix that remove per-clock spin-locks and use a global
clock lock instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-07 13:37:56 +02:00
Peter Ujfalusi c9343dd4f1 ipc4: copier: Clarify the log and return value when the dai_copier is not found
We are always returning 0 if the dai_copier is not found and never an error
code. Make it clear by returning 0.

With that out of the way, it is clear that this is not an error, it is
something which can happen.
Firmware log is a proof of that since it is flooded with
<err> copier: comp:X 0xSOMEHEX failed to find dai comp or sink pipeline not running.

prints. Drop the log level to info and add a comment as explanation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2023-03-07 13:37:23 +02:00
Baofeng Tian 15d18cdc13 copier: remove the host component and endpoint buffer creation
With previous commits, copier can perform DMA copy without host
endpoint buffer and host device, so remove host device and endpoint buffer
creation, accordinlgy, related state settings are all removed.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian 9bca4369da copier: replace host dev with copier dev
Replace params and copy host dev with copier dev, after this change,
host dev and endpoint buffer are no longer useful for copier, next
step can remove host device and its endpoint buffer.

Simplified host_zephyr_params parameters, since all parameters changed
to copier dev aligned.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian 2edea177a5 copier: change DMA callback register from host to copier
Current host dma call back register on host device,
With this optimization, move this call back function from host
to copier device, create a new copier_dma_cb for copier usage.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian c488851def host-zephyr: Expose common functions for host DMA copy
Create and expose a couple of functions for host DMA copy
along with struct host_data,these functions will be shared by both
host and copier component.
This is in preparation to remove the creation of a host component and
endpoint buffer in create_host().

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian f587974dde host-zephyr: Expose common functions for host DMA parameters
Create and expose a couple of functions for host DMA parameters
along with struct host_data,these functions will be shared by both
host and copier component.
This is in preparation to remove the creation of host component and
endpoint buffer in create_host().

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian 18b0605111 host-zephyr: Expose common functions for host trigger
Create and expose a couple of functions for host DMA trigger along with
struct host_data,these functions will be shared by both host and
copier component.
This is in preparation to remove the creation of  host component and
endpoint buffer in create_host().

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian 2b4bb06074 copier: Implement host processed data and position in copier
Implement host data processed data and host position in copier to
avoid use host ops driver.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian cc8ec1a00b host-zephyr: Expose common functions for host DMA prepare/reset
Create and expose a couple of functions for host DMA prepare and
reset along with struct host_data,these functions will be shared by both
host and copier component.
This is in preparation to remove the creation of host component and
endpoint buffer in create_host().

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian e1cc8beb19 host-zephyr: Expose common functions for host DMA new/free
Create and expose a couple of functions for host DMA allocation and
free along with struct host_data,these functions will be shared by both
host and copier component.
This is in preparation to remove the creation of host component and
endpoint buffer in create_host().

Below is the preparation work:
1. Add host data structure to copier data structure
Currently, copier call host interface need through ops driver.
However, with dedicated work, all host interface can be called
through host data, this commit add host data into copier data.

2. Add Header file to share host data between copier and host
Data and interaface will be shared through this header file between
host and copier.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Baofeng Tian 41c5fbb1a6 copier: Add gateway flag as preparation for copier optimization
The IPC gateway copier from the host copier both have the same comp type
SOF_COMP_HOST. So add a new flag to distinguish between the two and set
it in create_ipcgtw(). This will be used in the follow ups patches
to isolate the optimization for the host copier only.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-07 10:59:51 +00:00
Guennadi Liakhovetski f0782e39d9 buffer: simplify buffer_from_list()
buffer_from_list() is always used for buffer objects, the type is
always struct comp_buffer. Hard code the type instead of always
specifying is as a parameter.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-07 10:29:01 +02:00
Ievgen Ganakov 1a66d878c4 module_adapter: support modules with only sink or source connected
Extend module adapter simple_copy flow to support modules with only
one sink or one source connected such as KD or Intel WoV.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
2023-03-06 16:05:03 +01:00
Przemyslaw Blaszkowski 4a8e8f9467 volume: add attenuation adjustment for peakmeter
Add peak-meter attenuation adjustment to PeakVol processing functions.

Note: attentuation supported only for 32 bit container audio formats.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 14:49:09 +00:00
Przemyslaw Blaszkowski 51b1e00063 volume: add support for set attenuation config ipc
Add support for LargeConfigSet:SET_ATTENUATION IPC.

The purpose is to add attenuation adjustment for peak-meter.
To properly mix multiple streams without saturation, driver configures
attenuation to the input copier of each playback stream that is going
to be mixed into one output stream. In some topologies, PeakVol is
placed behind the copier with attenuation, hence its peak-meter value
is artificially scaled by FW. To report valid peak-meter value, FW has to
adjust the measurement by reverting attenuation provided in copier.

Example for 2 streams:
----
    | A   PeakMeter (A*2)
    |<-------------------+
    |                    |
    |     att=2          | A/2
    | A  -------- A/2  -------   ------- A/2
    |--->|Copier|----->|PeakV|-->|MixIN|--+
    |    --------      -------   -------  |   --------   ------
HOST|                                     +-->|MixOut|-->|Aria|-->...
    | A  -------- A/2  -------   -------  |   --------   ------
    |--->|Copier|----->|PeakV|-->|MixIN|--+
    |    --------      -------   ------- A/2
    |     att=2          | A/2
    |                    |
    |<-------------------+
    | A   PeakMeter (A*2)
----
att - attenuation set in copier
A - signal amplitude

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 14:49:09 +00:00
Przemyslaw Blaszkowski 3da039e56c volume: move set_volume to separate function
Move LargeConfigSet:IPC4_VOLUME handling to separate function.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 14:49:09 +00:00
Chao Song 8e916d510b selector: extend selector module to use base config extension
This patch extend the selector module to use base
config extension for module init, which ensures only
base_cfg and base_cfg_ext is received in module init
on linux side and align the init blob format with
other modules.

However, on Windows side, the payload base config with
output format style payload is still used, this payload
should be supported before Windows doing the payload
format migration.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-03-06 12:14:43 +00:00
Guennadi Liakhovetski 5a090a68cb schedule: remove schedule_task_complete()
schedule_task_complete() is never used, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-06 12:14:14 +00:00
Przemyslaw Blaszkowski a134878e46 copier: fix format check for set_attenuation
Fix format validation in set_attenuation function.

In previous implementation, bitdepth was compared to sink->buffer_fmt
value, which is an enum sof_ipc_buffer_format (interleaved or not).

Format bitdepth is represented by stream.frame_fmt (enum sof_ipc_frame),
so it should be compared to this value.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
2023-03-06 12:05:22 +00:00
Andrula Song 05751b80e7 Audio: Fix the ramp gain setting.
Fix the ramp gain setting bug to start ramp from the previous gain
instead of zero.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-03-06 12:35:23 +02:00
Andrula Song 0703228ec2 Audio: Dcblock: Avoid division by using frame aligned API
Using frame aligned API to avoid the division in
audio_stream_avail_frames() function, which is called by
dcblock processing function every time.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-03-06 12:18:09 +02:00
Kwasowiec, Fabiola a6f8daec2a kpb: add micselection function
Add micsel function to create a topology
with KD without a separate micselector module

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2023-03-06 10:29:15 +01:00
Kwasowiec, Fabiola b1822cde70 kpb: add sink channel setting
KPB in micselector mode has
a different number of channels on each sinks.
Sink 0 has one channel and the other sinks
have the same number as on the module input.

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2023-03-06 10:29:15 +01:00
Kwasowiec, Fabiola 552bc564a3 kpb: add large config set function
Add large config set function
to be able to set the micselector.
Allow to configure which mics are
used by the kpb,
using large_config_set interface

Signed-off-by: Kwasowiec, Fabiola <fabiola.kwasowiec@intel.com>
2023-03-06 10:29:15 +01:00
Baofeng Tian 6925dc51f1 dai-zephyr: remove no use functions in dai zephyr
Function: dai_comp_hw_params does not do anything and remove it.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-03 16:07:11 +00:00
Piotr Makaruk 1f710923dd ipc4: add file for notifications initializations
Add separate file for notifications initializations. All generic
initializations could be stored in one place. Add initialization for
generic xrun notification message which can be sent by gateway.

Signed-off-by: Piotr Makaruk <piotr.makaruk@intel.com>
2023-03-03 15:53:36 +00:00
Paul Olaru 43696239d3 audio: eq_fir: Use a data blob validator to ensure invalid blobs don't stop playback
The validator is intended to verify everything that the regular
algorithm checks without changing the actual component state. If it
receives an invalid data blob, it is discarded and an error returned
from the set_config function (which propagates to sof-ctl tool in the
userspace, assuming the set_config function was called from there).

The validator is only called during playback, to avoid invalid
configuration in the topology preventing the topology from loading in
the first place.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2023-03-03 16:59:18 +02:00
Paul Olaru d9644bc6bb audio: data_blob: Add support for custom validators for data blobs
Whenever a new data blob arrives via IPC it used to be the case that we
just trust it. Here we add the possibility to validate it before it is
actually active. If the data blob is invalid, an error is reported to
the tool and the old data is kept.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
2023-03-03 16:59:18 +02:00
Jyri Sarha 5b5ed42720 Revert "hda: chain dma: cancel task before freeing it"
This was not the correct fix for the ll timer free crash issue. Now
that the correct fix[1] is found and merged, this workaround can be
removed.

[1] b3a808afa8 "chain-dma: fix scheduling exception"

This reverts commit 60e9e97e0d.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
2023-03-03 13:28:43 +02:00
Iuliana Prodan e6845e69e5 imx: fix GIP bits clear method
mx_mu_xsr_rmw() doesn't work correctly for w1c bits
because it reads the register and writes it back fully.
So, use imx_mu_write to clear pending interrupts from MU,
instead of imx_mu_xsr_rmw.

Using imx_mu_xsr_rmw might clear a pending interrupt that
was triggered while handling the current interrupt.

This fixes the case when fw boot confirmation and first
command are sent, from kernel, close to each other and
the command is missed.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2023-03-03 09:09:25 +02:00
Iuliana Prodan 388d69fb9a imx: fix interrupt initialization
Fix interrupt initialization by:
- disable interrupt for DSP Core;
- disable interrupt from MU;
- clear pending interrupt from MU;
- clear pending interrupt for DSP Core;
- configure interrupt for DSP Core;
- enable interrupt from MU.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2023-03-03 09:09:25 +02:00
Guennadi Liakhovetski dc9ba281d7 platform: remove support for cAVS 1.8 platforms
Remove all support for cAVS 1.8 platformsm including Cannon Lake,
Comet Lake, Whiskey Lake and Coffee Lake, they aren't supported
any more.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-02 23:02:37 +00:00
Rander Wang 57874da1c5 ipc4: google: add ipc4 support for AEC
Add ipc4 config support and hw_params setting

Signed-off-by: Rander Wang <rander.wang@intel.com>
2023-03-02 14:51:04 -08:00
Chao Song 8d3d16c252 module_adapter: use type in abi header as config_id for IPC3
The type member in struct sof_abi_hdr is used for component's
specific blob type for IPC3, some module count on it to know
the blob is for module config or module processing algorithm
model. We should pass it to set_configuration ops.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-03-02 22:36:51 +00:00
Andrula Song 9a83f05d97 Audio: Fix the pointer update errors while volume ramp enabled
while enable volume ramp, we may need to run the while loop in
volume_process function several times, but we only update the
read/write pointers of in/output streams in module_adapter copy
function after the whole volume_process function finished. Then
we would always get and store data from wrong address and lead to
discontinuity waveform.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-03-02 22:22:04 +00:00
Baofeng Tian 5d210ccb69 host-zephyr: limit copy bytes to one period for capture pipeline
Limit copy bytes to period bytes for both playback and capture
to avoid high load spike.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
2023-03-02 09:28:27 -05:00
Guennadi Liakhovetski 5f066f2698 chain-dma: fix scheduling exception
Task state shouldn't be modified by client code, it is fully managed
by the scheduler. Setting task status to INIT after scheduling a task
is wrong and for chain DMA it leads to a scheduler exception. Simply
remove the offending line.

BugLink: https://github.com/thesofproject/sof/issues/7084
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-02 11:29:10 +00:00
Guennadi Liakhovetski 2b572c7d3b ll-schedule: fix tasks removed during execution
Zephyr LL-scheduler is supposed to be able to handle tasks, removed
or added while the scheduler is executing. However, there is a bug in
that implementation. If the task, that is currently executing, is
removed, its list head, that links it into the list of tasks, is
initialised. So when trying to get a pointer to the next task we
obtain a pointer to the same task.

BugLink: https://github.com/thesofproject/sof/issues/7084
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-02 11:29:10 +00:00
Guennadi Liakhovetski 0f0acaae94 platform: remove support for cAVS 1.5 platforms
Remove all support for cAVS 1.5 platformsm including Apollo Lake,
Sky Lake, Kaby Lake, Broxton and Gemini Lake, they aren't supported
any more.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-02 11:28:23 +00:00
Laurentiu Mihalcea d4c573401b xtos: include: sof: lib: io.h Fix naming inconsistency for 64-bit functions
The naming scheme used for the 64-bit read/write function is
not consistent with the naming scheme used for the other
read/write functions. This commit fixes this.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-03-01 16:03:40 +00:00
Guennadi Liakhovetski 1b934e9d6c IDC: set IDC task priority equal to that of the IPC task
One of the functions of the IDC thread is to execute IPCs on
secondary cores, those have to be executed with the same priority as
when they're run on the primary core, i.e. with the priority of the
IPC thread. Set IDC thread priority equal to the IPC thread.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-03-01 15:30:05 +00:00
Krzysztof Frydryk 10e1172ea5 ams: Add initial AMS implementation
Add Asynchronous Messaging Service. This can be used to communicate between
modules.
Asynchronous Messages are one-way messages from one producer to one or
multiple registered consumers. Messages between modules on different
cores are sent through IDC. All inter-core communication must be proxied
by the main core.

Signed-off-by: Krzysztof Frydryk <krzysztofx.frydryk@intel.com>
2023-02-28 09:10:29 +01:00
Laurentiu Mihalcea 7ed1159e48 Switch to using rtos/idc.h instead of sof/drivers/idc.h
The purpose of this commit is to separate the XTOS-specifc
code from the Zephyr-specifc code found in sof/drivers/idc.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Laurentiu Mihalcea 0a5c049ac0 Switch to using rtos/task.h instead of sof/schedule/task.h
The purpose of this commit is to separate XTOS-specific code
from the Zephyr-specific code found in sof/schedule/task.h.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2023-02-24 14:28:49 +02:00
Jaska Uimonen 1e21a5d2fc zephyr: lib: move cpu.c from lib-zephyr
Move zephyr cpu.c from "unnecessary" lib-zephyr to lib/zephyr.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2023-02-23 22:17:07 +00:00
Kai Vehmanen a74ad93270 audio: chain_dma: do not hold spinlock when calling schedule_task_free
schedule_task_free() might be a blocking call. E.g. the Zephyr
LL-scheduler implementation can call k_sem_take(). Do not call
this function with a spinlock held.

Link: https://github.com/thesofproject/sof/issues/7156
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2023-02-22 16:42:18 +02:00
Andrula Song 8bc97c1e13 Audio: Fix the volume change doesn't take effect issue
If the initial_ramp is zero, the ramp_finished would always be true,
that means we will never copy gain to circular buffer except we reset
state.

Signed-off-by: Andrula Song <andrula.song@intel.com>
2023-02-22 15:27:07 +02:00