Re: [PATCH] hwmon: (ina3221) Add averaging mode support

From: Nicolin Chen
Date: Tue Mar 12 2019 - 18:52:44 EST


On Tue, Mar 12, 2019 at 03:37:59PM -0700, Guenter Roeck wrote:
> > +average Averaging mode. Supports the list of number of samples:
> > + 1, 4, 16, 64, 128, 256, 512, 1024
>
> This is the number of samples, so I think "samples" would be a better
> attribute name. This would also avoid confusion with other _average
> attributes.
>
> I'll need to check with other chips if this is the best approach and
> name for the attribute, especially to see if it should be chip-wide
> or per sensor.

Will wait for that then. Another thing is that the conversion times
are also configurable. And I plan to use the update_interval in the
ABI once this average is added. This means that average value will
be changed via this 'average' node (or other name), and conversion
times will be changed via the 'update_interval' node by following
the formula: update_interval = channels * (vbus_ct + vsh_ct) * avg

> > + for (i = 0; i < ARRAY_SIZE(ina3221_avg); i++)
> > + if (ina3221_avg[i] == avg)
> > + break;
>
> Please use find_closest().

OK. Thanks