All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chi-Wen Weng" <cwweng.linux@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: Add Nuvoton MA35D1 EADC
Date: Fri, 30 Oct 2026 03:23:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-190221@kernel.org> (raw)
In-Reply-To: <20261030031501.130290-2-cwweng.linux@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] dt-bindings: iio: adc: channel schema inverts adc.yaml differential semantics
- [Medium] dt-bindings: iio: adc: incomplete channel property restriction with adc.yaml
--

commit f0823504c40ee953b211fa5196cd4cbe1be6611c
Author: Chi-Wen Weng <cwweng@nuvoton.com>

dt-bindings: iio: adc: Add Nuvoton MA35D1 EADC

This commit adds the devicetree binding schema for the Nuvoton MA35D1
Enhanced Analog-to-Digital Converter (EADC), describing its interrupts,
clocks, resets, reference supply, DMA support, and channel child nodes.

> diff --git a/Documentation/devicetree/bindings/iio/adc/nuvoton,ma35d1-eadc.yaml b/Documentation/devicetree/bindings/iio/adc/nuvoton,ma35d1-eadc.yaml
> new file mode 100644
> index 0000000000000..97144a8eeb5c1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/nuvoton,ma35d1-eadc.yaml

[ ... ]

> +patternProperties:
> +  '^channel@[0-7]$':
> +    type: object
> +    $ref: /schemas/iio/adc/adc.yaml#
> +    unevaluatedProperties: false
> +    description: |
> +      External EADC channel description.
> +
> +      For a single-ended channel, single-channel specifies the external
> +      analog input number (0 through 7), while reg provides the logical IIO
> +      channel index.
> +
> +      For a differential channel, omit single-channel. The reg value selects
> +      one of the four fixed hardware differential pairs: reg 0 selects 0-4,
> +      reg 1 selects 1-5, reg 2 selects 2-6 and reg 3 selects 3-7.
> +
> +    properties:
> +      reg:
> +        maximum: 7
> +
> +      single-channel:
> +        maximum: 7
> +
> +      # Differential pairs are fixed in hardware and are selected by reg.
> +      diff-channels: false
> +
> +      bipolar: false
> +
> +      common-mode-channel: false
> +
> +      settling-time-us: false
> +
> +      oversampling-ratio: false

[Severity: Medium]
Does using unevaluatedProperties: false here leave other unsupported
properties from Documentation/devicetree/bindings/iio/adc/adc.yaml permitted
in channel@[0-7] child nodes?

Because adc.yaml is referenced with unevaluatedProperties: false and only
five properties are explicitly set to false above, the remaining properties
defined in adc.yaml (reference-sources, input-chopping, excitation-channels,
excitation-current-nanoamp, and burn-out-current-nanoamp) will still pass
schema validation.

Should patternProperties.'^channel@[0-7]$' use additionalProperties: false
instead and list only the supported properties from adc.yaml?

> +
> +    allOf:
> +      - if:
> +          not:
> +            required:
> +              - single-channel
> +        then:
> +          properties:
> +            reg:
> +              maximum: 3

[Severity: Medium]
Doesn't forbidding diff-channels and using the omission of single-channel to
select differential pairs invert the standard semantics in
Documentation/devicetree/bindings/iio/adc/adc.yaml?

In adc.yaml, properties.single-channel specifies:

  single-channel:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      When devices combine single-ended and differential channels, allow the
      channel for a single element to be specified, independent of reg (as for
      differential channels). If this and diff-channels are not present reg
      shall be used instead.

Under adc.yaml, a child node with neither single-channel nor diff-channels
(such as channel@1 with only reg = <1> in the example) represents a
single-ended channel on input reg, whereas this schema treats it as
differential pair 1-5.

Additionally, for single-ended channels, reg (0 through 7) acts as a logical
channel index independent of the input pin selected by single-channel, while
for differential channels reg (0 through 3) is forced to act as both the
child node unit address and the hardware differential pair selector. Because
sibling devicetree nodes cannot share the same reg value, a board that uses
reg = <0> for a single-ended channel on another input (for instance,
channel@0 with reg = <0> and single-channel = <2>) cannot also describe
hardware differential pair 0-4, which requires reg = <0>.

Could differential channels use diff-channels constrained to the four valid
hardware pairs (<0 4>, <1 5>, <2 6>, and <3 7>) so that reg remains purely
the logical channel index?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261030031501.130290-1-cwweng.linux@gmail.com?part=1

  reply	other threads:[~2026-10-30  3:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  3:14 [PATCH v3 0/2] iio: adc: Add Nuvoton MA35D1 EADC support Chi-Wen Weng
2026-10-30  3:15 ` [PATCH v3 1/2] dt-bindings: iio: adc: Add Nuvoton MA35D1 EADC Chi-Wen Weng
2026-10-30  3:23   ` sashiko-bot [this message]
2026-10-30  3:15 ` [PATCH v3 2/2] iio: adc: Add Nuvoton MA35D1 EADC driver Chi-Wen Weng

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=sashiko-outbox-190221@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cwweng.linux@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.