ARM: tegra: ardbeg: powermon: set ina230 avg value
Jon McCaffrey [Wed, 25 Sep 2013 19:30:08 +0000 (12:30 -0700)]
Sets a value for the avg field of the ina230 config.  This will take 128
samples per-reading.  With the default conversion time of 140us, this
works out to ~18ms per-reading, which is a long time, but works well for
anti-aliasing power measurements for changes in power consumption over
graphics frames (~16ms).

Change-Id: I81f2a40dbae3f70e2fb24538d5a01b5c7c17ac24
Signed-off-by: Jon McCaffrey <jmccaffrey@nvidia.com>
Reviewed-on: http://git-master/r/299577
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

arch/arm/mach-tegra/board-ardbeg-powermon.c
arch/arm/mach-tegra/board-laguna-powermon.c
arch/arm/mach-tegra/board-macallan-powermon.c
arch/arm/mach-tegra/board-pluto-powermon.c

index 06c3934..5e88195 100644 (file)
 #define VDD_CPU_BUCKCPU_REWORKED       10
 #define VDD_1V35_SD2_REWORKED          10
 
+#define AVG_32_SAMPLES (4 << 9)
+
+/* AVG is specified from platform data */
+#define INA230_CONT_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                               INA230_VSH_CT | INA230_CONT_MODE)
+#define INA230_TRIG_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                               INA230_VSH_CT | INA230_TRIG_MODE)
+
 /* unused rail */
 enum {
        UNUSED_RAIL,
@@ -104,6 +112,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x1366,
                .power_lsb = 2.577527185 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BAT",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -112,6 +122,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.078127384 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_RTC_LDO5",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -120,6 +132,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x4759,
                .power_lsb = 1.401587736 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_3V3A_SMPS1_2",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -128,6 +142,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 3.906369213 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SOC_SMPS1_2",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -136,6 +152,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x1AC5,
                .power_lsb = 1.867795126 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BUCKCPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -144,6 +162,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2ECF,
                .power_lsb = 10.68179922 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_CPU_BUCKCPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -152,6 +172,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x5BA7,
                .power_lsb = 0.545539786 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V8A_SMPS3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -160,6 +182,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x50B4,
                .power_lsb = 0.309777348 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V8B_SMPS9",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -168,6 +192,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x369C,
                .power_lsb = 9.155937053 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_GPU_BUCKGPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -176,6 +202,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 3.906369213 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V35_SMPS6",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -185,6 +213,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x4759,
                .power_lsb = 1.401587736 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "unused_rail",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -193,6 +223,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x3269,
                .power_lsb = 0.198372724 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_3V3B_SMPS9",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -201,6 +233,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.039063692 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_LCD_1V8B_DIS",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -209,6 +243,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.130212307 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V05_SMPS8",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -219,6 +255,8 @@ static struct ina230_platform_data power_mon_info_2[] = {
                .calibration_data  = 0x1A29,
                .power_lsb = 0.63710119 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BL",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -227,6 +265,8 @@ static struct ina230_platform_data power_mon_info_2[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.390636921 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "AVDD_1V05_LDO2",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
        },
@@ -238,6 +278,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x1366,
                .power_lsb = 2.577527185 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BAT",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -247,6 +289,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.078127384 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_RTC_LDO3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 50,
@@ -256,6 +300,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x1AAC,
                .power_lsb = 0.624877954 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BUCKSOC",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 30,
@@ -265,6 +311,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 3.906369213 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SOC_SD1",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 1,
@@ -274,6 +322,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x1AC5,
                .power_lsb = 1.867795126 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BUCKCPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -283,6 +333,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x2ECF,
                .power_lsb = 10.68179922 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_CPU_BUCKCPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 1,
@@ -292,6 +344,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x45F0,
                .power_lsb = 0.714924039 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V8_SD5",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -301,6 +355,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x3A83,
                .power_lsb = 0.042726484 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_3V3A_LDO1_6",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 200,
@@ -310,6 +366,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.390636921 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_DIS_3V3_LCD",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -319,6 +377,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 3.906369213 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V35_SD2",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 1,
@@ -328,6 +388,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x1F38,
                .power_lsb = 1.601601602 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BUCKGPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -337,6 +399,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.039063692 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_LCD_1V8B_DIS",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 100,
@@ -346,6 +410,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_1[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.130212307 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V05_LDO0",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 30,
@@ -357,6 +423,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_2[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.390636921 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V05_SD4",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 10,
@@ -366,6 +434,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_2[] = {
                .calibration_data  = 0x5A04,
                .power_lsb = 0.277729561 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_1V8A_LDO2_5_7",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 20,
@@ -375,6 +445,8 @@ static struct ina230_platform_data ardbeg_A01_power_mon_info_2[] = {
                .calibration_data  = 0x2468,
                .power_lsb = 0.274678112 * PRECISION_MULTIPLIER_ARDBEG,
                .rail_name = "VDD_SYS_BL",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_ARDBEG,
                .resistor = 50,
index 396e9a4..9e970db 100644 (file)
 
 #define PRECISION_MULTIPLIER_LAGUNA    1000
 
+#define AVG_32_SAMPLES (4 << 9)
+
+/* AVG is specified from platform data */
+#define INA230_CONT_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                               INA230_VSH_CT | INA230_CONT_MODE)
+#define INA230_TRIG_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                                INA230_VSH_CT | INA230_TRIG_MODE)
+
 enum {
        VDD_MUX,
        VDD_CPU,
@@ -49,6 +57,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 3.63304501 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDD_MUX",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -56,6 +66,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x3E6A,
                .power_lsb = 16.02172852 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDD_CPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -63,6 +75,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.550446687 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDDIO_DDR_AP_1V35",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -70,6 +84,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x369D,
                .power_lsb = 4.577636719 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDD_CORE",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -77,6 +93,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.053405762 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "COM_1V8",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -84,6 +102,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.762939453 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDDIO_DDR_1V35",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -91,6 +111,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.356038411 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "AVDDIO_PEX_AP_1V05",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -98,6 +120,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.027743253 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "PEX_PLL_AP_3V3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -105,6 +129,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.023119377 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDD_USB_AP_3V3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -112,6 +138,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x4EF5,
                .power_lsb = 6.332397461 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDD_GPU",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -119,6 +147,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.003467907 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "HVDD_SATA_AP_3V3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -126,6 +156,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.023312039 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDDIO_SYS_AP_1V8",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -133,6 +165,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.002288818 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "VDDIO_BB_AP",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -140,6 +174,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.007629395 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "AVDD_LVDS_AP_1V05",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
@@ -147,6 +183,8 @@ static struct ina230_platform_data laguna_pm358_power_mon_info[] = {
                .calibration_data  = 0x7FFF,
                .power_lsb = 0.070514101 * PRECISION_MULTIPLIER_LAGUNA,
                .rail_name = "AVDD_HDMI_AP_3V3",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_LAGUNA,
        },
index 738c374..d3c7175 100644 (file)
 
 #define PRECISION_MULTIPLIER_MACALLAN 1000
 
+#define AVG_32_SAMPLES (4 << 9)
+
+/* AVG is specified from platform data */
+#define INA230_CONT_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                               INA230_VSH_CT | INA230_CONT_MODE)
+#define INA230_TRIG_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                                INA230_VSH_CT | INA230_TRIG_MODE)
+
 enum {
        VD_CPU,
        VD_SOC,
@@ -231,6 +239,8 @@ static struct ina230_platform_data power_mon_ina230_info[] = {
                .calibration_data  = 0x20c4,
                .power_lsb = 3.051757813 * PRECISION_MULTIPLIER_MACALLAN,
                .rail_name = "VDD_CELL",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .resistor = 5,
                .min_cores_online = 2,
                .divisor = 25,
index 06b984d..f3d90d9 100644 (file)
  */
 #define PLUTO_POWER_REWORKED_CONFIG    0x10
 
+#define AVG_32_SAMPLES (4 << 9)
+
+/* AVG is specified from platform data */
+#define INA230_CONT_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                               INA230_VSH_CT | INA230_CONT_MODE)
+#define INA230_TRIG_CONFIG     (AVG_32_SAMPLES | INA230_VBUS_CT | \
+                                INA230_VSH_CT | INA230_TRIG_MODE)
+
 enum {
        UNUSED_RAIL,
 };
@@ -75,6 +83,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x369c,
                .power_lsb = 3.051979018 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SUM",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -83,6 +93,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2bb0,
                .power_lsb = 2.288984263 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SMPS123",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -91,6 +103,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x4188,
                .power_lsb = 1.525989509 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SMPS45",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -99,6 +113,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2bb0,
                .power_lsb = 0.381497377 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SMPS6",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -107,6 +123,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2bb0,
                .power_lsb = 0.228898426  * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SMPS7",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .resistor = 50,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
@@ -116,6 +134,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2bb0,
                .power_lsb = 0.228898426 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_SMPS8",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -124,6 +144,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x4188,
                .power_lsb = 0.152598951 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_BL",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -132,6 +154,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2d82,
                .power_lsb = 0.054935622 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_SYS_LDO8",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -140,6 +164,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x51ea,
                .power_lsb = 0.03051979 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_MMC_LDO9",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -148,6 +174,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x2f7d,
                .power_lsb = 0.052644567 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_5V0_LDOUSB",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -156,6 +184,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x4feb,
                .power_lsb = 0.125128305 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_1V8_AP",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -164,6 +194,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x346d,
                .power_lsb = 0.047686462 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDD_MMC_LCD",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -172,6 +204,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x6d39,
                .power_lsb = 0.00915561 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDDIO_HSIC_BB",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -180,6 +214,8 @@ static struct ina230_platform_data power_mon_info_1[] = {
                .calibration_data  = 0x7fff,
                .power_lsb = 0.007812738 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "AVDD_PLL_BB",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -190,6 +226,8 @@ static struct ina230_platform_data power_mon_info_2[] = {
                .calibration_data  = 0x7fff,
                .power_lsb = 0.195318461 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "AVDD_1V05_LDO1",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },
@@ -198,6 +236,8 @@ static struct ina230_platform_data power_mon_info_2[] = {
                .calibration_data  = 0x7fff,
                .power_lsb = 0.078127384 * PRECISION_MULTIPLIER_PLUTO,
                .rail_name = "VDDIO_1V8_BB",
+               .trig_conf = INA230_TRIG_CONFIG,
+               .cont_conf = INA230_CONT_CONFIG,
                .divisor = 25,
                .precision_multiplier = PRECISION_MULTIPLIER_PLUTO,
        },