alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Shreyas NC <shreyas.nc@intel.com>, alsa-devel@alsa-project.org
Cc: patches.audio@intel.com, gregkh@linuxfoundation.org,
	vkoul@kernel.org, sanyog.r.kale@intel.com
Subject: Re: [PATCH v7 09/10] soundwire: Add support for multi link bank switch
Date: Thu, 26 Jul 2018 09:02:03 -0500	[thread overview]
Message-ID: <ffec253d-427d-44dd-522e-f0ffd08dfae6@linux.intel.com> (raw)
In-Reply-To: <1532605362-19282-10-git-send-email-shreyas.nc@intel.com>

The series looks pretty good now, I just found one possible improvement 
below
Thanks!

>   
> -static int sdw_bank_switch(struct sdw_bus *bus)
> +static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
>   {
>   	int col_index, row_index;
> +	bool multi_link;
>   	struct sdw_msg *wr_msg;
>   	u8 *wbuf = NULL;
>   	int ret = 0;
> @@ -638,6 +639,8 @@ static int sdw_bank_switch(struct sdw_bus *bus)
>   	if (!wr_msg)
>   		return -ENOMEM;
>   
> +	bus->defer_msg.msg = wr_msg;
> +
>   	wbuf = kzalloc(sizeof(*wbuf), GFP_KERNEL);
>   	if (!wbuf) {
>   		ret = -ENOMEM;
> @@ -658,17 +661,29 @@ static int sdw_bank_switch(struct sdw_bus *bus)
>   					SDW_MSG_FLAG_WRITE, wbuf);
>   	wr_msg->ssp_sync = true;
>   
> -	ret = sdw_transfer(bus, wr_msg);
> +	/*
> +	 * Set the multi_link flag only when both the hardware supports
> +	 * and there is a stream handled by multiple masters
> +	 */
> +	multi_link = bus->multi_link && (m_rt_count > 1);
> +
> +	if (multi_link)
> +		ret = sdw_transfer_defer(bus, wr_msg, &bus->defer_msg);
> +	else
> +		ret = sdw_transfer(bus, wr_msg);
> +
>   	if (ret < 0) {
>   		dev_err(bus->dev, "Slave frame_ctrl reg write failed");
>   		goto error;
>   	}
>   
> -	kfree(wr_msg);
> -	kfree(wbuf);
> -	bus->defer_msg.msg = NULL;
> -	bus->params.curr_bank = !bus->params.curr_bank;
> -	bus->params.next_bank = !bus->params.next_bank;
> +	if (!bus->multi_link) {
> +		kfree(wr_msg);
> +		kfree(wbuf);
> +		bus->defer_msg.msg = NULL;
> +		bus->params.curr_bank = !bus->params.curr_bank;
> +		bus->params.next_bank = !bus->params.next_bank;
> +	}

Should this test be extended to the case where the bus can support 
multi-link but m_rt_count ==1
should it be
if (!multi_link)
?

  reply	other threads:[~2018-07-26 14:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 11:42 [PATCH v7 00/10] soundwire: Add multi link support Shreyas NC
2018-07-26 11:42 ` [PATCH v7 01/10] soundwire: Fix duplicate stream state assignment Shreyas NC
2018-07-26 11:42 ` [PATCH v7 02/10] soundwire: Fix incorrect exit after configuring stream Shreyas NC
2018-07-26 11:42 ` [PATCH v7 03/10] soundwire: Fix acquiring bus lock twice during master release Shreyas NC
2018-07-26 11:42 ` [PATCH v7 04/10] Documentation: soundwire: Add documentation for multi link Shreyas NC
2018-07-26 11:42 ` [PATCH v7 05/10] soundwire: Initialize completion for defer messages Shreyas NC
2018-07-26 11:42 ` [PATCH v7 06/10] soundwire: Add support to lock across bus instances Shreyas NC
2018-07-26 11:42 ` [PATCH v7 07/10] soundwire: Handle multiple master instances in a stream Shreyas NC
2018-07-26 11:42 ` [PATCH v7 08/10] soundwire: keep track of Masters " Shreyas NC
2018-07-26 11:42 ` [PATCH v7 09/10] soundwire: Add support for multi link bank switch Shreyas NC
2018-07-26 14:02   ` Pierre-Louis Bossart [this message]
2018-07-27  3:22     ` Shreyas Nc
2018-07-26 11:42 ` [PATCH v7 10/10] soundwire: intel: Add pre/post bank switch ops Shreyas NC

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=ffec253d-427d-44dd-522e-f0ffd08dfae6@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=patches.audio@intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=shreyas.nc@intel.com \
    --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).