diff options
author | Nitin Kumbhar <nkumbhar@nvidia.com> | 2011-10-18 16:08:39 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:28 -0800 |
commit | dc99490d1a30d3dde9cc4bc5af5f9956466dbccc (patch) | |
tree | 140c26dc65aad092b84ffaf0bd3487b6d3318a26 /arch | |
parent | 1f8be3df89d34901aea08aff4a9fa304285f148f (diff) |
arm: tegra: cardhu: update ina monitor for VDD_CORE_IN
for fab A04 of cardhu, VDD_CORE_IN is monitored with ina monitor
present at i2c addr 0x4A. Update platform data to accommodate
this change.
Also, remove hard-coded indexes used in platform data and i2c
board info.
BUG 883788
Reviewed-on: http://git-master/r/58678
(cherry picked from commit 8e1628bc03bd4a1fde574187a017f67b6358c180)
Reviewed-on: http://git-master/r/59309
(cherry picked from commit ab3a20d05dd46483604f61fabfe865476bc448ac)
Change-Id: I48cc76fff912e702e4862014adf19806c58da915
Reviewed-on: http://git-master/r/59316
Tested-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Rebase-Id: R9642d23012d370a536ab72e050de059112d1e7bd
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-powermon.c | 158 |
1 files changed, 115 insertions, 43 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-powermon.c b/arch/arm/mach-tegra/board-cardhu-powermon.c index 219556d708c1..a637b68286a5 100644 --- a/arch/arm/mach-tegra/board-cardhu-powermon.c +++ b/arch/arm/mach-tegra/board-cardhu-powermon.c @@ -20,71 +20,97 @@ #include <linux/i2c.h> #include <linux/ina219.h> + +#include "board.h" #include "board-cardhu.h" +enum { + VDD_AC_BAT, + VDD_DRAM_IN, + VDD_BACKLIGHT_IN, + VDD_CPU_IN, + VDD_CORE_IN, + VDD_DISPLAY_IN, + VDD_3V3_TEGRA, + VDD_OTHER_PMU_IN, + VDD_1V8_TEGRA, + VDD_1V8_OTHER, + UNUSED_RAIL, +}; + static struct ina219_platform_data power_mon_info[] = { - { + [VDD_AC_BAT] = { .calibration_data = 0xa000, .power_lsb = 2, .rail_name = "VDD_AC_BAT", .divisor = 20, }, - { + + [VDD_DRAM_IN] = { .calibration_data = 0xa000, .power_lsb = 2, .rail_name = "VDD_DRAM_IN", .divisor = 20, }, - { + + [VDD_BACKLIGHT_IN] = { .calibration_data = 0x6aaa, .power_lsb = 1, .rail_name = "VDD_BACKLIGHT_IN", .divisor = 20, }, - { + + [VDD_CPU_IN] = { .calibration_data = 0xa000, .power_lsb = 1, .rail_name = "VDD_CPU_IN", .divisor = 20, }, - { + + [VDD_CORE_IN] = { .calibration_data = 0x6aaa, .power_lsb = 1, .rail_name = "VDD_CORE_IN", .divisor = 20, }, - { + + [VDD_DISPLAY_IN] = { .calibration_data = 0x4000, .power_lsb = 1, .rail_name = "VDD_DISPLAY_IN", .divisor = 20, }, - { + + [VDD_3V3_TEGRA] = { .calibration_data = 0x6aaa, .power_lsb = 1, .rail_name = "VDD_3V3_TEGRA", .divisor = 20, }, - { + + [VDD_OTHER_PMU_IN] = { .calibration_data = 0xa000, .power_lsb = 1, .rail_name = "VDD_OTHER_PMU_IN", .divisor = 20, }, - { + + [VDD_1V8_TEGRA] = { .calibration_data = 0x4000, .power_lsb = 1, .rail_name = "VDD_1V8_TEGRA", .divisor = 20, }, - { + + [VDD_1V8_OTHER] = { .calibration_data = 0xa000, .power_lsb = 1, .rail_name = "VDD_1V8_OTHER", .divisor = 20, }, + /* All unused INA219 devices use below data*/ - { + [UNUSED_RAIL] = { .calibration_data = 0x4000, .power_lsb = 1, .rail_name = "unused_rail", @@ -92,91 +118,137 @@ static struct ina219_platform_data power_mon_info[] = { }, }; +enum { + INA_I2C_ADDR_40, + INA_I2C_ADDR_41, + INA_I2C_ADDR_42, + INA_I2C_ADDR_43, + INA_I2C_ADDR_44, + INA_I2C_ADDR_45, + INA_I2C_ADDR_46, + INA_I2C_ADDR_47, + INA_I2C_ADDR_48, + INA_I2C_ADDR_49, + INA_I2C_ADDR_4A, + INA_I2C_ADDR_4B, + INA_I2C_ADDR_4C, + INA_I2C_ADDR_4D, + INA_I2C_ADDR_4E, + INA_I2C_ADDR_4F, +}; + static struct i2c_board_info cardhu_i2c0_ina219_board_info[] = { - { + [INA_I2C_ADDR_40] = { I2C_BOARD_INFO("ina219", 0x40), - .platform_data = &power_mon_info[0], + .platform_data = &power_mon_info[VDD_AC_BAT], .irq = -1, }, - { + + [INA_I2C_ADDR_41] = { I2C_BOARD_INFO("ina219", 0x41), - .platform_data = &power_mon_info[1], + .platform_data = &power_mon_info[VDD_DRAM_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_42] = { I2C_BOARD_INFO("ina219", 0x42), - .platform_data = &power_mon_info[2], + .platform_data = &power_mon_info[VDD_BACKLIGHT_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_43] = { I2C_BOARD_INFO("ina219", 0x43), - .platform_data = &power_mon_info[3], + .platform_data = &power_mon_info[VDD_CPU_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_44] = { I2C_BOARD_INFO("ina219", 0x44), - .platform_data = &power_mon_info[4], + .platform_data = &power_mon_info[VDD_CORE_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_45] = { I2C_BOARD_INFO("ina219", 0x45), - .platform_data = &power_mon_info[5], + .platform_data = &power_mon_info[VDD_DISPLAY_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_46] = { I2C_BOARD_INFO("ina219", 0x46), - .platform_data = &power_mon_info[6], + .platform_data = &power_mon_info[VDD_3V3_TEGRA], .irq = -1, }, - { + + [INA_I2C_ADDR_47] = { I2C_BOARD_INFO("ina219", 0x47), - .platform_data = &power_mon_info[7], + .platform_data = &power_mon_info[VDD_OTHER_PMU_IN], .irq = -1, }, - { + + [INA_I2C_ADDR_48] = { I2C_BOARD_INFO("ina219", 0x48), - .platform_data = &power_mon_info[8], + .platform_data = &power_mon_info[VDD_1V8_TEGRA], .irq = -1, }, - { + + [INA_I2C_ADDR_49] = { I2C_BOARD_INFO("ina219", 0x49), - .platform_data = &power_mon_info[9], + .platform_data = &power_mon_info[VDD_1V8_OTHER], .irq = -1, }, - { + + [INA_I2C_ADDR_4A] = { I2C_BOARD_INFO("ina219", 0x4A), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, - { + + [INA_I2C_ADDR_4B] = { I2C_BOARD_INFO("ina219", 0x4B), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, - { + + [INA_I2C_ADDR_4C] = { I2C_BOARD_INFO("ina219", 0x4C), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, - { + + [INA_I2C_ADDR_4D] = { I2C_BOARD_INFO("ina219", 0x4D), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, - { + + [INA_I2C_ADDR_4E] = { I2C_BOARD_INFO("ina219", 0x4E), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, - { + + [INA_I2C_ADDR_4F] = { I2C_BOARD_INFO("ina219", 0x4F), - .platform_data = &power_mon_info[10], + .platform_data = &power_mon_info[UNUSED_RAIL], .irq = -1, }, }; int __init cardhu_pmon_init(void) { + struct board_info bi; + + tegra_get_board_info(&bi); + + /* for fab A04 VDD_CORE_IN changed from ina with addr 0x44 to 0x4A */ + if (bi.fab == BOARD_FAB_A04) { + cardhu_i2c0_ina219_board_info[INA_I2C_ADDR_44].platform_data = + &power_mon_info[UNUSED_RAIL]; + cardhu_i2c0_ina219_board_info[INA_I2C_ADDR_4A].platform_data = + &power_mon_info[VDD_CORE_IN]; + } + i2c_register_board_info(0, cardhu_i2c0_ina219_board_info, ARRAY_SIZE(cardhu_i2c0_ina219_board_info)); return 0; |