devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: vkoul@kernel.org, yung-chuan.liao@linux.intel.com
Cc: andersson@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org,
	pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com,
	srinivas.kandagatla@linaro.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: [PATCH 2/6] soundwire: qcom: check for outanding writes before doing a read
Date: Wed, 26 Oct 2022 12:02:06 +0100	[thread overview]
Message-ID: <20221026110210.6575-3-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20221026110210.6575-1-srinivas.kandagatla@linaro.org>

Reading will increase the fifo count, so check for outstanding cmd wrt.
write fifo depth to avoid overflow as read will also increase
write fifo cnt.

Fixes: a661308c34de ("soundwire: qcom: wait for fifo space to be available before read/write")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 8f1a1eb017a2..cee2b2223141 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -380,6 +380,12 @@ static int qcom_swrm_cmd_fifo_rd_cmd(struct qcom_swrm_ctrl *swrm,
 
 	val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
 
+	/*
+	 * Check for outstanding cmd wrt. write fifo depth to avoid
+	 * overflow as read will also increase write fifo cnt.
+	 */
+	swrm_wait_for_wr_fifo_avail(swrm);
+
 	/* wait for FIFO RD to complete to avoid overflow */
 	usleep_range(100, 105);
 	swrm->reg_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
-- 
2.21.0


  parent reply	other threads:[~2022-10-26 11:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 11:02 [PATCH 0/6] soundwire: qcom: fixes and support for v1.7 Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 1/6] soundwire: qcom: reinit broadcast completion Srinivas Kandagatla
2022-10-26 11:02 ` Srinivas Kandagatla [this message]
2022-10-26 11:02 ` [PATCH 3/6] soundwire: qcom: remove unused SWRM_SPECIAL_CMD_ID Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 4/6] soundwire: qcom: make reset optional for v1.6 controller Srinivas Kandagatla
2022-10-26 11:02 ` [PATCH 5/6] dt-bindings: soundwire: qcom: add v1.7.0 support Srinivas Kandagatla
2022-10-26 14:28   ` Krzysztof Kozlowski
2022-10-26 11:02 ` [PATCH 6/6] soundwire: qcom: add support for v1.7 Soundwire Controller Srinivas Kandagatla
2022-10-26 20:14   ` Pierre-Louis Bossart
2022-10-27 10:19     ` Srinivas Kandagatla
2022-10-27 12:45       ` Pierre-Louis Bossart
2022-10-28 11:31 ` [PATCH 0/6] soundwire: qcom: fixes and support for v1.7 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=20221026110210.6575-3-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sanyog.r.kale@intel.com \
    --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 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).