Skip to content

Commit 49a4673

Browse files
Srinivas-Kandagatlavinodkoul
authored andcommitted
soundwire: qcom: check for outanding writes before doing a read
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: a661308 ("soundwire: qcom: wait for fifo space to be available before read/write") Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent f936fa7 commit 49a4673

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/soundwire/qcom.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ static int qcom_swrm_cmd_fifo_rd_cmd(struct qcom_swrm_ctrl *swrm,
380380

381381
val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
382382

383+
/*
384+
* Check for outstanding cmd wrt. write fifo depth to avoid
385+
* overflow as read will also increase write fifo cnt.
386+
*/
387+
swrm_wait_for_wr_fifo_avail(swrm);
388+
383389
/* wait for FIFO RD to complete to avoid overflow */
384390
usleep_range(100, 105);
385391
swrm->reg_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);

0 commit comments

Comments
 (0)