public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: "João Paulo Gonçalves" <jpaulo.silvagoncalves@gmail.com>
Cc: "Francesco Dolcini" <francesco@dolcini.it>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"João Paulo Gonçalves" <joao.goncalves@toradex.com>,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Francesco Dolcini" <francesco.dolcini@toradex.com>
Subject: Re: [PATCH v1 3/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy carrier board
Date: Tue, 24 Sep 2024 12:56:28 -0400	[thread overview]
Message-ID: <ZvLvPL+/gL0WHXWB@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20240924165021.n6lln424llsfzhtu@joaog-nb>

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@toradex.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

  reply	other threads:[~2024-09-24 16:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 11:40 [PATCH v1 0/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy carrier Francesco Dolcini
2024-09-24 11:40 ` [PATCH v1 1/3] dt-bindings: arm: freescale: Add verdin imx8mp ivy board Francesco Dolcini
2024-09-24 15:34   ` Conor Dooley
2024-09-24 11:40 ` [PATCH v1 2/3] arm64: dts: freescale: imx8mp-verdin: add labels to som nodes Francesco Dolcini
2024-09-24 15:02   ` Frank Li
2024-09-24 17:02     ` João Paulo Gonçalves
2024-09-25 16:53       ` Frank Li
2024-09-24 11:40 ` [PATCH v1 3/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy carrier board Francesco Dolcini
2024-09-24 15:09   ` Frank Li
2024-09-24 16:50     ` João Paulo Gonçalves
2024-09-24 16:56       ` Frank Li [this message]
2024-09-25  1:56 ` [PATCH v1 0/3] arm64: dts: freescale: imx8mp-verdin: Add Ivy carrier Rob Herring (Arm)
2024-10-17  9:29 ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZvLvPL+/gL0WHXWB@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=francesco@dolcini.it \
    --cc=imx@lists.linux.dev \
    --cc=joao.goncalves@toradex.com \
    --cc=jpaulo.silvagoncalves@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox