From: "Nuno Sá" <noname.nuno@gmail.com>
To: Kim Seer Paller <kimseer.paller@analog.com>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org
Cc: Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Dimitri Fedrau <dima.fedrau@gmail.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Michael Hennerich <michael.hennerich@analog.com>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v3 5/5] iio: dac: ltc2664: Add driver for LTC2664 and LTC2672
Date: Mon, 03 Jun 2024 15:12:36 +0200 [thread overview]
Message-ID: <f262dd8884e89bb36a72fe8fd5cb75cd9ae6fa08.camel@gmail.com> (raw)
In-Reply-To: <20240603012200.16589-6-kimseer.paller@analog.com>
On Mon, 2024-06-03 at 09:22 +0800, Kim Seer Paller wrote:
> LTC2664 4 channel, 16 bit Voltage Output SoftSpan DAC
> LTC2672 5 channel, 16 bit Current Output Softspan DAC
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202405241141.kYcxrSem-lkp@intel.com/
The above could be dropped. This is still not merged code :)
> Co-developed-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
> ---
LGTM... just a couple of minor points/questions that you can maybe take on if a re-
spin is needed.
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
...
>
> +static int ltc2664_scale_get(const struct ltc2664_state *st, int c)
> +{
> + const struct ltc2664_chan *chan = &st->channels[c];
> + const int (*span_helper)[2] = st->chip_info->span_helper;
> + int span, fs;
> +
> + span = chan->span;
> + if (span < 0)
> + return span;
> +
> + fs = span_helper[span][1] - span_helper[span][0];
> +
> + return (fs / 2500) * st->vref;
no need for ()
...
>
> +static int ltc2664_channel_config(struct ltc2664_state *st)
> +{
> + const struct ltc2664_chip_info *chip_info = st->chip_info;
> + struct device *dev = &st->spi->dev;
> + u32 reg, tmp[2], mspan;
> + int ret, span = 0;
> +
> + mspan = LTC2664_MSPAN_SOFTSPAN;
> + ret = device_property_read_u32(dev, "adi,manual-span-operation-config",
> + &mspan);
> + if (!ret) {
> + if (!chip_info->manual_span_support)
> + return dev_err_probe(dev, -EINVAL,
> + "adi,manual-span-operation-config not
> supported\n");
> +
> + if (mspan > ARRAY_SIZE(ltc2664_mspan_lut))
> + return dev_err_probe(dev, -EINVAL,
> + "adi,manual-span-operation-config not in range\n");
> + }
> +
> + st->rfsadj = 20000;
> + ret = device_property_read_u32(dev, "adi,rfsadj-ohms", &st->rfsadj);
> + if (!ret) {
> + if (!chip_info->rfsadj_support)
> + return dev_err_probe(dev, -EINVAL,
> + "adi,rfsadj-ohms not supported\n");
> +
> + if (st->rfsadj < 19000 || st->rfsadj > 41000)
> + return dev_err_probe(dev, -EINVAL,
> + "adi,rfsadj-ohms not in range\n");
> + }
> +
> + device_for_each_child_node_scoped(dev, child) {
> + struct ltc2664_chan *chan;
> +
> + ret = fwnode_property_read_u32(child, "reg", ®);
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "Failed to get reg property\n");
> +
> + if (reg >= chip_info->num_channels)
> + return dev_err_probe(dev, -EINVAL,
> + "reg bigger than: %d\n",
> + chip_info->num_channels);
> +
> + chan = &st->channels[reg];
> +
> + if (fwnode_property_read_bool(child, "adi,toggle-mode")) {
> + chan->toggle_chan = true;
> + /* assume sw toggle ABI */
Do we have any other option :)? For the ltc2668 driver (where this code came from),
we do have another way (driven by clocks) to toggle between outputs and hence the
comment.
BTW, there's a fair amount of duplicated code between this and ltc2668. At some point
we may see if it makes sense to add some common module. Anyways, fine for now.
- Nuno Sá
next prev parent reply other threads:[~2024-06-03 13:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 1:21 [PATCH v3 0/5] Add driver for LTC2664 and LTC2672 Kim Seer Paller
2024-06-03 1:21 ` [PATCH v3 1/5] iio: ABI: Generalize ABI documentation for DAC Kim Seer Paller
2024-06-08 14:40 ` Jonathan Cameron
2024-06-12 10:57 ` Paller, Kim Seer
2024-06-13 17:00 ` Jonathan Cameron
2024-06-03 1:21 ` [PATCH v3 2/5] iio: ABI: add DAC 42kohm_to_gnd powerdown mode Kim Seer Paller
2024-06-03 1:21 ` [PATCH v3 3/5] dt-bindings: iio: dac: Add adi,ltc2664.yaml Kim Seer Paller
2024-06-03 7:02 ` Krzysztof Kozlowski
2024-06-03 1:21 ` [PATCH v3 4/5] dt-bindings: iio: dac: Add adi,ltc2672.yaml Kim Seer Paller
2024-06-03 7:05 ` Krzysztof Kozlowski
2024-06-03 19:59 ` David Lechner
2024-06-03 20:17 ` David Lechner
2024-06-04 6:47 ` Krzysztof Kozlowski
2024-06-04 13:53 ` David Lechner
2024-06-08 14:32 ` Jonathan Cameron
2024-06-03 1:22 ` [PATCH v3 5/5] iio: dac: ltc2664: Add driver for LTC2664 and LTC2672 Kim Seer Paller
2024-06-03 13:12 ` Nuno Sá [this message]
2024-06-03 20:43 ` David Lechner
2024-06-06 15:49 ` Paller, Kim Seer
2024-06-07 19:13 ` David Lechner
2024-06-18 10:32 ` Paller, Kim Seer
2024-06-18 13:42 ` David Lechner
2024-06-08 14:57 ` 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=f262dd8884e89bb36a72fe8fd5cb75cd9ae6fa08.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dima.fedrau@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=kimseer.paller@analog.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=michael.hennerich@analog.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).