From: Jonathan Cameron <jic23@kernel.org>
To: "Stefan Brüns" <stefan.bruens@rwth-aachen.de>
Cc: <linux-iio@vger.kernel.org>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
<linux-kernel@vger.kernel.org>, "Andrew F . Davis" <afd@ti.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Hartmut Knaack" <knaack.h@gmx.de>,
Javier Martinez Canillas <javier@osg.samsung.com>
Subject: Re: [PATCH v2 2/3] iio: adc: ina2xx: Use LSB specifier instead of divider in config
Date: Sun, 19 Nov 2017 16:15:03 +0000 [thread overview]
Message-ID: <20171119161503.4f7bbbdd@archlinux> (raw)
In-Reply-To: <b1ed2d5d-f548-4d88-b563-58a86008e661@rwthex-w2-a.rwth-ad.de>
On Sat, 28 Oct 2017 23:12:47 +0200
Stefan Brüns <stefan.bruens@rwth-aachen.de> wrote:
> While the config uses the physical value corresponding to the LSB
> for both the power and the bus voltage register, the shunt voltage is
> specified as parts of 1 mV. Use the LSB physical value for all registers.
>
> No functional change.
>
> Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
>
Applied
> ---
>
> Changes in v2:
> - new patch
>
> drivers/iio/adc/ina2xx-adc.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
> index 84094235ff7e..c59843de3999 100644
> --- a/drivers/iio/adc/ina2xx-adc.c
> +++ b/drivers/iio/adc/ina2xx-adc.c
> @@ -115,7 +115,7 @@ enum ina2xx_ids { ina219, ina226 };
> struct ina2xx_config {
> u16 config_default;
> int calibration_factor;
> - int shunt_div;
> + int shunt_voltage_lsb; /* nV */
> int bus_voltage_shift; /* position of lsb */
> int bus_voltage_lsb; /* uV */
> int power_lsb; /* uW */
> @@ -138,7 +138,7 @@ static const struct ina2xx_config ina2xx_config[] = {
> [ina219] = {
> .config_default = INA219_CONFIG_DEFAULT,
> .calibration_factor = 40960000,
> - .shunt_div = 100,
> + .shunt_voltage_lsb = 10000,
> .bus_voltage_shift = INA219_BUS_VOLTAGE_SHIFT,
> .bus_voltage_lsb = 4000,
> .power_lsb = 20000,
> @@ -147,7 +147,7 @@ static const struct ina2xx_config ina2xx_config[] = {
> [ina226] = {
> .config_default = INA226_CONFIG_DEFAULT,
> .calibration_factor = 5120000,
> - .shunt_div = 400,
> + .shunt_voltage_lsb = 2500,
> .bus_voltage_shift = 0,
> .bus_voltage_lsb = 1250,
> .power_lsb = 25000,
> @@ -204,9 +204,9 @@ static int ina2xx_read_raw(struct iio_dev *indio_dev,
> case IIO_CHAN_INFO_SCALE:
> switch (chan->address) {
> case INA2XX_SHUNT_VOLTAGE:
> - /* processed (mV) = raw/shunt_div */
> - *val2 = chip->config->shunt_div;
> - *val = 1;
> + /* processed (mV) = raw * lsb(nV) / 1000000 */
> + *val = chip->config->shunt_voltage_lsb;
> + *val2 = 1000000;
> return IIO_VAL_FRACTIONAL;
>
> case INA2XX_BUS_VOLTAGE:
next prev parent reply other threads:[~2017-11-19 16:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171028211249.24148-1-stefan.bruens@rwth-aachen.de>
2017-10-28 21:12 ` [PATCH v2 1/3] iio: adc: ina2xx: Shift bus voltage register to mask flag bits Stefan Brüns
2017-11-19 16:13 ` Jonathan Cameron
2017-10-28 21:12 ` [PATCH v2 2/3] iio: adc: ina2xx: Use LSB specifier instead of divider in config Stefan Brüns
2017-11-19 16:15 ` Jonathan Cameron [this message]
2017-11-25 22:05 ` Stefan Brüns
2017-10-28 21:12 ` [PATCH v2 3/3] iio: adc: ina2xx: Allow setting Shunt Voltage PGA gain and Bus Voltage range Stefan Brüns
2017-11-19 16:16 ` Jonathan Cameron
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=20171119161503.4f7bbbdd@archlinux \
--to=jic23@kernel.org \
--cc=afd@ti.com \
--cc=javier@osg.samsung.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.bruens@rwth-aachen.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.