On Wed, Apr 25, 2018 at 03:09:17PM +0530, Vinod Koul wrote:
From: Sanyog Kale sanyog.r.kale@intel.com
Add APIs for prepare, enable, disable and de-prepare stream.
Signed-off-by: Sanyog Kale sanyog.r.kale@intel.com Signed-off-by: Shreyas NC shreyas.nc@intel.com Signed-off-by: Vinod Koul vkoul@kernel.org
drivers/soundwire/bus.c | 9 ++ drivers/soundwire/stream.c | 246 ++++++++++++++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 4 + 3 files changed, 259 insertions(+)
+static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream) +{
- struct sdw_master_runtime *m_rt = stream->m_rt;
- struct sdw_bus *bus = m_rt->bus;
- int ret = 0;
- /* De-prepare port(s) */
- ret = sdw_prep_deprep_ports(m_rt, false);
- if (ret < 0) {
dev_err(bus->dev, "De-prepare port(s) failed: %d", ret);
return ret;
- }
- /* TODO: Update this during Device-Device support */
- bus->params.bandwidth -= m_rt->stream->params.rate *
m_rt->ch_count * m_rt->stream->params.bps;
We should have kept zero bandwidth check here because there is no need to perform sdw_program_params when no stream is running on bus.
- /* Program params */
- ret = sdw_program_params(bus);
- if (ret < 0) {
dev_err(bus->dev, "Program params failed: %d", ret);
return ret;
- }
- return do_bank_switch(stream);
Change the state to DEPREPARE and then return.
- stream->state = SDW_STREAM_DEPREPARED;
- return ret;
+}
-- 2.7.4
--