Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2683899imu; Thu, 24 Jan 2019 18:06:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Atqu6habWCmuTSMKtkACzNIHMjsTFDctT/xt/MI26IXOrwCN9xHG4myVvbR2w20giCSDw X-Received: by 2002:a62:b15:: with SMTP id t21mr9336635pfi.136.1548381962196; Thu, 24 Jan 2019 18:06:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548381962; cv=none; d=google.com; s=arc-20160816; b=hUyLT2+icsdJMMpr5i3m2/3hsCjdJDkUDTFDrc+5GDg1PMigffRPCR9UegfBx+uFPB 3rBK005g9ZadZXt/FpNs27AeG28Qrf7J9SYaIIhR5FgUdfpC4Wnm5psIp7egF1cfZP/2 25Immc2acDs34Cp6BWhHkddUM7BCJTtJpa9IrzLQJD1NN2b0nhqhXmD5ybML8PhjZq1v NnYH2GYQMoXNJ7O1YDg4uOOE32NeKtwG/d/kN8zMM22rpxJFUKv9DpDRf9QLwmBQyhc1 UscLBY9o/5btAOEtMUr8f75koo6HIBTb8PIbVlM5OLN72qBJrF1SvyH5yzvrkBvy6s4k 7mJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=jT+c/zFeVgBGseX5bPDu4RXf12hn3eT6lTYfrmTceFU=; b=gnFsCIiIC3ouGdNBLYScW0qIJ714Ovnbd+u6Vg9LtztBcJGg/hhLmKL6P505AdnPfk 4sMGpcy1K1atg2AQBpJB34nP5TaQ+jxGqhHLsqb7dQ+5ReeNwvZJZf+xcWLdx9trpTd9 /RPRpJ5hJbrLODKSlQCo/fgdq/4EY8FAgXYugYMQjYuC/jE5C1NUK4JO3C1wrCKYBsM8 Q9OpozFD8JmkrCXWG5AXSwVM6CuXf0rgZgFrzwKY6xl1/DSMtNJpNimnxXtwLOGQHxfv 21ku+xdayMclUivS6KN2mg5MdGO5MtTgh1jGyR/OUsdyOdftKbRh4sVCKLCMQtA1zrq4 pwcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=gx9mFuZ3; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si260867pgh.565.2019.01.24.18.05.45; Thu, 24 Jan 2019 18:06:02 -0800 (PST) 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=@broadcom.com header.s=dkimrelay header.b=gx9mFuZ3; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728461AbfAYCFg (ORCPT + 99 others); Thu, 24 Jan 2019 21:05:36 -0500 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:36094 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727983AbfAYCFf (ORCPT ); Thu, 24 Jan 2019 21:05:35 -0500 X-Greylist: delayed 502 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Jan 2019 21:05:35 EST Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E1AAC30C012; Thu, 24 Jan 2019 17:57:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com E1AAC30C012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1548381431; bh=cZOP/nX3nnggIGwSwr68BY+QBEhuNcDNNNnqUyDj8rk=; h=From:To:Cc:Subject:Date:From; b=gx9mFuZ3mwaDlKdhz9+KpZ8SL8CA5iHUJdvyFcGDOazTGM/71Uvn9cB9V5uMO+o7+ jIfOwhvgJKp6nMwn5GRVkKk/SUF++5ykFUF5mDtUaBu15LZOoZ3WhhyT4li5ARhZm7 fRSsTTsTJe2WzxW2/yWYyUjzZNELMo4jyy5O9Kjg= Received: from stbirv-lnx-2.igp.broadcom.net (stbirv-lnx-2.igp.broadcom.net [10.67.48.34]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 3690DAC074C; Thu, 24 Jan 2019 17:57:12 -0800 (PST) Received: by stbirv-lnx-2.igp.broadcom.net (Postfix, from userid 47169) id 15E2A2800EA; Thu, 24 Jan 2019 17:57:12 -0800 (PST) From: justinpopo6@gmail.com To: linux-iio@vger.kernel.org Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, linux-kernel@vger.kernel.org, f.fainelli@gmail.com, Justin Chen Subject: [PATCH] iio: adc: ti-ads7950: inconsistency with spi msg Date: Thu, 24 Jan 2019 17:56:54 -0800 Message-Id: <1548381414-20561-1-git-send-email-justinpopo6@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Justin Chen To read a channel we require 3 cycles to send, process, and receive the data. The transfer buffer for the third transaction is left blank. This leaves it up to the SPI driver to decide what to do. In one particular case, if the tx buffer is not set the spi driver sets it to 0xff. This puts the ADC in a alarm programming state, therefore the following read to a channel becomes erroneous. Instead of leaving us to the mercy of the SPI driver, we send the ADC cmd on the third transaction to prevent inconsistent behavior. Signed-off-by: Justin Chen --- drivers/iio/adc/ti-ads7950.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c index 0ad6359..5453e10 100644 --- a/drivers/iio/adc/ti-ads7950.c +++ b/drivers/iio/adc/ti-ads7950.c @@ -422,6 +422,7 @@ static int ti_ads7950_probe(struct spi_device *spi) st->scan_single_xfer[1].tx_buf = &st->single_tx; st->scan_single_xfer[1].len = 2; st->scan_single_xfer[1].cs_change = 1; + st->scan_single_xfer[2].rx_buf = &st->single_tx; st->scan_single_xfer[2].rx_buf = &st->single_rx; st->scan_single_xfer[2].len = 2; -- 2.7.4