iio: meter: ina3221: support to offset shunt volt
authorRajkumar Kasirajan <rkasirajan@nvidia.com>
Mon, 23 Nov 2015 10:29:50 +0000 (18:29 +0800)
committermobile promotions <svcmobile_promotions@nvidia.com>
Wed, 16 Dec 2015 17:34:15 +0000 (09:34 -0800)
commitd7eab1e38039796d0958e0ee2d1c6c18c8be101e
tree6ac084140c3079be195c5d9ad5bc6660c7066d46
parent7f110dc1c1b69e6e6ffa4960da2b1c1839db7bb8
iio: meter: ina3221: support to offset shunt volt

added support to offset shunt voltage reading to hangle INA
channel inaccuracy on high voltage rails.

example:
    p2180_shuntv_offset: shuntv-offset {
        offset = <40>;
        conditional_offset@0 {
            shunt_volt_start = <40>;
            shunt_volt_end = <120>;
            offset = <33>;
        };
    conditional_offset@1 {
            shunt_volt_start = <200>;
            shunt_volt_end = <400>;
            offset = <80>;
        };
};

channel@0 {
reg = <0x0>;
ti,rail-name = "VDD_IN";
ti,shunt-resistor-mohm = <20>;
ti,current-critical-limit-ma = <2105>;
shunt-volt-offset-uv = <&p2180_shuntv_offset>;
};

which means,
 if shunt voltage reading is  from 40 to 120, offset -33 will be applied
 if shunt voltage reading is  from 200 to 400, offset -80 will be applied
 for all other readings offset -40 will be applied.

Bug 1677375

Change-Id: I67c12a6b105011a0a8ca2aae2c5764df6e21ce8b
Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-on: http://git-master/r/836475
(cherry picked from commit e1613a0534cc372160090e9e60b52349ffee9ade)
Reviewed-on: http://git-master/r/923383
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Documentation/devicetree/bindings/iio/meter/ina3221.txt
drivers/staging/iio/meter/ina3221.c