ARM: tegra: dvfs: Add entries for rail Vmax thermal control
Alex Frid [Tue, 23 Apr 2013 23:03:16 +0000 (16:03 -0700)]
- Expanded dvfs rail structure with Vmax thermal profile entries: Vmax
cooling device, and  list of thermal trip-points and thermal caps.
Added check for entries consistency.

- Added API to register Vmax cooling device trip-points in Tj thermal
zone.

Bug 1270003

Change-Id: I2066f4f6fcc0867ee05af01db6c70dc7feedd8fb
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/223150
(cherry picked from commit 01d2067e90214d6b14255f8b36319b05db902412)
Reviewed-on: http://git-master/r/224309
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

arch/arm/mach-tegra/board-common.c
arch/arm/mach-tegra/dvfs.c
arch/arm/mach-tegra/dvfs.h

index 113fe53..575d286 100644 (file)
@@ -173,6 +173,7 @@ void tegra_add_cdev_trips(struct thermal_trip_info *trips, int *num_trips)
 
 void tegra_add_tj_trips(struct thermal_trip_info *trips, int *num_trips)
 {
+       tegra_add_trip_points(trips, num_trips, tegra_dvfs_get_cpu_vmax_cdev());
        tegra_add_trip_points(trips, num_trips, tegra_core_edp_get_cdev());
 }
 
index 96f5419..d9b865b 100644 (file)
@@ -68,6 +68,15 @@ void tegra_dvfs_add_relationships(struct dvfs_relationship *rels, int n)
 /* Make sure there is a matching cooling device for thermal limit profile. */
 static void dvfs_validate_cdevs(struct dvfs_rail *rail)
 {
+       if (!rail->therm_mv_caps != !rail->therm_mv_caps_num) {
+               rail->therm_mv_caps_num = 0;
+               rail->therm_mv_caps = NULL;
+               WARN(1, "%s: not matching thermal caps/num\n", rail->reg_id);
+       }
+
+       if (rail->therm_mv_caps && !rail->vmax_cdev)
+               WARN(1, "%s: missing vmax cooling device\n", rail->reg_id);
+
        if (!rail->therm_mv_floors != !rail->therm_mv_floors_num) {
                rail->therm_mv_floors_num = 0;
                rail->therm_mv_floors = NULL;
@@ -857,6 +866,13 @@ int tegra_dvfs_dfll_mode_clear(struct dvfs *d, unsigned long rate)
        return ret;
 }
 
+struct tegra_cooling_device *tegra_dvfs_get_cpu_vmax_cdev(void)
+{
+       if (tegra_cpu_rail)
+               return tegra_cpu_rail->vmax_cdev;
+       return NULL;
+}
+
 struct tegra_cooling_device *tegra_dvfs_get_cpu_vmin_cdev(void)
 {
        if (tegra_cpu_rail)
index b247d8a..27eb9b4 100644 (file)
@@ -65,6 +65,8 @@ struct dvfs_rail {
        int nominal_millivolts;
        const int *therm_mv_floors;
        int therm_mv_floors_num;
+       const int *therm_mv_caps;
+       int therm_mv_caps_num;
 
        int step;
        bool jmp_to_zero;
@@ -85,6 +87,7 @@ struct dvfs_rail {
        bool dfll_mode_updating;
        int therm_floor_idx;
        struct tegra_cooling_device *vmin_cdev;
+       struct tegra_cooling_device *vmax_cdev;
        struct rail_stats stats;
 };
 
@@ -219,6 +222,7 @@ int tegra_cpu_dvfs_alter(int edp_thermal_index, const cpumask_t *cpus,
                         bool before_clk_update, int cpu_event);
 int tegra_dvfs_dfll_mode_set(struct dvfs *d, unsigned long rate);
 int tegra_dvfs_dfll_mode_clear(struct dvfs *d, unsigned long rate);
+struct tegra_cooling_device *tegra_dvfs_get_cpu_vmax_cdev(void);
 struct tegra_cooling_device *tegra_dvfs_get_cpu_vmin_cdev(void);
 struct tegra_cooling_device *tegra_dvfs_get_core_vmin_cdev(void);
 int tegra_dvfs_rail_dfll_mode_set_cold(struct dvfs_rail *rail);