Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1582134ybh; Sun, 15 Mar 2020 06:17:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuTxEvzVrawStiDbK+DT0Pfh008n4gNpweqRcIL+SDhvEVKF0qtR9zCX1ZGdda21dSdBudw X-Received: by 2002:a9d:53c4:: with SMTP id i4mr19957230oth.48.1584278274953; Sun, 15 Mar 2020 06:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584278274; cv=none; d=google.com; s=arc-20160816; b=v8bavfJ39kZgSddTWvWXlNWEl3+JPW2selo07aNxu/RxK/EDANDBPhC1JXatQWLvt1 OARLrGBYrWeIhimI3s4R8zocksFfkyNYwTvt4HHmwvR4SIoxC5NlXcV+gGcRdY+hzi2e QnfWGrIayHX/Fvs5VdTZ1C+YOTiYI6suULeP1+iMRVn4idN6xIkOb3gAy/DlbCguhKf1 UOMKF9HJwdvCXHdj4fCrh2Tdd5TMeQ2ufHHLniKLVvhvThX9wKqAkRexJnZX5Y6eHIM/ RvGXAAeDhMdqXYrb8A3wB/7PBRtYq6pGLt8nvLqhayzP25RY87d+jl/o/1gXgbKupkE9 teXw== 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=MXOA+YKkr+QMpHN7VLj32aI0SAF0G1KZ6WvdkY+svhs=; b=ggAecKzu/pumpegiE9/LGWSu/os2E/iRgMlqMYUdlr3nbabelms0NEGOIlsweCbvKq VGb++IhrdvYUu2SgkTwa9x/ewR60b1m3BM8LY+i8267AOvxErCF7xS0GGaHiYrGNsC+2 2Sy/kElwKur8i2t1hLyftchboIxL7mIumIl0iTPr9bYDKVrHfgdZhQTtY6MxkfOfuM8k L13dXf1sWBxUipA9iQ9d+s/iPljuNwf+d2hBA3DSGrAMlGVK3XpYqdPIsHqlcMZW4wS6 OaEqAVONcGdaFGpZelQzwiynd2HKKUf5S944Xq5YHEALBd0APJKvZRs7/rLn28Cci0a8 CM/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xWudyr8E; 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 t25si7564545oic.183.2020.03.15.06.17.42; Sun, 15 Mar 2020 06:17:54 -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=xWudyr8E; 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 S1728595AbgCONRB (ORCPT + 99 others); Sun, 15 Mar 2020 09:17:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:48590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728541AbgCONRB (ORCPT ); Sun, 15 Mar 2020 09:17:01 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 8BCDD205ED; Sun, 15 Mar 2020 13:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584278220; bh=X10LSDl+tgR7wxLhrOkAitKNHf55x2311G9Mgz947d0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=xWudyr8E5oAujeyIgdwtB/1wUEZb2qp4oXoLEVOA0tuL1mt3bYAAH8SYQhH5/vBtt p5aJiPO6GBZWsuUrTSEI1yk1/s0x/YcDoLRjbGGcuMnKad65M67PK7C+exUQ73X6DK dHwFl0yRWVV0jMio9DIJLuSJ0lSlY/gI5al3rdek= Date: Sun, 15 Mar 2020 13:16:56 +0000 From: Jonathan Cameron To: Beniamin Bia Cc: , , , , , , Dragos Bogdan Subject: Re: [PATCH 2/4] iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R Message-ID: <20200315131656.5baa8a42@archlinux> In-Reply-To: <20200311084328.17680-2-beniamin.bia@analog.com> References: <20200311084328.17680-1-beniamin.bia@analog.com> <20200311084328.17680-2-beniamin.bia@analog.com> X-Mailer: Claws Mail 3.17.4 (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 Wed, 11 Mar 2020 10:43:26 +0200 Beniamin Bia wrote: > From: Dragos Bogdan > > When CONVST signal is generated internally, IIO_CHAN_INFO_RAW can be > made available for AD7091R for single reads. This patch enables it and > makes supporting more devices by this driver easier. > > Signed-off-by: Dragos Bogdan > Signed-off-by: Beniamin Bia Applied. Thanks, Jonathan > --- > drivers/iio/adc/ad7476.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c > index 32e857dfec9c..3b48073dd62d 100644 > --- a/drivers/iio/adc/ad7476.c > +++ b/drivers/iio/adc/ad7476.c > @@ -29,6 +29,8 @@ struct ad7476_state; > struct ad7476_chip_info { > unsigned int int_vref_uv; > struct iio_chan_spec channel[2]; > + /* channels used when convst gpio is defined */ > + struct iio_chan_spec convst_channel[2]; > void (*reset)(struct ad7476_state *); > }; > > @@ -109,6 +111,8 @@ static int ad7476_scan_direct(struct ad7476_state *st) > { > int ret; > > + ad7091_convst(st); > + > ret = spi_sync(st->spi, &st->msg); > if (ret) > return ret; > @@ -176,6 +180,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, > #define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \ > BIT(IIO_CHAN_INFO_RAW)) > #define AD7091R_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), 0) > +#define AD7091R_CONVST_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), \ > + BIT(IIO_CHAN_INFO_RAW)) > #define ADS786X_CHAN(bits) _AD7476_CHAN((bits), 12 - (bits), \ > BIT(IIO_CHAN_INFO_RAW)) > > @@ -183,6 +189,8 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { > [ID_AD7091R] = { > .channel[0] = AD7091R_CHAN(12), > .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), > + .convst_channel[0] = AD7091R_CONVST_CHAN(12), > + .convst_channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), > .reset = ad7091_reset, > }, > [ID_AD7276] = { > @@ -288,6 +296,9 @@ static int ad7476_probe(struct spi_device *spi) > indio_dev->channels = st->chip_info->channel; > indio_dev->num_channels = 2; > indio_dev->info = &ad7476_info; > + > + if (st->convst_gpio && st->chip_info->convst_channel) > + indio_dev->channels = st->chip_info->convst_channel; > /* Setup default message */ > > st->xfer.rx_buf = &st->data;