Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp700129ybc; Sat, 23 Nov 2019 06:42:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwogVR9GpOTp941Ao5rQVFs+3wqaifB/lFOSJ9do3BPv3NR0DUTgowhxIcn5pJCBJB9c34z X-Received: by 2002:a05:6402:886:: with SMTP id e6mr7380826edy.46.1574520151744; Sat, 23 Nov 2019 06:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574520151; cv=none; d=google.com; s=arc-20160816; b=aLnkur+325apiKkkbU+rP5E3tfF7r2qR0FQvNhK5XAC9QwGx8rOBzx0Wg9R8/rxq7F S/E43zgrwOjgpeDQsCFzn1jHM1CXF8lSPE5+1VZapZvAeXbJyPcFxvAbLg0MK0HeDp50 a0dr8oBgGDEXIBUoxWM3jVvNUVqsqwsQWNWpKEE3v2FGZhe3oR99j5+6qWz/UheJVWcF N9QgrM5AT1WYcqGK/wHMTaILaPys5QKhemAvOxWncWdcp/v+RXetxSpUPyPyaLJSH+MM SrS/sBBvgxSYcrwRMGNmY8XU60VhAVe9cDyJMomRZfys9GU/GXCT86j/I0DA9P7JkcFb KqCQ== 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=iAgBE+M2vkDqZNQrew+8DKO6Rfzl6WrfRq6rqZSJyio=; b=y/nmdaP9sA7m0f54wFe0nEeRN8Be2vrRvgEdYQV/HDCe6mqDjif2wGUqZBZonrI+I9 oJA0Su1D2tbEyN/h8PcLDLjVAR+n41HwmUm/yjbqV4qb0FIpOOgVaDWgDx0fDwHqj7w2 5Fml1im1zZ65nTWjb4qTTBZfLD+ERxsaV/luzf2UMS6exYK7F5lXjT/UsusK0gLSvR4I eHUDgCJcx9OFW+o3VFChZbMgP+R5smB6rnBrs/Xy3lEW0mA/nlw0l/u6O09JGR88dJzq fqku4xd+q6oP/IEq1tk/D+h3bfs8+HOPH1Fzig3p+xqnznt/E8APVXkSD3cJyJpWwoG0 ddwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="exFpp/uV"; 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 y5si868046ejw.281.2019.11.23.06.42.08; Sat, 23 Nov 2019 06:42:31 -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="exFpp/uV"; 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 S1726740AbfKWOis (ORCPT + 99 others); Sat, 23 Nov 2019 09:38:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:55586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbfKWOis (ORCPT ); Sat, 23 Nov 2019 09:38:48 -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 8EC42204FD; Sat, 23 Nov 2019 14:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574519927; bh=pc1zIEOYRgv9Kk225bxi47Xudf6VWC6bd/TbCUHewJ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=exFpp/uVkER30wvKiUF/oh7UEd5A28YEcOnk3zMMUWuTRH/o54Wq7kOIWMO2XAfRp sLEL8Pd/YaIzB9lUA8tm6Vxv2FxxXpcbAAW/Qf6CVzPy7HPpOldm+2k9qcUZZYJJJ5 u7QWaEpZEzcZ28jmoIxgBXG5LgjWzjIFWM4uQXbM= Date: Sat, 23 Nov 2019 14:38:42 +0000 From: Jonathan Cameron To: Mircea Caprioru Cc: , , , , , Subject: Re: [PATCH V2] iio: adc: ad7124: Enable internal reference Message-ID: <20191123143842.776f2506@archlinux> In-Reply-To: <20191118083857.1754-1-mircea.caprioru@analog.com> References: <20191118083857.1754-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 Mon, 18 Nov 2019 10:38:57 +0200 Mircea Caprioru wrote: > When the internal reference was selected by a channel it was not enabled. > This patch fixes that and enables it. > > Fixes: b3af341bbd96 ("iio: adc: Add ad7124 support") > Signed-off-by: Mircea Caprioru Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan > --- > > Changelog V2: > - add fixes tag in commit message > > 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;