Re: [PATCH V2 1/2] i2c: i2c-qcom-geni: Store DMA mapping data in geni_i2c_dev struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-08-26 17:25, Akash Asthana wrote:
Hi Roja,

On 8/20/2020 4:05 PM, Roja Rani Yarubandi wrote:
Store DMA mapping data in geni_i2c_dev struct to enhance DMA mapping
data scope. For example during shutdown callback to unmap DMA mapping,
this stored DMA mapping data can be used to call geni_se_tx_dma_unprep
and geni_se_rx_dma_unprep functions.

Signed-off-by: Roja Rani Yarubandi <rojay@xxxxxxxxxxxxxx>
---
Changes in V2:
- As per Stephen's comments, changed commit text, fixed minor nitpicks.

  drivers/i2c/busses/i2c-qcom-geni.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index 7f130829bf01..1fda5c7c2cfc 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -86,6 +86,9 @@ struct geni_i2c_dev {
  	u32 clk_freq_out;
  	const struct geni_i2c_clk_fld *clk_fld;
  	int suspended;
+	dma_addr_t tx_dma;
+	dma_addr_t rx_dma;
+	size_t xfer_len;
  };
    struct geni_i2c_err_log {
@@ -358,6 +361,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
  	struct geni_se *se = &gi2c->se;
  	size_t len = msg->len;
  +	gi2c->xfer_len = msg->len;

nit: gi2c->xfer = len, for tx_one_msg as well.

Regards,

Akash


Okay

  	if (!of_machine_is_compatible("lenovo,yoga-c630"))
  		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
@@ -384,6 +388,7 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
  	if (dma_buf) {
  		if (gi2c->err)
  			geni_i2c_rx_fsm_rst(gi2c);
+		gi2c->rx_dma = rx_dma;
  		geni_se_rx_dma_unprep(se, rx_dma, len);
  		i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
  	}
@@ -400,6 +405,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
  	struct geni_se *se = &gi2c->se;
  	size_t len = msg->len;
  +	gi2c->xfer_len = msg->len;
  	if (!of_machine_is_compatible("lenovo,yoga-c630"))
  		dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
@@ -429,6 +435,7 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
  	if (dma_buf) {
  		if (gi2c->err)
  			geni_i2c_tx_fsm_rst(gi2c);
+		gi2c->tx_dma = tx_dma;
  		geni_se_tx_dma_unprep(se, tx_dma, len);
  		i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err);
  	}



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux