ASoC: SOF: client-probes: Add support for IPC4
Subsystems (3)
Peter Ujfalusi
maintainercover ASoC: SOF: client-probes: Add support for IPC4
Hi,
The probes (the ability of probing the audio data from firmware processing points or to receive stream of debug/trace information) is supported by IPC4 as well, but due to the differences between the two IPC version the low level setup and information we need for probing is different.
This series will extend the existing probes support for IPC3 with IPC4 'backend'
Regards,
Peter
---
Jyri Sarha (5):
ASoC: SOF: probes: Replace [0] union members with DECLARE_FLEX_ARRAY()
ASoC: SOF: probes: Separate IPC3 operations to a separate file
ASoC: SOF: client: Add sof_client_ipc_set_get_data()
ASoC: SOF: client: Add sof_client_ipc4_find_module() function
ASoC: SOF: IPC4: probes: Implement IPC4 ops for probes client device
sound/soc/sof/Makefile | 6 + sound/soc/sof/ipc.c | 8 + sound/soc/sof/sof-client-probes-ipc3.c | 236 +++++++++++++++++++++ sound/soc/sof/sof-client-probes-ipc4.c | 281 +++++++++++++++++++++++++ sound/soc/sof/sof-client-probes.c | 268 +++-------------------- sound/soc/sof/sof-client-probes.h | 34 +++ sound/soc/sof/sof-client.c | 34 +++ sound/soc/sof/sof-client.h | 6 + sound/soc/sof/sof-priv.h | 2 + 9 files changed, 637 insertions(+), 238 deletions(-) create mode 100644 sound/soc/sof/sof-client-probes-ipc3.c create mode 100644 sound/soc/sof/sof-client-probes-ipc4.c
Signature · 1 line
2.38.1
Peter Ujfalusi
maintainerPATCH 1/5 ASoC: SOF: probes: Replace [0] union members with DECLARE_FLEX_ARRAY()
From: Jyri Sarha <[email protected]>
Replace probes related [0] arrays, all found within unions, with DECLARE_FLEX_ARRAY() declarations.
--- sound/soc/sof/sof-client-probes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/sof/sof-client-probes.c +3 -2
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/pm_runtime.h> #include <linux/string_helpers.h> +#include <linux/stddef.h> #include <sound/soc.h> #include <sound/sof/header.h>
@@ -59,8 +60,8 @@ struct sof_ipc_probe_info_params {struct sof_ipc_reply rhdr;unsigned int num_elems;union { -struct sof_probe_dma dma[0 ]; -struct sof_probe_point_desc desc[0 ]; + DECLARE_FLEX_ARRAY(struct sof_probe_dma, dma); + DECLARE_FLEX_ARRAY(struct sof_probe_point_desc, desc); }; } __packed;
Signature · 1 line
2.38.1
Peter Ujfalusi
maintainerPATCH 2/5 ASoC: SOF: probes: Separate IPC3 operations to a separate file
In reply to Peter UjfalusiFrom: Jyri Sarha <[email protected]>
Declare an IPC ops struct for probes client device and move IPC3 functions behind it.
--- sound/soc/sof/Makefile | 2 +- sound/soc/sof/sof-client-probes-ipc3.c | 236 ++++++++++++++++++++++++ sound/soc/sof/sof-client-probes.c | 239 ++----------------------- sound/soc/sof/sof-client-probes.h | 21 +++ 4 files changed, 272 insertions(+), 226 deletions(-) create mode 100644 sound/soc/sof/sof-client-probes-ipc3.c
sound/soc/sof/Makefile +1 -1
@@ -26,7 +26,7 @@ snd-sof-of-objs := sof-of-dev.o snd-sof-ipc-flood-test-objs := sof-client-ipc-flood-test.o snd-sof-ipc-msg-injector-objs := sof-client-ipc-msg-injector.o -snd-sof-probes-objs := sof-client-probes.o +snd-sof-probes-objs := sof-client-probes.o sof-client-probes-ipc3.o snd-sof-nocodec-objs := nocodec.o
sound/soc/sof/sof-client-probes-ipc3.c new file +236 -0
236 lines not on this page · raw message
sound/soc/sof/sof-client-probes.c +14 -225
321 lines not on this page · raw message
sound/soc/sof/sof-client-probes.h +21 -0
@@ -28,4 +28,25 @@ struct sof_probes_host_ops { struct snd_soc_dai *dai); }; +struct sof_probe_point_desc { +unsigned int buffer_id; +unsigned int purpose; +unsigned int stream_tag; +} __packed; + +struct sof_probes_ipc_ops { +int (*init)(struct sof_client_dev *cdev,u32 stream_tag, +size_t buffer_size); +int (*deinit)(struct sof_client_dev *cdev); +int (*points_info)(struct sof_client_dev *cdev, +struct sof_probe_point_desc **desc, +size_t *num_desc); +int (*points_add)(struct sof_client_dev *cdev, +struct sof_probe_point_desc *desc, +size_t num_desc); +int (*points_remove)(struct sof_client_dev *cdev, +unsigned int *buffer_id,size_t num_buffer_id); +}; + +extern const struct sof_probes_ipc_ops ipc3_probe_ops;#endif
Signature · 1 line
2.38.1
Peter Ujfalusi
maintainerPATCH 3/5 ASoC: SOF: client: Add sof_client_ipc_set_get_data()
In reply to Peter UjfalusiFrom: Jyri Sarha <[email protected]>
No need to duplicate set_get_data msg handling in clients.
--- sound/soc/sof/ipc.c | 8 ++++++++ sound/soc/sof/sof-client.c | 19 +++++++++++++++++++ sound/soc/sof/sof-client.h | 2 ++ sound/soc/sof/sof-priv.h | 2 ++ 4 files changed, 31 insertions(+)
sound/soc/sof/ipc.c +8 -0
@@ -84,6 +84,14 @@ int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes }EXPORT_SYMBOL (sof_ipc_tx_message); +/* IPC set or get data from host to DSP */ +int sof_ipc_set_get_data (struct snd_sof_ipc *ipc,void *msg_data, +size_t msg_bytes,bool set) +{ +return ipc->ops->set_get_data (ipc->sdev, msg_data, msg_bytes, set); +} +EXPORT_SYMBOL (sof_ipc_set_get_data); +/* * send IPC message from host to DSP without modifying the DSP state. * This will be used for IPC's that can be handled by the DSP
sound/soc/sof/sof-client.c +19 -0
@@ -265,6 +265,25 @@ int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg, }EXPORT_SYMBOL_NS_GPL (sof_client_ipc_tx_message,SND_SOC_SOF_CLIENT ); +int sof_client_ipc_set_get_data (struct sof_client_dev *cdev,void *ipc_msg, +bool set) +{ +if (cdev->sdev->pdata->ipc_type ==SOF_IPC ) { +struct sof_ipc_cmd_hdr *hdr = ipc_msg; + +return sof_ipc_set_get_data (cdev->sdev->ipc, ipc_msg, hdr->size, + set); + }else if (cdev->sdev->pdata->ipc_type ==SOF_INTEL_IPC4 ) { +struct sof_ipc4_msg *msg = ipc_msg; + +return sof_ipc_set_get_data (cdev->sdev->ipc, ipc_msg, + msg->data_size, set); + } + +return -EINVAL ; +} +EXPORT_SYMBOL_NS_GPL (sof_client_ipc_set_get_data,SND_SOC_SOF_CLIENT ); +int sof_suspend_clients (struct snd_sof_dev *sdev,pm_message_t state) {struct auxiliary_driver *adrv;
sound/soc/sof/sof-client.h +2 -0
@@ -37,6 +37,8 @@ struct sof_client_dev {int sof_client_ipc_tx_message (struct sof_client_dev *cdev,void *ipc_msg,void *reply_data,size_t reply_bytes); +int sof_client_ipc_set_get_data (struct sof_client_dev *cdev,void *ipc_msg, +bool set);struct dentry *sof_client_get_debugfs_root (struct sof_client_dev *cdev);struct device *sof_client_get_dma_dev (struct sof_client_dev *cdev);
sound/soc/sof/sof-priv.h +2 -0
@@ -680,6 +680,8 @@ static inline void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev) }int sof_ipc_tx_message (struct snd_sof_ipc *ipc,void *msg_data,size_t msg_bytes,void *reply_data,size_t reply_bytes); +int sof_ipc_set_get_data (struct snd_sof_ipc *ipc,void *msg_data, +size_t msg_bytes,bool set);int sof_ipc_tx_message_no_pm (struct snd_sof_ipc *ipc,void *msg_data,size_t msg_bytes,void *reply_data,size_t reply_bytes); int sof_ipc_send_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
Signature · 1 line
2.38.1
Peter Ujfalusi
maintainerPATCH 4/5 ASoC: SOF: client: Add sof_client_ipc4_find_module() function
In reply to Peter UjfalusiFrom: Jyri Sarha <[email protected]>
Add sof_client_ipc4_find_module() for calling sof_ipc4_find_module_by_uuid() in sof client code.
--- sound/soc/sof/sof-client.c | 15 +++++++++++++++ sound/soc/sof/sof-client.h | 4 ++++ 2 files changed, 19 insertions(+)
sound/soc/sof/sof-client.c +15 -0
@@ -16,6 +16,7 @@#include "ops.h" #include "sof-client.h" #include "sof-priv.h" +#include "ipc4-priv.h" /** * struct sof_ipc_event_entry - IPC client event description
@@ -284,6 +285,20 @@ int sof_client_ipc_set_get_data(struct sof_client_dev *cdev, void *ipc_msg, }EXPORT_SYMBOL_NS_GPL (sof_client_ipc_set_get_data,SND_SOC_SOF_CLIENT ); +#ifdef CONFIG_SND_SOC_SOF_INTEL_IPC4 +struct sof_ipc4_fw_module *sof_client_ipc4_find_module (struct sof_client_dev *c,const guid_t *uuid) +{ +struct snd_sof_dev *sdev = c->sdev; + +if (sdev->pdata->ipc_type ==SOF_INTEL_IPC4 ) +return sof_ipc4_find_module_by_uuid (sdev, uuid); +dev_err (sdev->dev,"Only supported with IPC4\n" ); + +return NULL ; +} +EXPORT_SYMBOL_NS_GPL (sof_client_ipc4_find_module,SND_SOC_SOF_CLIENT ); +#endif +int sof_suspend_clients (struct snd_sof_dev *sdev,pm_message_t state) {struct auxiliary_driver *adrv;
sound/soc/sof/sof-client.h +4 -0
@@ -13,6 +13,8 @@ struct sof_ipc_cmd_hdr;struct snd_sof_dev ;struct dentry ; +struct sof_ipc4_fw_module ; +/** * struct sof_client_dev - SOF client device * @auxdev: auxiliary device
@@ -40,6 +42,8 @@ int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg,int sof_client_ipc_set_get_data (struct sof_client_dev *cdev,void *ipc_msg,bool set); +struct sof_ipc4_fw_module *sof_client_ipc4_find_module (struct sof_client_dev *c,const guid_t *u); +struct dentry *sof_client_get_debugfs_root (struct sof_client_dev *cdev);struct device *sof_client_get_dma_dev (struct sof_client_dev *cdev);const struct sof_ipc_fw_version *sof_client_get_fw_version (struct sof_client_dev *cdev);
Signature · 1 line
2.38.1
Peter Ujfalusi
maintainerPATCH 5/5 ASoC: SOF: IPC4: probes: Implement IPC4 ops for probes client device
In reply to Peter UjfalusiFrom: Jyri Sarha <[email protected]>
Implement IPC operations for IPC4 messaging and add doxygen documentation for the functions.
--- sound/soc/sof/Makefile | 8 +- sound/soc/sof/sof-client-probes-ipc4.c | 281 +++++++++++++++++++++++++ sound/soc/sof/sof-client-probes.c | 32 +-- sound/soc/sof/sof-client-probes.h | 13 ++ 4 files changed, 318 insertions(+), 16 deletions(-) create mode 100644 sound/soc/sof/sof-client-probes-ipc4.c
sound/soc/sof/Makefile +7 -1
@@ -26,7 +26,13 @@ snd-sof-of-objs := sof-of-dev.o snd-sof-ipc-flood-test-objs := sof-client-ipc-flood-test.o snd-sof-ipc-msg-injector-objs := sof-client-ipc-msg-injector.o -snd-sof-probes-objs := sof-client-probes.o sof-client-probes-ipc3.o +snd-sof-probes-objs := sof-client-probes.o +ifneq ($(CONFIG_SND_SOC_SOF_IPC3),) +snd-sof-probes-objs += sof-client-probes-ipc3.o +endif +ifneq ($(CONFIG_SND_SOC_SOF_INTEL_IPC4),) +snd-sof-probes-objs += sof-client-probes-ipc4.o +endif snd-sof-nocodec-objs := nocodec.o
sound/soc/sof/sof-client-probes-ipc4.c new file +281 -0
281 lines not on this page · raw message
sound/soc/sof/sof-client-probes.c +17 -15
@@ -30,16 +30,6 @@ static bool __read_mostly sof_probes_enabled;module_param_named (enable, sof_probes_enabled, bool,0444 );MODULE_PARM_DESC (enable,"Enable SOF probes support" ); -struct sof_probes_priv { -struct dentry *dfs_points; -struct dentry *dfs_points_remove; -u32 extractor_stream_tag; -struct snd_soc_card card; - -const struct sof_probes_host_ops *host_ops; -const struct sof_probes_ipc_ops *ipc_ops; -}; -static int sof_probes_compr_startup (struct snd_compr_stream *cstream,struct snd_soc_dai *dai) {
@@ -409,10 +399,6 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,if (!sof_probes_enabled)return -ENXIO ; -/* only ipc3 is supported */ -if (sof_client_get_ipc_type (cdev) !=SOF_IPC ) -return -ENXIO ; -if (!dev->platform_data) {dev_err (dev,"missing platform data\n" );return -ENODEV ;
@@ -431,7 +417,23 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev, } priv->host_ops = ops; - priv->ipc_ops = &ipc3_probe_ops; + +switch (sof_client_get_ipc_type (cdev)) { +#ifdef CONFIG_SND_SOC_SOF_INTEL_IPC4 +case SOF_INTEL_IPC4 : + priv->ipc_ops = &ipc4_probe_ops; +break ; +#endif +#ifdef CONFIG_SND_SOC_SOF_IPC3 +case SOF_IPC : + priv->ipc_ops = &ipc3_probe_ops; +break ; +#endif +default : +dev_err (dev,"Matching IPC ops not found." ); +return -ENODEV ; + } + cdev->data = priv;/* register probes component driver and dai */
sound/soc/sof/sof-client-probes.h +13 -0
@@ -49,4 +49,17 @@ struct sof_probes_ipc_ops { };extern const struct sof_probes_ipc_ops ipc3_probe_ops; +extern const struct sof_probes_ipc_ops ipc4_probe_ops; + +struct sof_probes_priv { +struct dentry *dfs_points; +struct dentry *dfs_points_remove; +u32 extractor_stream_tag; +struct snd_soc_card card; +void *ipc_priv; + +const struct sof_probes_host_ops *host_ops; +const struct sof_probes_ipc_ops *ipc_ops; +}; +#endif
Signature · 1 line
2.38.1
Mark Brown
maintainerQuoted 8 lines · Peter Ujfalusi
The probes (the ability of probing the audio data from firmware processing points or to receive stream of debug/trace information) is supported by IPC4 as well, but due to the differences between the two IPC version the low level setup and information we need for probing is different.
This series will extend the existing probes support for IPC3 with IPC4 'backend'
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/5] ASoC: SOF: probes: Replace [0] union members with DECLARE_FLEX_ARRAY()
commit: b7b080cf3c33976eb2b51f73948dd9a6109a1107
[2/5] ASoC: SOF: probes: Separate IPC3 operations to a separate file
commit: ccf06b148fc22e3a964308df1d158c87710a35bd
[3/5] ASoC: SOF: client: Add sof_client_ipc_set_get_data()
commit: d8bc54a5f2cb8b3bc2d727badc351b0ad24eb702
[4/5] ASoC: SOF: client: Add sof_client_ipc4_find_module() function
commit: 7f0a3dff1f23eadbc36a64600ad2c17912163b66
[5/5] ASoC: SOF: IPC4: probes: Implement IPC4 ops for probes client device
commit: f5623593060fc2f4d84781edcc5d15e44acfcbf6All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark