linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Michal Simek <michal.simek@xilinx.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	mtitinger@baylibre.com, Kevin Hilman <khilman@baylibre.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	narmstrong@baylibre.com
Subject: Re: ina226 as IIO device instead of HWMON
Date: Fri, 9 Aug 2019 15:42:00 +0200	[thread overview]
Message-ID: <7405c36a-797e-d25f-1a70-19f4a0b1de04@xilinx.com> (raw)
In-Reply-To: <a3760f34-02a3-a6ee-6b97-2705612aa735@roeck-us.net>

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


  reply	other threads:[~2019-08-09 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 10:37 ina226 as IIO device instead of HWMON Michal Simek
2019-08-09 13:02 ` Guenter Roeck
2019-08-09 13:42   ` Michal Simek [this message]
2019-08-09 14:54     ` Guenter Roeck
2019-08-12 11:28       ` Michal Simek

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=7405c36a-797e-d25f-1a70-19f4a0b1de04@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=khilman@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mtitinger@baylibre.com \
    --cc=narmstrong@baylibre.com \
    /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).