Unverified Commit 226abb75 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown
Browse files

ASoC: SOF: IPC: Introduce IPC ops



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: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220314200520.1233427-4-ranjani.sridharan@linux.intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0af0f463
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -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
+13 −0
Original line number Diff line number Diff line
@@ -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;
};

/*