Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hungyu Lin" <dennylin0707@gmail.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 1/1] dt-bindings: iio: dds: Add AD9832/AD9835 binding
Date: Sat, 09 May 2026 00:36:45 +0000	[thread overview]
Message-ID: <20260509003645.A7626C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260509002810.78372-2-dennylin0707@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The AD9832 and AD9835 require SPI Mode 2 (CPOL=1, CPHA=0), but the binding does not enforce `spi-cpol` and the example omits it.
- [High] The driver will unconditionally fail to probe when instantiated via Device Tree because it strictly requires `platform_data`.
- [Low] The example uses a specific part number for the node name (`ad9832@0`) rather than a generic functional name.
--

commit 0760129b4a1ce54473ebad28ebda22535e9eedd6
Author: Hungyu Lin <dennylin0707@gmail.com>

dt-bindings: iio: dds: Add AD9832/AD9835 binding

This commit adds device tree binding documentation for the Analog Devices
AD9832 and AD9835 SPI-controlled direct digital synthesizers.

Since the binding introduces device tree support, does the driver need
updates to actually probe successfully when instantiated this way?

Looking at ad9832_probe(), it unconditionally returns -ENODEV if
dev_get_platdata() is NULL:

drivers/iio/dds/ad9832.c:ad9832_probe() {
    struct ad9832_platform_data *pdata = dev_get_platdata(&spi->dev);
    
    if (!pdata) {
        dev_dbg(&spi->dev, "no platform data?\n");
        return -ENODEV;
    }
    ...
}

When instantiated via device tree, platform data is typically NULL. Will
the driver fail to probe without additional patches to handle missing
platform data?

> diff --git a/Documentation/devicetree/bindings/iio/dds/adi,ad9832.yaml b/Documentation/devicetree/bindings/iio/dds/adi,ad9832.yaml
> new file mode 100644
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dds/adi,ad9832.yaml
[ ... ]
> properties:
>   compatible:
>     enum:
>       - adi,ad9832
>       - adi,ad9835
> 
>   reg:
>     maxItems: 1
> 
>   spi-max-frequency:
>     maximum: 20000000

Does this binding need to specify spi-cpol? 

The AD9832 hardware requires SPI Mode 2 (CPOL=1, CPHA=0) where the SPI
clock idles high. Since the driver doesn't set spi->mode in code and
relies on the device tree to configure polarity, omitting it might cause
the controller to default to Mode 0, which would cause communication to
fail.

Should spi-cpol: true be added to the properties and included in the
example?

[ ... ]
>     spi {
>       #address-cells = <1>;
>       #size-cells = <0>;
> 
>       ad9832@0 {

This isn't a bug, but does this violate the device tree convention for
generic node names? Usually, node names describe the hardware's function
rather than the specific part number, such as generator@0 or frequency@0.

>         compatible = "adi,ad9832";
>         reg = <0>;
>         spi-max-frequency = <20000000>;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260509002810.78372-2-dennylin0707@gmail.com?part=1

      reply	other threads:[~2026-05-09  0:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-09  0:28 [PATCH v2 0/1] dt-bindings: iio: dds: Add AD9832/AD9835 binding Hungyu Lin
2026-05-09  0:28 ` [PATCH v2 1/1] " Hungyu Lin
2026-05-09  0:36   ` sashiko-bot [this message]

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=20260509003645.A7626C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=dennylin0707@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@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