mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	tiwai@suse.de, broonie@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>,
	Rander Wang <rander.wang@intel.com>,
	Sanyog Kale <sanyog.r.kale@intel.com>
Subject: Re: [PATCH 6/6] soundwire: stream: don't program ports for a stream that has not been prepared
Date: Fri, 10 Jan 2020 12:33:21 +0530	[thread overview]
Message-ID: <20200110070321.GA2818@vkoul-mobl> (raw)
In-Reply-To: <20200108175438.13121-7-pierre-louis.bossart@linux.intel.com>

On 08-01-20, 11:54, Pierre-Louis Bossart wrote:
> From: Rander Wang <rander.wang@intel.com>
> 
> In the Intel QA multi-pipelines test case, there are two pipelines for
> playback and capture on the same bus. The test fails with an error
> when setting port params:
> 
> [  599.224812] rt711 sdw:0:25d:711:0: invalid dpn_prop direction 1 port_num 0
> [  599.224815] sdw_program_slave_port_params failed -22
> [  599.224819] intel-sdw sdw-master-0: Program transport params failed: -22
> [  599.224822] intel-sdw sdw-master-0: Program params failed: -22

side note, one of these above err logs should be removed :)

> [  599.224828] sdw_enable_stream: SDW0 Pin2-Playback: done
> 
> This problem is root-caused to the programming of the capture stream
> ports while it is not yet prepared, the calling sequence is:
> 
> (1) hw_params for playback. The playback stream provide the port
>     information to Bus.
> (2) stream_prepare for playback, Transport and port parameters
>     are computed for playback.
> (3) hw_params for capture. The capture stream provide the port
>     information to Bus, but it has not been prepared so is not
>     accounted for in the bandwidth allocation.
> (4) stream_enable for playback. Program transport and port parameters
>     for all masters and slaves. Since the transport and port parameters
>     are not computed for capture stream, sdw_program_slave_port_params
>     will generate a error when setting port params for capture.
> 
> in step (4), we should only program the ports for the stream that have
> been prepared. A stream that is only in CONFIGURED state should be
> ignored, its ports will be programmed when it becomes PREPARED.
> 
> Tested on Comet Lake.
> 
> GitHub issue: https://github.com/thesofproject/linux/issues/1637

This is not relevant for kernel, pls remove

> Signed-off-by: Rander Wang <rander.wang@intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/soundwire/stream.c | 21 ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index da10f38298c0..198372977187 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -604,12 +604,23 @@ static int sdw_notify_config(struct sdw_master_runtime *m_rt)
>   *
>   * @bus: SDW bus instance
>   */
> -static int sdw_program_params(struct sdw_bus *bus)
> +static int sdw_program_params(struct sdw_bus *bus, bool prepare)
>  {
>  	struct sdw_master_runtime *m_rt;
>  	int ret = 0;
>  
>  	list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
> +
> +		/*
> +		 * this loop walks through all master runtimes for a
> +		 * bus, but the ports can only be configured while
> +		 * explicitly preparing a stream or handling an
> +		 * already-prepared stream otherwise.

we can go upto 80 chars, make sure you align the above comment block as
such

> +		 */
> +		if (!prepare &&
> +		    m_rt->stream->state == SDW_STREAM_CONFIGURED)
> +			continue;
> +
>  		ret = sdw_program_port_params(m_rt);
>  		if (ret < 0) {
>  			dev_err(bus->dev,
> @@ -1502,7 +1513,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
>  
>  program_params:
>  		/* Program params */
> -		ret = sdw_program_params(bus);
> +		ret = sdw_program_params(bus, true);
>  		if (ret < 0) {
>  			dev_err(bus->dev, "Program params failed: %d\n", ret);
>  			goto restore_params;
> @@ -1602,7 +1613,7 @@ static int _sdw_enable_stream(struct sdw_stream_runtime *stream)
>  		bus = m_rt->bus;
>  
>  		/* Program params */
> -		ret = sdw_program_params(bus);
> +		ret = sdw_program_params(bus, false);
>  		if (ret < 0) {
>  			dev_err(bus->dev, "Program params failed: %d\n", ret);
>  			return ret;
> @@ -1687,7 +1698,7 @@ static int _sdw_disable_stream(struct sdw_stream_runtime *stream)
>  		struct sdw_bus *bus = m_rt->bus;
>  
>  		/* Program params */
> -		ret = sdw_program_params(bus);
> +		ret = sdw_program_params(bus, false);

Can you do a converse test as well, when the streams are running and
concurrently two stream are stopped, it would be good to get it confirmed...

>  		if (ret < 0) {
>  			dev_err(bus->dev, "Program params failed: %d\n", ret);
>  			return ret;
> @@ -1769,7 +1780,7 @@ static int _sdw_deprepare_stream(struct sdw_stream_runtime *stream)
>  			m_rt->ch_count * m_rt->stream->params.bps;
>  
>  		/* Program params */
> -		ret = sdw_program_params(bus);
> +		ret = sdw_program_params(bus, false);
>  		if (ret < 0) {
>  			dev_err(bus->dev, "Program params failed: %d\n", ret);
>  			return ret;
> -- 
> 2.20.1

-- 
~Vinod

  reply	other threads:[~2020-01-10  7:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 17:54 [PATCH 0/6] soundwire: stream: fix state machines and transitions Pierre-Louis Bossart
2020-01-08 17:54 ` [PATCH 1/6] soundwire: stream: remove redundant pr_err traces Pierre-Louis Bossart
2020-01-10  7:04   ` Vinod Koul
2020-01-08 17:54 ` [PATCH 2/6] soundwire: stream: update state machine and add state checks Pierre-Louis Bossart
2020-01-10  6:48   ` Vinod Koul
2020-01-10 16:30     ` [alsa-devel] " Pierre-Louis Bossart
2020-01-11 11:30       ` Pierre-Louis Bossart
2020-01-13  5:22         ` Vinod Koul
2020-01-08 17:54 ` [PATCH 3/6] soundwire: stream: only prepare stream when it is configured Pierre-Louis Bossart
2020-01-08 17:54 ` [PATCH 4/6] soundwire: stream: do not update parameters during DISABLED-PREPARED transition Pierre-Louis Bossart
2020-01-10  6:55   ` Vinod Koul
2020-01-10 16:11     ` [alsa-devel] " Pierre-Louis Bossart
2020-01-08 17:54 ` [PATCH 5/6] soundwire: stream: fix support for multiple Slaves on the same link Pierre-Louis Bossart
2020-01-08 17:54 ` [PATCH 6/6] soundwire: stream: don't program ports for a stream that has not been prepared Pierre-Louis Bossart
2020-01-10  7:03   ` Vinod Koul [this message]
2020-01-10 16:24     ` [alsa-devel] " 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=20200110070321.GA2818@vkoul-mobl \
    --to=vkoul@kernel.org \
    --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=pierre-louis.bossart@linux.intel.com \
    --cc=rander.wang@intel.com \
    --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=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

all inboxes | Powered by JetHome®