lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 1 May 2024 20:38:53 -0300
From: João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>
To: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: joao.goncalves@...adex.com
Subject: Supporting a Device with Switchable Current/Voltage Measurement

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>;
};

Regards,
João Paulo Gonçalves


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ