summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-kai-sensors.c
diff options
context:
space:
mode:
authorJoshua Primero <jprimero@nvidia.com>2012-09-06 15:19:35 -0700
committerSimone Willett <swillett@nvidia.com>2012-10-25 15:49:32 -0700
commitcb9813bf04a80520d55be8e10421b71539517bee (patch)
tree3913adbadbbae8702a0a19a9a772110b5e4eaad4 /arch/arm/mach-tegra/board-kai-sensors.c
parent116efd351b7027cef2f6c16371b3a60e03a68e21 (diff)
ARM: tegra: thermal: Thermals in kai/enterprise
Enabled edp thermal capping, thermal throttling, and thermal shutdown on the Kai and Enterprise platforms which got lost in the previous refactor. Change-Id: I5b65058fd94162f256fdc40006db32d1e2dbde28 Signed-off-by: Joshua Primero <jprimero@nvidia.com> Reviewed-on: http://git-master/r/132884 (cherry picked from commit f6d6f30e07d679a74342bb5e5d599993414a9d56) Signed-off-by: Gaurav Batra <gbatra@nvidia.com> Reviewed-on: http://git-master/r/130366 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-kai-sensors.c')
-rw-r--r--arch/arm/mach-tegra/board-kai-sensors.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-kai-sensors.c b/arch/arm/mach-tegra/board-kai-sensors.c
index 062d9c9e66aa..e6ca6462a175 100644
--- a/arch/arm/mach-tegra/board-kai-sensors.c
+++ b/arch/arm/mach-tegra/board-kai-sensors.c
@@ -27,6 +27,7 @@
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/gpio.h>
+#include <mach/edp.h>
#include <asm/mach-types.h>
#include <media/ov2710.h>
@@ -39,11 +40,41 @@
static struct regulator *kai_1v8_cam3;
static struct regulator *kai_vdd_cam3;
+static struct balanced_throttle tj_throttle = {
+ .throt_tab_size = 10,
+ .throt_tab = {
+ { 0, 1000 },
+ { 640000, 1000 },
+ { 640000, 1000 },
+ { 640000, 1000 },
+ { 640000, 1000 },
+ { 640000, 1000 },
+ { 760000, 1000 },
+ { 760000, 1050 },
+ {1000000, 1050 },
+ {1000000, 1100 },
+ },
+};
+
static struct nct1008_platform_data kai_nct1008_pdata = {
.supported_hwrev = true,
.ext_range = true,
.conv_rate = 0x09, /* 0x09 corresponds to 32Hz conversion rate */
.offset = 8, /* 4 * 2C. 1C for device accuracies */
+
+ .shutdown_ext_limit = 90, /* C */
+ .shutdown_local_limit = 100, /* C */
+
+ /* Thermal Throttling */
+ .passive = {
+ .create_cdev = (struct thermal_cooling_device *(*)(void *))
+ balanced_throttle_register,
+ .cdev_data = &tj_throttle,
+ .trip_temp = 85000,
+ .tc1 = 0,
+ .tc1 = 1,
+ .passive_delay = 2000,
+ }
};
static struct i2c_board_info kai_i2c4_nct1008_board_info[] = {
@@ -54,6 +85,36 @@ static struct i2c_board_info kai_i2c4_nct1008_board_info[] = {
}
};
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+static void kai_init_edp_cdev(void)
+{
+ const struct tegra_edp_limits *cpu_edp_limits;
+ int cpu_edp_limits_size;
+ int i;
+
+ /* edp capping */
+ tegra_get_cpu_edp_limits(&cpu_edp_limits, &cpu_edp_limits_size);
+
+ if (cpu_edp_limits_size > MAX_THROT_TABLE_SIZE)
+ BUG();
+
+ for (i = 0; i < cpu_edp_limits_size-1; i++) {
+ kai_nct1008_pdata.active[i].create_cdev =
+ (struct thermal_cooling_device *(*)(void *))
+ edp_cooling_device_create;
+ kai_nct1008_pdata.active[i].cdev_data = (void *)i;
+ kai_nct1008_pdata.active[i].trip_temp =
+ cpu_edp_limits[i].temperature * 1000;
+ }
+ kai_nct1008_pdata.active[i].create_cdev = NULL;
+}
+#else
+static void kai_init_edp_cdev(void)
+{
+}
+#endif
+
+
static int kai_nct1008_init(void)
{
int ret = 0;
@@ -73,6 +134,9 @@ static int kai_nct1008_init(void)
pr_err("%s: set gpio to input failed\n", __func__);
gpio_free(KAI_TEMP_ALERT_GPIO);
}
+
+ kai_init_edp_cdev();
+
return ret;
}