From patchwork Mon Mar 12 13:14:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Sahu X-Patchwork-Id: 10276245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACF58602BD for ; Mon, 12 Mar 2018 13:15:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D090286D2 for ; Mon, 12 Mar 2018 13:15:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9175828DC3; Mon, 12 Mar 2018 13:15:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38908286D2 for ; Mon, 12 Mar 2018 13:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932102AbeCLNPw (ORCPT ); Mon, 12 Mar 2018 09:15:52 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42088 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302AbeCLNPt (ORCPT ); Mon, 12 Mar 2018 09:15:49 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id AA2A760590; Mon, 12 Mar 2018 13:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520860548; bh=OEjC8hwzTdYrAz6X5r9lljhFnIvyiLX/VP1V54+pGO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dj6rDnQ9XlmXfwTlQ8lUAQnpbsY4tkg3UDcNfxMf2n3Zt9RvANESozDTd9CE3QhS9 x7UQ9zhRIdLqG2mLBVjjszQTCSbzsSvnrr/lWxaNMPoVtsSsyYdg2WryAPXOCftGkQ wMhOTfir/snBOX4Kg9x3a1DgtOigMjhzjmpgJ4UA= Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 97362605FB; Mon, 12 Mar 2018 13:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520860548; bh=OEjC8hwzTdYrAz6X5r9lljhFnIvyiLX/VP1V54+pGO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dj6rDnQ9XlmXfwTlQ8lUAQnpbsY4tkg3UDcNfxMf2n3Zt9RvANESozDTd9CE3QhS9 x7UQ9zhRIdLqG2mLBVjjszQTCSbzsSvnrr/lWxaNMPoVtsSsyYdg2WryAPXOCftGkQ wMhOTfir/snBOX4Kg9x3a1DgtOigMjhzjmpgJ4UA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 97362605FB Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Andy Gross , Wolfram Sang Cc: David Brown , Sricharan R , Austin Christ , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abhishek Sahu Subject: [PATCH v2 08/13] i2c: qup: use the complete transfer length to choose DMA mode Date: Mon, 12 Mar 2018 18:44:57 +0530 Message-Id: <1520860502-14886-9-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520860502-14886-1-git-send-email-absahu@codeaurora.org> References: <1520860502-14886-1-git-send-email-absahu@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently each message length in complete transfer is being checked for determining DMA mode and if any of the message length is less than FIFO length then non DMA mode is being used which will increase overhead. DMA can be used for any length and it should be determined with complete transfer length. Now, this patch selects DMA mode if the total length is greater than FIFO length. Signed-off-by: Abhishek Sahu Reviewed-by: Austin Christ Reviewed-by: Andy Gross --- * Changes from v1: 1. Removed dma_threshold from global structure 2. Modified commit message for the same drivers/i2c/busses/i2c-qup.c | 25 ++++++++++++++++--------- drivers/i2c/busses/i2c-qup.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index d16361d..bf1b7ee 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1300,7 +1300,8 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, int num) { struct qup_i2c_dev *qup = i2c_get_adapdata(adap); - int ret, len, idx = 0; + int ret, idx = 0; + unsigned int total_len = 0; qup->bus_err = 0; qup->qup_err = 0; @@ -1326,14 +1327,14 @@ static int qup_i2c_xfer_v2(struct i2c_adapter *adap, goto out; } - len = (msgs[idx].len > qup->out_fifo_sz) || - (msgs[idx].len > qup->in_fifo_sz); - - if (is_vmalloc_addr(msgs[idx].buf) || !len) + if (is_vmalloc_addr(msgs[idx].buf)) break; + + total_len += msgs[idx].len; } - if (idx == num) + if (idx == num && (total_len > qup->out_fifo_sz || + total_len > qup->in_fifo_sz)) qup->use_dma = true; }