Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Xingyu Wu <xingyu.wu@starfivetech.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v1 1/2] bindings: iio: adc: Add StarFive JHB100 SARADC
Date: Wed, 20 May 2026 16:14:35 +0100	[thread overview]
Message-ID: <20260520-relic-chloride-c5cdb96696ce@spud> (raw)
In-Reply-To: <NTZPR01MB095657AA216608109BEF9CBA9F012@NTZPR01MB0956.CHNPR01.prod.partner.outlook.cn>

[-- Attachment #1: Type: text/plain, Size: 4048 bytes --]

On Wed, May 20, 2026 at 09:43:02AM +0000, Xingyu Wu wrote:
> On 2026/5/19 18:00, Conor Dooley wrote:
> > 
> > On Tue, May 19, 2026 at 09:26:03AM +0000, Xingyu Wu wrote:
> > > On 2026/5/19 00:24, Conor Dooley wrote:
> > > >
> > > > On Mon, May 18, 2026 at 04:18:51PM +0800, Xingyu Wu wrote:
> > > > > Add the new documentation of SAR-ADC for the StarFive JHB100 SoC.
> > > > >
> > > > > Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
> > > > > ---
> > > > >  .../iio/adc/starfive,jhb100-saradc.yaml       | 62 +++++++++++++++++++
> > > > >  1 file changed, 62 insertions(+)
> > > > >  create mode 100644
> > > > > Documentation/devicetree/bindings/iio/adc/starfive,jhb100-saradc.y
> > > > > aml
> > > > >
> > > > > diff --git
> > > > > a/Documentation/devicetree/bindings/iio/adc/starfive,jhb100-saradc
> > > > > .yam
> > > > > l
> > > > > b/Documentation/devicetree/bindings/iio/adc/starfive,jhb100-saradc
> > > > > .yam
> > > > > l
> > > > > new file mode 100644
> > > > > index 000000000000..ba8e19b72ad7
> > > > > --- /dev/null
> > > > > +++ b/Documentation/devicetree/bindings/iio/adc/starfive,jhb100-sa
> > > > > +++ radc
> > > > > +++ .yaml
> > > > > @@ -0,0 +1,62 @@
> > > > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
> > > > > +---
> > > > > +$id:
> > > > > +http://devicetree.org/schemas/iio/adc/starfive,jhb100-saradc.yaml
> > > > > +#
> > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > > +
> > > > > +title: Successive Approximation Register (SAR) A/D converter for
> > > > > +the StarFive JHB100 SoC
> > > > > +
> > > > > +maintainers:
> > > > > +  - Xingyu Wu <xingyu.wu@starfivetech.com>
> > > > > +
> > > > > +properties:
> > > > > +  compatible:
> > > > > +    const: starfive,jhb100-saradc
> > > > > +
> > > > > +  reg:
> > > > > +    maxItem: 1
> > > > > +
> > > > > +  interrupts:
> > > > > +    maxItems: 1
> > > > > +
> > > > > +  clocks:
> > > > > +    maxItems: 1
> > > > > +
> > > > > +  resets:
> > > > > +    maxItems: 2
> > > > > +
> > > > > +  "#io-channel-cells":
> > > > > +    const: 1
> > > > > +
> > > > > +  upper-bound-mv:
> > > > > +    description: The upper bound voltage value of the monitor.
> > > > > +    $ref: /schemas/types.yaml#/definitions/uint16
> > > > > +
> > > > > +  lower-bound-mv:
> > > > > +    description: The lower bound voltage value of the monitor.
> > > > > +    $ref: /schemas/types.yaml#/definitions/uint16
> > > > > +
> > > > > +  scan-freq:
> > > > > +    description: Number of the scan cycle interval.
> > > > > +    $ref: /schemas/types.yaml#/definitions/uint16
> > > >
> > > > Can you explain why any of these three properties are something that
> > > > should be in the devicetree rather than software controlled?
> > >
> > > My intention is to be able to obtain the initial values from the devicetree during
> > probe and preset them.
> > > Do I need to drop them and just set them through sysfs?
> > 
> > Unless the hardware configuration determines the values (which I can't really see
> > being the case for scan-freq at least) then yes, you need to drop and set them via
> > sysfs.
> 
> The ADC hardware can be set the scan-freq register to determine how frequent it should scan its inputs.
> The calculation is:
> 	frequency = 100/((register value) + 5) MHz, The register value should >= 15.
> The maximum allowable scan frequency is 5MHz. 
> 
> > 
> > > > How are the bounds calculated?
> > >
> > > The measurement range of this ADC hardware is from 0 to 1800 mV. This set
> > value cannot exceed it. This explanation will be added later.
> > 
> > I'm asking how this is calculated so that I can tell if you the property is permitted or
> > not.
> 
> The calculation of bound is:
> bound-mv = 1800mv * (register value) / 0xFFF

These are the formulas, but how does someone know what the value for
bound-mv needs to be? Why would someone not just want to always use
1800mv?

> 
> Best regards,
> Xingyu Wu
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-05-20 15:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  8:18 [PATCH v1 0/2] Add StarFive SAR-ADC driver Xingyu Wu
2026-05-18  8:18 ` [PATCH v1 1/2] bindings: iio: adc: Add StarFive JHB100 SARADC Xingyu Wu
2026-05-18  8:24   ` sashiko-bot
2026-05-19  6:10     ` Xingyu Wu
2026-05-18 10:21   ` Rob Herring (Arm)
2026-05-18 16:24   ` Conor Dooley
2026-05-19  9:26     ` Xingyu Wu
2026-05-19  9:59       ` Conor Dooley
2026-05-20  9:43         ` Xingyu Wu
2026-05-20 15:14           ` Conor Dooley [this message]
2026-05-21  9:54             ` Xingyu Wu
2026-05-21 10:20               ` Conor Dooley
2026-05-21 10:48                 ` Xingyu Wu
2026-05-21 11:39                 ` Jonathan Cameron
2026-05-21 16:41                   ` Conor Dooley
2026-05-22  1:56                     ` Xingyu Wu
2026-05-20 11:11         ` Jonathan Cameron
2026-05-20 15:15           ` Conor Dooley
2026-05-20 11:54   ` Krzysztof Kozlowski
2026-05-21  8:37     ` Xingyu Wu
2026-05-18  8:18 ` [PATCH v1 2/2] iio: adc: Add StarFive SAR-ADC driver Xingyu Wu
2026-05-18  8:31   ` Andy Shevchenko
2026-05-19  7:47     ` Xingyu Wu
2026-05-18  8:48   ` sashiko-bot
2026-05-19  8:58     ` Xingyu Wu
2026-05-20 12:05   ` Jonathan Cameron
2026-05-21  9:43     ` Xingyu Wu
2026-05-21 11:37       ` Jonathan Cameron
2026-05-22  2:20         ` Xingyu Wu
2026-05-22 10:52           ` Jonathan Cameron
2026-05-20 11:44 ` [PATCH v1 0/2] " Jonathan Cameron

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=20260520-relic-chloride-c5cdb96696ce@spud \
    --to=conor@kernel.org \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=xingyu.wu@starfivetech.com \
    /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