Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp381314imm; Sat, 22 Sep 2018 02:12:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV61yiKp32SNwiAVk9xbJMDCIRUFlLQY3xWkJ+kKPklTatSrodHXYnyk3xBtMf8ENRtqoe4UT X-Received: by 2002:a63:1e0b:: with SMTP id e11-v6mr1577893pge.44.1537607550999; Sat, 22 Sep 2018 02:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537607550; cv=none; d=google.com; s=arc-20160816; b=bg4Ww0wiSXip5t4UjFSobuGCH7O1bcy2G8uJq8NhDCQu1oSOy2yVRx1KkE3xR8I+bL XToSXbZ57+7w3V0VnZazm1Ox1I2BB++ExyVBBl/B6C9RrfyD66DrLW6AaEoT9VDg0f2e /TeeN1bL0zEiz+Uoib0hsw89JKfcRjlOfJsaImwM0k6GYGHm6236iuVbIW3xP/qtKaUP 85OcqcQfMMYKBspoV8RiQJ5FFqlnY4vopxtetQ4Y5HJ6aQEsG7tV0XzA+an3ss/Y763V ye33+mrwaUe9Msp53VFhJpcI50g2o0EmnpNQCSwcfkeksnvfVGcGPmJO1Qyg/BVjPzRF 17pA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=E4wjlLCUMGXYb/mrpJGvScyDgo8rqp4MZxkeSxXM8c0=; b=iw9FlpI2N0CWwx6Jukn6CkvUi2EgnSrRmkhJvat9Dhw9nBDHFUFPQjyjXXOd5RetZa I/o/ejyaOSLmRiUwVvBULuXFJqZR9iJpyC38b1SGhCgPm0KvYG/dVzyANW9Vcdcq2dhD F4p5sSBFo205cB/SnfN+++3vOc2dUL06lpzlQ+9IhU6U6PA48skIOyfUPqXtBcNj9Qsw 2isodpxKBeBjDaZxBPZAlsj5IDTDXEHhihYVUF2JtgK+OMcGU84E8tQnY34s5TPbNOAZ Ar6suhwPlgmvCnM+FVhcnyzagYk6jRNT7R+H1F+RvS63iryVzrWgZZamnYgtuwESbLYe 33dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gvikT6S3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14-v6si29313241pgg.540.2018.09.22.02.12.14; Sat, 22 Sep 2018 02:12:30 -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=pass header.i=@kernel.org header.s=default header.b=gvikT6S3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726363AbeIVPFB (ORCPT + 99 others); Sat, 22 Sep 2018 11:05:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:45026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725837AbeIVPFB (ORCPT ); Sat, 22 Sep 2018 11:05:01 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C755421532; Sat, 22 Sep 2018 09:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1537607529; bh=HCxI/MK105iEdQgLB9YTN2SqTi8uOuasEV3caJW+t8M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gvikT6S38KFKdntfnxqhO/wSDhvHFTPQ+/HfQqgYbmEGCTLf2r9W/nP+eC2E/ThAF QImASlphW6r2O+cLY/uaWQ7yctiCCXZGdVUTrbEv6CDH/3p8UK4gerS2yCqrKGMgMN fz8rIZz7VGLNbxsZUpO8H2V24xXhV1BH0YwZn0j0= Date: Sat, 22 Sep 2018 10:12:04 +0100 From: Jonathan Cameron To: David Lechner Cc: linux-spi@vger.kernel.org, linux-iio@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Mark Brown , Geert Uytterhoeven , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage Message-ID: <20180922101204.07ce82d5@archlinux> In-Reply-To: <7a70711c-5d38-5ba6-ec90-b2506dc0727d@lechnology.com> References: <20180918170850.2749-1-david@lechnology.com> <20180918170850.2749-4-david@lechnology.com> <7a70711c-5d38-5ba6-ec90-b2506dc0727d@lechnology.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Sep 2018 12:14:50 -0500 David Lechner wrote: > On 09/18/2018 12:08 PM, 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%. > > > > The use of big-endian for the raw data 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 so we opt to change the raw data > > format from big endian to CPU endian. > > > > There is a small risk that this could break some lazy userspace programs > > that use the raw data without checking the data format. We can address > > this if/when it actually comes up. > > > > Signed-off-by: David Lechner > > --- > > And I just realized I forgot to pick up... > > > Reviewed-by: Jonathan Cameron > I've applied this on top of the original series on the basis I doubt anyone will be testing this particular driver in such a way as to hit the changes you made in the last two patches + I don't think Mark has tagged those for me to easily pick up. If it's a problem I can apply them to the IIO tree as well and git will sort it out come merge window time. However, that's inelegant so I won't do it unless needed. Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it Thanks, Jonathan