summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-tegra/board-loki-power.c128
-rw-r--r--arch/arm/mach-tegra/board-loki-sensors.c33
-rw-r--r--arch/arm/mach-tegra/board-loki.c2
-rw-r--r--arch/arm/mach-tegra/board-loki.h1
4 files changed, 154 insertions, 10 deletions
diff --git a/arch/arm/mach-tegra/board-loki-power.c b/arch/arm/mach-tegra/board-loki-power.c
index c56c98da94b2..4adc865bda2f 100644
--- a/arch/arm/mach-tegra/board-loki-power.c
+++ b/arch/arm/mach-tegra/board-loki-power.c
@@ -33,6 +33,8 @@
#include <mach/irqs.h>
#include <mach/edp.h>
+#include <mach/tegra_fuse.h>
+#include <linux/pid_thermal_gov.h>
#include <asm/mach-types.h>
@@ -47,6 +49,8 @@
#include "tegra-board-id.h"
#include "dvfs.h"
#include "tegra_cl_dvfs.h"
+#include "tegra11_soctherm.h"
+#include "tegra3_tsensor.h"
#define PMC_CTRL 0x0
#define PMC_CTRL_INTR_LOW (1 << 17)
@@ -812,3 +816,127 @@ int __init loki_edp_init(void)
return 0;
}
+
+static struct pid_thermal_gov_params soctherm_pid_params = {
+ .max_err_temp = 9000,
+ .max_err_gain = 1000,
+
+ .gain_p = 1000,
+ .gain_d = 0,
+
+ .up_compensation = 20,
+ .down_compensation = 20,
+};
+
+static struct thermal_zone_params soctherm_tzp = {
+ .governor_name = "pid_thermal_gov",
+ .governor_params = &soctherm_pid_params,
+};
+
+static struct soctherm_platform_data loki_soctherm_data = {
+ .therm = {
+ [THERM_CPU] = {
+ .zone_enable = true,
+ .passive_delay = 1000,
+ .hotspot_offset = 6000,
+ .num_trips = 3,
+ .trips = {
+ {
+ .cdev_type = "tegra-shutdown",
+ .trip_temp = 98000,
+ .trip_type = THERMAL_TRIP_CRITICAL,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+ {
+ .cdev_type = "tegra-heavy",
+ .trip_temp = 96000,
+ .trip_type = THERMAL_TRIP_HOT,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+ {
+ .cdev_type = "tegra-balanced",
+ .trip_temp = 86000,
+ .trip_type = THERMAL_TRIP_PASSIVE,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+ },
+ .tzp = &soctherm_tzp,
+ },
+ [THERM_GPU] = {
+ .zone_enable = true,
+ .passive_delay = 1000,
+ .hotspot_offset = 6000,
+ .num_trips = 2,
+ .trips = {
+ {
+ .cdev_type = "tegra-shutdown",
+ .trip_temp = 100000,
+ .trip_type = THERMAL_TRIP_CRITICAL,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+ {
+ .cdev_type = "tegra-balanced",
+ .trip_temp = 88000,
+ .trip_type = THERMAL_TRIP_PASSIVE,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+/*
+ {
+ .cdev_type = "gk20a_cdev",
+ .trip_temp = 80000,
+ .trip_type = THERMAL_TRIP_PASSIVE,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+ {
+ .cdev_type = "tegra-heavy",
+ .trip_temp = 98000,
+ .trip_type = THERMAL_TRIP_HOT,
+ .upper = THERMAL_NO_LIMIT,
+ .lower = THERMAL_NO_LIMIT,
+ },
+*/
+ },
+ .tzp = &soctherm_tzp,
+ },
+ [THERM_PLL] = {
+ .zone_enable = true,
+ },
+ },
+ .throttle = {
+ [THROTTLE_HEAVY] = {
+ .priority = 100,
+ .devs = {
+ [THROTTLE_DEV_CPU] = {
+ .enable = true,
+ .depth = 80,
+ },
+ [THROTTLE_DEV_GPU] = {
+ .enable = false,
+ .throttling_depth = "heavy_throttling",
+ },
+ },
+ },
+ },
+};
+
+int __init loki_soctherm_init(void)
+{
+ /* do this only for supported CP,FT fuses */
+ if (!tegra_fuse_calib_base_get_cp(NULL, NULL) &&
+ !tegra_fuse_calib_base_get_ft(NULL, NULL)) {
+ tegra_platform_edp_init(
+ loki_soctherm_data.therm[THERM_CPU].trips,
+ &loki_soctherm_data.therm[THERM_CPU].num_trips,
+ 8000); /* edp temperature margin */
+ }
+
+ /* Always do soctherm init here.
+ * Allowing access to raw soctherm regs for debugging purposes */
+ return tegra11_soctherm_init(&loki_soctherm_data);
+}
diff --git a/arch/arm/mach-tegra/board-loki-sensors.c b/arch/arm/mach-tegra/board-loki-sensors.c
index b8f467e4cf80..41c85b185b6c 100644
--- a/arch/arm/mach-tegra/board-loki-sensors.c
+++ b/arch/arm/mach-tegra/board-loki-sensors.c
@@ -28,6 +28,7 @@
#include <media/as364x.h>
#include <mach/gpio-tegra.h>
#include <mach/edp.h>
+#include <mach/tegra_fuse.h>
#include <linux/gpio.h>
#include <linux/therm_est.h>
#include <linux/iio/light/jsa1127.h>
@@ -509,7 +510,7 @@ static struct nct1008_platform_data loki_nct72_pdata = {
.passive_delay = 2000,
- .num_trips = 2,
+ .num_trips = 3,
.trips = {
/* Thermal Throttling */
[0] = {
@@ -551,14 +552,30 @@ static int loki_nct72_init(void)
{
int nct72_port = TEGRA_GPIO_PI6;
int ret = 0;
+ int i;
+ struct thermal_trip_info *trip_state;
+
+ /* Raise NCT's thresholds if soctherm CP,FT fuses are ok */
+ if (!tegra_fuse_calib_base_get_cp(NULL, NULL) &&
+ !tegra_fuse_calib_base_get_ft(NULL, NULL)) {
+ /* Raise NCT's shutdown point by 20C */
+ loki_nct72_pdata.shutdown_ext_limit += 20;
+ /* Remove tegra-balanced cooling device from NCT pdata */
+ for (i = 0; i < loki_nct72_pdata.num_trips; i++) {
+ trip_state = &loki_nct72_pdata.trips[i];
+ if (!strncmp(trip_state->cdev_type, "tegra-balanced",
+ THERMAL_NAME_LENGTH)) {
+ trip_state->cdev_type = "_none_";
+ break;
+ }
+ }
+ } else {
+ tegra_platform_edp_init(loki_nct72_pdata.trips,
+ &loki_nct72_pdata.num_trips,
+ 12000); /* edp temperature margin */
+ }
+
-/*
- tegra_add_cdev_trips(loki_nct72_pdata.trips,
- &loki_nct72_pdata.num_trips);
-*/
- tegra_platform_edp_init(loki_nct72_pdata.trips,
- &loki_nct72_pdata.num_trips,
- 12000); /* edp temperature margin */
tegra_add_cdev_trips(loki_nct72_pdata.trips,
&loki_nct72_pdata.num_trips);
tegra_add_tj_trips(loki_nct72_pdata.trips,
diff --git a/arch/arm/mach-tegra/board-loki.c b/arch/arm/mach-tegra/board-loki.c
index 6369c7619642..1a2b43bb8f4a 100644
--- a/arch/arm/mach-tegra/board-loki.c
+++ b/arch/arm/mach-tegra/board-loki.c
@@ -827,9 +827,7 @@ static void __init tegra_loki_late_init(void)
loki_sensors_init();
loki_fan_init();
-#if 0
loki_soctherm_init();
-#endif
loki_setup_bluedroid_pm();
tegra_register_fuse();
tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
diff --git a/arch/arm/mach-tegra/board-loki.h b/arch/arm/mach-tegra/board-loki.h
index 78b6ae26a528..eaa17a7c77e9 100644
--- a/arch/arm/mach-tegra/board-loki.h
+++ b/arch/arm/mach-tegra/board-loki.h
@@ -35,6 +35,7 @@ int loki_suspend_init(void);
int loki_pmon_init(void);
int loki_edp_init(void);
int loki_rail_alignment_init(void);
+int loki_soctherm_init(void);
/* Invensense MPU Definitions */
#define MPU_GYRO_NAME "mpu6050"