From: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Laxman Dewangan
<ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: corbet-T1hC0tSOHrs@public.gmane.org,
lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/3] iio: adc: ina3221: Add DT binding details
Date: Fri, 3 Jun 2016 11:19:27 +0100 [thread overview]
Message-ID: <433b182c-fe43-df5c-ac6a-20a024630514@kernel.org> (raw)
In-Reply-To: <20160603020759.GA23947@rob-hp-laptop>
On 03/06/16 03:07, Rob Herring wrote:
> On Wed, Jun 01, 2016 at 06:04:12PM +0530, Laxman Dewangan wrote:
>> The INA3221 is a three-channel, high-side current and bus voltage monitor
>> with an I2C interface from Texas Instruments. The INA3221 monitors both
>> shunt voltage drops and bus supply voltages in addition to having
>> programmable conversion times and averaging modes for these signals.
>> The INA3221 offers both critical and warning alerts to detect multiple
>> programmable out-of-range conditions for each channel.
>>
>> Add DT binding details for INA3221 device for configuring device in
>> different modes and enable multiple functionalities from device.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> ---
>> .../devicetree/bindings/iio/adc/ina3221.txt | 107 +++++++++++++++++++++
>> 1 file changed, 107 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/iio/adc/ina3221.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/ina3221.txt b/Documentation/devicetree/bindings/iio/adc/ina3221.txt
>> new file mode 100644
>> index 0000000..9f0908d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/ina3221.txt
>> @@ -0,0 +1,107 @@
>> +TI INA3221 DT binding
>> +
>> +The INA3221 is a three-channel, high-side current and bus voltage monitor
>> +with an I2C interface from Texas Instruments. The INA3221 monitors both
>> +shunt voltage drops and bus supply voltages in addition to having
>> +programmable conversion times and averaging modes for these signals.
>> +The INA3221 offers both critical and warning alerts to detect multiple
>> +programmable out-of-range conditions for each channel.
>> +
>> +Required properties:
>> +-------------------
>> +- compatible: Must be "ti,ina3221".
>> +- reg: I2C slave device address.
>> +- #io-channel-cells: Should be set to 1. The value from the client node
>> + represent the channel number.
>> +
>> +Optional properties:
>> +------------------
>> +one-shot-average-sample: Integer, Number of sample to average before
>> + putting in the registers in oneshot mode.
Pick a sensible default in the driver then leave this to userspace to
control.
>> +
>> +one-shot-vbus-conv-time-us: Integer in microseconds, ADC conversion time for
>> + bus voltage reading in oneshot mode.
Hmm. This one is a little non obvious. It's really controlling the noise
level more than anything else. Kind of integration time I guess though
not described as such in the datasheet.
Again, I don't think this is really device tree material.
However, you could argue the right decision on this is hardware dependant
as it really depends on ripple in the voltages? Not how it's described in
the datasheet though.
>> +
>> +one-shot-shunt-conv-time-us: Integer in microseconds, ADC conversion time for
>> + shunt voltage reading in oneshot mode.
>> +
>> +continuous-average-sample: Integer, Number of sample to average before
>> + putting in the registers in continuous mode.
Classic oversampling - not device tree material as it may well want
runtime configuration.
>> +
>> +continuous-vbus-conv-time-us: Integer in microseconds, ADC conversion time for
>> + bus voltage reading in continuous mode.
Why should these be different from the one-shot versions? Might be
separately controlled (though I don't think they are). If one setting
makes sense fo the hardware in oneshot mode, surely the same setting makes
sense in continuous mode.
>> +
>> +continuous-shunt-conv-time-us: Integer in microseconds, ADC conversion time for
>> + shunt voltage reading in continuous mode.
>
> These all need vendor prefix and need to state the valid range of
> values.
>
>> +
>> +enable-power-monitor: Boolean, Enable power monitoring of the device.
Is this the power good stuff? description should be more detailed.
>> +
>> +enable-continuous-mode: Boolean. Device support oneshot and continuous
>> + mode for the channel data conversion. Presence
>> + of this property will enable the continuous
>> + mode from boot.
Is the difference between driver load time and the point where usespace can
set it up significant enough to justify this?
>> +
>> +enable-warning-alert: Boolean, Enable the alert signal when shunt
>> + current cross the warning threshold on any of
>> + the channel. Absence of this property will not
>> + enable the warning alert.
>> +
>> +enable-critical-alert: Boolean, Enable the alert signal when shunt
>> + current cross the critical threshold on any
>> + of the channel. Absence of this property will
>> + not enable the critical alert.
>
> Seems like these would be a user decision.
Absolutely.
>
>> +
>> +Optional Subnode properties:
>> +---------------------------
>> +The channel specific properties are provided as child node of device.
>> +The fixed child node names of device node used for channel identification.
>> +
>> +Child node's name are "channel0" for channel 0, "channel1" for channel 1 and
>> +"channel2" for channel 2.
>> +
>> +Channel specific properties are provided under these child node. Following
>> +are the properties:
>> +
>> +label: String, the name of the bus.
>> +shunt-resistor-mohm: Integer, The shunt resistance on bus
>> + in milli-ohm.
>
> Use -micro-ohms
>
>> +warning-current-limit-microamp: Integer in microamp, warning current threshold
>> + for the channel to generate warning alert.
>> +critical-current-limit-microamp: Integer in microamp, critical current threshold
>> + for the channel to generate warning alert.
These two limits feel like they should be a userspace decision really.
If they are that critical I'd expect this chip to not be under kernel control
in the first place but rather some system management firmware or other.
>> +
>> +Example:
>> +
>> +i2c@7000c400 {
>> + ina3221x@42 {
>
> What's the x?
>
>> + compatible = "ti,ina3221";
>> + reg = <0x42>;
>> + one-shot-average-sample = <1>;
>> + one-shot-vbus-conv-time-us = <140>;
>> + one-shot-shunt-conv-time-us = <140>;
>> + continuous-average-sample = <64>;
>> + continuous-vbus-conv-time-us = <140>;
>> + continuous-shunt-conv-time-us = <140>;
>> + enable-power-monitor;
>> +
>> + #io-channel-cells = <1>;
>> +
>> + channel0 {
>> + label = "VDD_MUX";
>> + shunt-resistor-mohm = <20>;
>> + };
>> +
>> + channel1 {
>> + label = "VDD_5V_IO_SYS";
>> + shunt-resistor-mohm = <5>;
>> + warning-current-limit-microamp = <8190000>;
>> + critical-current-limit-microamp = <1000000>;
>> + };
>> +
>> + channel2 {
>> + label = "VDD_3V3_SYS";
>> + shunt-resistor-mohm = <10>;
>> + };
>> + };
>> +};
>> --
>> 2.1.4
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2016-06-03 10:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 12:34 [PATCH 1/3] iio: adc: ina3221: Add DT binding details Laxman Dewangan
2016-06-01 12:34 ` [PATCH 2/3] iio: adc: ina3221: Add support for IIO ADC driver for TI INA3221 Laxman Dewangan
2016-06-03 10:06 ` Jonathan Cameron
2016-06-03 10:16 ` Jonathan Cameron
2016-06-03 11:31 ` Laxman Dewangan
[not found] ` <57516A74.4060008-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-03 12:04 ` Jonathan Cameron
[not found] ` <42c00dfb-bb45-405c-a1d2-516ece137826-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-06-03 12:03 ` Laxman Dewangan
[not found] ` <44e28639-67b6-7586-5e6d-c0180ccded79-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-06-03 11:26 ` Laxman Dewangan
2016-06-03 12:09 ` Jonathan Cameron
2016-06-03 12:17 ` Laxman Dewangan
2016-06-03 13:29 ` Guenter Roeck
2016-06-03 14:14 ` Laxman Dewangan
2016-06-03 15:17 ` Andrew F. Davis
2016-06-07 22:30 ` Guenter Roeck
2016-06-08 15:04 ` Andrew F. Davis
2016-06-08 15:37 ` Laxman Dewangan
2016-06-01 12:34 ` [PATCH 3/3] iio: adc: ina3221: Add sysfs details " Laxman Dewangan
2016-06-03 10:26 ` Jonathan Cameron
[not found] ` <1464784454-7988-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-03 2:07 ` [PATCH 1/3] iio: adc: ina3221: Add DT binding details Rob Herring
2016-06-03 9:02 ` Laxman Dewangan
2016-06-03 10:19 ` Jonathan Cameron [this message]
2016-06-03 11:48 ` Laxman Dewangan
2016-06-03 12:11 ` Jonathan Cameron
2016-06-03 12:21 ` Laxman Dewangan
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=433b182c-fe43-df5c-ac6a-20a024630514@kernel.org \
--to=jic23-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=corbet-T1hC0tSOHrs@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).