Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp33893imu; Thu, 24 Jan 2019 20:31:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN6vC0AKmHnCkjrvtH2zrhXzSHhqLh12VSLVrtU7fbYvfy8cLSMHT9w8eIi7fm0DIfdTP8rE X-Received: by 2002:a63:d252:: with SMTP id t18mr8644868pgi.133.1548390684348; Thu, 24 Jan 2019 20:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548390684; cv=none; d=google.com; s=arc-20160816; b=fFdStt4Pn3xOFkL/EgtPscZne0Xb0z34244AB479uJA55WXFY3YLj4P7ROHS9KyUrf QdYplIXIgqwna7iOgm0PwzjHvaiYR6GyGwy1VUIyV72YY73QCYGswhP5izEw8syoWjxR L/zIXftkhD8GQrULp53GzYS2zdn4caZfAy4wKaD88PiFfjVSJh13mERmtIy0ksChW1r7 9EEEj/cJJIef7tsQX0tTJj9NLESBMRgZ+sD8HpXWCerfQfXkldQ82vbgkiC0KibWdYyw Zqs2l4JcqTKkCqWz7+eJd6im5rZ7JJGUelrsS4m643MNJn4Ad7/T0wwqobTRxNTXClC/ Q3PQ== 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=HyX/aw5NyT6H0MdYC4RYsIJg2sU71AJwhOqZBljavi0=; b=mVTuWq3mZOo5mkAl6XzW0xwMyU9BxpDUD/QK3MC/Avu4oprIC9j0Ya8IFok6jftmW4 Ao/Ef1YejWbSbkhaPX0Y2pUhD1LRMUBbX/CUqaNDyDywdtcuBAIcuTCPhlKKWM8kVkFg kH8p6wHiqA709txWJtGrO0zEy4hrUspnx3vGP5YBFkwRg6cXg5MoyaYBGtJx+Yutpyqh 73isSx00pqRHg7pRr1JfgF16f9Vqxv34hsC3iccnr+azSenxtzRleYiLd3gAK7tWfrWE 75h4rymXtoNLD7pCsah8Wfom4aV8y9CfQYURuFBuByT+EM50oNSeJLx/yV9PilF6imwU uorw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=noxPPGM9; 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=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 m11si23503964plt.26.2019.01.24.20.31.08; Thu, 24 Jan 2019 20:31:24 -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=@gmail.com header.s=20161025 header.b=noxPPGM9; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727882AbfAYEag (ORCPT + 99 others); Thu, 24 Jan 2019 23:30:36 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:36073 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727163AbfAYEaf (ORCPT ); Thu, 24 Jan 2019 23:30:35 -0500 Received: by mail-yw1-f68.google.com with SMTP id i73so3416668ywg.3; Thu, 24 Jan 2019 20:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HyX/aw5NyT6H0MdYC4RYsIJg2sU71AJwhOqZBljavi0=; b=noxPPGM9kHmC9LX3ocPlzqTh4rwuZDgjRZKeaN9pjLrHZyWBeh5SImQZ3K5i0sLofJ Mzm9Q7MT1404e+KVsvHluAmgyrK+C0TaIzXR+s5GAZYLmVGxJxa8WVpiIx8h3llCU+O/ /1hi7kp1rtkHQkVdIAOSOifcVEBKCg1cHt3n/65B1aaPYp5hZ9hByixy7/1HlbqZsnQb hrWicTahvp5EcFTU8poEVLa2m2rpJVTuS65Vu4PC+r84ioZRiup15ozqcVCRb1w6Jqo3 wblmyA3PEoxUGbkxmSbVeubdwh3tO6jSWdka7j8cQNqJsSC4jbleLUcWhKya8/Vymmxl JK/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HyX/aw5NyT6H0MdYC4RYsIJg2sU71AJwhOqZBljavi0=; b=EXXSDdHnt15nJh018jWkbjXyAypSv3fb+l/N1BFCYun7o/KbSNmnMxYS3NAKssvqAT /kLZ7NWCf/1mj+5Mph+FnWddIWfe4tHvxa5UzNZOCrOYyQ2yGPr6U4MDUcCZLjmKXZWu feeU6fMjAYP3ETaRmALjbCno/Pfv8CkXiC8Q3z4bUb2Ds8qmIMwJiZKA9E9xOkkC0+6A RFmClhz+7XMeRSKxwmYpHxhy4DjqRfspUYrHDPxon5CcY9u/tzpi3F2x52KSIVwrYExg BVwwHcj/enGmZOuT8EARlRePyr6xger/PPl0fMkm0BQSZteP4DxQsonhPCYhEqPmTW8x WNTA== X-Gm-Message-State: AJcUukeekQbY6OY35aLJBBE+ejn4jlmb5/AWVfizeQI39bPKD0vLXYG/ LkaskBQxZ28wYZ/xMbYePE+c7brW X-Received: by 2002:a81:ad64:: with SMTP id l36mr9478284ywk.114.1548390633874; Thu, 24 Jan 2019 20:30:33 -0800 (PST) Received: from [10.10.116.193] ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id j12sm11872726ywk.43.2019.01.24.20.30.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 20:30:33 -0800 (PST) Subject: Re: [PATCH] iio: adc: ti-ads7950: inconsistency with spi msg To: justinpopo6@gmail.com, linux-iio@vger.kernel.org Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, linux-kernel@vger.kernel.org References: <1548381414-20561-1-git-send-email-justinpopo6@gmail.com> From: Florian Fainelli Message-ID: Date: Thu, 24 Jan 2019 20:30:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1548381414-20561-1-git-send-email-justinpopo6@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Justin, On 1/24/19 5:56 PM, justinpopo6@gmail.com wrote: > 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. Do you think this warrants a Fixes: tag? > > 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; Should this be st->scan_single_xfer[2].tx_buf? > st->scan_single_xfer[2].rx_buf = &st->single_rx; > st->scan_single_xfer[2].len = 2; > > -- Florian