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: <589caeefa5b00c7a6c2bfc199bb34871d43cde04.camel@gmail.com>
Date: Mon, 26 May 2025 11:24:33 +0100
From: Nuno Sá <noname.nuno@...il.com>
To: Marcelo Schmitt <marcelo.schmitt@...log.com>, linux-iio@...r.kernel.org,
 	devicetree@...r.kernel.org, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Cc: jic23@...nel.org, lars@...afoo.de, Michael.Hennerich@...log.com, 
	dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
 robh@...nel.org, 	krzk+dt@...nel.org, conor+dt@...nel.org,
 linus.walleij@...aro.org, brgl@...ev.pl, 	marcelo.schmitt1@...il.com
Subject: Re: [PATCH v3 03/10] iio: adc: ad4170: Add support for calibration
 gain

On Tue, 2025-05-13 at 09:34 -0300, Marcelo Schmitt wrote:
> Add support for ADC calibration gain configuration.
> 
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
> ---
> Change log v2 -> v3
> - New patch spun out of the base driver patch.
> 
>  drivers/iio/adc/ad4170.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad4170.c b/drivers/iio/adc/ad4170.c
> index bf19b31095ee..1df214f7fdec 100644
> --- a/drivers/iio/adc/ad4170.c
> +++ b/drivers/iio/adc/ad4170.c
> @@ -642,7 +642,8 @@ static const struct iio_chan_spec ad4170_channel_template
> = {
>  	.differential = 1,
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
>  			      BIT(IIO_CHAN_INFO_SCALE) |
> -			      BIT(IIO_CHAN_INFO_OFFSET),
> +			      BIT(IIO_CHAN_INFO_OFFSET) |
> +			      BIT(IIO_CHAN_INFO_CALIBSCALE),
>  	.info_mask_separate_available = BIT(IIO_CHAN_INFO_SCALE),
>  	.scan_type = {
>  		.realbits = 24,
> @@ -953,6 +954,9 @@ static int ad4170_read_raw(struct iio_dev *indio_dev,
>  		pga = FIELD_GET(AD4170_AFE_PGA_GAIN_MSK, setup->afe);
>  		*val = chan_info->offset_tbl[pga];
>  		return IIO_VAL_INT;
> +	case IIO_CHAN_INFO_CALIBSCALE:
> +		*val = setup->gain;

To be nitpicky, the only way this is correct for all archs is also locking the
load. Or read_once() but likely not worth it.

Other than that, looks good

- Nuno Sá
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ