Commit Graph

7619 Commits

Author SHA1 Message Date
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
Keyon Jie 828b167c34 ll_schedule: only check tasks asked for rescheduling
In schedule_ll_client_reschedule(), we only need to check those tasks
who ask for rescheduling, for others (e.g. _COMPLETED ones), we should
not take them into account for next_tick calculation.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-19 11:16:17 +00:00
Seppo Ingalsuo 8e7c07dd00 Audio: TDFB: Fix issue with different input and output channels count
This patch adds method tdfb_params() where comp_verify_params() is
called with BUFF_PARAMS_CHANNELS. With it the TDFB can get the
different channels count buffers for source and sink and initialize
correctly.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-18 14:39:14 +00:00
Marc Herbert b9fcc4156e xtensa-build-zephyr: fix incremental build, pass CMAKE_ARGS only once
As documented in
https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
and accidentally found when testing rimage cleanup
https://github.com/zephyrproject-rtos/zephyr/pull/40431

Fixes commit 88327f618c ("xtensa-build-zephyr: support passing through
CMake arguments"); ccache is too good and hid this regression from me.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:29:16 +00:00
Marc Herbert d4b8a01f20 xtensa-build-zephyr: temporarily exclude ICL
Because ICL fails to build, .noinit/.cached section overlap since
revert https://github.com/zephyrproject-rtos/zephyr/pull/40319

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Marc Herbert bccbfcc404 xtensa-build-zephyr: add new DEFAULT_PLATFORMS variable for -a
Sometimes we don't want to build all SUPPORTED_PLATFORMS by default.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-11-18 14:27:46 +00:00
Rander Wang 03e5f29ef0 ipc4: handler: add break for unsupported message
Missed break for unsupported SOF_IPC4_MOD_CONFIG_SET & GET

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-18 14:24:11 +00:00
Rander Wang 38ed99ffd4 ipc4: copier: only update pipeline reg for playback
We don't do it for capture.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-18 14:24:11 +00:00
Rander Wang 87fd87abb9 ipc4: copier: add get_large_config support
Copier will support llp reading in get_large_config.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-18 14:24:11 +00:00
Rander Wang 080b28a726 ipc4: add dai_position support for ipc4
Ipc4 will update private data for dma engine.
For intel, it is llp register.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-18 14:24:11 +00:00
Rander Wang c2974bcb75 ipc4: read linear link position for host driver.
Linear link position is updated in llp register by GP-DMA
hardware. Now it is enabled by SOF FW but not used.

This patch set up a path to read it and update it to host
driver.

Signed-off-by: Rander Wang <rander.wang@intel.com>
2021-11-18 14:24:11 +00:00
Guennadi Liakhovetski 9a6569d48c topology: nocodec: fix graph drawing
No functional change, only fix an ASCII-art topology representation
in a comment.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-17 13:51:01 +00:00
Keyon Jie 0ced257b36 topology1: sof-tgl-nocodec: change to support multi-core
Add multi-core coverage for tgl-nocodec platforms, the initial DSP core
assignment as below:

DMIC48k: Core 1
SSP0: Core 2
SSP1: Core 3
DMIC16k, SSP2: Core0

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-17 21:48:59 +08:00
Keyon Jie 8434f81d94 topology1: sof-adl-nocodec: change to support multi-core
Add multi-core coverage for adl-nocodec platforms, the initial DSP core
assignment as below:

DMIC48k: Core 1
SSP0: Core 2
SSP1: Core 3
DMIC16k, SSP2: Core0

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-17 21:48:59 +08:00
Keyon Jie bbfd5ebad7 cavs-ipc: hold ipc->lock in ipc handler to avoid race
For secondary core target IPC, the IPC handling could be completed on a
secondary DSP core, while the primary core may be in handling an reply
message from the host and touching the IPC_DIPCCTL at the same time, so
there is race condition from different DSP cores in this scenario, and
that actually lead to kinds of IPC timeout as setting of bit
IPC_DIPCCTL_IPCTBIE could be ignore and busy interrupt will be disabled
after that.

Simply holding of ipc-lock in the irq handler fixes the issue, according
to stress test with multicore scenarios.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-17 20:01:12 +08:00
Keyon Jie ace301db9c cavs-ipc: remove the superfluous message sending
The DSP->Host messages are sent in the EDF main task already, the one
more try in the IPC handler is superfluous, remove it.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-17 20:01:12 +08:00
Keyon Jie 99dfb38890 cavs-ipc: fix the IPC_COUNTERS debug for multi-core scenarios
In multi-core cases, the IPC could be handled by a secondary DSP core,
which means we need to use ipc_processed_counter with coherent access,
otherwise, the counter may be calculated wrongly.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-17 20:01:12 +08:00
Keyon Jie c2e644b701 component: allocate comp_dev with coherent uncached address
Allocate comp_dev on buffer zone with uncached address to rule out
multi-core cache coherency issue, may need to implement coherent API for
it if it is proved lead to too much performance drop with the change.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-16 15:23:03 +00:00
Guennadi Liakhovetski 65a95c339a zephyr: ll_schedule: protect global domain data
ll_scheduler tasks run audio pipelines on multiple cores in parallel.
Starting and stopping those tasks can cause access to global domain
data. That data has to be protected by the domain lock.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-16 13:49:58 +00:00
Guennadi Liakhovetski 001d1ac5ef zephyr: ll_schedule: remove a spin-lock
We're now making sure that all ll-scheduler tasks under Zephyr are
only ever accessed from their specific core, tasks to be run on core
1 aren't scheduled or cancelled from core 0, etc. Therefore it isn't
necessary any longer to use a spinlock to protect scheduler data,
just disabling interrupts is enough.

This also fixes a dead-lock on secondary cores. When the last task on
core exits, the respective scheduler thread terminates, and that
happens while it's still protecting the scheduler data. Therefore if
a spinlock is used, trying to take it again after that dead-locks the
core.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-16 13:49:58 +00:00
Guennadi Liakhovetski cf3a1163af zephyr: ll_schedule: make sure no cross-core scheduling is done
All LL-scheduling calls (scheduling a task, cancelling a task, etc.)
should only be done from the respective core. Add an assert() to
guard against violations.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-16 13:49:58 +00:00
Guennadi Liakhovetski cbb54fb1f6 zephyr: ll_schedule: wrap spin-lock and unlock operations
Zephyr ll-scheduler locking implementation can change, abstract
spin-lock calls into new functions to simplify such changes.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-16 13:49:58 +00:00
Mac Chiang b29636b936 topology: add nau8825 headphone variant boards support on ADL
sof-adl-nau8825.tplg:
    headphone connects SSP0 link.
    bluetooth offload uses SSP2 link.

With nau8825 headphone, enabled MCLK/BCLK early start.
Add smart amp and dumb speakers support separately.

sof-adl-max98373-nau8825.tplg:
sof-adl-max98360a-nau8825.tplg:
    headphone connects SSP0 link.
    speakers connects SSP1 link.
    bluetooth offload uses SSP2 link.

sof-adl-rt1019-nau8825.tplg:
    headphone connects SSP0 link.
    speakers connects SSP2 link.

Co-developed-by: David Lin <CTLIN0@nuvoton.com>
Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
2021-11-15 22:26:18 +00:00
Libin Yang 7835669c92 topology2: cavs-nocodec: fix dmic compile failure
The current topology2 requires to set id in PCM.pcm and to set index in Pipeline.

Signed-off-by: Libin Yang <libin.yang@intel.com>
2021-11-15 17:12:52 +00:00
cyk 9451716358 Add Waves codec into the main branch
Add Waves override config for tigerlake_chrome.
Enable codec_adapter and Waves codec.

Signed-off-by: CY Kuei <cyk@waves.com>
2021-11-12 17:54:37 +00:00
Jairaj Arava c5c0c1701e topology: sof-tgl-max98373-rt5682: add flag for Bluetooth audio offload
This patch adds flag to choose Bluetooth audio offload support

Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
2021-11-12 16:58:10 +00:00
Seppo Ingalsuo 37cd893d25 Audio: Optimize saturation inline functions in format.h
This patch adds two included header files format_generic.h and
format_hifi3.h. The latter contains intrinsics operations
optimized versions of 16, 24, and 32 bit saturations. Generic
header contains the previous C versions those will be used
for anything else but xt-xcc HiFi3 compatible build.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-12 16:27:39 +00:00
Keyon Jie db9e9eba8e dw-dma: change to use runtime_shared heap for lli buffer
The lli structs are used by both DSP and DMAC, allocate them from the
runtime_shared heap to avoid being corrupted by cache writing back.

This helps to fix a lot of DMA xrun issue according to the validation.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-12 15:53:33 +00:00
Keyon Jie f26b270346 Revert "dw-dma: set LLI alignment to platform specific"
This reverts commit aeda0158b0.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-11-12 15:53:33 +00:00
Yong Zhi 4f54914ceb topology2: add dmic pipeline to nocodec topology
With dmic definition already in, add pipeline to make use of the pcm.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2021-11-12 15:48:53 +00:00
Guennadi Liakhovetski 38ce52458f zephyr: fix secondary core IPC completion
Recently SOF IPC processing has been modified on multicore systems
to let secondary cores reply to IPCs if the primary core has already
left the IPC forwarding context. This hasn't been implemented for
Zephyr which led to unanswered IPCs and IPC timeouts on the host.
This patch lets secondary cores reply to IPCs under Zephyr.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 15:41:58 +00:00
Christopher Friedt 970d7d61ec zephyr: update print messages for 64-bit atomics
Atomics will use `long` rather than `int` so that they are 64-bit
on 64-bit builds and 32-bit on 32-bit builds.

Required by zephyrproject-rtos/zephyr#39531

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-12 13:25:33 +00:00
Guennadi Liakhovetski c5bb947f75 pipeline: (cosmetic) move a function
Move a static function closer to where it is used.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski 5254f0938a pipeline: (cosmetic) fix function names in trace text
Fix trace messages after moving them into different functions.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski c911a78ff0 pipeline: (cosmetic) move a block of code to a function
Improve readability by moving a block of code into a function.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski 7428f755ec pipeline: move STOP / PAUSE trigger to the pipeline task
A recent commit moved START and RESUME trigger processing to the
pipeline task for timer domain pipelines. This patch does the same
for STOP and PAUSE.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski 92510c938e ll_schedule: don't rely on schedule_task_cancel()
Currently there are two ways to stop scheduling an LL task: by
cancelling it from outside and by returning SOF_TASK_STATE_COMPLETED
from the task .run() function. In both cases the task will stop being
rescheduled, but in the latter case it will stay on the list of the
tasks, waiting to be cancelled. This means that even for those tasks
schedule_task_cancel() still has to be called. This is however
inconvenient because in some cases there is no suitable context to
cancel that task from. E.g. this will be the case with pipeline tasks
when we switch them over to handling STOP and PAUSE commands from the
task itself.

This patch restores the original behaviour when tasks are removed
from the list after completion, without waiting for cancellation.
For this we extend the calling convention of domain_unregister() to
be used with the task parameter equal to NULL when freeing the
scheduler. DMA domains preserve their current behaviour: they ignore
calls with task == NULL. The timer domain however now uses this call
to release the timer interrupt.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski 689e06d78b ll_schedule: remove an unused structure field
struct ll_schedule_domain::registered[] is only used inside
ll_schedule_domain.h and only to update itself, it's exclusively
self-serving. Remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Guennadi Liakhovetski 8dc05c5fd4 pipeline: (cosmetic) use a dedicated no-action trigger value
Currently -EINVAL is used to indicate an invalid trigger code,
requiring no handling. Use an explicit new COMP_TRIGGER_NO_ACTION
value for that for better clarity.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-11-12 13:21:41 +00:00
Seppo Ingalsuo ed1ad919a6 Drivers: Intel: DMIC: Add flexibility to parse less common blobs
This patch fixes the DMIC blob parser for cases where channel_ctrl_mask
and pdm_ctrl_mask differ from usual values 0x3. If channel_ctrl defines
only single FIFO with value 0x1 or 0x2 the appropriate FIFO0 or FIFO1
gets the configuration. Similarly if pdm_ctrl_value is 0x2 the blob
contains configuration data only for PDM1.

Previously such blobs caused incorrect DMIC HW configuration. Since the
appropriate HW resource programming is achieved by looping all controllers
in HW the data structures for non-defined remain NULL. Some checks against
null pointer reference need to be added to prevent corrupt blob from
causing FW panic.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-12 13:20:13 +00:00
Seppo Ingalsuo 4cf7e7a627 Drivers: Intel: DMIC: Add check for max BFTH value
This patch adds check for BFTH value in the blob. Applying higher
than supported FIFO depth would result to capture fail due to xruns.

This patch also changes some important traces from dai_dbg() to
dai_info().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-12 13:20:13 +00:00
Seppo Ingalsuo 9538c4feff DAI: DMIC: Get burst elems value from driver
This patch replaces the hard-coded value 8 with DAI platform data
FIFO depth. The depth is set by DMIC driver in set_config() from
BFTH^2 value. The BFTH value is hard-coded to driver in topology
params mode (8) or retrieved from blob OUTCONTROLx register setting
in blob mode.

If the blob set BFTH was different than hard-coded the capture resulted
to xruns and failure.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-12 13:20:13 +00:00
Seppo Ingalsuo 2e0b5d70ce Drivers: Intel: DMIC: Fix mistake in retrieving cic_control value
This patch fixes the value get from current pdm_cfg[n] instead of
first pdm_cfg[0]. It impacts case where PDM0 is omitted from blob
or in case of different registers values for PDM0 and PDM1.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-11-12 13:20:13 +00:00
Jaska Uimonen ba86bb4cab topology2: add io_clk attribute to dmic and ssp
Add io_clk attribute to dmic and ssp dai class. This is the platform
dependent clock that needs to variated in upper level topology files.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
2021-11-12 12:59:29 +00:00