From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Sa, Nuno" <Nuno.Sa@analog.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>
Subject: Re: [PATCH v3 1/3] iio: dac: add support for ltc2688
Date: Mon, 14 Feb 2022 15:49:34 +0200 [thread overview]
Message-ID: <Ygpd7pebiuGuB8nT@smile.fi.intel.com> (raw)
In-Reply-To: <e1bd9f14e63e55f48f804568705a9ab8c1a09f62.camel@gmail.com>
On Mon, Feb 07, 2022 at 09:19:46PM +0100, Nuno Sá wrote:
> On Mon, 2022-02-07 at 13:09 +0200, Andy Shevchenko wrote:
> > On Sun, Feb 06, 2022 at 01:19:59PM +0000, Sa, Nuno wrote:
> > > > From: Andy Shevchenko <andriy.shevchenko@intel.com>
> > > > Sent: Saturday, February 5, 2022 6:30 PM
> > > > On Fri, Jan 21, 2022 at 03:24:59PM +0100, Nuno Sá wrote:
...
> > > > Second, why do you need this specific function instead of regmap
> > > > bulk
> > > > ops against be24/le24?
> > >
> > > Not sure I'm following this one... If you mean why am I using a
> > > custom
> > > regmap_bus implementation, that was already explained in the RFC
> > > patch.
> > > And IIRC, you were the one already asking 😉.
> >
> > Hmm... It was some time I have looked there. Any message ID to share,
> > so
> > I can find it quickly?
> https://lore.kernel.org/all/20211112152235.12fdcc49@jic23-huawei/
Thanks!
So, it's all about cs_change, right?
But doesn't bulk operation work exactly as we need here?
Looking again to the RFC code, it seems like we can still do it
First, you call _gather_write() followed by _read(). It will show exactly what
you do, i.e. you send command first with the value 0x0000, followed by sending
command and reading back the value at the same time.
Would it work?
...
> > > > > + ret = kstrtou16(buf, 10, &val);
> > > >
> > > > In other function you have long, here u16. I would expect that
> > > > the
> > > > types are of
> > > > the same class, e.g. if here you have u16, then there something
> > > > like
> > > > s32 / s64.
> > > > Or here something like unsigned short.
> > > >
> > > > A bit of elaboration why u16 is chosen here?
> > >
> > > Well, I never really saw any enforcement here to be honest (rather
> > > than using
> > > stdint types...). So I pretty much just use these in unsigned types
> > > because
> > > I'm lazy and u16 is faster to type than unsigned short... In this
> > > case, unless Jonathan
> > > really asks for it, I prefer not to go all over the driver and
> > > change this...
> >
> > This is about consistency. It may work as is, but it feels not good
> > when for
> > int (or unsigned int) one uses fixed-width types. Also it's non-
> > written advice
> > to use fixed-width variables when it's about programming registers or
> > so, for
> > the rest, use POD types.
> I can understand your reasoning but again this is something that
> I never really saw being enforced. So, I'm more than ok to change it
> if it really becomes something that we will try to "enforce" in IIO.
> Otherwise it just feels as a random nitpick :).
No, this is about consistency and common sense. If you define type uXX,
we have an API for that exact type. It's confusing why POD type APIs
are used with fixed-width types or vise versa.
Moreover (which is pure theoretical, though) some architectures might
have no (mutual) equivalency between these types.
...
> > > > > +static int ltc2688_tgp_clk_setup(struct ltc2688_state *st,
> > > > > + struct ltc2688_chan *chan,
> > > > > + struct device_node *np, int
> > > > > tgp)
> > > > > +{
> > > > > + unsigned long rate;
> > > > > + struct clk *clk;
> > > > > + int ret, f;
> > > > > +
> > > > > + clk = devm_get_clk_from_child(&st->spi->dev, np, NULL);
> > > > > + if (IS_ERR(clk))
> > > >
> > > > Make it optional for non-OF, can be done as easy as
> > > >
> > > > if (IS_ERR(clk)) {
> > > > if (PTR_ERR(clk) == -ENOENT)
> > > > clk = NULL;
> > > > else
> > > > return dev_err_probe(...);
> > > > }
> > > >
> > > > > + return dev_err_probe(&st->spi->dev,
> > > > > PTR_ERR(clk),
> > > > > + "failed to get tgp
> > > > > clk.\n");
> > >
> > > Well, I might be missing the point but I think this is not so
> > > straight....
> > > We will only get here if the property " adi,toggle-dither-input" is
> > > given
> > > in which case having the associated clocks is __mandatory__.
> >
> > Ah, okay, would be a limitation for non-OF platforms.
> >
> > > Hence,
> > > once we are here, this can never be optional. That said, we need
> > > device_node
> >
> > That's fine, since CCF is OF-centric API.
> >
> > > and hence of.h
> >
> > Why? This header doesn't bring anything you will use here.
>
> Correct me if Im missing something. AFAIU, the idea is to use
> 'device_for_each_child_node()' which returns a fwnode_handle. That
> means, that we will have to pass that to this function and use
> 'to_of_node()' to pass a device_node to 'devm_get_clk_from_child()'.
>
> This means, we need of.h for 'to_of_node()'...
Yeah, you are right, but it would be still better since it narrows
the problem to the CCF calls only.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-02-14 13:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 14:24 [PATCH v3 0/3] Add support for LTC2688 Nuno Sá
2022-01-21 14:24 ` [PATCH v3 1/3] iio: dac: add support for ltc2688 Nuno Sá
2022-01-24 9:57 ` [RFC PATCH] iio: dac: ltc2688_regmap_bus can be static kernel test robot
2022-01-24 9:58 ` [PATCH v3 1/3] iio: dac: add support for ltc2688 kernel test robot
2022-02-05 17:29 ` Andy Shevchenko
2022-02-05 18:44 ` Jonathan Cameron
2022-02-05 18:50 ` Andy Shevchenko
2022-02-05 18:58 ` Andy Shevchenko
2022-02-06 15:16 ` Jonathan Cameron
2022-02-07 10:52 ` Andy Shevchenko
2022-02-06 13:19 ` Sa, Nuno
2022-02-07 11:09 ` Andy Shevchenko
2022-02-07 20:19 ` Nuno Sá
2022-02-14 13:23 ` Nuno Sá
2022-02-14 13:50 ` Andy Shevchenko
2022-02-18 13:40 ` Nuno Sá
2022-02-14 13:49 ` Andy Shevchenko [this message]
2022-02-18 13:51 ` Nuno Sá
2022-02-18 16:03 ` Jonathan Cameron
2022-02-20 11:32 ` Andy Shevchenko
2022-02-21 12:48 ` Nuno Sá
2022-02-21 17:04 ` Andy Shevchenko
2022-02-21 17:30 ` Jonathan Cameron
2022-02-21 18:49 ` Andy Shevchenko
2022-02-22 16:21 ` Jonathan Cameron
2022-02-19 12:57 ` Nuno Sá
2022-01-21 14:25 ` [PATCH v3 2/3] iio: ABI: add ABI file for the LTC2688 DAC Nuno Sá
2022-02-05 16:25 ` Andy Shevchenko
2022-01-21 14:25 ` [PATCH v3 3/3] dt-bindings: iio: Add ltc2688 documentation Nuno Sá
2022-02-05 2:28 ` Rob Herring
2022-01-22 17:27 ` [PATCH v3 0/3] Add support for LTC2688 Jonathan Cameron
2022-02-05 16:24 ` Andy Shevchenko
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=Ygpd7pebiuGuB8nT@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=Nuno.Sa@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=noname.nuno@gmail.com \
--cc=robh+dt@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.