Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp776170ybc; Sat, 16 Nov 2019 08:29:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwg9Y9vMYCve178atVQBm2f7A5KABepr7nL5DnfnM+7VQXHtFfqfp7T7dWAnLtb/7t6ofJd X-Received: by 2002:a17:906:3606:: with SMTP id q6mr10685370ejb.307.1573921770471; Sat, 16 Nov 2019 08:29:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921770; cv=none; d=google.com; s=arc-20160816; b=IC0tNQVRDG0oBdVMbHUseyVW4AucasVQaFH1EU3iY9+Kimw4eWeMsjAZv+9riDZfyP NGpiamXp4okUiXRJ2Du3wn/6AIEPA+zSB2qYozVr+txJsrk0gs+iEio12US+KeCbxk+l otT3fanzUFn2hyKcmhs/MxZ+6oZzS0S2ftj3CoUKyT0GxUYyWobpjOROmJ8UMAPPcmJf kbJ52gJme00WtZZkHhrm4++ySt683W6aCK1njzjd19+TYz3v9IfNXe8BoSDU+2grsd5s l8GAjYAXw7SBUBd0TDzD4KE6xIO8QjVDDLMeil87Rc4RkhlEz48++BuOZIwXT/5wX/Is 6lOA== 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=0dBaTssSd6j7dLjInrtbnh3wSuow9r435cv0/jXeNh8=; b=xsxs84LbLdKw6fLPFkYyNUdWwY2E9wduWf7nXycfWQK+Bja1HoGawzNsNIgqGcsoQA njLr2YHNHYTqwFC08NJFeQXQHCfrsX8fl81i3GPJYOH41oERZc45kHIcuOAUQzSSPbZ7 9zy34L41xAdZLm6yMKqgTZBenaZTu+OK/yRTKBdP6Pv5YneJb8MTIbFuHjsDyUf/nnQH OOzichOI9Y0aUo5VgZqW4Ri+IGZI8HIP07L0mbDuwUT/nFkBSyQ5C0GO6Q0HlCt61VFO DFTXbHxvZR0S8FcO2z3127muYlpq+9hrj8jT/C/lZ4Dzd8JlgxW/+5E996K1Zob2IGSJ iQaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PYMNe0Ns; 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 p25si7759365eji.415.2019.11.16.08.29.05; Sat, 16 Nov 2019 08:29:30 -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=@kernel.org header.s=default header.b=PYMNe0Ns; 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 S1731215AbfKPQ0u (ORCPT + 99 others); Sat, 16 Nov 2019 11:26:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:48318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727912AbfKPQ0q (ORCPT ); Sat, 16 Nov 2019 11:26:46 -0500 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 CB264214DE; Sat, 16 Nov 2019 16:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573921606; bh=u+xBCALwba5ux8lkBspkQlgCbUB0P91PtT6vi6b6KE4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PYMNe0NsWDQoRleJ+awapTwkV7w48mmVOZRnH7hzc1CE5BHI10gb/HJ2RzsNGcvho a16xCTubXSMeU3/Xm+0Zhr6Uh0pebkBRqu/dDDKM6lOWwXtlUCJl3as2cVG+U4r0r0 Xsdu5ZdggMH7rO5LHhED5VMJAs6vR9CjFvxw5t44= Date: Sat, 16 Nov 2019 16:26:41 +0000 From: Jonathan Cameron To: Mircea Caprioru Cc: , , , , , Subject: Re: [PATCH] iio: adc: ad7124: Enable internal reference Message-ID: <20191116162641.45c9a557@archlinux> In-Reply-To: <20191114092426.21631-1-mircea.caprioru@analog.com> References: <20191114092426.21631-1-mircea.caprioru@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 Thu, 14 Nov 2019 11:24:26 +0200 Mircea Caprioru wrote: > When the internal reference was selected by a channel it was not enabled. > This patch fixes that and enables it. > > Signed-off-by: Mircea Caprioru Probably want to clearly mark this as a fix in the patch title and give a fixes tag here. Seems like it would be awfully broken without this! Jonathan > --- > drivers/iio/adc/ad7124.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c > index edc6f1cc90b2..3f03abf100b5 100644 > --- a/drivers/iio/adc/ad7124.c > +++ b/drivers/iio/adc/ad7124.c > @@ -39,6 +39,8 @@ > #define AD7124_STATUS_POR_FLAG_MSK BIT(4) > > /* AD7124_ADC_CONTROL */ > +#define AD7124_ADC_CTRL_REF_EN_MSK BIT(8) > +#define AD7124_ADC_CTRL_REF_EN(x) FIELD_PREP(AD7124_ADC_CTRL_REF_EN_MSK, x) > #define AD7124_ADC_CTRL_PWR_MSK GENMASK(7, 6) > #define AD7124_ADC_CTRL_PWR(x) FIELD_PREP(AD7124_ADC_CTRL_PWR_MSK, x) > #define AD7124_ADC_CTRL_MODE_MSK GENMASK(5, 2) > @@ -424,7 +426,10 @@ static int ad7124_init_channel_vref(struct ad7124_state *st, > break; > case AD7124_INT_REF: > st->channel_config[channel_number].vref_mv = 2500; > - break; > + st->adc_control &= ~AD7124_ADC_CTRL_REF_EN_MSK; > + st->adc_control |= AD7124_ADC_CTRL_REF_EN(1); > + return ad_sd_write_reg(&st->sd, AD7124_ADC_CONTROL, > + 2, st->adc_control); > default: > dev_err(&st->sd.spi->dev, "Invalid reference %d\n", refsel); > return -EINVAL;