[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190821200521.17283-8-pierre-louis.bossart@linux.intel.com>
Date: Wed, 21 Aug 2019 15:05:17 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org, tiwai@...e.de, broonie@...nel.org,
vkoul@...nel.org, gregkh@...uxfoundation.org, jank@...ence.com,
srinivas.kandagatla@...aro.org, slawomir.blauciak@...el.com,
Bard liao <yung-chuan.liao@...ux.intel.com>,
Rander Wang <rander.wang@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Sanyog Kale <sanyog.r.kale@...el.com>
Subject: [RFC PATCH 07/11] soundwire: intel: improve .config_stream callback, add .free_stream
From: Rander Wang <rander.wang@...ux.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@...ux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.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
Powered by blists - more mailing lists