Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3084013imm; Sun, 16 Sep 2018 09:24:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY5By5+XnoVXKx8XySQgyOF7UJa0ccpJnGIIOtNXbLoNRzzY1cClgRPXi0uEdS0LUukXBX1 X-Received: by 2002:a62:d713:: with SMTP id b19-v6mr22266941pfh.88.1537115091981; Sun, 16 Sep 2018 09:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537115091; cv=none; d=google.com; s=arc-20160816; b=H1DU+pdd9lPRJKpBpfiYo1nLhveLoT8wND1Un9bStcqySOZ2FE4JGrzoV3f/QKepg6 IyfYcaOSBcV07GQs+zdCDVkjTuIOPnKxzh6k92vxAft8YrQFueVXhDFXOcuxomj5iQNU kDswXsR8hHRa8IFLmd4iju2fvOXGlJTf7REZqvljbJBeDvClluGqyC/kD7prbXQ1c++Q V1MdvXOHLM2mkZLY2Psi9y8OLQUfLnB0jIdaaRygry9BNF7LEAgMfLHl0CX7L5d5snLI PtOREJAvcMON2Cz9Da44Df9Vt/VF/KBUC1z5TLVoQFA/6VdKIitK0eVDJxJW5Kv+S5FQ AiyQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4Qn5P93A1gJi2Oa5WFG4/81ZmPloE2/r+Qg4adOdvQ0=; b=iDGxQmVl2iV0V6EcZSuKNkr7X/KYMmAsX+3UZYvGSPaFJJT+9vdgFQR/IS2VJYH8Ur 0TuNEFDUhP77XF6mNd7TV2Uv+wm55ALS3USDueyCUoZcZFFxOrrvAOTBVVQNjuqlfGRL p9aXC3PK2hrksoSsojSA51PRbiWIH/1jWnYKnNHH0ArccbBqcLWADDTKczagkzgKGq1O HuNgnB7tMVgpxQpifM4CbRLgoMo9Pa5umhlFKjpSFCCSW5BsWfCyREAO1LdrnTeMEOLZ ByKzrLGSjXG9GYOH2vd2OC0FMYM1zOE+vw48A1HuhZHlfhvN4HSVz83aIFIqcnDpkhOB yenw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=VNTsXIHv; 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 ba4-v6si13009567plb.240.2018.09.16.09.24.23; Sun, 16 Sep 2018 09:24:51 -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; dkim=fail header.i=@lechnology.com header.s=default header.b=VNTsXIHv; 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 S1728241AbeIPVrq (ORCPT + 99 others); Sun, 16 Sep 2018 17:47:46 -0400 Received: from vern.gendns.com ([206.190.152.46]:52051 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbeIPVrq (ORCPT ); Sun, 16 Sep 2018 17:47:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4Qn5P93A1gJi2Oa5WFG4/81ZmPloE2/r+Qg4adOdvQ0=; b=VNTsXIHvJhCV2yM1UKoKq0h2sW Pdhw4TRXVF9RJiBHYdwOjGHRbBzGzJJaTKmeCI9xw57xurbYv3VTlFoeHAPnxQpS77puLZr11SAvG Ts/XZmkCGbXc3s1DubVILubplFJDU/oUf0dgx5MDdfJm24JvVJhhcd4qvrteUJWU/AwnRjGGJP4p3 Yss3139ayt+/PxYoUPDKuBr5qJe5u77XsxC/XXOxAUV/bvYVJsgf5Mj3e1EAjlzzxQ//c7n43KYwf XEBQ4dzG5/Z8/eLOl4jAfIeb4bkusZE6QbA/vmQu1Z0kAi+MT507cIh5EeDCKXYbQ5XpjLXeNozHV pIWoZwyA==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:44598 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g1ZqK-0022Bw-7m; Sun, 16 Sep 2018 12:24:16 -0400 Subject: Re: [PATCH v2 3/4] iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage To: Jonathan Cameron Cc: linux-spi@vger.kernel.org, linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Mark Brown , linux-kernel@vger.kernel.org References: <20180913003920.30600-1-david@lechnology.com> <20180913003920.30600-4-david@lechnology.com> <20180916124110.4edfad9d@archlinux> From: David Lechner Message-ID: Date: Sun, 16 Sep 2018 11:24:16 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180916124110.4edfad9d@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.