summaryrefslogtreecommitdiff
path: root/drivers/soundwire/qcom.c
diff options
context:
space:
mode:
authorVinod Koul <vkoul@kernel.org>2022-11-23 17:21:09 +0300
committerVinod Koul <vkoul@kernel.org>2022-11-23 17:21:09 +0300
commitca1c131ccf6e09f4976aeca035f12529c9a7d8a9 (patch)
tree96d13e6491e88da26212fbd3d1fbcc813db9865d /drivers/soundwire/qcom.c
parentfebc50b82bc95089ef1d6f68a101c8a2b701e9ce (diff)
parent49a467310dc4fae591a3547860ee04d8730780f4 (diff)
downloadlinux-ca1c131ccf6e09f4976aeca035f12529c9a7d8a9.tar.xz
Merge branch 'fixes' into next
Merge fixes into next as Intel driver has a dependency
Diffstat (limited to 'drivers/soundwire/qcom.c')
-rw-r--r--drivers/soundwire/qcom.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index ce00a5cf980c..335424870290 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -345,6 +345,9 @@ static int qcom_swrm_cmd_fifo_wr_cmd(struct qcom_swrm_ctrl *swrm, u8 cmd_data,
if (swrm_wait_for_wr_fifo_avail(swrm))
return SDW_CMD_FAIL_OTHER;
+ if (cmd_id == SWR_BROADCAST_CMD_ID)
+ reinit_completion(&swrm->broadcast);
+
/* Its assumed that write is okay as we do not get any status back */
swrm->reg_write(swrm, SWRM_CMD_FIFO_WR_CMD, val);
@@ -378,6 +381,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);