Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3703741imm; Mon, 17 Sep 2018 01:34:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYyBW+e6PlqaMF9jDlCFToLTYjoSOECeI1yqelEVWogAym0VLdEeMShfAnUM6zTKqnQaIgE X-Received: by 2002:a63:d806:: with SMTP id b6-v6mr22151770pgh.347.1537173290983; Mon, 17 Sep 2018 01:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537173290; cv=none; d=google.com; s=arc-20160816; b=Cv1ZRcCLuPTEo6+OjKw2Um4HWt49qgxtvpJoA0RsFuPPuOIK8+qnN/rv/whTD2DKjf 9OqMlPjQ+VGHKchazpDQjZgkQ/58C0voi6kkDTD9GBzW5eZATqs+zz1ENP0sDuToojNV qcuarj7OSjs8durPOOjTDx1Ufhor+eBs/gfkhqVJntcQo3Y2uX0LkLIZNTOw/I2dFTjb AlKpmFSRs2EhmwiirlzVbYlAm6UxN7r7sB4Kbs/V5dmpz1irqK4OfQEB5hXzyTI9A0um g58uDgsNxLysq4GZLUyoS0CQd97B/WQGe2OFUKQGh+Rg2uTIfw5w+MJhc7h1LfmJBQUU 1bPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=fmDqhj7kUSqEaiFtV6G2zawqfVBRaDPX7/bPrSKRS1g=; b=SOvpbT9tYJcRN4oWWtfqjSuI1rYXBR2D6zT4wIUzaahT3QUvt02ucCQFMidluks57Z TrcPO2vlKFq3NZJ6bNz2n5rWD+epPsQ/Xqx9QH+iWRB2xsJpQYHaz81tclkzZxQRKjlQ lhyqBuSwcrquFPv90VHd8siyoNJFmssnuLYXrHP9zti8mXMHJHEtdR0LNwMSluf6knxp I9X50JLIy8y2OrOmRSIqTv8MlOEIGaG7c9BT25Nm8g6ftTmIUp7FfwHzg8M4Hzz+owlc rqAStWiRkrBDsSRdOUuxBpyDQ9pyTHrxAdgD/20aKQLtUudYLYtzLUS7iQNnKmm8x/aH MbmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si15006251plz.351.2018.09.17.01.34.35; Mon, 17 Sep 2018 01:34:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728336AbeIQOAD (ORCPT + 99 others); Mon, 17 Sep 2018 10:00:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:57898 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727946AbeIQOAD (ORCPT ); Mon, 17 Sep 2018 10:00:03 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1A4FEE88EFB61; Mon, 17 Sep 2018 16:33:38 +0800 (CST) Received: from localhost (10.202.226.46) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Mon, 17 Sep 2018 16:33:38 +0800 Date: Mon, 17 Sep 2018 09:33:25 +0100 From: Jonathan Cameron To: David Lechner CC: Jonathan Cameron , , , Hartmut Knaack , "Lars-Peter Clausen" , Peter Meerwald-Stadler , "Mark Brown" , Subject: Re: [PATCH v2 3/4] iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage Message-ID: <20180917093325.00006e24@huawei.com> In-Reply-To: References: <20180913003920.30600-1-david@lechnology.com> <20180913003920.30600-4-david@lechnology.com> <20180916124110.4edfad9d@archlinux> Organization: Huawei X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.46] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 16 Sep 2018 11:24:16 -0500 David Lechner wrote: > On 09/16/2018 06:41 AM, Jonathan Cameron wrote: > > On Wed, 12 Sep 2018 19:39:19 -0500 > > David Lechner wrote: > > > >> This changes how the SPI message for the triggered buffer is setup in > >> the TI ADS7950 A/DC driver. By using the SPI_CS_WORD flag, we can read > >> multiple samples in a single SPI transfer. If the SPI controller > >> supports DMA transfers, we can see a significant reduction in CPU usage. > >> > >> For example, on an ARM9 system running at 456MHz reading just 4 channels > >> at 100Hz: before this change, top shows the CPU usage of the IRQ thread > >> of this driver to be ~7.7%. After this change, the CPU usage drops to > >> ~3.8%. > >> > >> Signed-off-by: David Lechner > > > > Hi David, > > > > I've managed to forget why we are changing any of the endian related code > > at all. The change SPI_CS_WORD result in changes between words which is > > fine but it doesn't change any ordering within words? So as such why > > do we no longer need to do the big endian conversions? > > > > The big-endian stuff was cargo culted from another driver when this driver > was originally written. It used an SPI word size of 8 bits and big-endian > byte ordering to effectively emulate 16 bit words. > > Now, in order to inject a CS toggle between each word, we need to use the > correct word size, otherwise we would get a CS toggle half way through > each word 16-bit. The SPI subsystem uses CPU byte ordering for multi-byte > words. So, the data we get back from the SPI is going to be CPU endian now > no matter what. Converting that to big endian will just add overhead on > little endian systems. Cool. Thanks for the explanation. If you are rerolling put that in the patch description. Reviewed-by: Jonathan Cameron I'm kind of assuming Mark will want to take this through the SPI tree if he is happy with it. Mark, shout if you want to do it another way. Thanks, Jonathan