Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Piyush Patle" <piyushpatle228@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v11 04/11] dt-bindings: iio: adc: hx711: add HX710B support
Date: Wed, 03 Jun 2026 19:02:30 +0000	[thread overview]
Message-ID: <20260603190230.E7DE11F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603184859.89693-5-piyushpatle228@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The HX710B driver fails to request and enable the `avdd-supply` and `dvdd-supply` regulators, leaving the chip unpowered.
- [Low] The driver uses a non-existent compiler macro `__counted_by_ptr`, which will cause a build failure.
--

commit 4a57ad17002849c3ffed8137401cf0ed7fd81778
Author: Piyush Patle <piyushpatle228@gmail.com>

iio: adc: hx711: add support for HX710B

This commit adds support for the AVIA HX710B ADC, sharing the GPIO interface
with the HX711 but using trailing pulses for mode selection. It introduces
variant-specific channel configurations and tracks active channels across
conversions. Additionally, it refactors the gain and scale computations to
use fixed values for the new variant.

> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index 5c326f01c5543..e90780dfd34e5 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
> @@ -84,12 +86,16 @@ static int hx711_get_scale_to_gain(const int *gain_scale, int scale)
>   * @channels: channel specification array
>   * @num_channels: number of entries in @channels
>   * @iio_info: IIO info ops for this variant
> + * @fixed_gain_val: fixed PGA gain (used when @has_fixed_gain is true)
> + * @has_fixed_gain: true if the variant has a fixed ADC gain
>   */
>  struct hx711_chip_info {
>  	const char			*name;
>  	const struct iio_chan_spec	*channels __counted_by_ptr(num_channels);

[Severity: Low]
Will this compile? The __counted_by_ptr macro doesn't appear to be defined
anywhere in the kernel, whereas __counted_by is used for flexible array
members. Could this result in a syntax error during the build?

>  	unsigned int			num_channels;
>  	const struct iio_info		*iio_info;
> +	unsigned int			fixed_gain_val;
> +	bool				has_fixed_gain;
>  };

[ ... ]

> @@ -543,32 +709,43 @@ static int hx711_probe(struct platform_device *pdev)
>  		return dev_err_probe(dev, PTR_ERR(hx711_data->gpiod_dout),
>  				     "failed to get dout-gpiod\n");
>  
> -	ret = devm_regulator_get_enable_read_voltage(dev, "avdd");
> +	if (chip_info->has_fixed_gain)
> +		ret = devm_regulator_get_enable_read_voltage(dev, "vref");
> +	else
> +		ret = devm_regulator_get_enable_read_voltage(dev, "avdd");
>  	if (ret < 0)
>  		return ret;

[Severity: High]
Does this leave the HX710B unpowered? The device tree bindings require
both avdd-supply and dvdd-supply for the avia,hx710b compatible.

However, when has_fixed_gain is true for the HX710B variant, the driver
only requests the vref supply. If avdd and dvdd are controlled by actual
regulators on the board, will they remain disabled and cause the hardware
to fail?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603184859.89693-1-piyushpatle228@gmail.com?part=4

  reply	other threads:[~2026-06-03 19:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 18:48 [PATCH v11 00/11] iio: adc: Add support for AVIA HX710B ADC Piyush Patle
2026-06-03 18:48 ` [PATCH v11 01/11] dt-bindings: iio: adc: hx711: clean up existing binding text Piyush Patle
2026-06-03 18:48 ` [PATCH v11 02/11] dt-bindings: iio: adc: hx711: add VSUP and DVDD supply properties Piyush Patle
2026-06-03 18:48 ` [PATCH v11 03/11] dt-bindings: iio: adc: hx711: add RATE GPIO property Piyush Patle
2026-06-03 18:48 ` [PATCH v11 04/11] dt-bindings: iio: adc: hx711: add HX710B support Piyush Patle
2026-06-03 19:02   ` sashiko-bot [this message]
2026-06-03 18:48 ` [PATCH v11 05/11] iio: adc: hx711: move scale computation to per-device storage Piyush Patle
2026-06-03 18:48 ` [PATCH v11 06/11] iio: adc: hx711: introduce hx711_chip_info structure Piyush Patle
2026-06-03 19:00   ` sashiko-bot
2026-06-03 18:48 ` [PATCH v11 07/11] iio: adc: hx711: pass trailing pulse count into hx711_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 08/11] iio: adc: hx711: split variable assignments in hx711_read and hx711_reset Piyush Patle
2026-06-03 18:48 ` [PATCH v11 09/11] iio: adc: hx711: localize loop iterators in hx711_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 10/11] iio: adc: hx711: pass iio_chan_spec to hx711_reset_read Piyush Patle
2026-06-03 18:48 ` [PATCH v11 11/11] iio: adc: hx711: add support for HX710B Piyush Patle
2026-06-03 19:06   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260603190230.E7DE11F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=piyushpatle228@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox