summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2011-05-12 14:25:01 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-05-18 22:49:28 -0700
commit40429e13014675e82e1126c5df87c9008aee92c1 (patch)
treeb30547a20db2839eda5cd3837a080d668854ae75
parentdbfa483300a34035c9b5de68e67bdad269817144 (diff)
arm: tegra: cardhu: set CPU EDP limitstegra-T30.ER5
Change-Id: I6282bbb63c34b8cc0d503cdd6eafe575fb78ef5f Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/31342 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-cardhu-power.c27
-rw-r--r--arch/arm/mach-tegra/board-cardhu-sensors.c37
-rw-r--r--arch/arm/mach-tegra/board-cardhu.c3
-rw-r--r--arch/arm/mach-tegra/board-cardhu.h3
4 files changed, 59 insertions, 11 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-power.c b/arch/arm/mach-tegra/board-cardhu-power.c
index f593d9fe4d11..6af7c4a85b51 100644
--- a/arch/arm/mach-tegra/board-cardhu-power.c
+++ b/arch/arm/mach-tegra/board-cardhu-power.c
@@ -33,6 +33,7 @@
#include <mach/iomap.h>
#include <mach/irqs.h>
#include <mach/pinmux.h>
+#include <mach/edp.h>
#include "gpio-names.h"
#include "board.h"
@@ -943,3 +944,29 @@ int __init cardhu_power_off_init(void)
return 0;
}
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+/*
+ * placeholder for now. needs to be changed with characterized data.
+ * step size cannot be less than 4C
+ */
+static struct tegra_edp_limits cardhu_edp_limits[] = {
+/* Temperature 1 CPU 2 CPUs 3 CPUs 4 CPUs */
+ {60, {1400000, 1300000, 1300000, 1300000}},
+ {70, {1400000, 1300000, 1300000, 1260000}},
+ {80, {1400000, 1300000, 1300000, 1200000}},
+ {90, {1400000, 1300000, 1300000, 1100000}},
+};
+
+void cardhu_thermal_zones_info(struct tegra_edp_limits **z, int *sz)
+{
+ *z = cardhu_edp_limits;
+ *sz = ARRAY_SIZE(cardhu_edp_limits);
+}
+
+int __init cardhu_edp_init(void)
+{
+ // FIXME: uncomment to override default EDP with above table
+ //tegra_init_cpu_edp_limits(cardhu_edp_limits, ARRAY_SIZE(cardhu_edp_limits));
+ return 0;
+}
+#endif
diff --git a/arch/arm/mach-tegra/board-cardhu-sensors.c b/arch/arm/mach-tegra/board-cardhu-sensors.c
index 7948e89b9f99..094db0a20eae 100644
--- a/arch/arm/mach-tegra/board-cardhu-sensors.c
+++ b/arch/arm/mach-tegra/board-cardhu-sensors.c
@@ -35,6 +35,7 @@
#include <media/sh532u.h>
#include <mach/gpio.h>
+#include <mach/edp.h>
#include "gpio-names.h"
#include "board-cardhu.h"
@@ -428,6 +429,8 @@ static struct i2c_board_info cardhu_i2c8_board_info[] = {
},
};
+extern void tegra_throttling_enable(bool enable);
+
static struct nct1008_platform_data cardhu_nct1008_pdata = {
.supported_hwrev = true,
.ext_range = false,
@@ -436,8 +439,8 @@ static struct nct1008_platform_data cardhu_nct1008_pdata = {
.hysteresis = 5,
.shutdown_ext_limit = 75,
.shutdown_local_limit = 75,
- .throttling_ext_limit = 60,
- .alarm_fn = NULL,
+ .throttling_ext_limit = 90,
+ .alarm_fn = tegra_throttling_enable,
};
static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = {
@@ -447,7 +450,7 @@ static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = {
},
};
-static struct i2c_board_info cardhu_i2c4_board_info[] = {
+static struct i2c_board_info cardhu_i2c4_nct1008_board_info[] = {
{
I2C_BOARD_INFO("nct1008", 0x4C),
.platform_data = &cardhu_nct1008_pdata,
@@ -455,10 +458,19 @@ static struct i2c_board_info cardhu_i2c4_board_info[] = {
}
};
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+extern void cardhu_thermal_zones_info(struct tegra_edp_limits **, int *);
+#endif
+
static int cardhu_nct1008_init(void)
{
int nct1008_port = -1;
int ret;
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+ struct tegra_edp_limits *z;
+ int zones_sz;
+ int i;
+#endif
if ((board_info.board_id == BOARD_E1198) ||
(board_info.board_id == BOARD_E1291)) {
@@ -471,8 +483,7 @@ static int cardhu_nct1008_init(void)
if (nct1008_port >= 0) {
/* FIXME: enable irq when throttling is supported */
- /* cardhu_i2c4_board_info[0].irq = */
- /* TEGRA_GPIO_TO_IRQ(nct1008_port); */
+ cardhu_i2c4_nct1008_board_info[0].irq = TEGRA_GPIO_TO_IRQ(nct1008_port);
ret = gpio_request(nct1008_port, "temp_alert");
if (ret < 0)
@@ -483,8 +494,16 @@ static int cardhu_nct1008_init(void)
gpio_free(nct1008_port);
else
tegra_gpio_enable(nct1008_port);
-
}
+
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+ cardhu_thermal_zones_info(&z, &zones_sz);
+ zones_sz = min(zones_sz, MAX_ZONES);
+ for (i = 0; i < zones_sz; i++)
+ cardhu_nct1008_pdata.thermal_zones[i] = z[i].temperature;
+
+ cardhu_nct1008_pdata.thermal_zones_sz = zones_sz;
+#endif
return ret;
}
@@ -628,9 +647,6 @@ int __init cardhu_sensors_init(void)
pmu_tca6416_init();
- i2c_register_board_info(4, cardhu_i2c4_board_info,
- ARRAY_SIZE(cardhu_i2c4_board_info));
-
if (board_info.board_id == BOARD_E1291)
i2c_register_board_info(4, cardhu_i2c4_bq27510_board_info,
ARRAY_SIZE(cardhu_i2c4_bq27510_board_info));
@@ -642,6 +658,9 @@ int __init cardhu_sensors_init(void)
if (err)
return err;
+ i2c_register_board_info(4, cardhu_i2c4_nct1008_board_info,
+ ARRAY_SIZE(cardhu_i2c4_nct1008_board_info));
+
#ifdef CONFIG_MPU_SENSORS_MPU3050
cardhu_mpuirq_init();
#endif
diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c
index 64f108eb4b5f..dced282926c0 100644
--- a/arch/arm/mach-tegra/board-cardhu.c
+++ b/arch/arm/mach-tegra/board-cardhu.c
@@ -604,6 +604,9 @@ static void __init tegra_cardhu_init(void)
cardhu_pinmux_init();
cardhu_i2c_init();
cardhu_usb_init();
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+ cardhu_edp_init();
+#endif
snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid());
andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL);
platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices));
diff --git a/arch/arm/mach-tegra/board-cardhu.h b/arch/arm/mach-tegra/board-cardhu.h
index 05af0b482725..955e453fc39f 100644
--- a/arch/arm/mach-tegra/board-cardhu.h
+++ b/arch/arm/mach-tegra/board-cardhu.h
@@ -125,8 +125,6 @@
#define TPS6591X_IRQ_BASE TEGRA_NR_IRQS
#define TPS6591X_IRQ_END (TPS6591X_IRQ_BASE + 24)
-
-
int cardhu_charge_init(void);
int cardhu_regulator_init(void);
int cardhu_suspend_init(void);
@@ -142,6 +140,7 @@ int cardhu_gpio_switch_regulator_init(void);
int cardhu_pins_state_init(void);
int cardhu_emc_init(void);
int cardhu_power_off_init(void);
+int cardhu_edp_init(void);
/* Touchscreen GPIO addresses */
#ifdef CONFIG_TOUCHSCREEN_PANJIT_I2C