Commit Graph

39 Commits

Author SHA1 Message Date
Ranjani Sridharan addc349d6a ipc4: helper: Remove hardcoded UUID map for CONFIG_LIBRARY
Always append the UUID to the end of the module init IPC data and use
that to look up the component driver instead of using the hardcoded UUID
map. This will make it easier to support new processing elements with
the plugin/testbench. Also, modify the get/set_large_config handlers to
use the component driver set in the dev instead of looking it up again.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-10-02 15:03:56 +03:00
Ranjani Sridharan 88cde10fec tools: plugin: ctl: Add support for bytes control
Add a new field in struct plug_shm_ctl to save the bytes data from
topology for bytes controls. This will be used to send the kcontrol data
to the modules right after they are instantiated. Fix the tlv callback
in the control to handle the tlv bytes read/write when using sof-ctl.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-19 18:21:33 +01:00
Ranjani Sridharan ec8c6c765d tools: plugin: common: Move plug_ctl_ipc_message() definition to common code
It will be used by both the PCM and the control plugin.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-19 18:21:33 +01:00
Ranjani Sridharan 08a1a84027 tools: plugin: Move plug_mq_cmd_tx_rx() definition to common code
It will be used by both the PCM and the control plugin.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-19 18:21:33 +01:00
Ranjani Sridharan 28f4ef57a6 tool: plugin: tplg: Parse kcontrols for process type widgets
Parse and set up the kcontrols during topology parsing.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-19 18:21:33 +01:00
Ranjani Sridharan 3d2df90f2e tools: plugin: tplg_ctl: Set control type
Set the type while parsing the controls.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-19 18:21:33 +01:00
Marcin Szkudlinski a1b89e08a2 buf: make all the modules use comp_dev_get_first_data_producer
Change all access to the first element of dev->bsource_list
from direct to API call comp_dev_get_first_data_producer

access in pipeline management code, like module adapter,
is omitted intentionally

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-19 12:43:39 +03:00
Marcin Szkudlinski 718df513f2 buf: make all the modules use comp_dev_get_first_data_consumer
Change all access to the first element of dev->bsink_list
from direct to API call comp_dev_get_first_data_consumer

access in pipeline management code, like module adapter,
is omitted intentionally

Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
2024-09-19 12:43:39 +03:00
Ranjani Sridharan d7c0b5573f tools: plugin: Add support for enum controls
Add support for enum controls in the plugin. Fix the get_attribute and
get_enumerated_name callbacks to use the enum control items instad of
the count.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-17 16:21:25 +01:00
Ranjani Sridharan 5b606a94dd tools: plugin: ctl: Add a helper function to configure the IPC message
This will avoid the duplicated code when configuring the IPC message for
kcontrol IO.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-17 16:21:25 +01:00
Ranjani Sridharan 5416adbc23 tools: plugin: ctl: Fix reply_data_size calculation
Use the size of struct ipc4_module_large_config_reply instead of the
size of the pointer.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-17 16:21:25 +01:00
Ranjani Sridharan 0ae6a330aa tools: plugin: tplg_ctl: Use the ops info to determine kcontrol type
Use the ops info to differentiate the different kcontrols in topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-17 16:21:25 +01:00
Ranjani Sridharan ce385cf32a tools: plugin: Add index for kcontrols
Add an index field for kcontrols. This will be useful in differenciating
kcontrols of the same type in a widget. Modify the signature of the
control callback function to pass the index as an argument when creating
kcontrols. Pass 0 for ipc3 kcontrol builds as it will be unused in this
case anyway.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-17 16:21:25 +01:00
Ranjani Sridharan 08754de013 plugin: alsaplug: Add kcontrol set up callback
Define the callback for setting up kcontrols in the plugin. Add a few
new fields in struct plug_shm_ctl to store the module info and the
volume table for converting mixer values to linear volume gain.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-13 12:50:54 +03:00
Ranjani Sridharan 58465b8750 tools: plugin: tplg: Pass comp_info when creating controls for pga
This will be used to store the module id and instance ID when creating
the volume controls.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-13 12:50:54 +03:00
Ranjani Sridharan 4c3c1ed7dd plugin: alsaplug: pcm: Init the global context earlier
Initialize the shared memory for the global context during init so that
it can be used to store the kcontrol info during topology parsing. Move
the glb_ctx field from struct snd_sof_pcm to struct snd_sof_plug so that
it can be accessed during topology parsing.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-13 12:50:54 +03:00
Ranjani Sridharan 40c1a7d55f tools: plugin: alsaplug: ctl: Fix control ops for IPC4
Fix the read/write integer operations for IPC4 and the IPC messages
queues in the plugin kcontrol. Convert the bytes/enum ops implementation
to stubs. Support for these will be added later.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-13 12:50:54 +03:00
Ranjani Sridharan 139120033f plugin: alsaplug: Modify the signature of plug_parse_conf()
In preparation for parsing just the topology file from the command line
for kcontrols, modify the signature of plug_parse_conf() to add an
argument to specify it.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-13 12:50:54 +03:00
Ranjani Sridharan 847b2ae7a7 tools: plugin: noise_suppression: Fix build error
Recent changes to UUID naming dropped the _comp in the UUID declaration.
Fix the noise suppression module to adhere to the new naming while
declaring the module interface and trace.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-09-02 11:24:53 +01:00
Marc Herbert 21e2028bef tools/plugin: drop bogus -Wl,-EL binutils endianness option
This mysterious option has been causing portability issues and has never
made any difference, see previous commits for details.

I compiled the plugin with and without it and there was absolutely zero
binary difference.

Let's remove it from all tools/plugin/ CMakeLists.txt files before the
mass copy/paste/diverge there spreads it even more.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-08-09 13:03:46 +03:00
Andy Ross 17f46a71ee uuid: Use new UUID registry pervasively
Strip out all the literall UUID management from existing C code (the
API itself still works for any out-of-tree or test code users) and
exclusively use the new, much simpler, SOF_DEFINE_REG_UUID() macro
which sources IDs from the registry by name.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross fdb039ef5f everywhere: Normalize UUID naming
UUIDs are defined with both a string name (used mostly just for trace
output on legacy xtos builds) and a symbol name used as a global
variable to tie the struct to e.g. component driver definitions.  And
because human beings are allowed to type them in, they have been
somewhat inconsistently defined.  Normalize them so the string name
and the symbol name match (the symbol has a "_uuid" suffix).

Some of these rules are fairly regular:

* Some of the component drivers added a "_comp" to the global symbol
  name and some didn't.  Strip the ones that included it.

* Some naming liked dashes where underscores would be present in a
  symbol name (e.g. "dw-dma" for dw_dma_uuid).  Unify the conventions
  so all name strings are valid C symbols.

* Applying those rules produces a collision between "dai" UUIDs
  defined in dai.c, dai_legacy.c and dai_zephyr.c, so the latter two
  have been renamed to "dai_legacy" and "dai_zephyr".

And in a handful of spots the code just wasn't consistent.  These
UUIDs have been manually renamed, generally trying to pick a name the
corresponds to the original string name, or to the C file that defines
them if that seems impractical:

    Orig. String Name      Orig. Symbol     New Unified Name
    =================      ============     ================
    Maxim DSM              smart_amp        maxim_dsm
    Passthru Amp           smart_amp        passthru_smart_amp
    agent_work             agent_work_task  agent_work
    cadence_codec          cadence          cadence_codec
    channel_map            chmap            chmap
    comp_task              idc_comp_task    idc_comp
    component              comp             component
    dp_schedule            dp_sched         dp_sched
    dts_codec              dts              dts
    edf_schedule           edf_sched        edf_sched
    google_hotword_detect  ghd              google_hotword
    ipcgw                  ipcgtw           ipcgw
    irq_818x               irq_mt818x       irq_mt818x
    kd_test                keyword          keyword
    ll_schedule            ll_sched         ll_sched
    memory                 mem              mem
    micfil_dai             micfil           micfil
    mix_in                 mixin            mixin
    mix_out                mixout           mixout
    modules                intel            modules
    passthrough_codec      passthrough      passthrough
    pga                    volume           volume
    posix_ipc_task         ipc_task         ipc_task
    schedule               sch              schedule
    spi_completion         spi_compl_task   spi_completion
    waves_codec            waves            waves
    zll_schedule           zll_sched        zll_sched

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Andy Ross a3c1b75808 uuid: Rename DECLARE_SOF(_RT)?_UUID() -> SOF_DEFINE_UUID()
Complete the unification of the diverged UUID APIs with a big rename.
Call it "DEFINE" instead of "DECLARE" since this is in fact a C struct
definition and not just a declaration of a type or extern symbol.

Signed-off-by: Andy Ross <andyross@google.com>
2024-07-05 14:32:56 +01:00
Ranjani Sridharan 9b7fffd0d5 tools: plugin: tplg: Fix a couple of memory leaks
Free the memory allocated for tplg base and available input/output
formats when the topology is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-06-19 21:16:52 +03:00
Yong Zhi 9c334976c4 tools: plugin: README: remove reference to tgl-nocodec
Fix the tplg name to match the actual name used in example.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
2024-06-18 14:29:11 +01:00
Ranjani Sridharan f38f118b93 plugin: noise_suppression_interface: Query available devices
Query the list of available devices and use the NPU if available,
otherwise compile the model for the CPU.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-05-22 15:20:05 +01:00
Kai Vehmanen d0239c70da tools: plugin: ipc4: fix build error in switch-case
A label must be followed with a statement and declaration is
not a statement. Enclose the case in brackets to avoid compiler
error on this.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-04-17 14:35:17 +03:00
Ranjani Sridharan 48462a47bd tools: plugin: README: Add instructions for testing noise suppression
Fix the stale instruction for install and add the steps for setting up
OpenVino/OpenCV to test the noise suppression model from the open model
zoo repository.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 06b3e329da tools: plugin: modules: Introduce the OpenVino noise suppression module
Introduce a new module that performs noise suppression. The module loads
the noise suppression model using the OpenVino Runtime plugin, processes
the input samples to produce output samples with clean speech.
CUrrently, the module is hard-coded to compile the model to be run on
the CPU only and will be extended for other devices like the NPU in the
future.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan de2d39514f tools: plugin: 50-sof: Add new config for 16KHz stereo 16-bit format
This will be needed for the plugin voice PCM in preparation to add the
noise suppression module in the host pipeline.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 850e1d3eb3 tools: plugin: Fix prepare/free widgets for capture
Set the host widget correctly and use the capture specific functions
during prepare/free.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 47a17d7fcf tools: plugin: tplg: Fix ibs/obs for all widgets
Set both ibs/obs to be based on the ALSA period_size to make sure that the
intermediate buffers are large enough.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 4feebf2a5c tools: plugin: tplg: Fix parsing of process widgets
For now, only process widgets that don't need the basecfg extension are
supported.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan 61fdc16240 tools: plugin: pcm: Add missing return
Add the missing return in the hw_free callback.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-16 21:45:27 +02:00
Ranjani Sridharan a5bdcce1e1 topology2: Add topology for testing SOF plugin
The topology uses passthrough pipelines for playback/capture and
supports only 48k, 2ch, 16bit format for now.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2024-02-05 18:16:40 +02:00
Ranjani Sridharan e65eb8500c tools: plugin: Fix hybrid pipeline support
Fix the pcm handle name and the params to fix playback/capture with
hybrid host-dsp pipeline.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-12-05 11:10:49 +02:00
Marc Herbert 50c224a2c7 tools/plugin/README.md: add -GNinja. Remove stale -DPLUGIN_IPC4
Add instructions to build sof_ep and parser_ep first to avoid dependency
issue and race condition.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-12-01 13:09:19 -08:00
Ranjani Sridharan 48324bd3f4 tools: plugin: alsa: Remove calls to buffer_acquire/release
These dont exist anymore.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2023-11-22 09:41:50 +02:00
Liam Girdwood 87148abf1e tools: Introduce the SOF ALSA plugin
The SOF ALSA plugin allows SOF topologies to be run on the host. The plugin
is still WIP with many rough edges that need refined before production
deployment, however the plugin is usable today as a rapid development
framework for SOF infrastructure and processing.

Features that are function in the current implementation
 * aplay & arecord usage working today
 * modules are loaded as SO shared libraries.
 * topology is parsed by the plugin and pipelines associated with the requested PCM ID are loaded
 * pipelines run as individual userspace threads
 * pipelines can be pinned to efficency cores
 * pipelines can use realtime priority.
 * alsa sink and alsa source modules available.
 * pipelines can block (non blocking and mmap todo)
 * 16-bit playback and capture support. Other formats to be added soon

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
2023-09-29 14:46:34 +01:00