arm: tegra: roth: Change thermal trip points
Anshul Jain [Mon, 25 Mar 2013 00:11:44 +0000 (17:11 -0700)]
For the redesigned roth

Active Fan
State 1 at 72C with 10C hysteresis at 107 PWM
State 2 at 83 with 6C hysteresis at 150 PWM

Passive
SW balanced throttle at 86C
SW heavy thrtottle at 89C (unchanged)

HW shutdown at 91C (unchanged)

Bug 1259204

Change-Id: I3fc00085379aad4f5360184097b80eb7775c06f4
Signed-off-by: Anshul Jain <anshulj@nvidia.com>
Reviewed-on: http://git-master/r/212432
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
(cherry picked from commit 78b917373bf7bac25fceadfe1bc1b7e87953d5d4)
Reviewed-on: http://git-master/r/246419
Reviewed-by: Jun Yan <juyan@nvidia.com>
Tested-by: Jun Yan <juyan@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/board-roth-fan.c
arch/arm/mach-tegra/board-roth-sensors.c

index 0127dd6..84d0a46 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-roth-fan.c
  *
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2013 NVIDIA CORPORATION, All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 
 #include "gpio-names.h"
 #include "devices.h"
+#include "board.h"
+#include "board-common.h"
 #include "board-roth.h"
+#include "tegra-board-id.h"
 
-static struct pwm_fan_platform_data fan_data = {
+static struct pwm_fan_platform_data fan_data_yltc_8k = {
        .active_steps = MAX_ACTIVE_STATES,
-       .active_temps = {59, 60, 61, 62, 63, 64, 65, 66, 67, 71},
        .active_rpm = {
                0, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000},
        .active_pwm = {0, 158*1024, 227*1024 , 230*1024, 235*1024, 240*1024,
@@ -39,23 +41,53 @@ static struct pwm_fan_platform_data fan_data = {
        .pwm_period = 256,
        .pwm_id = 0,
        .step_time = 100, /*msecs*/
-       .pwm_cap = 158,
+       .state_cap = 1,
+       .precision_multiplier = 1024,
+       .tach_gpio = -1,
+};
+
+static struct pwm_fan_platform_data fan_data_delta_6k = {
+       .active_steps = MAX_ACTIVE_STATES,
+       .active_rpm = {
+               0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 10000, 11000},
+       .active_pwm = {0, 107*1024, 150*1024 , 230*1024, 235*1024, 240*1024,
+                               245*1024, 250*1024, 252*1024, 255*1024},
+       .active_rru = {1024*40, 1024*2, 1024, 256,
+                                               256, 256, 256, 256, 256, 256},
+       .active_rrd = {1024*40, 1024*2, 1024, 256, 256,
+                                               256, 256, 128, 128, 128},
+       .pwm_period = 256,
+       .pwm_id = 0,
+       .step_time = 100, /*msecs*/
+       .state_cap = 1,
        .precision_multiplier = 1024,
        .tach_gpio = TEGRA_GPIO_PU2,
 };
 
-static struct platform_device pwm_fan_therm_cooling_device = {
+static struct platform_device pwm_fan_therm_cooling_device_yltc_8k = {
        .name = "pwm-fan",
        .id = -1,
        .num_resources = 0,
        .dev = {
-               .platform_data = &fan_data,
+               .platform_data = &fan_data_yltc_8k,
+       },
+};
+
+static struct platform_device pwm_fan_therm_cooling_device_delta_6k = {
+       .name = "pwm-fan",
+       .id = -1,
+       .num_resources = 0,
+       .dev = {
+               .platform_data = &fan_data_delta_6k,
        },
 };
 
 int __init roth_fan_init(void)
 {
        int err;
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
 
        err = gpio_request(TEGRA_GPIO_PU3, "pwm-fan");
        if (err < 0) {
@@ -63,6 +95,14 @@ int __init roth_fan_init(void)
                return err;
        }
        gpio_free(TEGRA_GPIO_PU3);
-       platform_device_register(&pwm_fan_therm_cooling_device);
+
+       if (board_info.board_id == BOARD_P2560) {
+               platform_device_register(
+                               &pwm_fan_therm_cooling_device_delta_6k);
+               pr_info("FAN:registering for P2560\n");
+       } else {
+               platform_device_register(&pwm_fan_therm_cooling_device_yltc_8k);
+               pr_info("FAN:registering for P2454\n");
+       }
        return 0;
 }
index c0f4a1c..d2a2862 100644 (file)
@@ -153,7 +153,7 @@ static struct nct1008_platform_data roth_nct1008_pdata = {
                /* Thermal Throttling */
                [0] = {
                        .cdev_type = "tegra-balanced",
-                       .trip_temp = 84000,
+                       .trip_temp = 86000,
                        .trip_type = THERMAL_TRIP_PASSIVE,
                        .upper = THERMAL_NO_LIMIT,
                        .lower = THERMAL_NO_LIMIT,
@@ -436,7 +436,8 @@ static int roth_fan_est_get_temp(void *data, long *temp)
        return 0;
 }
 
-static struct therm_fan_est_data fan_est_data = {
+/*Fan thermal estimator init data for P2454*/
+static struct therm_fan_est_data fan_est_data_p2454 = {
        .toffset = 0,
        .polling_period = 1100,
        .ndevs = 2,
@@ -470,20 +471,72 @@ static struct therm_fan_est_data fan_est_data = {
        .active_hysteresis = {0, 10000, 7000, 0, 0, 0, 0, 0, 0, 0},
 };
 
-static struct platform_device roth_fan_therm_est_device = {
+static struct platform_device roth_fan_therm_est_device_p2454 = {
        .name   = "therm-fan-est",
        .id     = -1,
        .num_resources  = 0,
        .dev = {
-               .platform_data = &fan_est_data,
+               .platform_data = &fan_est_data_p2454,
+       },
+};
+
+/*Fan thermal estimator data for P2560*/
+static struct therm_fan_est_data fan_est_data_p2560 = {
+       .toffset = 0,
+       .polling_period = 1100,
+       .ndevs = 2,
+       .devs = {
+                       {
+                               .dev_data = "nct_ext_soc",
+                               .get_temp = roth_fan_est_get_temp,
+                               .coeffs = {
+                                       100, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0
+                               },
+                       },
+                       {
+                               .dev_data = "nct_int_soc",
+                               .get_temp = roth_fan_est_get_temp,
+                               .coeffs = {
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0,
+                                       0, 0, 0, 0
+                               },
+                       },
+       },
+       .cdev_type = "pwm-fan",
+       .active_trip_temps = {0, 72000, 83000, 120000, 130000,
+                               140000, 150000, 160000, 170000, 180000},
+       .active_hysteresis = {0, 10000, 6000, 0, 0, 0, 0, 0, 0, 0},
+};
+
+static struct platform_device roth_fan_therm_est_device_p2560 = {
+       .name   = "therm-fan-est",
+       .id     = -1,
+       .num_resources  = 0,
+       .dev = {
+               .platform_data = &fan_est_data_p2560,
        },
 };
 
 static int __init roth_fan_est_init(void)
 {
-       platform_device_register(&roth_fan_therm_est_device);
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
+       if (board_info.board_id == BOARD_P2560)
+               platform_device_register(&roth_fan_therm_est_device_p2560);
+       else
+               platform_device_register(&roth_fan_therm_est_device_p2454);
+
        return 0;
 }
+
 int __init roth_sensors_init(void)
 {
        int err;