Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1167696ybd; Wed, 26 Jun 2019 12:26:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWI3GWqBisKHLF0UxZXB49B9sn5tnlx6XKTAa7WRzGBueo3Z5emDqSgUKOR1lpZI6vvZ+I X-Received: by 2002:a17:902:b944:: with SMTP id h4mr7159076pls.179.1561577199879; Wed, 26 Jun 2019 12:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561577199; cv=none; d=google.com; s=arc-20160816; b=t/DDFODoLgQtLuhb5e1toLPEA0U517YcFfPlV2vfBZ47/cMECByfcVIi0v4C/F99cw +kkQWSPPJiWECKiuAZwOaWflTP49BXTExTpOqCU0jcdtaQNv7Pmxiekalevm+4GLUvOH oAfpNR/V+OJ9KtbJAJ63WWGcY1ePiaxDuXns1H31uv9f0qRqAMRMMIubK55t7X8goKUZ 1B8fyHrGOzkhHo9gybzW8l85mLbdrcz48WV73AiH09XhZ/l8ssmzBUTLGLjFGrjQYqJg 7Lh7za33lqkRMDtYUwKIbRtJwlbYcgEZP7byfTSE/5wVLMd6jl/zaW6nNy48eVTzAvBi 25aQ== 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=ZMc81LBCdo4uYvWBOn6FqjgXo97euBjuoDX5fcgC60g=; b=0EvaatfMjrodtcJleq1MiBwb+IUbFNj3PBIZXXjdC4SoT+pkcQngA9+30lysU8hS4m LgS31CahF5b1ecTvjsNVQEhkzy7RA6+EEFckwXSb4JPZL2tWtRIEuvMl+e1d8lE8qPpX rAyHyxQH2vtyly5ZYbXBc8eL47lWYWsaOYuAL1j2F+4+P5cF1eFYHnGUU6vjB2DwxiyO tnQQ8mCheiMCaTsgx3PphuGFprCr69VOUoA7gPbAfi2i3jMtycoYRmJPLE8oCEE1ZhtQ Oyaf530dvk0p95036ti7vQmh+nM1dtVSiamJpLnbhqDzBnH63IhqRHpwZPzkEV5OqRjE k/vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jf6UJSlK; 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 m8si17590670pgs.457.2019.06.26.12.26.23; Wed, 26 Jun 2019 12:26:39 -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=Jf6UJSlK; 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 S1726445AbfFZTZA (ORCPT + 99 others); Wed, 26 Jun 2019 15:25:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:52424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfFZTZA (ORCPT ); Wed, 26 Jun 2019 15:25:00 -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 E2F1F20663; Wed, 26 Jun 2019 19:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561577098; bh=9ddGytE2MAIZUMOytFZySMm/WxQbcmBwrlBm8SgBIsU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Jf6UJSlKMAJtNs2U6rd/Pm+8Rt34lOdXkcEID0cY+PtdcZ256uVQ/cR2KdiTBh5hC s1i0LObLC7xcuhwewtfmy+ZlujlxP+fGNBwt4DGi0lGiUeiH31AVPhoYWs7mgTuQ0w etI/kDkA6VNAP9fQUhwH/n3Hka1I9zG/IjGMrWYs= Date: Wed, 26 Jun 2019 20:24:53 +0100 From: Jonathan Cameron To: Mircea Caprioru Cc: , , , , , , , Subject: Re: [PATCHi V4 2/5] iio: adc: ad7124: Add buffered input support Message-ID: <20190626202453.723aded1@archlinux> In-Reply-To: <20190625081128.22190-2-mircea.caprioru@analog.com> References: <20190625081128.22190-1-mircea.caprioru@analog.com> <20190625081128.22190-2-mircea.caprioru@analog.com> X-Mailer: Claws Mail 3.17.3 (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, 25 Jun 2019 11:11:25 +0300 Mircea Caprioru wrote: > This patch adds the option to enable the buffered mode for positive and > negative inputs. Each option can be enabled independently. > > In buffered mode, the input channel feeds into a high impedance input stage > of the buffer amplifier. Therefore, the input can tolerate significant > source impedances and is tailored for direct connection to external > resistive type sensors such as strain gages or RTDs. > > Signed-off-by: Mircea Caprioru Applied. Thanks, Jonathan > --- > > Changelog v2: > - nothing changed here > > Changelog v3: > - nothing changed here > > Changelog v4: > - nothing changed here > > drivers/iio/adc/ad7124.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c > index 810234db9c0d..ab52c5e9ecb1 100644 > --- a/drivers/iio/adc/ad7124.c > +++ b/drivers/iio/adc/ad7124.c > @@ -61,6 +61,8 @@ > #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x) > #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0) > #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x) > +#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6) > +#define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x) > > /* AD7124_FILTER_X */ > #define AD7124_FILTER_FS_MSK GENMASK(10, 0) > @@ -108,6 +110,8 @@ struct ad7124_chip_info { > struct ad7124_channel_config { > enum ad7124_ref_sel refsel; > bool bipolar; > + bool buf_positive; > + bool buf_negative; > unsigned int ain; > unsigned int vref_mv; > unsigned int pga_bits; > @@ -473,6 +477,11 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, > else > st->channel_config[channel].refsel = tmp; > > + st->channel_config[channel].buf_positive = > + of_property_read_bool(child, "adi,buffered-positive"); > + st->channel_config[channel].buf_negative = > + of_property_read_bool(child, "adi,buffered-negative"); > + > *chan = ad7124_channel_template; > chan->address = channel; > chan->scan_index = channel; > @@ -492,7 +501,7 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, > static int ad7124_setup(struct ad7124_state *st) > { > unsigned int val, fclk, power_mode; > - int i, ret; > + int i, ret, tmp; > > fclk = clk_get_rate(st->mclk); > if (!fclk) > @@ -525,8 +534,12 @@ static int ad7124_setup(struct ad7124_state *st) > if (ret < 0) > return ret; > > + tmp = (st->channel_config[i].buf_positive << 1) + > + st->channel_config[i].buf_negative; > + > val = AD7124_CONFIG_BIPOLAR(st->channel_config[i].bipolar) | > - AD7124_CONFIG_REF_SEL(st->channel_config[i].refsel); > + AD7124_CONFIG_REF_SEL(st->channel_config[i].refsel) | > + AD7124_CONFIG_IN_BUFF(tmp); > ret = ad_sd_write_reg(&st->sd, AD7124_CONFIG(i), 2, val); > if (ret < 0) > return ret;