Received: by 2002:ac8:6d01:0:b0:423:7e07:f8e4 with SMTP id o1csp6902569qtt; Mon, 18 Dec 2023 09:48:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu6Cppc39JZUKDA2jpyqnZZPxT16Ij/NSS4WJYDj/eFsU1OJM6/jdwbE5QUeMRYR8iwhoz X-Received: by 2002:a05:6358:7e11:b0:170:b6f3:91eb with SMTP id o17-20020a0563587e1100b00170b6f391ebmr6441178rwm.20.1702921737105; Mon, 18 Dec 2023 09:48:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702921736; cv=none; d=google.com; s=arc-20160816; b=obFoXMNLrKg2hsHQSLcFV48t1OA3QUfc8sb07uwueVPGD6SSqAtTxEjgw8oFxMCnC5 ty2NTuiy/r1LV/xsUveXTZnr3rF4hVUfbk6FlN5ZNU4VmHe37oFWea3ogiyPI5k8GQvl J0rapd2PGVbNp2uQnlpLPhodQNxEhomP7JTirHd652MuZjOk9PDhqy1jQ7OdxrmBGu1x mFpvpyUSTjwHYzlc/32flCMApMKhO6E9tPPR6aYWTfPawWN2FLl/z3K8JIZrwB78UuVH c8Hu0W8jBcuOGlCmis0Qchwj+9Q+N5e1Zxta89W/89XOY1vnbTS86KOHhYB2pChfHPnp F9hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MGc3H1mZH6buwISmfip+JfxIDpEG4RSu3DvfL7xLHYM=; fh=sFr9N9/Q+207osPW92a1CFfyHiaoQ53KwbtQcVc+N/E=; b=VPeVRQpOxvxH/AMbR49+KutjfYIiUYPSGeItDO6wqgEh/zFmK/qx8XUf8CJ5+TH5w5 E2tLdtNXKgPerH8fI5RQndR/yxPDymlvhBa4uvxSqXDc2e0xgBJcYTrtTslp2dt0Ca9Z 5PXcjIrt5iIzz/a8oKL+57UxBWyxNXx3Up7k2LZfGW32W3OLF9VNbABf4N6UyaQp7bU9 4CyjUFNWXYTi3u22TeY802z43XELp16A21XecZdnwD8jezKBNRTpQBG1mhmxB1v32qHy l0991/zhvCYqztmVo5DKZ9fcxwhwrrzTIY88k6PbGwgEMPJaEgDE9LxP2AHtIkvmf3cL W3Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="naM/PjGX"; spf=pass (google.com: domain of linux-kernel+bounces-4206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw20-20020a056a02049400b005cda5867a34si1433599pgb.594.2023.12.18.09.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:48:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="naM/PjGX"; spf=pass (google.com: domain of linux-kernel+bounces-4206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 6A0B3285A96 for ; Mon, 18 Dec 2023 17:48:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91D0A5D74E; Mon, 18 Dec 2023 17:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="naM/PjGX" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7084A5D73B; Mon, 18 Dec 2023 17:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d3ac28ae81so13783315ad.0; Mon, 18 Dec 2023 09:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702921331; x=1703526131; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=MGc3H1mZH6buwISmfip+JfxIDpEG4RSu3DvfL7xLHYM=; b=naM/PjGXR+ZvuuwwNlrNflE4mn1iPSGtvi0kA6Pswm793wmWZm5PMI37LZwLW7Fm4A tLOjwa0wl3JyLcpKOViFUry+TQEY/yg4QnJeQYKDRGUdinxhKSTGiFsw+H8W+QMzX3kI Vi7ZOA3uJhFevYnyuMn/mZD7CsniUuaRw9RfdDqGOqQ5Zk+EFM1FJo1kTi2STd0QnK1r 8MK62oVw8jLSvsu6xhChBZC6QxtKztSVtOqTaI25Bl2wrCjqaVIj53UTkHRd4bwRbo3D rTF8wx2/SDtHrMnX2ndDvkYDy3sFBwaKgespEKePPos6CoEaZamFNGDTOHiissDAzjfP 7GfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702921331; x=1703526131; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MGc3H1mZH6buwISmfip+JfxIDpEG4RSu3DvfL7xLHYM=; b=HPzYHYsS/mQSaNMnnLhy6Px5C3z/hhDrwJROF+5wP0+zviML+zZ27cri1h2UWiRHc1 YffDwOqGZ48CrqqUNLlzjZjlh9+6iT8RqsVSUqFmwH1zYch0N6BY3RyI4ZZ5X1GtvYb6 hjUFvOiAkMBueca+IFqOhzIVLOcnsKxPpHdyKDypJWEZRHyUkZTGD48tl0pSsFuNaNMX 2jDYnCTVwp94Zahq3KqARxBduhFSmvA9Cdk3rxNlo8PH8KosHiDVtZtk+9Z/5Nukdzzq MQnqWppLKz3KZTxJE+uq+S2itnFZIFt6nT2YHEPvZZKYsMIgGaVJiV1gxYdIqOy1OPwV Jb6Q== X-Gm-Message-State: AOJu0YzY4eI3sVj0c0FnVoAwl2Uw65Xb7fNjDazDnTshUwqWYguhtIpH eS+qqMpbCfnNfyg+gCg5hn8= X-Received: by 2002:a17:902:ab83:b0:1d0:6ffd:e2ef with SMTP id f3-20020a170902ab8300b001d06ffde2efmr15136709plr.137.1702921330684; Mon, 18 Dec 2023 09:42:10 -0800 (PST) Received: from localhost ([2804:30c:160d:b800:be05:2c5b:24c0:12aa]) by smtp.gmail.com with ESMTPSA id a21-20020a1709027d9500b001cfed5524easm19233051plm.288.2023.12.18.09.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 09:42:10 -0800 (PST) Date: Mon, 18 Dec 2023 14:42:01 -0300 From: Marcelo Schmitt To: David Lechner Cc: Marcelo Schmitt , apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, paul.cercueil@analog.com, Michael.Hennerich@analog.com, lars@metafoo.de, jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, dan.carpenter@linaro.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 09/15] iio: adc: ad7091r: Enable internal vref if external vref is not supplied Message-ID: References: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 12/17, David Lechner wrote: > On Sat, Dec 16, 2023 at 11:49 AM 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 > > --- > > 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)); > > Can we use regmap_set_bits() here to avoid the BIT(0)? > > The same comment applies to other patches in this series. Looks good, will do. Thanks > > > + 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) > > -- > > 2.42.0 > >