[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:
signature.asc
Description: PGP signature