ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / include / mach / thermal.h
index 43388d2..800eb74 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/thermal.h
  *
- * Copyright (C) 2010-2012 NVIDIA Corporation.
+ * Copyright (c) 2010-2013 NVIDIA CORPORATION. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
 #include <linux/therm_est.h>
 #include <linux/thermal.h>
 
-enum thermal_device_id {
-       THERMAL_DEVICE_ID_NULL = 0,
-       THERMAL_DEVICE_ID_NCT_EXT = 1,
-       THERMAL_DEVICE_ID_NCT_INT = 2,
-       THERMAL_DEVICE_ID_TSENSOR = 3,
-       THERMAL_DEVICE_ID_THERM_EST_SKIN = 4,
+struct tegra_cooling_device {
+       char *cdev_type;
+       int *trip_temperatures;
+       int trip_temperatures_num;
 };
 
-#define THERMAL_DEVICE_MAX     (5)
+#define MAX_THROT_TABLE_SIZE   (64)
+#define NO_CAP                 (ULONG_MAX) /* no cap */
+#define CPU_THROT_LOW          0 /* lowest throttle freq. only used for CPU */
 
-enum cooling_device_id {
-       CDEV_BTHROT_ID_TJ      = 0x00010000,
-       CDEV_EDPTABLE_ID_EDP   = 0x00030000,
-       CDEV_EDPTABLE_ID_EDP_0 = 0x00030000,
-       CDEV_EDPTABLE_ID_EDP_1 = 0x00030001,
-       CDEV_EDPTABLE_ID_EDP_2 = 0x00030002,
-       CDEV_EDPTABLE_ID_EDP_3 = 0x00030003,
-       CDEV_EDPTABLE_ID_EDP_4 = 0x00030004,
-};
+#ifdef CONFIG_ARCH_TEGRA_12x_SOC
+#define GBUS_CNT               1
+#else
+#define GBUS_CNT               0
+#endif
 
-struct tegra_thermal_bind {
-       enum thermal_device_id tdev_id;
-       enum cooling_device_id cdev_id;
-       int type;
-       int (*get_trip_temp) (void *, long);
-       int (*get_trip_size) (void);
-       struct passive_params {
-               long trip_temp;
-               int tc1;
-               int tc2;
-               long passive_delay;
-       } passive;
-};
+#ifdef CONFIG_TEGRA_DUAL_CBUS
+#define CBUS_CNT               2
+#else
+#define CBUS_CNT               1
+#endif
 
-struct tegra_thermal_device {
-       char *name;
-       enum thermal_device_id id;
-       void *data;
-       int (*get_temp) (void *, long *);
-       int (*set_limits) (void *, long, long);
-       int (*set_alert)(void *, void (*)(void *), void *);
-       struct thermal_zone_device *thz;
-       struct list_head node;
-};
-
-struct tegra_cooling_device {
-       enum cooling_device_id id;
-};
+/* cpu, gpu(0|1), cbus(1|2), sclk, emc */
+#define NUM_OF_CAP_FREQS       (1 + GBUS_CNT + CBUS_CNT + 1 + 1)
 
 struct throttle_table {
-       unsigned int cpu_freq;
-       int core_cap_level;
+       unsigned long cap_freqs[NUM_OF_CAP_FREQS];
 };
 
-#define MAX_THROT_TABLE_SIZE   (32)
-
 struct balanced_throttle {
-       struct tegra_cooling_device tegra_cdev;
        struct thermal_cooling_device *cdev;
        struct list_head node;
-       int is_throttling;
-       int throttle_index;
+       unsigned long cur_state;
+       int throttle_count;
        int throt_tab_size;
-       struct throttle_table throt_tab[MAX_THROT_TABLE_SIZE];
+       struct throttle_table *throt_tab;
 };
 
 #ifdef CONFIG_TEGRA_THERMAL_THROTTLE
+int tegra_throttle_init(struct mutex *cpu_lock);
 struct thermal_cooling_device *balanced_throttle_register(
-       struct balanced_throttle *bthrot);
-#else
-static inline struct thermal_cooling_device *balanced_throttle_register(
-       struct balanced_throttle *bthrot)
-{ return ERR_PTR(-EINVAL); }
-#endif
-
-#ifdef CONFIG_TEGRA_THERMAL
-int tegra_thermal_init(struct tegra_thermal_bind *thermal_binds);
-int tegra_thermal_device_register(struct tegra_thermal_device *device);
-struct tegra_thermal_device *tegra_thermal_get_device(enum thermal_device_id id);
-int tegra_thermal_exit(void);
+               struct balanced_throttle *bthrot,
+               char *type);
+void tegra_throttle_exit(void);
+bool tegra_is_throttling(int *count);
+unsigned long tegra_throttle_governor_speed(unsigned long requested_speed);
 #else
-static inline int tegra_thermal_init(struct tegra_thermal_bind *thermal_binds)
-{ return 0; }
-static inline int tegra_thermal_device_register(struct tegra_thermal_device *device)
-{ return 0; }
-static inline struct tegra_thermal_device *tegra_thermal_get_device(
-       enum thermal_device_id id)
-{ return NULL; }
-static inline int tegra_thermal_exit(void)
+static inline int tegra_throttle_init(struct mutex *cpu_lock)
 { return 0; }
-#endif
+static inline struct thermal_cooling_device *balanced_throttle_register(
+               struct balanced_throttle *bthrot,
+               char *type)
+{ return ERR_PTR(-ENODEV); }
+static inline void tegra_throttle_exit(void)
+{}
+static inline bool tegra_is_throttling(int *count)
+{ return false; }
+static inline unsigned long tegra_throttle_governor_speed(
+       unsigned long requested_speed)
+{ return requested_speed; }
+#endif /* CONFIG_TEGRA_THERMAL_THROTTLE */
 
 #endif /* __MACH_THERMAL_H */