All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Ina219 with linux kernel driver
@ 2014-04-08 13:29 Pierre Kancir
  2014-04-08 13:50 ` Guenter Roeck
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Pierre Kancir @ 2014-04-08 13:29 UTC (permalink / raw)
  To: lm-sensors

Hi,

I am trying to use ina219 sensor (http://www.adafruit.com/products/904)
with linux kernel driver on beaglebone black.

I want to use device tree overlay to use the sensor. I follow kernel
indications (
http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/i2c/ina2xx.txt)
and the sensor works as expected.

But adafruit board use 0.1ohms and default driver value for shunt-resistor
is 10mOhms so return value are wrong.

I want to modify value in device tree as indicated

ina219@40 {
          compatible = "ti,ina219";
          reg = <0x40>;
          shunt-resistor = <100000>;
 };

but changing shunt-resistor value does nothing. The sensor is always create
with 10mOhms value

ina2xx 1-0040: power monitor ina219 (Rshunt = 10000 uOhm)

How can i change the shunt-resistor value to get the proper return?

thanks,

Pierre
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Ina219 with linux kernel driver
  2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
@ 2014-04-08 13:50 ` Guenter Roeck
  2014-04-08 14:13 ` Pierre Kancir
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-04-08 13:50 UTC (permalink / raw)
  To: lm-sensors

On 04/08/2014 06:29 AM, Pierre Kancir wrote:
> Hi,
>
> I am trying to use ina219 sensor (http://www.adafruit.com/products/904)
> with linux kernel driver on beaglebone black.
>
> I want to use device tree overlay to use the sensor. I follow kernel
> indications (
> http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/i2c/ina2xx.txt)
> and the sensor works as expected.
>
> But adafruit board use 0.1ohms and default driver value for shunt-resistor
> is 10mOhms so return value are wrong.
>
> I want to modify value in device tree as indicated
>
> ina219@40 {
>            compatible = "ti,ina219";
>            reg = <0x40>;
>            shunt-resistor = <100000>;
>   };
>
> but changing shunt-resistor value does nothing. The sensor is always create
> with 10mOhms value
>
> ina2xx 1-0040: power monitor ina219 (Rshunt = 10000 uOhm)
>
> How can i change the shunt-resistor value to get the proper return?
>

Good question. This functionality was added mid-2013. What is your kernel version ?

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Ina219 with linux kernel driver
  2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
  2014-04-08 13:50 ` Guenter Roeck
@ 2014-04-08 14:13 ` Pierre Kancir
  2014-04-08 15:08 ` Guenter Roeck
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Pierre Kancir @ 2014-04-08 14:13 UTC (permalink / raw)
  To: lm-sensors

Hi,

I am using beaglebone black default kernel, here is its informations :
Linux arm 3.8.13-bone40 #1 SMP Fri Jan 31 10:36:05 UTC 2014 armv7l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.10
DISTRIB_CODENAME=saucy
DISTRIB_DESCRIPTION="Ubuntu 13.10"

I modify devicetree as follow : in /boot/dtbs/

# generate the dts from the dtb
dtc -I dtb -O dts -o am335x-boneblack.dts am335x-boneblack.dtb

# modify the dts with a text editor  :

i add after cape_eeprom3@57 ( in i2c3 lines i2c@4819c000)

ina219@40 {
          compatible = "ti,ina219";
          reg = <0x40>;
          shunt-resistor = <100000>;
 };

# generate the dtb from the modified dts
dtc -I dts -O dtb -o am335x-boneblack.dtb am335x-boneblack.dts

#reboot the beaglebone black to load the new device tree

#use sensors
ubuntu@arm:~$ sensors
am335x-bandgap-isa-0000
Adapter: ISA adapter
temp1:        +53.0°C

ina219-i2c-1-40
Adapter: OMAP I2C adapter
in0:          +0.03 V
in1:          +4.94 V
power1:       12.74 W <- wrong value since not the good shunt resistor
value...
curr1:        +2.56 A  <- wrong value since not the good shunt resistor
value..



 *Kancir Pierre*
pierre.kancir@gmail.com
LinkedIn <http://www.linkedin.com/pub/pierre-kancir/4b/a1a/32a> |
Viadeo<http://www.viadeo.com/fr/profile/pierre.kancir>


2014-04-08 15:50 GMT+02:00 Guenter Roeck <linux@roeck-us.net>:

> On 04/08/2014 06:29 AM, Pierre Kancir wrote:
>
>> Hi,
>>
>> I am trying to use ina219 sensor (http://www.adafruit.com/products/904)
>> with linux kernel driver on beaglebone black.
>>
>> I want to use device tree overlay to use the sensor. I follow kernel
>> indications (
>> http://lxr.free-electrons.com/source/Documentation/
>> devicetree/bindings/i2c/ina2xx.txt)
>> and the sensor works as expected.
>>
>> But adafruit board use 0.1ohms and default driver value for shunt-resistor
>> is 10mOhms so return value are wrong.
>>
>> I want to modify value in device tree as indicated
>>
>> ina219@40 {
>>            compatible = "ti,ina219";
>>            reg = <0x40>;
>>            shunt-resistor = <100000>;
>>   };
>>
>> but changing shunt-resistor value does nothing. The sensor is always
>> create
>> with 10mOhms value
>>
>> ina2xx 1-0040: power monitor ina219 (Rshunt = 10000 uOhm)
>>
>> How can i change the shunt-resistor value to get the proper return?
>>
>>
> Good question. This functionality was added mid-2013. What is your kernel
> version ?
>
> Guenter
>
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Ina219 with linux kernel driver
  2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
  2014-04-08 13:50 ` Guenter Roeck
  2014-04-08 14:13 ` Pierre Kancir
@ 2014-04-08 15:08 ` Guenter Roeck
  2014-04-08 15:57 ` Pierre Kancir
  2014-04-08 16:00 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-04-08 15:08 UTC (permalink / raw)
  To: lm-sensors

On Tue, Apr 08, 2014 at 04:13:00PM +0200, Pierre Kancir wrote:
> Hi,
> 
> I am using beaglebone black default kernel, here is its informations :
> Linux arm 3.8.13-bone40 #1 SMP Fri Jan 31 10:36:05 UTC 2014 armv7l
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE\x13.10
> DISTRIB_CODENAME=saucy
> DISTRIB_DESCRIPTION="Ubuntu 13.10"
> 
Devicetree support was only added to the ina2xx driver with
kernel version 3.11. You would have to back-port commit 31e7ad7
into your kernel to get it.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Ina219 with linux kernel driver
  2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
                   ` (2 preceding siblings ...)
  2014-04-08 15:08 ` Guenter Roeck
@ 2014-04-08 15:57 ` Pierre Kancir
  2014-04-08 16:00 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Pierre Kancir @ 2014-04-08 15:57 UTC (permalink / raw)
  To: lm-sensors

ok! thank you!

Is there another way to use ina2xx driver without devicetree?


 *Kancir Pierre*
pierre.kancir@gmail.com
LinkedIn <http://www.linkedin.com/pub/pierre-kancir/4b/a1a/32a> |
Viadeo<http://www.viadeo.com/fr/profile/pierre.kancir>


2014-04-08 17:08 GMT+02:00 Guenter Roeck <linux@roeck-us.net>:

> On Tue, Apr 08, 2014 at 04:13:00PM +0200, Pierre Kancir wrote:
> > Hi,
> >
> > I am using beaglebone black default kernel, here is its informations :
> > Linux arm 3.8.13-bone40 #1 SMP Fri Jan 31 10:36:05 UTC 2014 armv7l
> > DISTRIB_ID=Ubuntu
> > DISTRIB_RELEASE\x13.10
> > DISTRIB_CODENAME=saucy
> > DISTRIB_DESCRIPTION="Ubuntu 13.10"
> >
> Devicetree support was only added to the ina2xx driver with
> kernel version 3.11. You would have to back-port commit 31e7ad7
> into your kernel to get it.
>
> Guenter
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Ina219 with linux kernel driver
  2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
                   ` (3 preceding siblings ...)
  2014-04-08 15:57 ` Pierre Kancir
@ 2014-04-08 16:00 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-04-08 16:00 UTC (permalink / raw)
  To: lm-sensors

On Tue, Apr 08, 2014 at 05:57:03PM +0200, Pierre Kancir wrote:
> ok! thank you!
> 
Please don't top-post.

> Is there another way to use ina2xx driver without devicetree?
> 
You should be able to use it as-is and correct the reported values in
the sensors configuration file. Another option would be to provide
the shunt resistor value with platform data. Since that would mean
patching your kernel, it might be easier to back-port the missing patch.

Guenter

> 
>  *Kancir Pierre*
> pierre.kancir@gmail.com
> LinkedIn <http://www.linkedin.com/pub/pierre-kancir/4b/a1a/32a> |
> Viadeo<http://www.viadeo.com/fr/profile/pierre.kancir>
> 
> 
> 2014-04-08 17:08 GMT+02:00 Guenter Roeck <linux@roeck-us.net>:
> 
> > On Tue, Apr 08, 2014 at 04:13:00PM +0200, Pierre Kancir wrote:
> > > Hi,
> > >
> > > I am using beaglebone black default kernel, here is its informations :
> > > Linux arm 3.8.13-bone40 #1 SMP Fri Jan 31 10:36:05 UTC 2014 armv7l
> > > DISTRIB_ID=Ubuntu
> > > DISTRIB_RELEASE\x13.10
> > > DISTRIB_CODENAME=saucy
> > > DISTRIB_DESCRIPTION="Ubuntu 13.10"
> > >
> > Devicetree support was only added to the ina2xx driver with
> > kernel version 3.11. You would have to back-port commit 31e7ad7
> > into your kernel to get it.
> >
> > Guenter
> >

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-08 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-08 13:29 [lm-sensors] Ina219 with linux kernel driver Pierre Kancir
2014-04-08 13:50 ` Guenter Roeck
2014-04-08 14:13 ` Pierre Kancir
2014-04-08 15:08 ` Guenter Roeck
2014-04-08 15:57 ` Pierre Kancir
2014-04-08 16:00 ` Guenter Roeck

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.