]> git.baikalelectronics.ru Git - kernel.git/commitdiff
soundwire: qcom: check for outanding writes before doing a read
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Wed, 26 Oct 2022 11:02:06 +0000 (12:02 +0100)
committerVinod Koul <vkoul@kernel.org>
Fri, 28 Oct 2022 11:30:38 +0000 (17:00 +0530)
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>
Link: https://lore.kernel.org/r/20221026110210.6575-3-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/qcom.c

index 8f1a1eb017a2e573b4f8a85998a91b897f9d7df9..cee2b22231410345e9373b5968b1f9b9c977623b 100644 (file)
@@ -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);