]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - arch/arm/mach-tegra/board-cardhu.c
ARM: tegra: thermal: Edp into cooling device
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu.c
index 237dd5f648a4018ea4c08c3a5fec76f3a293eebe..efd613c0805529dca245af8cd25167873cb64e53 100644 (file)
@@ -2,6 +2,7 @@
  * arch/arm/mach-tegra/board-cardhu.c
  *
  * Copyright (c) 2011-2012, NVIDIA Corporation.  All rights reserved.
+ * Copyright (c) 2011-2012, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <linux/nfc/pn544.h>
 #include <linux/rfkill-gpio.h>
 
+
 #include <sound/wm8903.h>
 #include <sound/max98095.h>
 #include <media/tegra_dtv.h>
 
 #include <asm/hardware/gic.h>
 
+#include <mach/edp.h>
 #include <mach/clk.h>
 #include <mach/iomap.h>
 #include <mach/irqs.h>
@@ -62,6 +65,7 @@
 #include <mach/pci.h>
 #include <mach/gpio-tegra.h>
 #include <mach/tegra_fiq_debugger.h>
+#include <linux/thermal.h>
 
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include "common.h"
 
 static struct balanced_throttle throttle_list[] = {
-#ifdef CONFIG_TEGRA_THERMAL_THROTTLE
        {
-               .id = BALANCED_THROTTLE_ID_TJ,
+               .tegra_cdev = {
+                       .id = CDEV_BTHROT_ID_TJ,
+               },
                .throt_tab_size = 10,
                .throt_tab = {
                        {      0, 1000 },
@@ -97,10 +102,11 @@ static struct balanced_throttle throttle_list[] = {
                        {1000000, 1100 },
                },
        },
-#endif
 #ifdef CONFIG_TEGRA_SKIN_THROTTLE
        {
-               .id = BALANCED_THROTTLE_ID_SKIN,
+               .tegra_cdev = {
+                       .id = CDEV_BTHROT_ID_SKIN,
+               },
                .throt_tab_size = 6,
                .throt_tab = {
                        { 640000, 1200 },
@@ -116,29 +122,57 @@ static struct balanced_throttle throttle_list[] = {
 
 /* All units are in millicelsius */
 static struct tegra_thermal_data thermal_data = {
-       .shutdown_device_id = THERMAL_DEVICE_ID_NCT_EXT,
-       .temp_shutdown = 90000,
-
-#if defined(CONFIG_TEGRA_EDP_LIMITS) || defined(CONFIG_TEGRA_THERMAL_THROTTLE)
        .throttle_edp_device_id = THERMAL_DEVICE_ID_NCT_EXT,
-#endif
 #ifdef CONFIG_TEGRA_EDP_LIMITS
        .edp_offset = TDIODE_OFFSET,  /* edp based on tdiode */
        .hysteresis_edp = 3000,
 #endif
-#ifdef CONFIG_TEGRA_THERMAL_THROTTLE
        .temp_throttle = 85000,
-       .tc1 = 0,
-       .tc2 = 1,
-       .passive_delay = 2000,
+       .binds = {
+               /* Thermal Throttling */
+               {
+                       .tdev_id = THERMAL_DEVICE_ID_NCT_EXT,
+                       .cdev_id = CDEV_BTHROT_ID_TJ,
+                       .type = THERMAL_TRIP_PASSIVE,
+                       .passive = {
+                               .trip_temp = 85000,
+                               .tc1 = 0,
+                               .tc2 = 1,
+                               .passive_delay = 2000,
+                       }
+               },
+               /* EDP Capping */
+               {
+                       .tdev_id = THERMAL_DEVICE_ID_NCT_EXT,
+                       .cdev_id = CDEV_EDPTABLE_ID_EDP,
+                       .type = THERMAL_TRIP_ACTIVE,
+                       .get_trip_temp = tegra_edp_get_trip_temp,
+                       .get_trip_size = tegra_edp_get_trip_size,
+               },
+#ifdef CONFIG_TEGRA_SKIN_THROTTLE
+               /* Skin Thermal Throttling */
+               {
+                       .tdev_id = THERMAL_DEVICE_ID_SKIN,
+                       .cdev_id = CDEV_BTHROT_ID_SKIN,
+                       .type = THERMAL_TRIP_PASSIVE,
+                       .passive = {
+                               .trip_temp = 43000,
+                               .tc1 = 10,
+                               .tc2 = 1,
+                               .passive_delay = 15000,
+                       }
+               },
 #endif
+               {
+                       .tdev_id = THERMAL_DEVICE_ID_NULL,
+               },
+       },
+};
+
+static struct tegra_skin_data skin_data = {
 #ifdef CONFIG_TEGRA_SKIN_THROTTLE
-       .skin_device_id = THERMAL_DEVICE_ID_SKIN,
+       .skin_device_id = THERMAL_DEVICE_ID_THERM_EST_SKIN,
        .temp_throttle_skin = 43000,
-       .tc1_skin = 0,
-       .tc2_skin = 1,
-       .passive_delay_skin = 5000,
-
        .skin_temp_offset = 9793,
        .skin_period = 1100,
        .skin_devs_size = 2,
@@ -164,9 +198,12 @@ static struct tegra_thermal_data thermal_data = {
                        }
                },
        },
+#else
+       .skin_device_id = THERMAL_DEVICE_ID_NULL,
 #endif
 };
 
+
 static struct rfkill_gpio_platform_data cardhu_bt_rfkill_pdata[] = {
        {
                .name           = "bt_rfkill",
@@ -730,12 +767,25 @@ static struct platform_device tegra_rtc_device = {
        .num_resources = ARRAY_SIZE(tegra_rtc_resources),
 };
 
-static struct tegra_wm8903_platform_data cardhu_audio_wm8903_pdata = {
+static struct tegra_asoc_platform_data cardhu_audio_wm8903_pdata = {
        .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
        .gpio_hp_det            = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = {
@@ -744,6 +794,19 @@ static struct tegra_asoc_platform_data cardhu_audio_max98095_pdata = {
        .gpio_hp_mute           = -1,
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = -1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
 };
 
 static struct platform_device cardhu_audio_wm8903_device = {
@@ -769,14 +832,17 @@ static struct tegra_asoc_platform_data cardhu_audio_aic326x_pdata = {
        .gpio_int_mic_en        = -1,
        .gpio_ext_mic_en        = -1,
        /*defaults for Verbier-Cardhu board with TI AIC326X codec*/
-       .audio_port_id          = {
-               [HIFI_CODEC] = 0,
-               [BASEBAND] = -1,
-               [BT_SCO] = 3,
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
        },
-       .baseband_param         = {
-               .rate = -1,
-               .channels = -1,
+       .i2s_param[BT_SCO]      = {
+               .sample_size    = 16,
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
        },
 };
 
@@ -1385,6 +1451,7 @@ static void cardhu_sata_init(void) { }
 static void __init tegra_cardhu_init(void)
 {
        tegra_thermal_init(&thermal_data,
+                               &skin_data,
                                throttle_list,
                                ARRAY_SIZE(throttle_list));
        tegra_clk_init_from_table(cardhu_clk_init_table);