Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp755526imu; Fri, 25 Jan 2019 10:22:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hMEwXFgNGFDHh5/St5RoTn6ELSMKS1e9h9GDIgYQzlV/zlokQl9QQixhrlWevhU4lWYIf X-Received: by 2002:a17:902:2867:: with SMTP id e94mr12216827plb.264.1548440532120; Fri, 25 Jan 2019 10:22:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548440532; cv=none; d=google.com; s=arc-20160816; b=DNM23iFdzYEdaDkza2czLsg12iL+AAWkPhyQ9cIOUqFgaOr71k4Z0XuEZh8MocqMYY Akc9PX6V+R7JnHak+ghkms9ZoIqH5xgE5i1WS7fJQiGf9M5JGlK7/ZLZqYIs89aNUdkw 6IDk8Bh+IBPs8us6BD/MyHYcIo6Wkqu33WYBw1F/slY4UwVHBldpyiWvbB2TeehfPy6O oFKWx4JybcDLpTFWnwtgVm7Dw8kWDs8P1ZkPA/32ft4UC4Q+CcztHlgsoIUduKU4lgqg 6WnhOPFmtKzJJnvJWx81mNaEhnfOrSXCBMMub7i+1uqAebzo4+UEKVEz0z/boju1uvv+ qJbg== 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=JuBkEhCMZrmDHOTgIo+D5vog4cKlPevyv8P5KOY1nSA=; b=jHwPMQ/FWbVQEqiMYt4EL/6oAqgFqhlL3/iaWp7bMdninH1UuYxEtFaxHQvF3ITKA5 1PfAyY1Iv/yCNOzWJLMhi0KYI+r9Ky+kmof/3hK49sk/SIj66zAae95n2hNV9gNAISc6 +90+kXFEg/90TxqkRRftw+6KxoiNNp970hGkdExH+o9zuQQAFHtFGZwAd4GfzZiw9Dfm fDa51tJfFPdUyOfZd2I+Mfv63BDjhOXaUWXpWx0uenb+GbgdS+ZXQwwK3TVz4p8gn+5u KwDL+ZluHxcxvaJxN59P8Ipm86JaIt95fhEzWjeZxwcykLcH6spWv9f7NyncjeCGNc0h s6SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=JG0t3YBY; 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 y17si1818611pll.10.2019.01.25.10.21.56; Fri, 25 Jan 2019 10:22:12 -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=JG0t3YBY; 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 S1729066AbfAYSUf (ORCPT + 99 others); Fri, 25 Jan 2019 13:20:35 -0500 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:37488 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfAYSUf (ORCPT ); Fri, 25 Jan 2019 13:20:35 -0500 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 7AAA730C0A5; Fri, 25 Jan 2019 10:20:29 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 7AAA730C0A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1548440429; bh=OnBTKt6woy+u6w5wYAW86X+xtJCsSnClrQJsvmKgaP8=; h=From:To:Cc:Subject:Date:From; b=JG0t3YBYG3o9k1hxzlEnmvlHZ9cIty5MU9hayH0MPDMF+RUg+YINy7TI8NLZGdO6s mwCTMN6G0sFA7HlB56zq0ZJIT+iebipS/BVAfmt8sud1PSCpE2/Iqzegsd0936fieV Gm4WthlueHWrwrKKrgo0exJhkVHTkgPYZwhQr7nQ= 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 6D943AC0730; Fri, 25 Jan 2019 10:20:29 -0800 (PST) Received: by stbirv-lnx-2.igp.broadcom.net (Postfix, from userid 47169) id 5188A2800EA; Fri, 25 Jan 2019 10:20:29 -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 v2] iio: adc: ti-ads7950: inconsistency with spi msg Date: Fri, 25 Jan 2019 10:20:22 -0800 Message-Id: <1548440422-27943-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. Fixes: 902c4b2446d4 ("iio: adc: New driver for TI ADS7950 chips") 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..1255d8b 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].tx_buf = &st->single_tx; st->scan_single_xfer[2].rx_buf = &st->single_rx; st->scan_single_xfer[2].len = 2; -- 2.7.4