Commit Graph

6539 Commits

Author SHA1 Message Date
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
Kai Vehmanen 282fe224d8 dmic: fix pause/release error leading to invalid dmic_active_fifos
The 'in_active' parameter of dmic_stop() is used to control whether
the fifo should be released or not. In case of COMP_TRIGGER_PAUSE,
this should be false and the 'dmic_active_fifos' count should not
be modified.

Without this fix:

  PAUSED -> RELEASE -> dmic_start() -> no change on dmic_active_fifos

  ACTIVE -> PAUSE   -> dmic_stop()  -> dmic_active_fifos--

If a test case repeatedly pauses and releases, 'dmic_active_fifos'
will go out-of-sync.

Fix the issue that dmic_stop for PAUSE does not release the fifo
reference.

Fixes: 22731744cb ("dmic: don't decrement active FIFO count below 0")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-06-04 13:02:30 +01:00
Marc Herbert 3ea21a3afd installer: automate the creation of symlinks inside intel-signed/
In other words:

├── intel-signed
│   ├── sof-cfl.ri -> sof-cnl.ri
│   ├── sof-cml.ri -> sof-cnl.ri
│   ├── sof-glk.ri -> sof-apl.ri

Doing this manually is time-consuming and error-prone.

Not for ehl because it has a different key.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-04 12:05:44 +01:00
Marc Herbert 9f8cce1522 Disable __TIME__ and the non-reproducible build counter by default
Makes even CONFIG_DEBUG builds (locally) deterministic by
default: (re)building twice produces the same binaries. Also a partial
fix for incremental builds: running "make" twice in a row now recompiles
fewer files because version.h does not keep changing.

Also makes sure non-debug builds can't use uninitialized strings in some
future security accident.

Fixes:

 ./scripts/checkpatch.pl -g 'aa85e2c0e956c'

ERROR: Use of the '__DATE__' macro makes the build non-deterministic
+		.date = __DATE__,
ERROR: Use of the '__TIME__' macro makes the build non-deterministic
+		.time = __TIME__,

The previous behavior can be restored using any standard CMake
configuration method, example:

  ./scripts/xtensa-build-all.sh apl
  cmake -B build_apl_gcc/ -DBUILD_COUNTERS=1
  make -C build_apl_gcc

https://reproducible-builds.org/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-06-04 12:00:34 +01:00
Ranjani Sridharan fcaede7a87 ipc: ipc3: Do not reset pipeline components during comp_free
Pipelines can be shared between multiple PCM's. For example,
in the case of the sof-apl-nocodec, a part of pipeline 1
(mixer1.0 ->BUF1.2 ->PGA1.1-> BUF1.3 -> SSP0.OUT)
is shared between PCM0 and PCM7. Setting the source_comp for
pipeline 1 to NULL when PCM0 is stopped results in a panic.
So, hold off resetting the pipeline until the scheduler widget
is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2021-06-03 14:26:08 +01:00
Seppo Ingalsuo 8c497439bc Add GET_BIT() and GET_BITS() macros to bit.h
These macros are useful for decoding bit fields.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-03 14:06:24 +01:00
Viorel Suman 58b4aa472a topology: imx8: add kwd component with wm8960 codec
Add KWD topology for imx8: SAI1 and wm8960 codec
used for recording.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
2021-06-03 13:49:58 +01:00
Curtis Malainey 89e7983498 probe: fix realloc mishandling
you need to use a temp var always with realloc, otherwise you through
away your pointer to your memory (which is still valid) in the event of
realloc failing.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-06-03 13:32:59 +01:00
Curtis Malainey ead5afa6c2 probe: refactor function to decrease indent
following commit fixes a bug but to do the fix we need to allow
ourselves more room to add ifs, so lets pull out this function

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2021-06-03 13:32:59 +01:00
Seppo Ingalsuo 8cec7d3ef1 Topology: Allow 8 - 192 kHz rates for Media Playback PCM
The pipeline was limited to 48 kHz min and max that is not
useful for running and testing SRC component.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
2021-06-03 13:21:35 +01:00
Guennadi Liakhovetski 62caecc114 zephyr: schedule: start the timer during domain registration
The Zephyr scheduling domain is triggered by a periodic timer, which
is started when the first task in the domain is scheduled and
stopped when the domain is unregistered. Since the timer period is
anyway fixed, it's even easier to just start the timer when the
domain is registered. This eliminates the need for the .domain_set()
method completely.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-06-03 11:03:10 +01:00
Liam Girdwood 60a6b1330e testbench: improve error messaging on file failures.
Tell the user the error.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00
Liam Girdwood da67183a6b testbench: fix the component type for file writer.
Incorrectly set as filereader. Fix it.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2021-06-03 09:31:27 +01:00