[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjLe0yIpMyPRl-eZ@archie.me>
Date: Thu, 2 May 2024 07:31:15 +0700
From: Bagas Sanjaya <bagasdotme@...il.com>
To: João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>,
Linux IIO <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Devicetree <devicetree@...r.kernel.org>
Cc: joao.goncalves@...adex.com, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: Supporting a Device with Switchable Current/Voltage Measurement
[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
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists