From: "Nuno Sá" <nuno.sa@analog.com>
To: Rodrigo Alencar <455.rodrigo.alencar@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@analog.com, devicetree@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-doc@vger.kernel.org,
"Jonathan Cameron" <jonathan.cameron@oss.qualcomm.com>,
"Olivier Moysan" <olivier.moysan@foss.st.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>
Subject: Re: [PATCH v2 07/10] iio: frequency: ad9910: support drctl control
Date: Fri, 23 Oct 2026 15:48:08 +0100 [thread overview]
Message-ID: <attyyTaW3IRJQ85r@nsa> (raw)
In-Reply-To: <pg7pcjaaxuu6vmi4qowgaefyo3mynrvmiu6iazzormyvc5kiat@4hiqrtwbw2gg>
On Fri, Oct 23, 2026 at 07:40:32AM -0300, Rodrigo Alencar wrote:
> On 22/10/26 12:19, Rodrigo Alencar wrote:
> > The DRCTL pin controls the slope direction of the AD9910 digital ramp
> > generator (DRG). When dwell is enabled at a ramp limit, the DRG holds
> > that limit until the next DRCTL transition, so the sweep pattern is
> > defined by the waveform applied to that pin, which can be generated by
> > a PWM.
> >
> > Get the optional "drctl" PWM and expose the integration_time attribute
> > in the DRG ramp up and ramp down channels, which sets the time interval
> > assigned to each ramp direction while the sweep parameter is accumulating.
>
> ...
>
> > + st->drctl_pwm = devm_pwm_get(dev, "drctl");
> > + if (IS_ERR(st->drctl_pwm)) {
> > + ret = PTR_ERR(st->drctl_pwm);
> > + if (ret != -ENOENT && ret != -ENODEV)
>
> Sashiko points out the problem with passing a non-nul con_id to devm_pwm_get(),
> which would get us EINVAL or ENODATA from of_property_match_string(), and that
> would break the intent here for an optional pwm. Similar to what we tried to
> achieve with an optional IIO backend. I wonder what is the best strategy here
> (ascending order of complexity):
>
> * Use con_id = NULL as DRCTL is the only pwm signal being considered at this point.
Likely the best option for now. If you really envision having other PWM
sources I think the most important place to actually define the name is
in bindings because then we need to care about backward compatibility
(typically case for clocks when we need to grow the number of needed
clocks).
> * Local workaround by checking for EINVAL and ENODATA too
Don't love the above
> * Convert error codes from of_property_match_string() in of_pwm_get()
> implementation and create a devm_pwm_get_optional(), which would only check
> for ENODEV and ENOENT.
I guess we would need more users but those should not be hard to find in
tree (But up to Uwe I would say)
- Nuno Sá
>
> The pwm is optional as the digital ramp generator is one of the possible modes
> to be used.
>
> > + return dev_err_probe(dev, PTR_ERR(st->drctl_pwm),
> > + "failed to get drctl pwm\n");
> > + st->drctl_pwm = NULL;
> > + } else {
> > + ret = devm_add_action_or_reset(dev, ad9910_drctl_disable_action,
> > + st->drctl_pwm);
> > + if (ret)
> > + return dev_err_probe(dev, ret,
> > + "failed to add drctl disable action\n");
> > + }
>
> --
> Kind regards,
>
> Rodrigo Alencar
next prev parent reply other threads:[~2026-10-23 14:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 15:18 [PATCH v2 00/10] iio: frequency: ad9910: add IIO backend support Rodrigo Alencar via B4 Relay
2026-10-22 15:18 ` [PATCH v2 01/10] iio: frequency: ad9910: powerdown fix Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 02/10] iio: backend: add devm_iio_backend_get_optional() Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 03/10] dt-bindings: iio: frequency: add adi,ad9910-axi-backend Rodrigo Alencar via B4 Relay
2026-10-22 18:38 ` Conor Dooley
2026-10-23 11:15 ` Rodrigo Alencar
2026-10-23 17:39 ` Conor Dooley
2026-10-22 15:19 ` [PATCH v2 04/10] dt-bindings: iio: frequency: ad9910: add io-backends property Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 05/10] iio: frequency: ad9910: move channel indexes into a shared header Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 06/10] iio: frequency: ad9910: add axi backend driver Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 07/10] iio: frequency: ad9910: support drctl control Rodrigo Alencar via B4 Relay
2026-10-23 10:40 ` Rodrigo Alencar
2026-10-23 14:48 ` Nuno Sá [this message]
2026-10-22 15:19 ` [PATCH v2 08/10] iio: frequency: ad9910: support iio backend Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 09/10] iio: ABI: add integration_time for output channels Rodrigo Alencar via B4 Relay
2026-10-22 15:19 ` [PATCH v2 10/10] docs: iio: ad9910: document DRCTL pin control Rodrigo Alencar via B4 Relay
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=attyyTaW3IRJQ85r@nsa \
--to=nuno.sa@analog.com \
--cc=455.rodrigo.alencar@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=ukleinek@kernel.org \
/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
all inboxes | Powered by JetHome®