瀏覽代碼

soc: swr-mstr: Avoid redunant delay for wcd934x

For codecs like tavil/tasha where the soundwire register access
is through codec bridge, the soundwire bus latency is absorbed
in slimbus io operations, hence do not require extra delay in
soundwire driver for io operations.

Change-Id: If77aa02f0c3c1755916b7a57776115d12e4f08bd
Signed-off-by: Ramprasad Katkam <[email protected]>
Ramprasad Katkam 6 年之前
父節點
當前提交
1e90620030
共有 1 個文件被更改,包括 16 次插入7 次删除
  1. 16 7
      soc/swr-mstr-ctrl.c

+ 16 - 7
soc/swr-mstr-ctrl.c

@@ -448,11 +448,16 @@ static int swrm_cmd_fifo_rd_cmd(struct swr_mstr_ctrl *swrm, int *cmd_data,
 
 	mutex_lock(&swrm->iolock);
 	val = swrm_get_packed_reg_val(&swrm->rcmd_id, len, dev_addr, reg_addr);
-	/* wait for FIFO RD to complete to avoid overflow */
-	usleep_range(100, 105);
-	swr_master_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
-	/* wait for FIFO RD CMD complete to avoid overflow */
-	usleep_range(250, 255);
+	if (swrm->read) {
+		/* skip delay if read is handled in platform driver */
+		swr_master_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
+	} else {
+		/* wait for FIFO RD to complete to avoid overflow */
+		usleep_range(100, 105);
+		swr_master_write(swrm, SWRM_CMD_FIFO_RD_CMD, val);
+		/* wait for FIFO RD CMD complete to avoid overflow */
+		usleep_range(250, 255);
+	}
 retry_read:
 	*cmd_data = swr_master_read(swrm, SWRM_CMD_FIFO_RD_FIFO_ADDR);
 	dev_dbg(swrm->dev, "%s: reg: 0x%x, cmd_id: 0x%x, rcmd_id: 0x%x, \
@@ -496,8 +501,12 @@ static int swrm_cmd_fifo_wr_cmd(struct swr_mstr_ctrl *swrm, u8 cmd_data,
 			dev_num: 0x%x, cmd_data: 0x%x\n", __func__,
 			reg_addr, cmd_id, swrm->wcmd_id,dev_addr, cmd_data);
 	swr_master_write(swrm, SWRM_CMD_FIFO_WR_CMD, val);
-	/* wait for FIFO WR command to complete to avoid overflow */
-	usleep_range(250, 255);
+	/*
+	 * wait for FIFO WR command to complete to avoid overflow
+	 * skip delay if write is handled in platform driver.
+	 */
+	if(!swrm->write)
+		usleep_range(250, 255);
 	if (cmd_id == 0xF) {
 		/*
 		 * sleep for 10ms for MSM soundwire variant to allow broadcast