All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	upstream@semihalf.com, harshapriya.n@intel.com, rad@semihalf.com,
	pierre-louis.bossart@linux.intel.com, tiwai@suse.com,
	hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com,
	cujomalainey@chromium.org, lma@semihalf.com
Subject: [PATCH 13/14] ASoC: Intel: avs: Prepare modules before bindings them
Date: Mon, 28 Mar 2022 19:24:09 +0200	[thread overview]
Message-ID: <20220328172410.761309-14-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20220328172410.761309-1-cezary.rojewski@intel.com>

When binding modules to pins other than pin0, sometimes additional
preparations need to be made, depending on the module type.
Add function that prepares modules when necessary before binding them.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/path.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index abeb6921fcce..b5c0f89add4f 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -466,6 +466,37 @@ struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
 	return path;
 }
 
+static int avs_path_bind_prepare(struct avs_dev *adev,
+				 struct avs_path_binding *binding)
+{
+	const struct avs_audio_format *src_fmt, *sink_fmt;
+	struct avs_tplg_module *tsource = binding->source->template;
+	struct avs_path_module *source = binding->source;
+	int ret;
+
+	/*
+	 * only copier modules about to be bound
+	 * to output pin other than 0 need preparation
+	 */
+	if (!binding->source_pin)
+		return 0;
+	if (!guid_equal(&tsource->cfg_ext->type, &AVS_COPIER_MOD_UUID))
+		return 0;
+
+	src_fmt = tsource->in_fmt;
+	sink_fmt = binding->sink->template->in_fmt;
+
+	ret = avs_ipc_copier_set_sink_format(adev, source->module_id,
+					     source->instance_id, binding->source_pin,
+					     src_fmt, sink_fmt);
+	if (ret) {
+		dev_err(adev->dev, "config copier failed: %d\n", ret);
+		return AVS_IPC_RET(ret);
+	}
+
+	return 0;
+}
+
 int avs_path_bind(struct avs_path *path)
 {
 	struct avs_path_pipeline *ppl;
@@ -481,6 +512,10 @@ int avs_path_bind(struct avs_path *path)
 			source = binding->source;
 			sink = binding->sink;
 
+			ret = avs_path_bind_prepare(adev, binding);
+			if (ret < 0)
+				return ret;
+
 			ret = avs_ipc_bind(adev, source->module_id,
 					   source->instance_id, sink->module_id,
 					   sink->instance_id, binding->sink_pin,
-- 
2.25.1


  parent reply	other threads:[~2022-03-28 17:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 17:23 [PATCH 00/14] ASoC: Intel: avs: Topology and path management Cezary Rojewski
2022-03-28 17:23 ` [PATCH 01/14] ASoC: Intel: avs: Declare vendor tokens Cezary Rojewski
2022-03-28 17:23 ` [PATCH 02/14] ASoC: Intel: avs: Add topology parsing infrastructure Cezary Rojewski
2022-03-28 17:23 ` [PATCH 03/14] ASoC: Intel: avs: Parse module-extension tuples Cezary Rojewski
2022-03-28 17:24 ` [PATCH 04/14] ASoC: Intel: avs: Parse pplcfg and binding tuples Cezary Rojewski
2022-03-28 17:24 ` [PATCH 05/14] ASoC: Intel: avs: Parse pipeline and module tuples Cezary Rojewski
2022-03-28 17:24 ` [PATCH 06/14] ASoC: Intel: avs: Parse path and path templates tuples Cezary Rojewski
2022-03-28 17:24 ` [PATCH 07/14] ASoC: Intel: avs: Add topology loading operations Cezary Rojewski
2022-03-28 17:24 ` [PATCH 08/14] ASoC: Intel: avs: Support link_mask formatted string Cezary Rojewski
2022-03-28 17:24 ` [PATCH 09/14] ASoC: Intel: avs: Declare path and its components Cezary Rojewski
2022-03-28 17:24 ` [PATCH 10/14] ASoC: Intel: avs: Path creation and freeing Cezary Rojewski
2022-03-28 21:34   ` kernel test robot
2022-03-28 17:24 ` [PATCH 11/14] ASoC: Intel: avs: Path state management Cezary Rojewski
2022-03-28 17:24 ` [PATCH 12/14] ASoC: Intel: avs: Arm paths after creating them Cezary Rojewski
2022-03-28 17:24 ` Cezary Rojewski [this message]
2022-03-28 17:24 ` [PATCH 14/14] ASoC: Intel: avs: Configure modules according to their type Cezary Rojewski

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=20220328172410.761309-14-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=harshapriya.n@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=lma@semihalf.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rad@semihalf.com \
    --cc=tiwai@suse.com \
    --cc=upstream@semihalf.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.