From: Cosmin Tanislav <demonsingur@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
linux-iio@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Cosmin Tanislav <cosmin.tanislav@analog.com>,
Rob Herring <robh@kernel.org>
Subject: Re: [PATCH v8 1/2] dt-bindings: iio: adc: add AD4130
Date: Thu, 8 Sep 2022 10:03:35 +0300 [thread overview]
Message-ID: <06476041-e8d6-7030-2f46-ace964c42513@gmail.com> (raw)
In-Reply-To: <CACRpkdZVkXM-8DZjTaOxnS05Wz5GHon0sK1g7hDbz5SDJf9A=A@mail.gmail.com>
On 7/18/22 16:14, Linus Walleij wrote:
> Hi Cosmin,
>
> thanks for your patch!
>
> On Fri, Jul 15, 2022 at 6:50 AM Cosmin Tanislav <demonsingur@gmail.com> wrote:
>
>> AD4130-8 is an ultra-low power, high precision, measurement solution for
>> low bandwidth battery operated applications.
>>
>> The fully integrated AFE (Analog Front-End) includes a multiplexer for up
>> to 16 single-ended or 8 differential inputs, PGA (Programmable Gain
>> Amplifier), 24-bit Sigma-Delta ADC, on-chip reference and oscillator,
>> selectable filter options, smart sequencer, sensor biasing and excitation
>> options, diagnostics, and a FIFO buffer.
>>
>> Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
>> Reviewed-by: Rob Herring <robh@kernel.org>
> (...)
>
> This caught my eye:
>
>> + adi,int-clk-out:
>> + description: Specify if the internal clock should be exposed on the CLK pin.
>> + type: boolean
>
> Okay, but would it not make more sense to just imply this if the clock
> on the CLK
> pin has any consumers? Like update this setting in hardware when the consumer
> does clk_prepare() or so on that externally routed clock?
>
You're right, this is indeed fit for being implemented using the clock
framework.
>> + adi,ext-clk-freq-hz:
>> + description: Specify the frequency of the external clock.
>> + enum: [76800, 153600]
>> + default: 76800
>
> This looks like cheating, i.e just outputting a clock on that pin
> and ignoring to model the consumer.
You got this wrong.
The chip has 4 operating modes regarding clocking.
Internal 76.8kHz clock (clkout can be used as an interrupt pin).
Internal 76.8kHz clock, available externally on the clkout pin (clkout
becomes an output).
External 76.8kHz clock (clkout is an input).
External 153.6kHz clock, internally divided by two (clkout is an input).
This property is used to choose between what frequency to set the
external clock up with. Indeed, if the external clock is not present,
then exposing the 76.8kHz clock using the clock framework would be fine.
Maybe you have a better suggestion about what to do with this?
How do I tell the chip what frequency the external clock is, but also
tell the clock what frequency to use? It's a bit of a conundrum for me.
>
> Shouldn't this rather be a clkout subnode with 2 #clock-cells
> and the fequency set in a cell in a consumer phandle?
> Like how I did in
> commit 7335631fcd5eecfa84555bd57433e6446d06ad21
> "dt-bindings: clock: u8500: Add clkout clock bindings"
>
> Usually it is the consumer that requests a specific clock and then the
> producer will respond.
>
> Certainly whatever is consuming this clock needs to be in the device tree
> as well, and then this is the right pattern.
>
> (In Linux you will then use the clk framework to manage the clock and callbacks
> but that is irrelevant for the DT bindings.)
>
>> + adi,bipolar:
>> + description: Specify if the device should be used in bipolar mode.
>> + type: boolean
>
> Can you explain what this means? I don't understand what it would
> mean for an analog device / AFE to be in bipolar mode.
>
Range becomes [-VRef, VRef], as opposed to [0, VRef], resolution is
halved.
> Other than that it looks very nice!
>
> Yours,
> Linus Walleij
next prev parent reply other threads:[~2022-09-08 7:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 4:49 [PATCH v8 0/2] AD4130 Cosmin Tanislav
2022-07-15 4:49 ` [PATCH v8 1/2] dt-bindings: iio: adc: add AD4130 Cosmin Tanislav
2022-07-18 13:14 ` Linus Walleij
2022-09-08 7:03 ` Cosmin Tanislav [this message]
2022-09-08 12:40 ` Linus Walleij
2022-07-15 4:49 ` [PATCH v8 2/2] iio: adc: ad4130: add AD4130 driver Cosmin Tanislav
2022-07-15 4:53 ` Cosmin Tanislav
2022-07-18 13:26 ` Linus Walleij
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=06476041-e8d6-7030-2f46-ace964c42513@gmail.com \
--to=demonsingur@gmail.com \
--cc=cosmin.tanislav@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--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).