linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org,
	vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com,
	srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com,
	Bard liao <yung-chuan.liao@linux.intel.com>,
	Rander Wang <rander.wang@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Sanyog Kale <sanyog.r.kale@intel.com>
Subject: [RFC PATCH 07/11] soundwire: intel: improve .config_stream callback, add .free_stream
Date: Wed, 21 Aug 2019 15:05:17 -0500	[thread overview]
Message-ID: <20190821200521.17283-8-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20190821200521.17283-1-pierre-louis.bossart@linux.intel.com>

From: Rander Wang <rander.wang@linux.intel.com>

We need the link_id as a parameter for the config callback, and we
also need a matching free callback in case any resources need to be
released.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/intel.c           | 19 +++++++++++++++++--
 include/linux/soundwire/sdw_intel.h |  4 +++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 0001f433e848..529d7bc693d1 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -578,17 +578,31 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
 static int intel_config_stream(struct sdw_intel *sdw,
 			       struct snd_pcm_substream *substream,
 			       struct snd_soc_dai *dai,
-			       struct snd_pcm_hw_params *hw_params, int link_id)
+			       struct snd_pcm_hw_params *hw_params,
+			       int link_id, int alh_stream_id)
 {
 	struct sdw_intel_link_res *res = sdw->res;
 
 	if (res->ops && res->ops->config_stream && res->arg)
 		return res->ops->config_stream(res->arg,
-				substream, dai, hw_params, link_id);
+					       substream, dai, hw_params,
+					       link_id, alh_stream_id);
 
 	return -EIO;
 }
 
+static int intel_free_stream(struct sdw_intel *sdw,
+			     struct snd_pcm_substream *substream,
+			     struct snd_soc_dai *dai,
+			     int link_id)
+{
+	if (sdw->res->ops && sdw->res->ops->free_stream && sdw->res->arg)
+		return sdw->res->ops->free_stream(sdw->res->arg,
+						  substream, dai, link_id);
+
+	return 0;
+}
+
 /*
  * bank switch routines
  */
@@ -718,6 +732,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
 
 	/* Inform DSP about PDI stream number */
 	ret = intel_config_stream(sdw, substream, dai, params,
+				  sdw->instance,
 				  pdi->intel_alh_id);
 	if (ret)
 		goto error;
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index c9427cb6020b..c5a2caf3a9d5 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -12,7 +12,9 @@
  */
 struct sdw_intel_ops {
 	int (*config_stream)(void *arg, void *substream,
-			     void *dai, void *hw_params, int stream_num);
+			     void *dai, void *hw_params,
+			     int link_id, int alh_stream_id);
+	int (*free_stream)(void *arg, void *substream, void *dai, int link_id);
 };
 
 /**
-- 
2.20.1


  parent reply	other threads:[~2019-08-21 20:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 20:05 [RFC PATCH 00/11] soundwire: intel: simplify DAI/PDI handling Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 01/11] soundwire: intel: fix intel_register_dai PDI offsets and numbers Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 02/11] soundwire: remove DAI_ID_RANGE definitions Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 03/11] soundwire: intel: remove playback/capture stream_name Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 04/11] soundwire: cadence/intel: simplify PDI/port mapping Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 05/11] soundwire: intel: don't filter out PDI0/1 Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 06/11] soundwire: cadence_master: improve PDI allocation Pierre-Louis Bossart
2019-08-21 20:05 ` Pierre-Louis Bossart [this message]
2019-08-21 20:05 ` [RFC PATCH 08/11] soundwire: intel: add prepare support in sdw dai driver Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 09/11] soundwire: intel: add trigger " Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 10/11] soundwire: intel: do sdw stream setup in setup function Pierre-Louis Bossart
2019-08-21 20:05 ` [RFC PATCH 11/11] soundwire: intel: free all resources on hw_free() Pierre-Louis Bossart

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=20190821200521.17283-8-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jank@cadence.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rander.wang@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=slawomir.blauciak@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).