[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <653e93e7-6bdc-3498-7719-f3a7860dd245@connolly.tech>
Date: Sun, 07 Aug 2022 15:31:17 +0000
From: Caleb Connolly <caleb@...nolly.tech>
To: Robin Reckmann <robin.reckmann@...glemail.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Konrad Dybcio <konrad.dybcio@...ainline.org>,
Sumit Semwal <sumit.semwal@...aro.org>,
Christian König <christian.koenig@....com>
Cc: Robin Reckmann <robin.reckmann@...il.com>,
linux-arm-msm@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH] i2c: qcom-geni: Fix GPI DMA buffer sync-back
On 07/08/2022 15:04, Robin Reckmann wrote:
> 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.
Thanks for sending this, it fixes GPI DMA on the PocoPhone F1 and Pixel 3!
>
> Signed-off-by: Robin Reckmann <robin.reckmann@...il.com>Reviewed-by: Caleb Connolly <caleb@...nolly.tech>
> ---
> drivers/i2c/busses/i2c-qcom-geni.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 6ac402ea58fb..d3541e94794e 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -484,12 +484,12 @@ static void geni_i2c_gpi_unmap(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
> {
> if (tx_buf) {
> dma_unmap_single(gi2c->se.dev->parent, tx_addr, msg->len, DMA_TO_DEVICE);
> - i2c_put_dma_safe_msg_buf(tx_buf, msg, false);
> + i2c_put_dma_safe_msg_buf(tx_buf, msg, !gi2c->err);
> }
>
> if (rx_buf) {
> dma_unmap_single(gi2c->se.dev->parent, rx_addr, msg->len, DMA_FROM_DEVICE);
> - i2c_put_dma_safe_msg_buf(rx_buf, msg, false);
> + i2c_put_dma_safe_msg_buf(rx_buf, msg, !gi2c->err);
> }
> }
>
> @@ -553,6 +553,7 @@ static int geni_i2c_gpi(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
> desc->callback_param = gi2c;
>
> dmaengine_submit(desc);
> + *buf = dma_buf;
> *dma_addr_p = addr;
>
> return 0;
> --
> 2.25.1
>
--
Kind Regards,
Caleb
Powered by blists - more mailing lists