From: Bagas Sanjaya <bagasdotme@gmail.com>
To: "João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>,
"Linux IIO" <linux-iio@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Linux Devicetree" <devicetree@vger.kernel.org>
Cc: joao.goncalves@toradex.com, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: Supporting a Device with Switchable Current/Voltage Measurement
Date: Thu, 2 May 2024 07:31:15 +0700 [thread overview]
Message-ID: <ZjLe0yIpMyPRl-eZ@archie.me> (raw)
In-Reply-To: <20240501233853.32y4ev7jvas5ahdz@joaog-nb>
[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]
[also Cc: IIO and devicetree maintainers]
On Wed, May 01, 2024 at 08:38:53PM -0300, João Paulo Gonçalves wrote:
> Hello all,
>
> We need to support a hardware that can measure current and voltage on
> the same differential analog input, similar to a multimeter. The mode
> of measurement is controlled by a GPIO switch and goes to different
> ADC inputs depending on the mode. If the switch is enabled, a current
> loop with a shunt is enabled for current measurement; otherwise, voltage
> is measured. From the software point of view, we are considering using
> the iio-rescale driver as a consumer of an ADC IIO parent device. One
> of the problems is that we need to change the mode of measurement at
> runtime, but we are trying to avoid using some userspace "hack". The
> other is that for a minimal solution to enable the mode from boot, we
> can use a gpio-hog and control it with overlays. However,
> still would be better that this was done by the kernel. Do you know
> or have some guidance on how to properly support this in the kernel?
>
> For the in kernel gpio solution, this is a draft of DT we are thinking:
>
> current-sense {
> compatible = "current-sense-shunt";
> io-channels = <&adc 0>;
> gpio = <&main_gpio0 29 GPIO_ACTIVE_HIGH>;
> shunt-resistor-micro-ohms = <3300000>;
> };
>
> voltage-sense {
> compatible = "voltage-divider";
> io-channels = <&adc 1>;
> gpio = <&main_gpio0 29 GPIO_ACTIVE_LOW>;
> output-ohms = <22>;
> full-ohms = <222>;
> };
What are these ohms and where do you get them?
Confused...
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-05-02 0:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 23:38 Supporting a Device with Switchable Current/Voltage Measurement João Paulo Gonçalves
2024-05-02 0:31 ` Bagas Sanjaya [this message]
2024-05-02 0:42 ` João Paulo Silva Gonçalves
2024-05-02 0:50 ` Bagas Sanjaya
2024-05-02 12:36 ` Jonathan Cameron
2024-05-02 13:49 ` Peter Rosin
2024-05-02 14:05 ` Peter Rosin
2024-05-02 14:53 ` jpaulo.silvagoncalves
2024-05-02 15:09 ` Jonathan Cameron
2024-05-02 16:43 ` Peter Rosin
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=ZjLe0yIpMyPRl-eZ@archie.me \
--to=bagasdotme@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=joao.goncalves@toradex.com \
--cc=jpaulo.silvagoncalves@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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 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.