All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: =tiwai@suse.com,
	"Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
	broonie@kernel.org, "Bard Liao" <yung-chuan.liao@linux.intel.com>
Subject: [PATCH 02/18] ASoC: SOF: IPC: Introduce IPC ops
Date: Mon, 14 Mar 2022 13:05:04 -0700	[thread overview]
Message-ID: <20220314200520.1233427-4-ranjani.sridharan@linux.intel.com> (raw)
In-Reply-To: <20220314200520.1233427-1-ranjani.sridharan@linux.intel.com>

In preparation for supporting a new IPC version that will be introduced
in the SOF firmware, add a new set of ops that will be version specific.

For now, the IPC ops contain only the topology-related ops for setting
up widgets and pipeline connections. It will be expanded later to also
abstract the IPC-specific items in the component driver and DAI driver.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-audio.h | 36 ++++++++++++++++++++++++++++++++++++
 sound/soc/sof/sof-priv.h  | 13 +++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index 548d443e83b0..79041622987f 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -30,6 +30,42 @@
 
 #define WIDGET_IS_DAI(id) ((id) == snd_soc_dapm_dai_in || (id) == snd_soc_dapm_dai_out)
 
+struct snd_sof_widget;
+struct snd_sof_route;
+
+/**
+ * struct sof_ipc_tplg_widget_ops - IPC-specific ops for topology widgets
+ * @ipc_setup: Function pointer for setting up widget IPC params
+ * @ipc_free: Function pointer for freeing widget IPC params
+ * @token_list: List of token ID's that should be parsed for the widget
+ * @token_list_size: number of elements in token_list
+ * @bind_event: Function pointer for binding events to the widget
+ */
+struct sof_ipc_tplg_widget_ops {
+	int (*ipc_setup)(struct snd_sof_widget *swidget);
+	void (*ipc_free)(struct snd_sof_widget *swidget);
+	enum sof_tokens *token_list;
+	int token_list_size;
+	int (*bind_event)(struct snd_soc_component *scomp, struct snd_sof_widget *swidget,
+			  u16 event_type);
+};
+
+/**
+ * struct sof_ipc_tplg_ops - IPC-specific topology ops
+ * @widget: Array of pointers to IPC-specific ops for widgets. This should always be of size
+ *	    SND_SOF_DAPM_TYPE_COUNT i.e one per widget type. Unsupported widget types will be
+ *	    initialized to 0.
+ * @route_setup: Function pointer for setting up pipeline connections
+ * @token_list: List of all tokens supported by the IPC version. The size of the token_list
+ *		array should be SOF_TOKEN_COUNT. The unused elements in the array will be
+ *		initialized to 0.
+ */
+struct sof_ipc_tplg_ops {
+	const struct sof_ipc_tplg_widget_ops *widget;
+	int (*route_setup)(struct snd_sof_dev *sdev, struct snd_sof_route *sroute);
+	const struct sof_token_info *token_list;
+};
+
 /** struct snd_sof_tuple - Tuple info
  * @token:	Token ID
  * @value:	union of a string or a u32 values
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 28d3f1ac8be8..0dab5b70406e 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -360,6 +360,16 @@ struct snd_sof_ipc_msg {
 	bool ipc_complete;
 };
 
+struct sof_ipc_tplg_ops;
+
+/**
+ * struct sof_ipc_ops - IPC-specific ops
+ * @tplg:	Pointer to IPC-specific topology ops
+ */
+struct sof_ipc_ops {
+	const struct sof_ipc_tplg_ops *tplg;
+};
+
 /* SOF generic IPC data */
 struct snd_sof_ipc {
 	struct snd_sof_dev *sdev;
@@ -370,6 +380,9 @@ struct snd_sof_ipc {
 	bool disable_ipc_tx;
 
 	struct snd_sof_ipc_msg msg;
+
+	/* IPC ops based on version */
+	const struct sof_ipc_ops *ops;
 };
 
 /*
-- 
2.25.1


  parent reply	other threads:[~2022-03-14 20:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 20:05 [PATCH 00/18] Introduce IPC abstraction for SOF topology parsing Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 01/18] ASoC: SOF: Introduce struct snd_sof_dai_link Ranjani Sridharan
2022-03-14 20:05 ` [PATCH] ASoC: SOF: IPC4-tooplogy: Add ccore tokens Ranjani Sridharan
2022-03-14 20:07   ` Ranjani Sridharan
2022-03-14 20:05 ` Ranjani Sridharan [this message]
2022-03-14 20:05 ` [PATCH 03/18] ASoC: SOF: topology: Add helper function for processing tuple arrays Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 04/18] ASoC: SOF: Introduce IPC3 ops Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 05/18] ASoC: SOF: topology: Make scheduler widget parsing IPC agnostic Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 06/18] ASoC: SOF: topology: Make buffer " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 07/18] ASoC: SOF: topology: Make pga " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 08/18] ASoC: SOF: topology: Make mixer " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 09/18] ASoC: SOF: topology: Make mux/demux " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 10/18] ASoC: SOF: topology: Make src " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 11/18] ASoC: SOF: topology: Make asrc " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 12/18] ASoC: SOF: topology: Make siggen " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 13/18] ASoC: SOF: topology: Make effect " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 14/18] ASoC: SOF: topology: Make route setup " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 15/18] ASoC: SOF: topology: Make DAI widget parsing " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 16/18] ASoC: SOF: topology: Make control " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 17/18] ASoC: SOF: topology: Make widget binding " Ranjani Sridharan
2022-03-14 20:05 ` [PATCH 18/18] ASoC: SOF: topology: remove snd_sof_complete_pipeline() Ranjani Sridharan
2022-03-16 20:36 ` [PATCH 00/18] Introduce IPC abstraction for SOF topology parsing Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220314200520.1233427-4-ranjani.sridharan@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc==tiwai@suse.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.