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] [day] [month] [year] [list]
Message-ID: <gmv5tncy7xwgbc64na7ib42hdthojsfrusauk4hez5zmc6hh2k@4jfk74vt2gcb>
Date: Fri, 22 Nov 2024 17:39:30 +0100
From: Uwe Kleine-König <ukleinek@...nel.org>
To: Guillaume Stols <gstols@...libre.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, 
	Michael Hennerich <Michael.Hennerich@...log.com>, Jonathan Cameron <jic23@...nel.org>, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, 
	Conor Dooley <conor+dt@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	"Rafael J. Wysocki" <rafael@...nel.org>, Jonathan Corbet <corbet@....net>, linux-pwm@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org, linux-iio@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-doc@...r.kernel.org, aardelean@...libre.com, 
	dlechner@...libre.com, jstephan@...libre.com, nuno.sa@...log.com, 
	Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v5 7/8] iio: adc: ad7606: Add iio-backend support

On Tue, Oct 15, 2024 at 01:56:20PM +0000, Guillaume Stols wrote:
> @@ -640,6 +665,14 @@ static int ad7606_read_raw(struct iio_dev *indio_dev,
>  	case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
>  		*val = st->oversampling;
>  		return IIO_VAL_INT;
> +	case IIO_CHAN_INFO_SAMP_FREQ:
> +		/*
> +		 * TODO: return the real frequency intead of the requested one once
> +		 * pwm_get_state_hw comes upstream.
> +		 */
> +		pwm_get_state(st->cnvst_pwm, &cnvst_pwm_state);
> +		*val = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC, cnvst_pwm_state.period);
> +		return IIO_VAL_INT;
>  	}
>  	return -EINVAL;
>  }

Being late to the party as the patch is already applied:

ad7606_set_sampling_freq() uses DIV_ROUND_UP_ULL to determine the period
from freq. So I guess you should a down-rounding div here to calculate
freq from period.

Having said that, pwm_get_state_hw() is in mainline and will be included
in v6.13-rc1.

Best regards
Uwe

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ