Commit Graph

6601 Commits

Author SHA1 Message Date
Pin-chih Lin 1289b33e9c drc: Make DRC_MAX_PRE_DELAY_FRAMES as kconfig
DRC_MAX_PRE_DELAY_FRAMES determines the length of pre-delay frame
buffers which are allocated runtime on DRC setup.

Use rballoc instead of rzalloc to allocate frame buffers.

The default value 512 is suggested by inference to avoid memory waste
and provide reasonable length for pre-delay frames.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-06-15 16:35:04 -07:00
Chao Song 9c50fff928 topology2: add asrc class
Add the class definition for ASRC widget, it can be
instantiated as follows:
	Object.Widget.asrc."N" {
		period_sink_count	2
		period_source_count	2
		format			"s24le"
		rate_out		48000
		asynchronous_mode	1
		operation_mode		0
	}

Where N is the unique instance number for asrc widget
within the same alsaconf node.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2021-06-15 12:43:12 +01:00
Chao Song d3f3c50205 topology2: add src class
Add the class definition for SRC widget, it can be
instantiated as follows:
	Object.Widget.src."N" {
		period_sink_count	2
		period_source_count	2
		format			"s24le"
		rate_out		48000
	}

Where N is the unique instance number for src widget
within the same alsaconf node.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2021-06-15 12:43:12 +01:00
Ranjani Sridharan a68b1af80d topology2: Add pga class
Add the class definition for PGA widget. It can be
instantiated as follows:
        Object.Widget.pga."N" {
                format	     s24le
                index        0
		period_sink_count 2
		period_source_count 2
        }

Where N is the unique instance number for pga widget in the same
alsaconf node.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-14 18:51:12 +01:00
Ranjani Sridharan d720725840 topology2: Add buffer class
Add the definition for the buffer class. A buffer object
can be instantiated as follows:
Object.Widget.buffer."N" {
	index	0
	periods	2
	caps	"host"
}

where 'N' is a unique instance number for the buffer object within
the same alsaconf node.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-14 18:51:12 +01:00
Ranjani Sridharan 4d830c908c topology2: Add DAI widget class
Add the class definition for DAI widgets. A DAI widget
can be instantiated as follows:
Object.Widget.dai."playback" {
	type			SSP
	index			"1"
	period_sink_count	"2"
	period_source_count	"0"
	widget_type		"dai_in"
}

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-14 18:51:12 +01:00
Ranjani Sridharan 9ef233de48 topology2: Introduction to Topology2.0
About
    -----

    This is a high level keyword extension on top of the existing ALSA
    conf topology format designed to:

    1) Simplify the ALSA conf topology definitions by providing high level
       "classes" so topology designers need to write less config for common
       object definitions.

    2) Allow simple reuse of objects. Define once and reuse (like M4) with
       the ability to alter objects configuration attributes from defaults.

    3) Allow data type and value verification. This is not done today and
       frequently crops up in FW bug reports.

    Common Topology Classes
    -----------------------

    Topology today has some common classes that are often reused throughout
    with slightly altered configurations. i.e. widgets (components),
    pipelines, dais and controls.

    This PR introduces the high level concept of reusable "class" like
    definition for a AIF_IN/AIF_OUT type object that can be used to create
    topology objects.

    Common Topology Attributes
    --------------------------
    Topology defines a lot of attributes per object with different types
    and constraints. Today there is no easy way to validate type or
    constraints and this can lead to many hard to find problems in FW at
    runtime.

    A new keyword "DefineAttribute" has been added to define attribute
    type, size, min value, max value, enum_values. This then allows
    alsatplg to validate each topology object attribute.

    Topology Classes define the list of attributes that they use and
    whether the attribute is mandatory, can be overridden by parent users
    or is immutable. This also helps alsatplg emit the appropriate errors
    for attribute misuse.

    Common Topology Arguments
    -------------------------

    Arguments are used to pass essential data needed for instantiating an
    object particularly needed for the object name. A new keyword
    "DefineArgument" has been added to define the arguments. The order in
    which the arguments are defined determines the name for the widget.
    For example, in the case of the host widget, the name would be
    constructed as "host.1.playback" where "1" is the pipeline_id argument
    value and "playback" is the direction argument value.

    Attribute Inheritance:
    ----------------------
    One of the key features of Topology2.0 is howthe attribute values are
    propagated from a parent object to a child object. This is accomplished
    by adding attributes/arguments with the same name for a parent and an
    object. By doing so, when creating a child object, the value for the
    common attribute is populated from the parent. If the value is provided
    in the child object instance, then it overrides the value coming from
    the parent.

    ALSA Conf Parser
    ----------------

    All the changes being proposed and discussed here must be 100%
    compliant with the ALSA conf parser. i.e. no syntax changes or
    changes to semantics for any existing keyword.

    It's intended that there will be NO changes to the ALSA conf parser
    (unless new keywords require this ?) and all topology building
    changes will be in the alsatplg compiler.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-14 18:51:12 +01:00
Pin-chih Lin 6515df852e topology: fix name mismatch of EQIIR control bytes
The name of CONTROLBYTES_PRIV should be aligned as mentioned in
sof/pipe-drc-eq-volume-demux-playback.m4#48.

Signed-off-by: Pin-chih Lin <johnylin@google.com>
2021-06-14 17:11:13 +01:00
Guennadi Liakhovetski 499d0ee310 zephyr: ll-schedule: remove work queue left-over
Remove work-queue implementation left-over code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-11 17:32:36 +01:00
Guennadi Liakhovetski e0ba5446c1 hda: remove left-over code
Handling of NOTIFIER_ID_LL_PRE_RUN has been removed from the HDA DMA
driver in July 2020, remove left-over dead code.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-11 17:32:36 +01:00
Guennadi Liakhovetski 1eabb71264 zephyr: fix a race in LL-scheduler
If a timer interrupt happens before the scheduler thread suspends,
it will be missed. Use a semaphore to count interrupts as they occur.

BugLink: https://github.com/thesofproject/sof/issues/4306
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-11 17:31:33 +01:00
Ben Zhang 91467d0924 cmake: Link TGL Google hotword library
libc and libm are provided by the xcc toolchain.
They are not available from the gcc toolchain.
To build with gcc, libc and libm should be provided
under third_party_libraries.

Signed-off-by: Ben Zhang <benzh@chromium.org>
2021-06-11 13:53:12 +01:00
Curtis Malainey 2b0ac19ed7 CODEOWNERS: add johnylin as owner
Johny is working a lot with google processing modules, add him as an
owner over all the modules google has contributed.

Signed-off-by: Curtis Malainey <cujomalainey@google.com>
2021-06-11 13:53:12 +01:00
Curtis Malainey bd45d92277 CODEOWNERS: add owners for hotword wrapper
also fixup some indentation that was done with spaces instead of tabs

Signed-off-by: Curtis Malainey <cujomalainey@google.com>
2021-06-11 13:53:12 +01:00
Ben Zhang f26a32dc90 google_hotword_detect: Remove model CRC to avoid XRUN
The CRC calculation of the language model (~64kB) takes
a long time (~475k platform timer ticks). For comparison:
GoogleHotwordDspInit takes 1.2k ticks.
GoogleHotwordDspProcess takes ~11k ticks for 320 samples.

The CRC calculation is causing XRUN on other tasks so
it's not suitable in the copy callback. Remove the CRC
for now until there is support for running it in low
priority background task.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@google.com>
2021-06-11 13:53:12 +01:00
Ben Zhang 6dd44d5b4c comp: Add initial Google hotword detector
Add a new component that uses the Google hotword library
to do keyword detection. The language model needs to be
set using the byte control from userspace before running
the detector.

1. Put the hotword library at $SOF_REPO/third_party_libraries/
hotword_dsp_api.h
libhifi3_google_hotword_dsp_api.a (TGL)
libcometlake_google_hotword_dsp_api.a (CML)

2. Build SOF fw and tools with xcc

3. Set language model on DUT:
amixer -c 0 contents | grep Model
      numid=73,iface=MIXER,name='GHD9.0 Hotword Model'
./sof-ctl -n 73 -t 0 -b -r -s x_google/en_all.mmap

4. Open the WoV pcm device
arecord -Dhw:0,8 -M -N -r 16000 -c2 -f s16_le --buffer-size=67200 -vvv
/tmp/wov.wav

5. Say "OK Google" and verify wov.wav

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@google.com>
2021-06-11 13:53:12 +01:00
Pierre-Louis Bossart 83638c61a5 buffer: demote info messages to dbg
Move to dbg since having zero bytes to produce/consume is not
necessarily a problem.

Fixes: https://github.com/thesofproject/sof/issues/3308
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
2021-06-11 11:51:19 +01:00
fy.tsuo 87ae3505f6 ipc: abstraction: added SOF_COMP_NONE in comp_specific_builder.
For non-specific type of component, the comp builder will adopt

the process type.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-06-11 11:39:45 +01:00
fy.tsuo d5cb673fa2 audio: igo_nr: reject params for mismatch channel
If source channels != sink channels, simply reject the parameter to avoid
potential bug due to channel mismatch.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-06-11 11:39:45 +01:00
fy.tsuo a85e06a380 audio: igo_nr: added active channel selection
Use binary to configure active channel index.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-06-11 11:39:45 +01:00
fy.tsuo 0ac3b7a470 audio: igo_nr: code refactor
Isolated debug code with CONFIG_DEBUG and renamed a function.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-06-11 11:39:45 +01:00
fy.tsuo b456e36c9a audio: igo_nr: pass through all the other channels
The component handled the first channel and ignored others previously.
Now it processes the first channel and pass though all the others.

Signed-off-by: fy.tsuo <fy.tsuo@intelli-go.com>
2021-06-11 11:39:45 +01:00
Liam Girdwood 7ba1a08862 ipc4: add support for ipc4 boot message and data
Add support to send IPC4 boot message and boot data by providing
a new API to get this data from ABI specific code.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-11 10:34:35 +01:00
Liam Girdwood f6cc7dd499 ipc4: cavs: add support for IPC doorbell header abstraction
This patch allows the doorbell headers to be abstracted by ABI and
support the IPC4 doorbell compact messages on CAVS platforms.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-11 10:34:35 +01:00
Marc Herbert 73df64444b logger: prefix and pad "task add 0xbe05ba30 <bad uid ptr 0x00000000>"
Before:
 WARN task add 0xbe05ba30 <bad uid ptr 0>

After:
 WARN task add 0xbe05ba30 <bad uid ptr 0x00000000>

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 47d9d5465d trace.c: put_header(): make sof->timer optional for early tracing
Avoids crashes when trying to use put_header() early. Learned the hard
way because put_header() has also a timestamp argument.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 6ac13128cd trace: initialize DMA trace _after_ mailbox
The DMA trace is optional, the mailbox is not. This lets use the mailbox
when initializing the DMA trace.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert a1c43ef855 dma-trace: new dma_trace_initialized() function
Avoids duplication and potential divergence.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 29b1a9fc92 trace: rename trace_flush() to trace_flush_dma_to_mbox()
Pure rename, zero functional change.

The very poorly named trace_flush() function sounds like earlier
scheduling of something that would the same later anyway but that's
absolutely not what it does. Instead it copies pending DMA traces to the
shared mailbox.

As an example, in June 2020, PR #3195 commit 6c14e76c0d ("trace: Log
FW ABI and hash numbers") added a tr_info() "banner" immediately after
to make sure tracing works. That included a likely misunderstood
trace_flush() call immediately after the tr_info().

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert ff69d28210 dma-trace.c: remove misunderstood trace_flush() after FW ABI banner
Fixes commit 6c14e76c0d ("trace: Log FW ABI and hash numbers").

In June 2020, PR #3195 added a tr_info() "banner" immediately after to
make sure tracing works.

That commit included a likely misunderstood trace_flush() call
immediately after the tr_info(). The very poorly named trace_flush()
function sounds like earlier scheduling of something that would the same
later anyway but that's absolutely not what it does. Instead it copies
pending DMA traces to the shared mailbox.

This was most likely why the FW ABI banner is randomly duplicated in the
etrace from time to time, see for instance:
https://sof-ci.01.org/linuxpr/PR2954/build5823/devicetest/?model=BYT_MB_NOCODEC&testcase=test-speaker
https://sof-ci.01.org/softestpr/PR666/build721/devicetest/?model=TGLH_RVP_HDA&testcase=check-sof-logger

Note this test failure is unrelated. For now this CI does not read
etrace unless there's a failure.

In August 2020, commit 67a0a6937c ("trace: Trace initial message as
error logs") upgraded this banner from tr_info() to tr_err(). That made
sure it gets to both the mailbox and the DMA trace but it didn't remove
the trace_flush(). Remove it now.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 4ebd4d66a6 dma-trace.c: add some comments
Connect the DMA initialization dots.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 448bbc61a7 logger: print INFO and DEBUG prefixes, not just ERROR and WARN
It's not long and more consistent.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert ab643b7655 logger: catch out of bounds e->params[i] access
... when there are too many % characters in format string. Spotted by
routine valgrind run.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 15:50:21 +01:00
Marc Herbert 9c1d103520 xtensa-build-zephyr.sh: remove west --pristine option
Zephyr's incremental build works and saves time. I have been using it
with SOF for a long time. Slowly rebuilding from scratch is as simple as
deleting the build-$platform/ build directory. Quickly building not from
scratch is not possible without this commit.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 12:29:03 +01:00
Marc Herbert 7d37ca6fa1 xtensa-build-zephyr.sh: use west long options
Zero functional change.

Makes the code and the build logs clearer, especially for SOF people new
to west. Short options are for saving repetitive typing; no reason to
use them in a script.

Also show the real /bin/pwd which can help when west gets lost in
complex symbolic link situations.
https://github.com/zephyrproject-rtos/west/issues/419

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 12:29:03 +01:00
Marc Herbert 3b06515262 Kconfig: add link to Zephyr modules "magic"
Because it's not a documented feature.

"Fixes" commit 9235eb8360 ("kconfig: move BUILD_VM_ROM
Kconfig.xtos-build") / PR #4201

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-10 12:29:03 +01:00
Ranjani Sridharan 5b072d97d5 topology: sof-apl-nocodec: revert to static pipelines
Dynamic pipelines will fail with the sof-apl-nocodec topology
due to issues with the memory allocator. Revert back to
use static pipelines until we have a more flexible memory
allocatory available with Zephyr.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-10 12:11:57 +01:00
Keyon Jie 64c5f3a46b topology: sof-tgl-nocodec-ci: fix DMIC16KHz PCM
Correct the wrong PCM name and pipeline number.

Fixes: 7c62a65ac6 ("topology: sof-tgl-nocodec-ci: add dmic16k coverage")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-09 23:00:13 +08:00
Guennadi Liakhovetski 97cffa5bd6 ll-scheduler: reduce the number of DSP register reads
cpu_get_id() forces a read from a DSP special register. When its
value is reused it's better to force such a read only once.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-09 13:15:49 +01:00
Guennadi Liakhovetski a1b6003e35 ll-scheduler: unregister domain when the last task completes
When all tasks in a domain terminate, the domain has to be
unregistered. This is done when the last LL task in a domain is
cancelled, but it isn't done when such a task completes. This almost
never occurs in practice, because LL tasks usually don't complete,
they are always cancelled. The only case when they complete is in
case of an xrun. Fix handling of such cases.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-09 13:15:49 +01:00
Guennadi Liakhovetski d8295f4c49 ll-scheduler: remove an unused field
The .registered_cores field in struct ll_schedule_domain is never
used, remove it.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-09 13:15:49 +01:00
Brent Lu 5abd8a9ea5 topology: sof-glk-cs42l42: using 2.4MHz bclk
By changing bclk to 2.4MHz, we can use XTAL as clock source and reduce
power consumption.

Signed-off-by: Brent Lu <brent.lu@intel.com>
2021-06-08 21:37:15 +01:00
Seppo Ingalsuo b634aebad7 Drivers: Intel: DMIC: Spinlocks notes add
This patch adds comments to code parts about spinlocks applied
elsewhere to avoid confusion.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-08 21:23:28 +01:00
Seppo Ingalsuo bb683099b8 Drivers: Intel: DMIC: Fix FW panic caused by too eager dmic_remove()
This patch fixes an FW panic that could be triggered by multiple
DMIC DAI capture when pausing, stopping, and resuming. A sequence like
this crashed in last operation

start capture on dmic0, dmic1
pause 0
stop 1
resume 0

It was caused by dmic_remove() for dmic1 that issued pm_runtime_put_sync()
for DMIC clock and power, and freed the dmic_prm[] that resume for 0
needed.

commit 282fe224d8 ("dmic: fix pause/release error leading to invalid
dmic_active_fifos") solved the panic but left the HW start/stop sequence
details incorrect.

commit 73e6a6fab1 ("Driver: Intel: DMIC: Remove state check from
active FIFO mask update") re-introduced the FW panic issue in multiple
DAI capture.

This should be a proper quick fix for pause handling. A successive
patch will clean up the DMIC component data and do this in a nicer
looking way.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-08 21:23:28 +01:00
Seppo Ingalsuo c3814db969 Drivers: Intel: DMIC: Change active_fifos_mask to uint32_t
This patch does not change any functionality. The mask is no more
signed value and cache_to_uncache() needs a multiple of 32 bit type.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-08 21:23:28 +01:00
Keyon Jie 7c62a65ac6 topology: sof-tgl-nocodec-ci: add dmic16k coverage
Add dmic16k to run on Core 0, this will help to cover DMIC dais on
multi-core scenario (dmic 48k on core 2, dmic 16k on core 0).

Also correct the comment w.r.t. DSP cores.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
2021-06-08 16:37:24 +01:00
Seppo Ingalsuo d6e29ced24 Drivers: Intel: DMIC: Remove in_active parameter from dmic_stop()
Cleanup to trigger() since the parameter is not needed to protect from
errors with bit mask active FIFOs tracking.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-04 16:35:50 +01:00
Seppo Ingalsuo 73e6a6fab1 Driver: Intel: DMIC: Remove state check from active FIFO mask update
The mask does not over/undercount events so no need to protect
from multiple start() or stop() calls.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-04 16:35:50 +01:00
Seppo Ingalsuo b2c65e3afc Drivers: Intel: DMIC: Track fifos activity with mask bits
The counter dmic_active_fifos has been a source of many issues. The
use of bits to track active FIFOs is simpler and avoids the risk
of counting to negative or over the actual FIFOs count in various
control scenarios. The incorrect counter value has caused resources
allocate and free and start/stop sequences fails.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-04 16:35:50 +01:00
Kai Vehmanen 76e773bb4f drivers: dmic: fix multi-fifo logic in interrupt handler
When the dmic driver is instantiated multiple times (e.g. for fifo-A and
fifo-B), the interrupt gets registered also twice.

While supported usage of interrupt interface, there is no guarantee that
the interrupt context data is for the expected dai instance. It is thus
not safe to modify the dai state directly or call dai_stop().

Modify the interrupt handler not to make any assumptions on which dai
instance is passed as 'data' matches a specific fifo instance.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-04 13:18:51 +01:00