Commit Graph

6449 Commits

Author SHA1 Message Date
Guennadi Liakhovetski b602e275c9 zephyr: kpb: fix a compiler warning
When built under Zephyr the wrong format generates a compiler
warning:

modules/audio/sof/zephyr/include/sof/trace/trace.h:35:11: warning: \
format '%d' expects argument of type 'int', but argument 3 has \
type 'uint64_t'

Since native SOF tracing cannot print 64-bit data, only print the
low 32 bits of the time interval.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski 1a249e8421 ll-schedule: (cosmetic) simplify a conditional
If one of the "if" branches contains a jump instruction like "goto,"
"return," "break" etc. usually making that the only "if" branch
simplifies the code. Fix one such case in schedule_ll_task().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Guennadi Liakhovetski c15c43e9fe clock: add a function to convert microseconds to ticks
Several code paths use the existing clock_ms_to_ticks() function in
some not ideal ways, potentially leading to computation overhead or
to precision loss. The function is often called to calculate ticks
for 1 millisecond, which then is recalculated to the required time
interval. It's better to let the function calculate the number of
ticks for the required time interval directly. E.g. instead of
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * milliseconds
it's better to call
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, milliseconds)
directly. For microseconds however replacing
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) * microseconds / 1000
with
clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, microseconds / 1000)
can lead to a loss of precision. To avoid that a new function
clock_us_to_ticks() is added.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-24 11:17:22 +01:00
Slawomir Blauciak 06c3a90b6e rimage: update rimage submodule
Updates the rimage submodule to:
6f45b61921

Signed-off-by: Slawomir Blauciak <slawomir.blauciak@linux.intel.com>
2021-05-24 11:16:30 +01:00
Curtis Malainey ab7961ccbc ipc: check pipeline validity
We have some commands that fail to check the component's pipeline
pointer before running the command which results in various null pointer
dereferences across the codebase. Solution is to copy existing checks
and patch the code paths.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-24 10:31:03 +01:00
Iuliana Prodan 8357dcf793 zephyr: trace: use zephyr utilities when enabled
Use the Zephyr sys/printk.h when Zephyr RTOS is used.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-05-21 15:56:58 +01:00
fy.tsuo c32a0e032f topology: igo_nr: move igo_nr to core 1.
igo_nr runs on core 1 to balance loading.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-21 11:06:47 +01:00
fy.tsuo 9266614004 audio: igo_nr: igo_nr support 48k
To roll back SSP clock setting to original one.

igo_nr now support 48k-in-48-out and the entire pipeline

DMIC_PIPELINE_48k is reverted back to 48k too.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-05-21 11:06:47 +01:00
Kai Vehmanen 72a51a462f cavs: memory: fix panic on tplg load for zephyr on cavs20/25
The Zephyr linker scripts for cavs20/25 do not map sections
on uncached RAM, so the memory accesses to uncached memory will
fail. This shows up as a DSP panic while loading initial topology.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-20 16:29:33 +01:00
ShriramShastry 7de1744501 Math: Trignometry: Cordic sine() and cos()
Add static inline for math sin() and cos()
functions.This PR is just moving existing code to
improve runtime performance due to less function calls

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-05-20 15:35:26 +01:00
Liam Girdwood 25a3fde242 kpb: validate data size passed in by IPC new.
Make sure IPC data fits.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-05-20 14:01:34 +01:00
Liam Girdwood 45918aa19b dai: abstract the DAI hardware configuration
Currently the DAI HW configuration is tightly bound to the IPC major
version and IPC structures. Provide a mechanism whereby different
IPC data structures can be passed for DAI configuration.

This change does the following changes.

1) Pass a common ipc_config_dai structure to all dai config call. This
allows retention of common logic that uses this common data.

2) Provide a IPC specific private data pointer to the dai config that
can be interpreted by the DAI as custom data. Today this is the
existing IPC, but it could also support an NHLT binary register blob in
the future.

3) Splits ipc specific code out of src/audio/dai.c and into
src/ipc/ipc3-dai.c.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-05-20 14:01:34 +01:00
Liam Girdwood 7965c563f1 dai: remove extra new lines
Some new lines were not removed during a recent "sed" based search and
replace. Remove them now.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-05-20 14:01:34 +01:00
Guennadi Liakhovetski 367fa7cec5 zephyr: clean up timer-domain left-overs, fix task cancellation
- Replace several further "timer" name domain left-overs with zephyr
  domain counterparts
- Remove useless "inline" specifier, the compiler will decide itself
- Remove the unused struct zephyr_domain::arg member
- Add delayable work cancellation when cancelling a task

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-20 12:41:07 +01:00
Guennadi Liakhovetski 560d29ddaf zephyr: rename functions and objects in zephyr_domain.c
Mostly a result of s/timer_domain/zephyr_domain/g

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-20 12:41:07 +01:00
Guennadi Liakhovetski f1f5abab0d zephyr: split timer domain
timer_domain.c contains a lot of Zephyr- and XTOS-specific code and
relatively little common code. Aplit it into two files instead of
using a large number of #ifdef instructions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-20 12:41:07 +01:00
Yong Zhi 68499a08ba topology: sof-tgl-rt711-rt1308: add BT offload for ADL
Add pipelines for Bluetooth offload support:

PCM14 <---> passthrough (pipe 13, 14) <---> SSP2 BT offload

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-19 15:22:35 +01:00
ShriramShastry 845c278ed6 Math: Trignometry: Added cordic sin cos function
Cordic sin cos input value range is [-2*pi to 2*pi]
and output range is [-1 to +1]

This is common function to calculate trignometric sine
and cosine using separate lookup table size for speeds
and accuracy calculation.

For 32bit sine and cosine
Error (max = 0.000000011175871), THD+N  = -170.152933

For 16bit sine and cosine
Error (max = 0.000061), THD+N  = -91.518584

Signed-off-by: ShriramShastry <malladi.sastry@intel.com>
2021-05-19 11:00:27 +01:00
Kai Vehmanen 7c5e08c4f1 kconfig: move DW_DMA_AGGREGATED_IRQ to dw/Kconfig
The DW-DMA driver specific option does not belong to the top-level
Kconfig file.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-19 10:50:02 +01:00
Kai Vehmanen 0efce6361d kconfig: rename HW_LLI to DMA_HW_LLI
Add a proper namespace prefix to CONFIG_HW_LLI. While this
option is only used by DW-DMA driver at the moment, this is
a generic option, so remove the DW-DMA specific text from
top-level documentation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-05-19 10:50:02 +01:00
Seppo Ingalsuo 79c647542d IPC: Handle ASRC as ASoC component type and not as process type
ASRC new() receives incorrect topology tokens values before this
fix. It occurred as pipeline DAI find fail for capture direction
ASRC.

Fixes #4193

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-05-19 10:47:35 +01:00
Marc Herbert ab08781733 .github/ipc_fuzzer: add back local compilation hack as a comment
... because it has definitely helped reproduce compilation issues in the
past in just two lines without going through the whole setup process,
see a list of examples in #4126.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-19 10:40:00 +01:00
Guennadi Liakhovetski 7aee1e594b agent: exit for system power down
Exit the system agent for system power down.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-19 10:36:17 +01:00
Guennadi Liakhovetski e76540d883 cavs: zephyr: fix power_down
power_down is an assembly function that powers down memory banks.
Before that it locks the execution code and data into cache for
obvious reasons. However, for this cacheable address aliases have to
be used. Under Zephyr this code executes in a thread with a
dynamically allocated stack, which currently means, that it uses
uncached memory aliases. This leads to a memory access exception.
This patch fixes it by using a cached alias of the data.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-19 10:36:17 +01:00
Guennadi Liakhovetski 41945cfdba cavs: use safer macros for cache-uncache conversions
Currently conversions between cached and uncached addresses is done
by adding or subtracting the alias offset. This is unsafe because it
cannot be done repeatedly. Setting and clearing the aliasing bit is
safe, but it cannot be used in static variable initialisations. This
patch converts conversions to bitwise operations where possible and
adds a new macro for static variable initialisation and uses it where
needed.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-19 10:36:17 +01:00
Curtis Malainey 0a1029c2a2 actions: consolidate yamlint
Lets not trust that everyone remembers to lint themselves or that they
fetch the repo in order to execute their job.

Also rename workflow file to be a bit more generic

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-18 17:24:22 +01:00
Curtis Malainey e11c3c9e51 actions: rename fuzzer job
rename scant to ipc as this is the ipc fuzzer

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-18 17:24:22 +01:00
Curtis Malainey 39551b08ce actions: scant fuzzer: refactor CI build
Use oss-fuzz infra to make sure we don't break the fuzzer

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-05-18 17:24:22 +01:00
Marc Herbert 571cc290a4 xtensa/cmake: fix !CONFIG_TRACE
Looks like no one ever !CONFIG_TRACE

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-18 16:46:44 +01:00
Marc Herbert 964b7afa74 smex: don't corrupt the build with a bogus .ldc output
This made troubleshooting CMake issues more complicated.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-18 16:46:44 +01:00
Marc Herbert 7e1fd0adef Really copy sof-$platform.{ri,ldc} to sof.{ri,ldc}
Fixes incomplete commit 0e60ec8da4 ("Copy sof-$platform.{ri,ldc} to
sof.{ri,ldc}"), see full rationale there. I missed the
copy/paste/diverge at the time and did it only in the MEU_SIGN case.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-05-18 16:46:44 +01:00
Chao Song f510435a25 topology: sof-tgl-nocodec-ci: run pipelines on different cores
This patch moves DMIC pipeline to run on DSP core 2,
and SSP1 pipelines to run on DSP core 3 for multi-core
verification.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Zhang Keqiao <keqiao.zhang@linux.intel.com>
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-17 22:24:06 +08:00
Keyon Jie b5df7bf2ac dmic: switch to use uncached dmic_prm[]
When multi-core introduced, we need to use uncached address for the
global configuration variables, to make sure they are consistent for all
DSP cores.

When variables change, write through for both cached and uncached
addresses, to ensure the consistency.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-17 22:23:54 +08:00
Yong Zhi e9d2900b3b topology: adl-sdw-max98373-rt5682: Add BT offload support
Add BT offload support for ADL platform:

PCM14 <---> passthrought (pipe 14, 15) <---> SSP2 (BT offload)

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-05-17 09:15:38 +01:00
Daniel Baluta 67bf7b479a dai: limit number of bytes copied to one period for all directions
This is similar with:
commit 761bbac5ac ("host: dai: limit number of bytes copied to one
period") which limits the number of copied bytes for CAPTURE direction.

This patch does the same thing for PLAYBACK direction.

We need this with codec adapter component that most of the time
will produce more than period_bytes in a period.

DAI will copy more than on period_bytes at a time and this
affects sound quality.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
2021-05-16 21:57:22 +01:00
Ranjani Sridharan eb9b04a205 drivers: Intel: DMIC: make DMIC prm and active fifo count shared
When the DMIC pipeline is moved to a core other than the
primary core, the DMIC params and dmic_active_fifos are
not valid. Modify them to be shared data and handle
cache management when accessing/modifying them.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-05-16 21:49:34 +01:00
Guennadi Liakhovetski a5cc6f47b5 ll-scheduler: fix the wrong use of atomic operations
A sequence of atomic_sub(); atomic_read() breaks atomicity. A single
atomic_sub() should be used instead.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-05-14 11:58:52 +01:00
Iuliana Prodan 8ed78885bc imx: invalidate cache for specific address range only
The _memmap_cacheattr_reset linker script variable has
dedicate cache attribute for every 512M in 4GB space
1: write through
2: cache bypass
4: write back
F: invalid access

For imx, implement is_cached() based on
_memmap_cacheattr_reset.

Without this fix, when loading a topology we get:
sof-audio-of 556e8000.dsp: error: reply expected 20 got 12 bytes
sof-audio-of 556e8000.dsp: error: ipc error for 0x30010000 size 20
sof-audio-of 556e8000.dsp: error: DSP failed to add widget id 0 type 23 name : PCM0P stream Passthrough Playback 0 reply 0
sof-audio-of 556e8000.dsp: ASoC: failed to load widget PCM0P
sof-audio-of 556e8000.dsp: ASoC: topology: could not load header: -22
sof-audio-of 556e8000.dsp: error: tplg component load failed -22
sof-audio-of 556e8000.dsp: error: failed to load DSP topology -22
sof-audio-of 556e8000.dsp: ASoC: error at snd_soc_component_probe on 556e8000.dsp: -22
sof-audio-of 556e8000.dsp: ASoC: failed to probe component -22
asoc-simple-card sof-sound-wm8960: ASoC: failed to instantiate card -22
asoc-simple-card: probe of sof-sound-wm8960 failed with error -22

That's because, on mailbox_hostbox_read() we don't invalidate cache
before reading the address.

Fixes: bfe7707f37 ("cavs: disable data cache operations on uncached addresses")
Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-05-13 20:34:09 +03:00
Iuliana Prodan 844df3dde3 platform: imx: add info for linker script variable
Added information for linker script variable that
contains the cache attributes.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-05-13 20:34:09 +03:00
Keyon Jie d4b8fa80dc mux: stop copy if get_stream_index() fail
We should return error if the matching in get_stream_index() fail, add
check in the callers, stop using it and return failure when needed.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 13:09:31 +01:00
Keyon Jie 8da8060ea9 mux: remove the wrong error message
A wrong error message was added in helper get_stream_index(), remove to
fix it.

Fixes: 80666b7cc7 ("ipc: component: abstract the component creation API")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 13:09:31 +01:00
Vamshi Krishna e112e0bc0f topology: sof-tgl-sdw-max98373-rt5682: add support for ADL
For speakers SDW2 link is used.
For Headset SDW0 link is used.
add sof-adl-sdw-max98373-rt5682 topology

Signed-off-by: Vamshi Krishna <vamshi.krishna.gopal@intel.com>
2021-05-13 12:27:22 +01:00
Vamshi Krishna 7d44f31e7d topology: sof-tgl-sdw-max98373-rt5682: remove redundant topologies
removing 2-ch topology and renaming 4-ch topology.

Signed-off-by: Vamshi Krishna <vamshi.krishna.gopal@intel.com>
2021-05-13 12:27:22 +01:00
Keyon Jie fc0fe9f4aa ll_schedule: add new_target_tick to ll_schedule_domain
Add a new_target_tick to store the new target tick for the next set,
which is used during the reschedule stage.

Update the new_target_tick on tasks done on each core, and do the final
domain_set() at the point that tasks on all cores are finished.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie c855cffb35 ll_schedule: domain tasks/cores refinement
Refinement to make the domain tasks/cores management more clear:

a. update the total_num_tasks and num_cores in the helper pair
domain_register/unregister().

b. update the enabled[core] and enabled_cores in the helper pair
domain_enable/disable().

c. for the completed task, do the domain client/task update in the new
created helper schedule_ll_task_done().

d. cleanup and remove the tasks/cores management from the ll_schedule
helpers schedule_ll_clients_enable(), schedule_ll_tasks_run(),
schedule_ll_domain_set() and schedule_ll_domain_clear().

Without those refinement, the num_clients was not used correctly,
we used it for both num_registered_cores and num_enabled_cores, with
that we observed that it may be changed to '-1' when component/pipeline
is asked for running on a slave core.

This reverts changes in 'commit b500999477 ("scheduler: guard against
subdivision underflow on domain clear")' as it is not needed anymore.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie 8bfcdcfb55 ll_schedule_domain: add flag to store the enabled cores
The flag registered_cores was created to denote the number of registered
cores, but it is also used as the number of the enabled cores today.

Here add a new flag enabled_cores for the former purpose to remove the
confusion and help for the subsequent domain tasks/cores management
refinement.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie 364ee49c53 ll_schedule: rename num_clients to registered_cores
Rename the 'num_clients' in struct ll_schedule_domain to 'registered_cores'
to reflect the real use of it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie 538d7dba7a ll_schedule_domain: add return value of domain_unregister()
Add return value of domain_unregister(), which will be used for the LL
scheduler and the domain state management in the subsequent refinement.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie 77a231202c cavs: timer: remove the wrong timer_disable
The timer_disable() in the timer_register() is wrong, the
interrupt_enable() calling handles the interrupt enabling already,
remove the wrong timer_disable() calling to correct it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00
Keyon Jie a398e92f2e schedule: add a core index for schedule_data
A scheduler will run on a specific scheduler only, add a core index flag
to schedule_data to denote that.

To schedule or cancel a task, looking for the scheduler with correct
core index to perform the action.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-05-13 12:04:44 +01:00