ARM: tegra: tn8: add power monitor devices for P1761
Timo Alho [Mon, 23 Dec 2013 12:18:55 +0000 (14:18 +0200)]
Change-Id: I6d5cf5977cd5497e24f541f539ee3eaa843d890c
Signed-off-by: Timo Alho <talho@nvidia.com>
Reviewed-on: http://git-master/r/349016
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-ardbeg.h
arch/arm/mach-tegra/board-tn8-p1761-powermon.c [new file with mode: 0644]

index 4bc4f93..12b1397 100644 (file)
@@ -262,6 +262,7 @@ obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg-power.o
 obj-${CONFIG_MACH_ARDBEG}               += board-tn8-power.o
 obj-${CONFIG_MACH_ARDBEG}               += board-norrin-power.o
 obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg-powermon.o
+obj-${CONFIG_MACH_ARDBEG}               += board-tn8-p1761-powermon.o
 obj-${CONFIG_MACH_ARDBEG}               += panel-a-1080p-11-6.o
 obj-${CONFIG_MACH_ARDBEG}               += panel-p-wuxga-10-1.o
 obj-${CONFIG_MACH_ARDBEG}               += panel-s-wqxga-10-1.o
index 1700bc3..082ca0e 100644 (file)
@@ -1162,10 +1162,17 @@ static void __init tegra_ardbeg_late_init(void)
        isomgr_init();
        ardbeg_touch_init();
        ardbeg_panel_init();
-       if (board_info.board_id == BOARD_PM358)
+       switch (board_info.board_id) {
+       case BOARD_PM358:
                laguna_pm358_pmon_init();
-       else
+               break;
+       case BOARD_P1761:
+               tn8_p1761_pmon_init();
+               break;
+       default:
                ardbeg_pmon_init();
+               break;
+       }
        if (board_info.board_id == BOARD_PM359 ||
                        board_info.board_id == BOARD_PM358 ||
                        board_info.board_id == BOARD_PM363)
index 357cbf2..8c3b00b 100644 (file)
@@ -182,6 +182,8 @@ void tn8_new_sysedp_init(void);
 void tn8_sysedp_dynamic_capping_init(void);
 void tn8_sysedp_batmon_init(void);
 
+int tn8_p1761_pmon_init(void);
+
 /* SATA Specific */
 
 #define CLK_RST_CNTRL_RST_DEV_W_SET 0x7000E438
diff --git a/arch/arm/mach-tegra/board-tn8-p1761-powermon.c b/arch/arm/mach-tegra/board-tn8-p1761-powermon.c
new file mode 100644 (file)
index 0000000..428ca73
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * arch/arm/mach-tegra/board-tn8-p1761-powermon.c
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <linux/i2c.h>
+#include <linux/ina3221.h>
+
+/* rails on TN8_P1761 i2c */
+enum {
+       VDD_BAT_CPU_GPU,
+};
+enum {
+       INA_I2C_ADDR_40,
+};
+
+static struct ina3221_platform_data tn8_p1761_power_mon_info[] = {
+       [VDD_BAT_CPU_GPU] = {
+               .rail_name = {"VDD_BAT", "VDD_CPU", "VDD_GPU"},
+               .shunt_resistor = {1, 1, 1},
+               .cont_conf_data = INA3221_CONT_CONFIG_DATA,
+               .trig_conf_data = INA3221_TRIG_CONFIG_DATA,
+               .warn_conf_limits = {-1, -1, -1},
+               .crit_conf_limits = {-1, -1, -1},
+       },
+};
+
+static struct i2c_board_info tn8_p1761_i2c_ina3221_info[] = {
+       [INA_I2C_ADDR_40] = {
+               I2C_BOARD_INFO("ina3221", 0x40),
+               .platform_data = &tn8_p1761_power_mon_info[VDD_BAT_CPU_GPU],
+               .irq = -1,
+       },
+};
+
+int __init tn8_p1761_pmon_init(void)
+{
+       int ret;
+       ret = i2c_register_board_info(1, tn8_p1761_i2c_ina3221_info,
+                                     ARRAY_SIZE(tn8_p1761_i2c_ina3221_info));
+       return ret;
+}