Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4640260rwb; Mon, 8 Aug 2022 04:52:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7UBep/j589LboSjjfbdWPVClOQMDzs7iuWjkVEwKEXPNwgfnwdFk9IbM78YCl52o7g3PCK X-Received: by 2002:a62:38d8:0:b0:52d:1496:6775 with SMTP id f207-20020a6238d8000000b0052d14966775mr18083562pfa.15.1659959546724; Mon, 08 Aug 2022 04:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659959546; cv=none; d=google.com; s=arc-20160816; b=S0ugui8IJSnQDq7JK5IvhFtwy1uOENkietEo1DqsSlDa/lml/R3uaWBuYE+QntGoX7 485+9C1Ufup5YckJT8Ba2di3eBgNqmaonZL3kGO/MyfiayD8Kn7f+Vq/06oirbT6J0Hb ZzIfeoi+e2fWpkMWptbtwFPs7S576qpwLtIF0L5NIkl+9UqAqcIQI90YVF76EHSbCKf3 dfwphusp0/ZK+YSFoNX0DGnBhhAwlksf4uYSIfrTZwbynoFXlhdK0RZ1pQkjMNBsQjkC 8NHvSRR3LawjkSKDGBoAy61zc2n2yBtXve25U7aGpU7TDVusliB5yhCM3gd1/By2ATrD P+FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=LRtX8CaIFf6tUa2kcwwGXHmJWT8VEFEWk8lk2Kc580g=; b=WsrSBt9wrafKYsuXNuf8exDG+QmzJAhBoR5me9Nmk2dye33yrjpbSEoTMXt/IRdDZW 7KhuvyOXixGw6wMWGaS+aWTQr1dGapJQJ8zP0pV+tneMbmSsxe8nv8+2kYoUMz25Iotm kLBagSFK63ed+caYBuYxI72z4o7qQRWGo8AKVlv3jx9d0CfxOh/l4Y1nJrrlY+qfRlXn 0FNmZ82WR+EnE3PgT4lEdKULKsza9rKoPJkk50xd53rydr7HjeWPBBXwzFALbjKh5Iqf jvDjSzist2bs9KCvC6xDLY2/RMJcoEilu2Ji9d0wE+tjA7EWHFKGQOs3GjBaH+BMfWhB c+mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a17090a9b8100b001f74f8ee43asi2914202pjp.25.2022.08.08.04.52.12; Mon, 08 Aug 2022 04:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234788AbiHHLqg (ORCPT + 99 others); Mon, 8 Aug 2022 07:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233073AbiHHLqe (ORCPT ); Mon, 8 Aug 2022 07:46:34 -0400 Received: from relay05.th.seeweb.it (relay05.th.seeweb.it [5.144.164.166]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9425FB4 for ; Mon, 8 Aug 2022 04:46:34 -0700 (PDT) Received: from [192.168.1.101] (abxh187.neoplus.adsl.tpnet.pl [83.9.1.187]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 2D60F3F6FC; Mon, 8 Aug 2022 13:46:32 +0200 (CEST) Message-ID: Date: Mon, 8 Aug 2022 13:46:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] i2c: qcom-geni: Fix GPI DMA buffer sync-back Content-Language: en-US To: Robin Reckmann , Andy Gross , Bjorn Andersson , Sumit Semwal , =?UTF-8?Q?Christian_K=c3=b6nig?= Cc: Robin Reckmann , linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org References: <20220807140455.409417-1-robin.reckmann@gmail.com> From: Konrad Dybcio In-Reply-To: <20220807140455.409417-1-robin.reckmann@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7.08.2022 16: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. > > Signed-off-by: Robin Reckmann > --- Makes SM8450 Xperia 1 IV boot with the touchscreen but enabled (previously it would simply crash), but the touchscreen itself does not work yet (not yet sure if something is still missing on my part wrt hw setup): [ 1.838819] gpi 900000.dma-controller: Error in Transaction [ 1.838944] geni_i2c 990000.i2c: DMA txn failed:3 [ 1.839166] geni_i2c 990000.i2c: GPI transfer failed: -5 Still, this is a very nice improvement. Reviewed-by: Konrad Dybcio Konrad > 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;