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: <20200510112417.1e54d66e@archlinux>
Date:   Sun, 10 May 2020 11:24:17 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Jonathan Bakker <xc-racer2@...e.ca>
Cc:     knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
        kgene@...nel.org, krzk@...nel.org, cw00.choi@...sung.com,
        kstewart@...uxfoundation.org, mpe@...erman.id.au,
        m.szyprowski@...sung.com, swboyd@...omium.org, tglx@...utronix.de,
        linux-iio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: Add scaling support to exynos adc driver

On Fri,  8 May 2020 14:14:00 -0700
Jonathan Bakker <xc-racer2@...e.ca> wrote:

> Currently the driver only exposes the raw counts.  As we
> have the regulator voltage and the maximum value (stored in
> the data mask), we can trivially produce a scaling fraction
> of voltage / max value.
> 
> This assumes that the regulator voltage is in fact the max
> voltage, which appears to be the case for all mainline dts
> and cross referenced with the public Exynos4412 and S5PV210
> datasheets.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@...e.ca>

Seems reasonable to me. I'd like an exynos Ack though before applying.

thanks,

Jonathan


> ---
>  drivers/iio/adc/exynos_adc.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 22131a677445..9d29b56805cd 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -531,8 +531,19 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>  	unsigned long timeout;
>  	int ret;
>  
> -	if (mask != IIO_CHAN_INFO_RAW)
> +	if (mask == IIO_CHAN_INFO_SCALE) {
> +		ret = regulator_get_voltage(info->vdd);
> +		if (ret < 0)
> +			return ret;
> +
> +		/* Regulator voltage is in uV, but need mV */
> +		*val = ret / 1000;
> +		*val2 = info->data->mask;
> +
> +		return IIO_VAL_FRACTIONAL;
> +	} else if (mask != IIO_CHAN_INFO_RAW) {
>  		return -EINVAL;
> +	}
>  
>  	mutex_lock(&indio_dev->mlock);
>  	reinit_completion(&info->completion);
> @@ -683,6 +694,7 @@ static const struct iio_info exynos_adc_iio_info = {
>  	.channel = _index,				\
>  	.address = _index,				\
>  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),	\
> +	.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SCALE),	\
>  	.datasheet_name = _id,				\
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ