All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	vkoul@kernel.org
Cc: yung-chuan.liao@linux.intel.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, steev@kali.org,
	johan+linaro@kernel.org, quic_bjorande@quicinc.com
Subject: Re: [PATCH 3/5] soundwire: qcom: wait for fifo to be empty before suspend
Date: Thu, 9 Feb 2023 17:12:55 +0000	[thread overview]
Message-ID: <8fb08ac8-13ae-cd87-869e-34af894407e8@linaro.org> (raw)
In-Reply-To: <f956351e-de37-062b-c02e-5cbdf9a3bdfd@linux.intel.com>



On 09/02/2023 16:33, Pierre-Louis Bossart wrote:
> 
> 
> On 2/9/23 09:52, Srinivas Kandagatla wrote:
>>
>>
>> On 09/02/2023 15:23, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 2/9/23 07:13, Srinivas Kandagatla wrote:
>>>> Wait for Fifo to be empty before going to suspend or before bank
>>>> switch happens. Just to make sure that all the reads/writes are done.
>>>
>>> For the suspend case that seems like a valid approach, but for bank
>>> switch don't we already have a bus->msg_lock mutex that will prevent the
>>> bank switch command from being sent before the other commands are
>>> handled?
>>
>> All read/writes are fifo based, so writes could be still pending.
> 
> I am not following. The bank switch happens with this function, where a
> mutex is taken.
> 
> int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
> {
> 	int ret;
> 
> 	mutex_lock(&bus->msg_lock);
> 
> 	ret = sdw_transfer_unlocked(bus, msg);

Qualcomm controller uses fifo to read/write, so return after writing to 
fifo might not always indicate that write is completed.

Qcom Soundwire controller do not have any synchronous interrupt 
mechanism to indicate write complete.

--srini


> 
> 	mutex_unlock(&bus->msg_lock);
> 
> 	return ret;
> }
> 
> The transfer_unlocked is synchronous and waits for the command response
> to be available.
> 
> In other words, there's both a mutual exclusion and a synchronous
> behavior, so not sure how commands *before* the bank switch could be
> pending?


  reply	other threads:[~2023-02-09 17:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 13:13 [PATCH 0/5] soundwire: qcom: stablity fixes Srinivas Kandagatla
2023-02-09 13:13 ` [PATCH 1/5] soundwire: qcom: update status correctly with mask Srinivas Kandagatla
2023-02-09 13:13 ` [PATCH 2/5] soundwire: qcom: enable runtime pm before controller is registered Srinivas Kandagatla
2023-02-09 15:21   ` Pierre-Louis Bossart
2023-02-09 15:49     ` Srinivas Kandagatla
2023-02-09 13:13 ` [PATCH 3/5] soundwire: qcom: wait for fifo to be empty before suspend Srinivas Kandagatla
2023-02-09 15:23   ` Pierre-Louis Bossart
2023-02-09 15:52     ` Srinivas Kandagatla
2023-02-09 16:33       ` Pierre-Louis Bossart
2023-02-09 17:12         ` Srinivas Kandagatla [this message]
2023-02-09 18:24           ` Pierre-Louis Bossart
2023-02-09 13:13 ` [PATCH 4/5] soundwire: qcom: add software workaround for bus clash interrupt assertion Srinivas Kandagatla
2023-02-09 13:13 ` [PATCH 5/5] soundwire: qcom: set clk stop need reset flag at runtime Srinivas Kandagatla
2023-02-09 15:33   ` 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=8fb08ac8-13ae-cd87-869e-34af894407e8@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=quic_bjorande@quicinc.com \
    --cc=steev@kali.org \
    --cc=vkoul@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.