From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: linux-hwmon@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>,
Rob Herring <robh+dt@kernel.org>,
Jean Delvare <jdelvare@suse.com>
Subject: ina2xx: New DT properties
Date: Tue, 15 Nov 2016 20:52:33 +0100 [thread overview]
Message-ID: <20161115195232.GA24893@archie.localdomain> (raw)
Hi,
I am preparing a patch for the ina2xx driver to allow configuring the
PGA bits (which define the shunt voltage range) and the BRNG bit (which
defines the bus voltage range) from the device tree.
We have multiple INA219 with different voltage ranges, so I can't just
change the hardcoded default in ina2xx.c
The ADC averaging setting should also be configurable.
Now I am asking myself if I should create several new DT properties or
rather add one config-reg property to set a different default value for
the 16-bit configuration register (instead of the driver defaults of
0x399F for the INA219 and 0x4527 for the INA226) ?
Solution A:
ina219_foo: ina219@44 {
compatible = "ti,ina219";
reg = <0x44>;
shunt-resistor = <25000>;
pga = <2>; /* PGA Gain /2 instead of the default /8 */
/* Note: Possible PGA Gain values are /1, /2, /4 and /8 */
has-16v-brng; /* Bus voltage range of 16V instead of 32V */
averaging = <128>; /* Average 128 samples */
};
Should each of those also have a sysfs attribute?
Solution B:
ina219_bar: ina219@45 {
compatible = "ti,ina219";
reg = <0x45>;
shunt-resistor = <25000>;
config-reg = <0x019F>; /* PGA /1, BRNG = 16V, No averaging */
};
Regards,
Clemens
next reply other threads:[~2016-11-15 19:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-15 19:52 Clemens Gruber [this message]
2016-11-15 20:25 ` ina2xx: New DT properties Rob Herring
2016-11-15 21:04 ` Guenter Roeck
2016-11-16 10:50 ` Clemens Gruber
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=20161115195232.GA24893@archie.localdomain \
--to=clemens.gruber@pqgruber.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@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