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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZvLvPL+/gL0WHXWB@lizhi-Precision-Tower-5810>
Date: Tue, 24 Sep 2024 12:56:28 -0400
From: Frank Li <Frank.li@....com>
To: João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>
Cc: Francesco Dolcini <francesco@...cini.it>,
	Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	João Paulo Gonçalves <joao.goncalves@...adex.com>,
	imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	Francesco Dolcini <francesco.dolcini@...adex.com>
Subject: Re: [PATCH v1 3/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy
 carrier board

On Tue, Sep 24, 2024 at 01:50:21PM -0300, João Paulo Gonçalves wrote:
> Hi Frank,
>
> On Tue, Sep 24, 2024 at 11:09:51AM -0400, Frank Li wrote:
> > On Tue, Sep 24, 2024 at 01:40:53PM +0200, Francesco Dolcini wrote:
> > > From: João Paulo Gonçalves <joao.goncalves@...adex.com>
> > >
> > > Add Toradex Verdin Ivy carrier board support. One notable feature of Ivy
> > > is the analog inputs. These inputs are multiplexed, allowing the same
> > > input to measure either voltage or current. For current measurements,
> > > a GPIO switch enables or disables the shunt resistor. This process is
> > > automatically managed by the Linux kernel using the IIO and MUX
> > > subsystems. Voltage measurement is always enabled, but the voltage
> > > measured by the ADC is scaled by a cascade voltage divider. In the
> > > device tree, the equivalent gain of the voltage divider is used, which
> > > can be calculated as follows:
> > >
> > >                ------------
> > >                +          |
> > >                          .-.
> > >                   R1=30K | |
> > >                          | |
> > >                          '-'
> > >                           |-------------------
> > >     Analog Input (AIN)    |                  |
> > >                          .-.                .-.
> > >                   R2=10K | |         R3=30K | |
> > >                          | |                | |
> > >                          '-'                '-'
> > >                           |                  |
> > >                           |                  |--------
> > >                           |                 .-.      +
> > >                           |          R4=10K | |
> > >                           |                 | |      ADC Input (Channels 0 and 1)
> > >                           |                 '-'
> > >                -          |                  |       -
> > >                -----------|                  |--------
> > >                          ===                ===
> > >                          GND                GND
> > >
> > > Vin  = Analog Input (AIN)
> > > Vout = ADC Input
> > > Rth  = Thevenin Equiv. Resistance
> > > Vth  = Thevenin Equiv. Voltage
> > > RL   = Load Resistor
> > >
> > > R1 = 30K, R2 = 10K, R3 = 30K, R4 = 10K
> > > RL = R4 = 10K
> > >
> > > Rth  = (R1 // R2) + R3 = 37500 Ohms
> > > Vth  = (Vin * R2) / (R1 + R2) = Vin/4;
> > > Vout = (Vth * RL)/ (Rth + RL) = Vth/4.75 = Vin/19
> > > Gain = Vout/Vin = 1/19
> >
> > which properties related these value?
>
> The gain value is used on the "ain1_voltage_unmanaged" node for the full-ohms
> and output-ohms properties.

Okay, why not define a C macros, which calculate value base on input R<n>
's number.

Frank

>
> Best Regards,
> João Paulo Gonçalves

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ