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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <db78eee7049abc62a1a230ff87d04332de8afd66.camel@gmail.com>
Date: Thu, 03 Apr 2025 19:56:08 +0100
From: Nuno Sá <noname.nuno@...il.com>
To: David Lechner <dlechner@...libre.com>, Jonathan Cameron
 <jic23@...nel.org>,  Rob Herring <robh@...nel.org>, Krzysztof Kozlowski
 <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
 linux-iio@...r.kernel.org
Cc: Michael Hennerich <Michael.Hennerich@...log.com>, Nuno
 Sá
	 <nuno.sa@...log.com>, Jonathan Corbet <corbet@....net>, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-doc@...r.kernel.org
Subject: Re: [PATCH 3/5] iio: adc: ad7380: move internal reference voltage
 to chip_info

On Tue, 2025-04-01 at 17:50 -0500, David Lechner wrote:
> Move the internal reference voltage value to the chip_info structure.
> 
> Before this change, only ADAQ chips could be internal_ref_only and only
> non-ADAQ chips could be external_ref_only. Now, this restriction is
> removed.
> 
> Signed-off-by: David Lechner <dlechner@...libre.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@...log.com>

>  drivers/iio/adc/ad7380.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
> index
> 18ed07275be8e031e54f3595f70afe47514084cd..e5cd11fd7b1083af2082985f2c0226b1a97d600f
> 100644
> --- a/drivers/iio/adc/ad7380.c
> +++ b/drivers/iio/adc/ad7380.c
> @@ -120,6 +120,7 @@ struct ad7380_chip_info {
>  	unsigned int num_supplies;
>  	bool external_ref_only;
>  	bool internal_ref_only;
> +	unsigned int internal_ref_mv;
>  	const char * const *vcm_supplies;
>  	unsigned int num_vcm_supplies;
>  	const unsigned long *available_scan_masks;
> @@ -609,6 +610,7 @@ static const struct ad7380_chip_info ad7380_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -622,6 +624,7 @@ static const struct ad7380_chip_info ad7381_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -637,6 +640,7 @@ static const struct ad7380_chip_info ad7383_chip_info = {
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
>  	.vcm_supplies = ad7380_2_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -652,6 +656,7 @@ static const struct ad7380_chip_info ad7384_chip_info = {
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
>  	.vcm_supplies = ad7380_2_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_2_channel_vcm_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -665,6 +670,7 @@ static const struct ad7380_chip_info ad7386_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -679,6 +685,7 @@ static const struct ad7380_chip_info ad7387_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -693,6 +700,7 @@ static const struct ad7380_chip_info ad7388_chip_info = {
>  	.num_simult_channels = 2,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x2_channel_scan_masks,
>  	.timing_specs = &ad7380_timing,
> @@ -721,6 +729,7 @@ static const struct ad7380_chip_info ad7381_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
>  	.max_conversion_rate_hz = 4 * MEGA,
> @@ -734,6 +743,7 @@ static const struct ad7380_chip_info ad7383_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.vcm_supplies = ad7380_4_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -749,6 +759,7 @@ static const struct ad7380_chip_info ad7384_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.vcm_supplies = ad7380_4_channel_vcm_supplies,
>  	.num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies),
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
> @@ -764,6 +775,7 @@ static const struct ad7380_chip_info ad7386_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -778,6 +790,7 @@ static const struct ad7380_chip_info ad7387_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -792,6 +805,7 @@ static const struct ad7380_chip_info ad7388_4_chip_info = {
>  	.num_simult_channels = 4,
>  	.supplies = ad7380_supplies,
>  	.num_supplies = ARRAY_SIZE(ad7380_supplies),
> +	.internal_ref_mv = AD7380_INTERNAL_REF_MV,
>  	.has_mux = true,
>  	.available_scan_masks = ad7380_2x4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -807,6 +821,7 @@ static const struct ad7380_chip_info adaq4370_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -822,6 +837,7 @@ static const struct ad7380_chip_info adaq4380_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -837,6 +853,7 @@ static const struct ad7380_chip_info adaq4381_4_chip_info = {
>  	.supplies = adaq4380_supplies,
>  	.num_supplies = ARRAY_SIZE(adaq4380_supplies),
>  	.internal_ref_only = true,
> +	.internal_ref_mv = ADAQ4380_INTERNAL_REF_MV,
>  	.has_hardware_gain = true,
>  	.available_scan_masks = ad7380_4_channel_scan_masks,
>  	.timing_specs = &ad7380_4_timing,
> @@ -1855,7 +1872,7 @@ static int ad7380_probe(struct spi_device *spi)
>  		 * in bulk_get_enable().
>  		 */
>  
> -		st->vref_mv = ADAQ4380_INTERNAL_REF_MV;
> +		st->vref_mv = st->chip_info->internal_ref_mv;
>  
>  		/* these chips don't have a register bit for this */
>  		external_ref_en = false;
> @@ -1880,7 +1897,8 @@ static int ad7380_probe(struct spi_device *spi)
>  					     "Failed to get refio regulator\n");
>  
>  		external_ref_en = ret != -ENODEV;
> -		st->vref_mv = external_ref_en ? ret / 1000 :
> AD7380_INTERNAL_REF_MV;
> +		st->vref_mv = external_ref_en ? ret / 1000
> +					      : st->chip_info->internal_ref_mv;
>  	}
>  
>  	if (st->chip_info->num_vcm_supplies > ARRAY_SIZE(st->vcm_mv))
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ