Re: [PATCH v1 3/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy carrier board

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> > >
> > > 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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux