Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp192048rdb; Sun, 17 Dec 2023 07:42:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5hQj3yCH0UJlhv4yYIGdKuTo9zfkz7pFrQ1QLOmkbi08pFCyotuHgNUl+TUxmd7A100b0 X-Received: by 2002:a05:6871:4609:b0:203:d46:ff79 with SMTP id nf9-20020a056871460900b002030d46ff79mr13258420oab.106.1702827728571; Sun, 17 Dec 2023 07:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702827728; cv=none; d=google.com; s=arc-20160816; b=Ew6fW02j1JBWSebn+h7PtMgwiNVpXzxRYaZV7iZRalmMJmwS00L7y8GLAUfnvz3AfZ 1Ucn8w5N/Umj8vMzVK42wDzbZuX1fr46ihL3brkgbDPeCNQ942uMigrrWy7M+AVPeSpj CojASiPrQMLyH7SE+99RpKO3EBJ316fuJMzZxzj8ykpBvnnc7GDDqOPz1mInlIw/6ZKd YduIcTEQwtWtzYlcjlCtYurIdo/6NtNjfXnHZ9+vKW13Ky0SBoxdQ+n+rQZCUsLsQiyM 8bHTf6S4x3xHPAM50e0oCq/xhmT1wmhoIsPJe7Fz8O5w6cgfw9DIgmB568/wH2I8/tKY e5aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=g3wnuKBylCKHEJBbrYvb2ywJYU1jEBHV4ud9AyPcIlM=; fh=IYtYDItZhYxUobJUE4h/DPNfo4t2DYpfZJxUzFo9Hpw=; b=n3yj8wyp89H4Yi4gz2sH9Zo3DdQd5jgnZFBvYHF9R5WBfbDkKDxkDk6R6zzVnlV18a nYEjq2VYqxVAGCNTCMNRLohafBRzF0kk/CXLcHOovCzTDVafeqpCegOFDtnKxfQzq1Z6 NBRYHnzTsPbMsz81Sk0L173ihhsjhXZ9DRq6G1oeIbqnLg9+ykEB5kP7kLXYlTdRfh/T KZxsdLpyOmpHs+DkJ7PrqAIv5b9N2eX+P0JWHwFuZjRfWLiBybT8z8Aysj4im+6p+bBV m1zvOAbhjayft30H9v3mOOz0ntVBYWOYvVazt4it+grWHKZ0hd8rgUU/6t+C+PuxxNIT eDSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bmwGWyMD; spf=pass (google.com: domain of linux-kernel+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d8-20020a17090ab30800b0028a2b0c5d7asi16027658pjr.41.2023.12.17.07.42.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 07:42:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bmwGWyMD; spf=pass (google.com: domain of linux-kernel+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2670-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 37245282790 for ; Sun, 17 Dec 2023 15:42:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CCB145972; Sun, 17 Dec 2023 15:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bmwGWyMD" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0A5044C94; Sun, 17 Dec 2023 15:42:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8689C433C8; Sun, 17 Dec 2023 15:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702827720; bh=ovab6ORHF0GtuIwBZlj2200LHMco9SKl/almTH+DVgI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bmwGWyMDgARtHTMkR6oPbxcnyLG2zhtQfT1hT1yf7H/tOILSiYNzQrsFUybheJfrB Od46St3/xSi/NbBp3w60WeUTZGUFB2+AEd9WUFUdUSITyNjOjSNPFtlFcp2l+pJjgF 3dJg7yiXMoG1v/gDoxoYtulL406XiPTCgkIL8OZTHqIpZepwW0Gjzre8db4qokahxR Mv3p1SjuFIaH0uPiBTIa7po/jcaBpusHCflyUw0MQIA+Kky/KgV1efr5uE7EDfN2dx mabIectN6VR7HAfP/zvhnUM+Ssgg9shrFQ2kyGCfZS5U5BYZ0fJOf8/LIDKR/68DAZ kRYDtE9FkyIwg== Date: Sun, 17 Dec 2023 15:41:42 +0000 From: Jonathan Cameron To: Marcelo Schmitt Cc: , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 09/15] iio: adc: ad7091r: Enable internal vref if external vref is not supplied Message-ID: <20231217154142.191ba69b@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 16 Dec 2023 14:49:07 -0300 Marcelo Schmitt wrote: > The ADC needs a voltage reference to work correctly. > Enable AD7091R internal voltage reference if no external vref is supplied. > > Signed-off-by: Marcelo Schmitt This one sounds to me like it should have a fixes tag and be much earlier in the set to perhaps simplify backports. Jonathan > --- > drivers/iio/adc/ad7091r-base.c | 7 +++++++ > drivers/iio/adc/ad7091r-base.h | 1 + > 2 files changed, 8 insertions(+) > > diff --git a/drivers/iio/adc/ad7091r-base.c b/drivers/iio/adc/ad7091r-base.c > index aead72ef55b6..9d0b489966f5 100644 > --- a/drivers/iio/adc/ad7091r-base.c > +++ b/drivers/iio/adc/ad7091r-base.c > @@ -217,7 +217,14 @@ int ad7091r_probe(struct device *dev, const struct ad7091r_init_info *init_info, > if (IS_ERR(st->vref)) { > if (PTR_ERR(st->vref) == -EPROBE_DEFER) > return -EPROBE_DEFER; > + > st->vref = NULL; > + /* Enable internal vref */ > + ret = regmap_update_bits(st->map, AD7091R_REG_CONF, > + AD7091R_REG_CONF_INT_VREF, BIT(0)); > + if (ret) > + return dev_err_probe(st->dev, ret, > + "Error on enable internal reference\n"); > } else { > ret = regulator_enable(st->vref); > if (ret) > diff --git a/drivers/iio/adc/ad7091r-base.h b/drivers/iio/adc/ad7091r-base.h > index 81b8a4bbb929..9cfb362a00a4 100644 > --- a/drivers/iio/adc/ad7091r-base.h > +++ b/drivers/iio/adc/ad7091r-base.h > @@ -20,6 +20,7 @@ > #define AD7091R_REG_CH_HYSTERESIS(ch) ((ch) * 3 + 6) > > /* AD7091R_REG_CONF */ > +#define AD7091R_REG_CONF_INT_VREF BIT(0) > #define AD7091R_REG_CONF_ALERT_EN BIT(4) > #define AD7091R_REG_CONF_AUTO BIT(8) > #define AD7091R_REG_CONF_CMD BIT(10)