Re: ina226 as IIO device instead of HWMON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09. 08. 19 15:02, Guenter Roeck wrote:
> Hi Michal,
> 
> On 8/9/19 3:37 AM, Michal Simek wrote:
>> Hi,
>>
>> we are dealing with one issue with ina226 on xilinx platform when hwmon
>> driver is used. We have board for battery monitoring with shunt resistor
>> setup to 10 Ohm which is out of config value in hwmon driver. I have
> 
> Took me a while to understand that you mean 10 Ohm, not mOhm.

yes.

> Well, yes, that is a bit large. I'd be open to accept a patch fixing that,
> though I don't immediately know how to update the devicetree property (and,
> unless I am missing something, the iio driver has the same problem).

There is shunt-resistor property in uOhm that's why 10 Ohm is like this
shunt-resistor = <10000000>;

> 
>> temporary code to workaround this but I have also found that ina226 is
>> supported via iio framework. I have seen that Baylibre was trying to add
>> generic iio support to sigrok.
>> http://wiki.baylibre.com/doku.php?id=acme:oldstart
>>
>> I expect you wanted to use sigrok also for ina226.
>>
>> Anyway my question is if there is any standard tool which is capable to
>> calculate and show information from iio ina226 chip which is can be used
>> instead of lm-sensors and hwmon driver.
>>
>> I would expect that iio-hwmon could be also used but didn't try that yet
>> with ina226 chip.
>>
> 
> I don't immediately see why iio-hwmon couldn't be used. Also, if you don't
> use the ina226 as hardware monitoring device, iio would be a more
> appropriate
> solution anyway.

I have tried this and found that IIO_POWER is not exported via iio-hwmon
driver.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
/tree/drivers/hwmon/iio_hwmon.c?h=next-20190809#n104

It is easy to add because ina226 iio export power via channel 2

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/iio/adc/ina2xx-adc.c?h=next-20190809#n690

Also dt description is easy to add. + iio-channels = <1>; to ina226 dt node.
       iio-hwmon {
               compatible = "iio-hwmon";
               io-channels = <&ps_pmbus 1>, <&ps_pmbus 2>, <&ps_pmbus 3>;
       };

> 
> FWIW, we should actually remove the in22xx hwmon driver at some point and
> ask users to use the iio driver combined with the iio-hwmon bridge instead
> (after making sure that the iio driver combined with the iio-hwmon bridge
> provides the same functionality).

The functionality is likely the same but I would expect that with this
new driver we should get something more. Especially that sigrok
connection looks interesting.
In our system we have SoC which have a lot of ina226 which monitors the
second SoC and would be nice to get precise information or graphs out of
it via standard user space tools or directly to web page.

Thanks,
Michal




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux