lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMknhBF7Ab0FZCKYkSq8siDMPtX5VRRn04FS7XiYLtK-1TJa3A@mail.gmail.com>
Date: Sun, 17 Dec 2023 18:36:34 -0600
From: David Lechner <dlechner@...libre.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>
Cc: apw@...onical.com, joe@...ches.com, dwaipayanray1@...il.com, 
	lukas.bulwahn@...il.com, paul.cercueil@...log.com, 
	Michael.Hennerich@...log.com, lars@...afoo.de, jic23@...nel.org, 
	robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org, 
	dan.carpenter@...aro.org, marcelo.schmitt1@...il.com, 
	linux-iio@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 09/15] iio: adc: ad7091r: Enable internal vref if
 external vref is not supplied

On Sat, Dec 16, 2023 at 11:49 AM Marcelo Schmitt
<marcelo.schmitt@...log.com> 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 <marcelo.schmitt@...log.com>
> ---
>  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.

> +               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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ