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: <f4665f80-97a8-dedb-6d4b-b5e92b99ed78@axentia.se>
Date:   Mon, 16 Apr 2018 16:00:44 +0200
From:   Peter Rosin <peda@...ntia.se>
To:     linux-kernel@...r.kernel.org
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        "Andrew F . Davis" <afd@...com>,
        Fabio Estevam <festevam@...il.com>, linux-iio@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: iio: afe: add current-sense-shunt and
 voltage-divider

On 2018-04-10 17:28, Peter Rosin wrote:
> +Example:
> +The system voltage is circa 12V, but divided down with a 22/200
> +voltage divider to adjust it to the ADC range.
> +
> +SYSV        ADC       GND
> +  +          +         +
> +  |  .-----. | .----.  |
> +  '--| 200 |-+-| 22 |--'
> +     '-----'   '----'
> +
> +sysv {
> +	compatible = "voltage-divider";
> +	io-channels = <&maxadc 1>;
> +
> +	/* Multiply the ADC voltage by 222/22 to get the system voltage. */
> +	numerator = <222>; /* 200 + 22 */
> +	denominator = <22>;
> +};

While I already got a reviewed-by from Rob, and maybe I shouldn't be
stirring the pot, but I had an umpteenth look and I now think this
one looks a bit odd. It shows a bit that it originates from when the
compatible was the very generic "io-channel-unit-converter" in v1
of the series. What I mean is that a voltage divider presumable always
gets you a lower voltage. Therefore, one would assume that the
denominator should be larger than the numerator. The fact that this
translates into the inverted fraction when calculating backwards
through the voltage divider should probably not affect the binding.

So, in the above example, I think it would make more sense to have

	numerator = <22>;
	denominator = <222>; /* 200 + 22 */

(and then, naturally, adjust the driver to invert the fraction)

Comments?

Cheers,
Peter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ