From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>,
<nuno.sa@analog.com>, <linux-iio@vger.kernel.org>,
<devicetree@vger.kernel.org>,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Olivier Moysan <olivier.moysan@foss.st.com>
Subject: Re: [PATCH 1/8] iio: backend: add API for interface tuning
Date: Mon, 22 Apr 2024 18:13:16 +0100 [thread overview]
Message-ID: <20240422181316.000060ff@Huawei.com> (raw)
In-Reply-To: <2131a0feac13fa8c1341c3546761ff1a34ca79df.camel@gmail.com>
> >
> > > + *
> > > + * Get the current state of the backend channel. Typically used to check if
> > > + * there were any errors sending/receiving data.
> > > + *
> > > + * RETURNS:
> > > + * 0 on success, negative error number on failure.
> > > + */
> > > +int iio_backend_chan_status(struct iio_backend *back, unsigned int chan,
> > > + struct iio_backend_chan_status *status)
> > > +{
> > > + return iio_backend_op_call(back, chan_status, chan, status);
> > > +}
> > > +EXPORT_SYMBOL_NS_GPL(iio_backend_chan_status, IIO_BACKEND);
> > > +
> > > +/**
> > > + * iio_backend_iodelay_set - Set digital I/O delay
> > > + * @back: Backend device
> > > + * @lane: Lane number
> > > + * @tap: Number of taps
> > > + *
> > > + * Controls delays on sending/receiving data. One usecase for this is to
> > > + * calibrate the data digital interface so we get the best results when
> > > + * transferring data. Note that @tap has no unit since the actual delay per tap
> > > + * is very backend specific. Hence, frontend devices typically should go through
> > > + * an array of @taps (the size of that array should typically match the size of
> > > + * calibration points on the frontend device) and call this API.
> > > + *
> > > + * RETURNS:
> > > + * 0 on success, negative error number on failure.
> > > + */
> > > +int iio_backend_iodelay_set(struct iio_backend *back, unsigned int lane,
> > > + unsigned int tap)
> >
> > taps maybe given it's a number of them?
>
> yeps...
>
> > Is this an industry standard term - sounds like it probably is but my
> > google fu is failing.
> >
>
> Not really (I think). It's very AMD/Xilinx specific. If you google for Xilinx IDELAY
> control you may found something. I could not find a good name (originally I just had
> 'delay' but without a proper unit it felt weird), so I admit I used the one it made
> more sense for my specific usecase. Open to suggestions though :).
Taps is fine.
> > >
> > > +/* vendor specific from 32 */
> > > +enum iio_backend_test_pattern {
> > > + /* modified prbs9 */
> > > + IIO_BACKEND_ADI_PRBS_9A = 32,
> >
> > Not knowing anything much about this, does it make sense to use an enum,
> > or should we face facts that we can't have a true generic interface
> > and just use a suitably sized int?
> >
>
> I'm also not a fan of the above but we do have generic/standard patterns in this core
> (and that could be used by others):
>
> - 0x0: pn9a (device specific, modified pn9)
> - 0x1: pn23a (device specific, modified pn23)
> - 0x4: pn7 (standard O.150)
> - 0x5: pn15 (standard O.150)
> - 0x6: pn23 (standard O.150)
> - 0x7: pn31 (standard O.150)
> - 0x9: pnX (device specific, e.g. ad9361)
> - 0x0A: Nibble ramp (Device specific e.g. adrv9001)
> - 0x0B: 16 bit ramp
>
> Lucky enough the user we have for this is only using a custom/modified pattern. my
> issue with the int is that how do frontends know what value do they need to pass into
> the API? It would really be very backend specific. I know we do expect frontends to
> have some assumed knowledge on the backend they're connected too but I would like to
> avoid making those assumptions bigger than they need to be.
>
> My expectation with the enum is that we can have some "contract" between backends and
> frontends on the pattern to use. I guess we could give it a try (unless you have some
> other idea) and if it starts going out of control, I can assume defeat and change it
> to an int.
>
> Or, is the idea to just have the int parameter and some plain defines in the backend
> header?
Keep it as an enum for now and let's see where this goes. Things called
'modified' are always ominous. Modified how? The standard defined ones
are easier to argue for.
>
> > How do you unset the test pattern? I expected a IIO_BACKEND_NO_TESTPATERN = 0
> > or something like that.
> >
>
> Since this is on the input direction (and for our particular core), we don't have to
> unset it. When you choose a test pattern, it just tells the core to match for a
> specific signal/pattern. So when you do start getting "real" data, we may still have
> those status bits saying there are "errors" but in reality we don't care. We just
> care during the tuning/calibration procedure as we configure matching patters between
> frontend and backend...
>
> OTOH for the axi-dac, for example, we do need to unset the test pattern. And we do
> that by (re)configuring the internal CW tone or the external data source (typically
> some DMA core).
Can we unset it for both input and output? May make no difference, but easier to reason about
perhaps.
>
>
> > > + IIO_BACKEND_TEST_PATTERN_MAX
> > > +};
next prev parent reply other threads:[~2024-04-22 17:13 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-19 15:36 [PATCH 0/8] iio: ad9467: support interface tuning Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-19 15:36 ` [PATCH 1/8] iio: backend: add API for " Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:00 ` Jonathan Cameron
2024-04-22 15:40 ` Nuno Sá
2024-04-22 17:13 ` Jonathan Cameron [this message]
2024-04-23 7:52 ` Nuno Sá
2024-04-28 15:46 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 2/8] iio: adc: adi-axi-adc: only error out in major version mismatch Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:02 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 3/8] dt-bindings: adc: axi-adc: add clocks property Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-19 16:11 ` Krzysztof Kozlowski
2024-04-20 15:04 ` Jonathan Cameron
2024-04-22 15:06 ` Nuno Sá
2024-04-22 17:09 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 4/8] iio: adc: axi-adc: make sure AXI clock is enabled Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:04 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 5/8] iio: adc: adi-axi-adc: remove regmap max register Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-19 15:36 ` [PATCH 6/8] iio: adc: adi-axi-adc: support digital interface calibration Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:13 ` Jonathan Cameron
2024-04-23 7:27 ` Nuno Sá
2024-04-28 15:49 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 7/8] iio: adc: ad9467: cache the sample rate Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:19 ` Jonathan Cameron
2024-04-22 15:46 ` Nuno Sá
2024-04-22 17:08 ` Jonathan Cameron
2024-04-19 15:36 ` [PATCH 8/8] iio: adc: ad9467: support digital interface calibration Nuno Sa
2024-04-19 15:36 ` Nuno Sa via B4 Relay
2024-04-20 15:34 ` Jonathan Cameron
2024-04-23 7:32 ` Nuno Sá
2024-04-20 15:39 ` [PATCH 0/8] iio: ad9467: support interface tuning 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=20240422181316.000060ff@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.ardelean@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+nuno.sa.analog.com@kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=robh@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 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.