Skip to content

Commit 8689b80

Browse files
robin-reckmannwsakernel
authored andcommitted
i2c: qcom-geni: Fix GPI DMA buffer sync-back
Fix i2c transfers using GPI DMA mode for all message types that do not set the I2C_M_DMA_SAFE flag (e.g. SMBus "read byte"). In this case a bounce buffer is returned by i2c_get_dma_safe_msg_buf(), and it has to synced back to the message after the transfer is done. Add missing assignment of dma buffer in geni_i2c_gpi(). Set xferred in i2c_put_dma_safe_msg_buf() to true in case of no error to ensure the sync-back of this dma buffer to the message. Fixes: d870355 ("i2c: qcom-geni: Add support for GPI DMA") Signed-off-by: Robin Reckmann <[email protected]> Tested-by: Luca Weiss <[email protected]> Tested-by: Caleb Connolly <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent ffcf9c5 commit 8689b80

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/i2c/busses/i2c-qcom-geni.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,12 @@ static void geni_i2c_gpi_unmap(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
494494
{
495495
if (tx_buf) {
496496
dma_unmap_single(gi2c->se.dev->parent, tx_addr, msg->len, DMA_TO_DEVICE);
497-
i2c_put_dma_safe_msg_buf(tx_buf, msg, false);
497+
i2c_put_dma_safe_msg_buf(tx_buf, msg, !gi2c->err);
498498
}
499499

500500
if (rx_buf) {
501501
dma_unmap_single(gi2c->se.dev->parent, rx_addr, msg->len, DMA_FROM_DEVICE);
502-
i2c_put_dma_safe_msg_buf(rx_buf, msg, false);
502+
i2c_put_dma_safe_msg_buf(rx_buf, msg, !gi2c->err);
503503
}
504504
}
505505

@@ -563,6 +563,7 @@ static int geni_i2c_gpi(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
563563
desc->callback_param = gi2c;
564564

565565
dmaengine_submit(desc);
566+
*buf = dma_buf;
566567
*dma_addr_p = addr;
567568

568569
return 0;

0 commit comments

Comments
 (0)