From: Jean Delvare <khali@linux-fr.org>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Wolfram Sang <w.sang@pengutronix.de>,
Dirk Eibach <eibach@gdsys.de>,
devicetree-discuss@lists.ozlabs.org, rdunlap@xenotime.net,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH] hwmon: (ads1015) Add devicetree documentation
Date: Thu, 3 Mar 2011 23:02:53 +0100 [thread overview]
Message-ID: <20110303230253.0e8455c2@endymion.delvare> (raw)
In-Reply-To: <20110303172653.GB22940@angua.secretlab.ca>
On Thu, 3 Mar 2011 10:26:53 -0700, Grant Likely wrote:
> On Thu, Mar 03, 2011 at 02:25:49PM +0100, Wolfram Sang wrote:
> > OK. The thing is you can't map platform_data 1:1 to bindings, because
> > most are very specific to the Linux-driver. Do you think something like
> > "active-channels" would be sufficent for those other hwmon devices, too?
> > (I still do not like "exported-channels", because there is no need to
> > export the channels for the OS. The devicetree is primarily a hardware
> > description language) Or maybe we go specific and say "ads1015,channel1
> > = 1"? Maybe somebody knows of a similar chips as a reference?
>
> Yes, Wolfram's correct. The focus should be on what the connections
> actually are instead of what the OS should attempt to do with them.
> ie. give the active channels actual names for what they do, or use a
> phandle to reference them from another node. The driver can then make
> a decision based on whether or not a channel has a configuration
> provided.
>
> From the little information I have, I'd recommend something like:
>
> sensor@49 {
> compatible = "ti,ads1015"
> reg = <0x49>;
>
> // Each child node (one node per channel) has an address with
> // no range
> #address-cells = <1>;
> #size-cells = <0>;
>
> adc@2 {
> ti,measurement = "cpu voltage";
> reg = <2>;
> };
>
> adc@4 {
> ti,measurement = "base voltage";
> reg = <4>;
> };
> };
>
> However, after taking a little look at the data sheet, this binding
> might end up being a little naive for what the part can do. It might
> make more sense to do something like:
>
> sensor@49 {
> compatible = "ti,ads1015"
> reg = <0x49>;
>
> // Each child node (one node per channel) has an address with
> // no range
> #address-cells = <1>;
> #size-cells = <0>;
>
> measurement@0 {
> reg = <0>; // This reg value no longer reflects
> // the chip, it's just a handle for
> // logical measurement channels
If there any hard requirement for this? From the driver's perspective,
the multiplexer setting can be used as the channel ID, and it's easier
this way than using arbitrary identifiers.
> ti,measurement = "cpu voltage";
> ti,multiplexer = <2>; // AIN0 vs. AIN3
> ti,gain = <5>; // +/-0.256V
> ti,inverse-polarity;
> };
>
> measurement@1 {
> reg = <1>;
> ti,measurement = "base voltage";
> ti,multiplexer = <4>; // AIN0 vs. GND
> ti,gain = <2>; // +/-2.048V
> };
> };
>
> ...which splits it up by logical measurement configurations instead of
> only the multiplexer setting.
I wouldn't disagree, as I did suggest making the gain a per-channel
setting while reviewing Dirk's driver. I had not thought of labelling,
but the hwmon sysfs API supports this too, so it would fit nicely
(although it can also be handled in user-space if needed.)
> It's more verbose than a single exported-channels property, but it is
> flexible enough that it can be easily extended with extra
> configuration data per channel.
I will leave it up to Dirk to decide how much time he wants to spend on
this. He has already been very patient with the driver review process
and I do not want to abuse his patience.
--
Jean Delvare
next prev parent reply other threads:[~2011-03-03 22:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 9:16 [PATCH] hwmon: (ads1015) Add devicetree documentation Dirk Eibach
2011-03-03 11:51 ` Wolfram Sang
2011-03-03 12:20 ` Jean Delvare
[not found] ` <20110303132025.51e0d92e-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2011-03-03 13:25 ` Wolfram Sang
2011-03-03 17:26 ` Grant Likely
2011-03-03 22:02 ` Jean Delvare [this message]
2011-03-03 22:09 ` Grant Likely
[not found] ` <AANLkTikXzJEAYg7+5ekMzTj_V-Hs63Psgru4Vc_QGhRy-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-03-17 10:25 ` Jean Delvare
2011-03-17 16:46 ` Grant Likely
2011-03-03 17:01 ` Grant Likely
2011-03-03 12:32 ` [PATCH v3] " Dirk Eibach
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=20110303230253.0e8455c2@endymion.delvare \
--to=khali@linux-fr.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=eibach@gdsys.de \
--cc=grant.likely@secretlab.ca \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=w.sang@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox