alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Sanyog Kale <sanyog.r.kale@intel.com>
Cc: ALSA <alsa-devel@alsa-project.org>,
	tiwai@suse.de, Greg KH <gregkh@linuxfoundation.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
	Vinod Koul <vkoul@kernel.org>,
	broonie@kernel.org
Subject: Re: [PATCH v5 07/13] soundwire: Add stream configuration APIs
Date: Thu, 26 Apr 2018 09:58:56 +0530	[thread overview]
Message-ID: <20180426042856.GR6014@localhost> (raw)
In-Reply-To: <20180426040016.GA15388@buildpc-HP-Z230>

On Thu, Apr 26, 2018 at 09:30:16AM +0530, Sanyog Kale wrote:
> 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.

Looking at it I think it helps to program the calculated values, we may get
a new stream even before we get a chance to suspend. And frankly at bus, we
should not make any assumptions about suspend behaviour they may change with
platforms and archs :)

> 
> > +	/* 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.

good spot will fix

> 
> > +
> > +	stream->state = SDW_STREAM_DEPREPARED;
> > +
> > +	return ret;
-- 
~Vinod

  reply	other threads:[~2018-04-26  4:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25  9:39 [PATCH v5 00/13] soundwire: Add stream support Vinod Koul
2018-04-25  9:39 ` [PATCH v5 01/13] Documentation: soundwire: Add more documentation Vinod Koul
2018-04-25  9:39 ` [PATCH v5 02/13] soundwire: Add support for SoundWire stream management Vinod Koul
2018-04-25 23:46   ` Pierre-Louis Bossart
2018-04-25  9:39 ` [PATCH v5 03/13] soundwire: Add support for port management Vinod Koul
2018-04-25  9:39 ` [PATCH v5 04/13] soundwire: Add Master and Slave port programming Vinod Koul
2018-04-25  9:39 ` [PATCH v5 05/13] soundwire: Add helpers for ports operations Vinod Koul
2018-04-25  9:39 ` [PATCH v5 06/13] soundwire: Add bank switch routine Vinod Koul
2018-04-25  9:39 ` [PATCH v5 07/13] soundwire: Add stream configuration APIs Vinod Koul
2018-04-26  4:00   ` Sanyog Kale
2018-04-26  4:28     ` Vinod Koul [this message]
2018-04-26  4:38       ` Sanyog Kale
2018-04-26  5:23         ` Vinod Koul
2018-04-25  9:39 ` [PATCH v5 08/13] ASoC: Add SoundWire stream programming interface Vinod Koul
2018-04-25  9:39 ` [PATCH v5 09/13] soundwire: Remove cdns_master_ops Vinod Koul
2018-04-25  9:39 ` [PATCH v5 10/13] soundwire: cdns: Add port routines Vinod Koul
2018-04-25  9:39 ` [PATCH v5 11/13] soundwire: cdns: Add stream routines Vinod Koul
2018-04-25  9:39 ` [PATCH v5 12/13] soundwire: intel: Add stream initialization Vinod Koul
2018-04-25  9:39 ` [PATCH v5 13/13] soundwire: intel: Add audio DAI ops Vinod Koul

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=20180426042856.GR6014@localhost \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    /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).