Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d87fe2ef authored by Girish Mahadevan's avatar Girish Mahadevan
Browse files

i2c: i2c-qcom-geni: Modify the DMA buffer mapping



Modify the DMA buffer mapping to use the wrapper device and using the API
exposed by the geni wrapper file.

Change-Id: I78490191b69ba5a2d1111b5e0ea926204901b961
Signed-off-by: default avatarGirish Mahadevan <girishm@codeaurora.org>
parent 84a47e8c
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -469,8 +469,8 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
		int stretch = (i < (num - 1));
		dma_cookie_t tx_cookie, rx_cookie;
		struct msm_gpi_tre *go_t = &gi2c->go_t;
		struct device *rx_dev = gi2c->dev;
		struct device *tx_dev = gi2c->dev;
		struct device *rx_dev = gi2c->wrapper_dev;
		struct device *tx_dev = gi2c->wrapper_dev;

		gi2c->cur = &msgs[i];
		if (!gi2c->cfg_sent) {
@@ -501,9 +501,8 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],

		if (msgs[i].flags & I2C_M_RD) {
			sg_init_table(&gi2c->rx_sg, 1);
			gi2c->rx_ph = dma_map_single(rx_dev, msgs[i].buf,
						     msgs[i].len,
						     DMA_FROM_DEVICE);
			geni_se_iommu_map_buf(rx_dev, &gi2c->rx_ph, msgs[i].buf,
						msgs[i].len, DMA_FROM_DEVICE);
			gi2c->rx_t.dword[0] =
				MSM_GPI_DMA_W_BUFFER_TRE_DWORD0(gi2c->rx_ph);
			gi2c->rx_t.dword[1] =
@@ -533,9 +532,8 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
			rx_cookie = dmaengine_submit(gi2c->rx_desc);
			dma_async_issue_pending(gi2c->rx_c);
		} else {
			gi2c->tx_ph = dma_map_single(tx_dev, msgs[i].buf,
						     msgs[i].len,
						     DMA_TO_DEVICE);
			geni_se_iommu_map_buf(tx_dev, &gi2c->tx_ph, msgs[i].buf,
						msgs[i].len, DMA_TO_DEVICE);
			gi2c->tx_t.dword[0] =
				MSM_GPI_DMA_W_BUFFER_TRE_DWORD0(gi2c->tx_ph);
			gi2c->tx_t.dword[1] =
@@ -568,11 +566,11 @@ static int geni_i2c_gsi_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],

		timeout = wait_for_completion_timeout(&gi2c->xfer, HZ);
		if (msgs[i].flags & I2C_M_RD)
			dma_unmap_single(rx_dev, gi2c->rx_ph, msgs[i].len,
					 DMA_FROM_DEVICE);
			geni_se_iommu_unmap_buf(rx_dev, &gi2c->rx_ph,
				msgs[i].len, DMA_FROM_DEVICE);
		else
			dma_unmap_single(tx_dev, gi2c->tx_ph, msgs[i].len,
					 DMA_TO_DEVICE);
			geni_se_iommu_unmap_buf(tx_dev, &gi2c->tx_ph,
				msgs[i].len, DMA_TO_DEVICE);

		if (!timeout) {
			GENI_SE_ERR(gi2c->ipcl, true, gi2c->dev,