From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vinod Koul Subject: Re: [PATCH v5 07/13] soundwire: Add stream configuration APIs Date: Thu, 26 Apr 2018 09:58:56 +0530 Message-ID: <20180426042856.GR6014@localhost> References: <1524649163-12088-1-git-send-email-vkoul@kernel.org> <1524649163-12088-8-git-send-email-vkoul@kernel.org> <20180426040016.GA15388@buildpc-HP-Z230> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by alsa0.perex.cz (Postfix) with ESMTP id 5A59826772B for ; Thu, 26 Apr 2018 06:24:18 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20180426040016.GA15388@buildpc-HP-Z230> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Sanyog Kale Cc: ALSA , tiwai@suse.de, Greg KH , Pierre-Louis Bossart , liam.r.girdwood@linux.intel.com, patches.audio@intel.com, Vinod Koul , broonie@kernel.org List-Id: alsa-devel@alsa-project.org 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 > > > > Add APIs for prepare, enable, disable and de-prepare stream. > > > > Signed-off-by: Sanyog Kale > > Signed-off-by: Shreyas NC > > Signed-off-by: Vinod Koul > > --- > > 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