diff mbox

[1/4] Documentation: dt-bindings: iio: Add max961x

Message ID 1487948756-25172-2-git-send-email-jacopo+renesas@jmondi.org (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Jacopo Mondi Feb. 24, 2017, 3:05 p.m. UTC
Add device tree bindings documentation for Maxim max961x current sense
amplifier.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 .../devicetree/bindings/iio/adc/max961x.txt        | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/max961x.txt

Comments

Geert Uytterhoeven Feb. 24, 2017, 3:22 p.m. UTC | #1
On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
> @@ -0,0 +1,27 @@
> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
> +
> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
> +12-bits ADC communicating over I2c bus.
> +The device node for this driver shall be a child of a I2c controller.
> +
> +Required properties
> +  - compatible: Should be "maxim,max961x"
> +  - reg: The 7-bits long I2c address of the device
> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
> +                   resistor.

shunt-resistor-micro-ohms?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Geert Uytterhoeven Feb. 24, 2017, 3:29 p.m. UTC | #2
Hi Jacopo,

[fixed Peter Meerwald's address]

On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
> Add device tree bindings documentation for Maxim max961x current sense
> amplifier.
>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  .../devicetree/bindings/iio/adc/max961x.txt        | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/adc/max961x.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/max961x.txt b/Documentation/devicetree/bindings/iio/adc/max961x.txt
> new file mode 100644
> index 0000000..abbc6c4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
> @@ -0,0 +1,27 @@
> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
> +
> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
> +12-bits ADC communicating over I2c bus.
> +The device node for this driver shall be a child of a I2c controller.
> +
> +Required properties
> +  - compatible: Should be "maxim,max961x"

I'ts not a good idea to use wildcards in compatible values.
Ask yourself: is this valid for any (future) value of "x"?

Hence please use "maxim,max9611" or "maxim,max9612".
The only difference between these two is a noninverting vs. inverting
input-to-output configuration. Does the driver need to care?

> +  - reg: The 7-bits long I2c address of the device
> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
> +                   resistor.

shunt-resistor-micro-ohms?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Lars-Peter Clausen Feb. 24, 2017, 3:33 p.m. UTC | #3
On 02/24/2017 04:22 PM, Geert Uytterhoeven wrote:
> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>> @@ -0,0 +1,27 @@
>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>> +
>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>> +12-bits ADC communicating over I2c bus.
>> +The device node for this driver shall be a child of a I2c controller.
>> +
>> +Required properties
>> +  - compatible: Should be "maxim,max961x"
>> +  - reg: The 7-bits long I2c address of the device
>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>> +                   resistor.
> 
> shunt-resistor-micro-ohms?

I'll take this one further:

maxim,shunt-resistor-micro-ohms?

Although there is precedence for just 'shunt-resistor' in the ina2xx bindings.
Jacopo Mondi Feb. 24, 2017, 3:48 p.m. UTC | #4
Hi Lars-Peter,

On 24/02/2017 16:33, Lars-Peter Clausen wrote:
> On 02/24/2017 04:22 PM, Geert Uytterhoeven wrote:
>> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>>> @@ -0,0 +1,27 @@
>>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>>> +
>>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>>> +12-bits ADC communicating over I2c bus.
>>> +The device node for this driver shall be a child of a I2c controller.
>>> +
>>> +Required properties
>>> +  - compatible: Should be "maxim,max961x"
>>> +  - reg: The 7-bits long I2c address of the device
>>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>>> +                   resistor.
>>
>> shunt-resistor-micro-ohms?
>
> I'll take this one further:
>
> maxim,shunt-resistor-micro-ohms?
>
> Although there is precedence for just 'shunt-resistor' in the ina2xx bindings.
>

And that's where I took "inspiration" from :)
Jacopo Mondi Feb. 24, 2017, 3:50 p.m. UTC | #5
Hi Geert,

On 24/02/2017 16:29, Geert Uytterhoeven wrote:
> Hi Jacopo,
>
> [fixed Peter Meerwald's address]
>
> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>> Add device tree bindings documentation for Maxim max961x current sense
>> amplifier.
>>
>> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
>> ---
>>  .../devicetree/bindings/iio/adc/max961x.txt        | 27 ++++++++++++++++++++++
>>  1 file changed, 27 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/iio/adc/max961x.txt
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/max961x.txt b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>> new file mode 100644
>> index 0000000..abbc6c4
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>> @@ -0,0 +1,27 @@
>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>> +
>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>> +12-bits ADC communicating over I2c bus.
>> +The device node for this driver shall be a child of a I2c controller.
>> +
>> +Required properties
>> +  - compatible: Should be "maxim,max961x"
>
> I'ts not a good idea to use wildcards in compatible values.
> Ask yourself: is this valid for any (future) value of "x"?
>

I suspect you already know the answer here :)

> Hence please use "maxim,max9611" or "maxim,max9612".
> The only difference between these two is a noninverting vs. inverting
> input-to-output configuration. Does the driver need to care?

No, not right now, as the inverting/non-inverting output is on the 
op-amp/comparator side, which is currently not supported by this driver.

Instead of using one or the other, should we use both, as long as it 
does not makes any difference from driver perspective?

Thanks
   j


>
>> +  - reg: The 7-bits long I2c address of the device
>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>> +                   resistor.
>
> shunt-resistor-micro-ohms?
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
>
Geert Uytterhoeven Feb. 24, 2017, 3:54 p.m. UTC | #6
Hi Jacopo,

On Fri, Feb 24, 2017 at 4:50 PM, jacopo mondi <jacopo@jmondi.org> wrote:
> On 24/02/2017 16:29, Geert Uytterhoeven wrote:
>> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org>
>> wrote:
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>>> @@ -0,0 +1,27 @@
>>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC
>>> interface
>>> +
>>> +Maxim max9611/max9612 is an high-side current sense amplifier with
>>> integrated
>>> +12-bits ADC communicating over I2c bus.
>>> +The device node for this driver shall be a child of a I2c controller.
>>> +
>>> +Required properties
>>> +  - compatible: Should be "maxim,max961x"
>>
>>
>> I'ts not a good idea to use wildcards in compatible values.
>> Ask yourself: is this valid for any (future) value of "x"?
>
> I suspect you already know the answer here :)
>
>> Hence please use "maxim,max9611" or "maxim,max9612".
>> The only difference between these two is a noninverting vs. inverting
>> input-to-output configuration. Does the driver need to care?
>
> No, not right now, as the inverting/non-inverting output is on the
> op-amp/comparator side, which is currently not supported by this driver.
>
> Instead of using one or the other, should we use both, as long as it does
> not makes any difference from driver perspective?

DT describes the hardware, not current software limitations.
So yes, we want both (in the bindings/drivers, not in the same *.dts file ;-).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Jonathan Cameron Feb. 25, 2017, 3:19 p.m. UTC | #7
On 24/02/17 15:48, jacopo mondi wrote:
> Hi Lars-Peter,
> 
> On 24/02/2017 16:33, Lars-Peter Clausen wrote:
>> On 02/24/2017 04:22 PM, Geert Uytterhoeven wrote:
>>> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>>>> @@ -0,0 +1,27 @@
>>>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>>>> +
>>>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>>>> +12-bits ADC communicating over I2c bus.
>>>> +The device node for this driver shall be a child of a I2c controller.
>>>> +
>>>> +Required properties
>>>> +  - compatible: Should be "maxim,max961x"
>>>> +  - reg: The 7-bits long I2c address of the device
>>>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>>>> +                   resistor.
>>>
>>> shunt-resistor-micro-ohms?
>>
>> I'll take this one further:
>>
>> maxim,shunt-resistor-micro-ohms?
>>
>> Although there is precedence for just 'shunt-resistor' in the ina2xx bindings.
>>
> 
> And that's where I took "inspiration" from :)
Which raises another open question.  Why IIO rather than hwmon like the ina2xx?

cc'd Guenter and hwmon list.

I don't typically have strong opinions on this but best to make sure everyone
is happy.  Always best to layout your thinking on this in the cover letter.

I'll raise it there as well but came to mind when seeing the ina2xx reference
here.

Whether we are better going for the existing binding without units, or
'fixing' that is a question for the device tree maintainers.  I guess that
one snuck through.

Jonathan
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Feb. 25, 2017, 3:34 p.m. UTC | #8
Hi Jonathan,

On Sat, Feb 25, 2017 at 4:19 PM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 24/02/17 15:48, jacopo mondi wrote:
>> On 24/02/2017 16:33, Lars-Peter Clausen wrote:
>>> On 02/24/2017 04:22 PM, Geert Uytterhoeven wrote:
>>>> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>>>>> @@ -0,0 +1,27 @@
>>>>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>>>>> +
>>>>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>>>>> +12-bits ADC communicating over I2c bus.
>>>>> +The device node for this driver shall be a child of a I2c controller.
>>>>> +
>>>>> +Required properties
>>>>> +  - compatible: Should be "maxim,max961x"
>>>>> +  - reg: The 7-bits long I2c address of the device
>>>>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>>>>> +                   resistor.
>>>>
>>>> shunt-resistor-micro-ohms?
>>>
>>> I'll take this one further:
>>>
>>> maxim,shunt-resistor-micro-ohms?
>>>
>>> Although there is precedence for just 'shunt-resistor' in the ina2xx bindings.
>>>
>>
>> And that's where I took "inspiration" from :)
> Which raises another open question.  Why IIO rather than hwmon like the ina2xx?

Actually we have both drivers/hwmon/ina2xx.c and drivers/iio/adc/ina2xx-adc.c.

> Whether we are better going for the existing binding without units, or
> 'fixing' that is a question for the device tree maintainers.  I guess that
> one snuck through.

ltc4151 uses shunt-resistor-micro-ohms.
sgtl5000 uses micbias-resistor-k-ohms.

So there's precedence for everything ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Jonathan Cameron Feb. 25, 2017, 3:56 p.m. UTC | #9
On 25/02/17 15:34, Geert Uytterhoeven wrote:
> Hi Jonathan,
> 
> On Sat, Feb 25, 2017 at 4:19 PM, Jonathan Cameron <jic23@kernel.org> wrote:
>> On 24/02/17 15:48, jacopo mondi wrote:
>>> On 24/02/2017 16:33, Lars-Peter Clausen wrote:
>>>> On 02/24/2017 04:22 PM, Geert Uytterhoeven wrote:
>>>>> On Fri, Feb 24, 2017 at 4:05 PM, Jacopo Mondi <jacopo+renesas@jmondi.org> wrote:
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
>>>>>> @@ -0,0 +1,27 @@
>>>>>> +* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
>>>>>> +
>>>>>> +Maxim max9611/max9612 is an high-side current sense amplifier with integrated
>>>>>> +12-bits ADC communicating over I2c bus.
>>>>>> +The device node for this driver shall be a child of a I2c controller.
>>>>>> +
>>>>>> +Required properties
>>>>>> +  - compatible: Should be "maxim,max961x"
>>>>>> +  - reg: The 7-bits long I2c address of the device
>>>>>> +  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
>>>>>> +                   resistor.
>>>>>
>>>>> shunt-resistor-micro-ohms?
>>>>
>>>> I'll take this one further:
>>>>
>>>> maxim,shunt-resistor-micro-ohms?
>>>>
>>>> Although there is precedence for just 'shunt-resistor' in the ina2xx bindings.
>>>>
>>>
>>> And that's where I took "inspiration" from :)
>> Which raises another open question.  Why IIO rather than hwmon like the ina2xx?
> 
> Actually we have both drivers/hwmon/ina2xx.c and drivers/iio/adc/ina2xx-adc.c.
Oops,. I'd forgotten about that.

Need that discussion to happen though before I take it into IIO though.
> 
>> Whether we are better going for the existing binding without units, or
>> 'fixing' that is a question for the device tree maintainers.  I guess that
>> one snuck through.
> 
> ltc4151 uses shunt-resistor-micro-ohms.
> sgtl5000 uses micbias-resistor-k-ohms.
> 
> So there's precedence for everything ;-)
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/max961x.txt b/Documentation/devicetree/bindings/iio/adc/max961x.txt
new file mode 100644
index 0000000..abbc6c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/max961x.txt
@@ -0,0 +1,27 @@ 
+* Maxim max9611/max9612 current sense amplifier with 12-bits ADC interface
+
+Maxim max9611/max9612 is an high-side current sense amplifier with integrated
+12-bits ADC communicating over I2c bus.
+The device node for this driver shall be a child of a I2c controller.
+
+Required properties
+  - compatible: Should be "maxim,max961x"
+  - reg: The 7-bits long I2c address of the device
+  - shunt-resistor: Resistor value, in uOhm, of the current sense shunt
+		    resistor.
+
+Example:
+
+&i2c4 {
+	csa: max9611@7c {
+		compatible = "maxim,max961x";
+		reg = <0x7c>;
+
+		shunt-resistor = <5000>;
+	};
+};
+
+This device node describes a current sense amplifier sitting on I2c4 bus
+with address 0x7c (read address is 0xf9, write address is 0xf8).
+A sense resistor with 0,005 Ohm is installed between RS+ and RS-
+current-sensing inputs.