Resolved migration conflicts from kernel 4.9 to 4.14.
Change-Id: I565316644978e42ccf1aab7532651701df915185
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
return 0;
}
+static int exynos_cpufreq_cooling_get_level(struct thermal_cooling_device *cdev,
+ unsigned long value)
+{
+ struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
+
+ return get_level(cpufreq_cdev, value);
+}
+
/**
* cpufreq_get_requested_power() - get the current power
* @cdev: &thermal_cooling_device pointer
.get_max_state = cpufreq_get_max_state,
.get_cur_state = cpufreq_get_cur_state,
.set_cur_state = cpufreq_set_cur_state,
+ .get_cooling_level = exynos_cpufreq_cooling_get_level,
};
static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = {
return val;
}
-EXPORT_SYMBOL_GPL(gpufreq_cooling_get_level);
+EXPORT_SYMBOL_GPL(gpufreq_cooling_get_freq);
/**
* build_dyn_power_table() - create a dynamic power to frequency table
return gpufreq_apply_cooling(gpufreq_cdev, state);
}
+static int exynos_gpufreq_cooling_get_level(struct thermal_cooling_device *cdev,
+ unsigned long value)
+{
+ return gpufreq_cooling_get_level(0, value);
+}
+
static enum gpu_noti_state_t gpu_tstate = GPU_COLD;
static int gpufreq_set_cur_temp(struct thermal_cooling_device *cdev,
.get_cur_state = gpufreq_get_cur_state,
.set_cur_state = gpufreq_set_cur_state,
.set_cur_temp = gpufreq_set_cur_temp,
+ .get_cooling_level = exynos_gpufreq_cooling_get_level,
};
int exynos_gpu_add_notifier(struct notifier_block *n)
pr_info("[GPU cooling] index : %d, frequency : %d\n",
gpu_freq_table[count].driver_data, gpu_freq_table[count].frequency);
+
count++;
}
if (ret) {
pr_err("Fail to initialize gpu_cooling_table\n");
return ret;
-
}
np = of_find_node_by_name(NULL, "mali");
}
EXPORT_SYMBOL_GPL(isp_cooling_get_level);
+static int exynos_isp_cooling_get_level(struct thermal_cooling_device *cdev,
+ unsigned long value)
+{
+ return isp_cooling_get_level(0, value);
+}
+
/**
* isp_cooling_get_fps - for a give isp, return the fps value corresponding to cooling level.
* @isp: isp for which the level is required
.get_cur_state = isp_get_cur_state,
.set_cur_state = isp_set_cur_state,
.set_cur_temp = isp_set_cur_temp,
+ .get_cooling_level = exynos_isp_cooling_get_level,
};
if (tbp->cooling_device == cdev->np) {
int ret;
+#if defined(CONFIG_EXYNOS_THERMAL)
+ /* if governor is not power_allocator */
+ if (strncasecmp(thermal->tzp->governor_name, "power_allocator",
+ THERMAL_NAME_LENGTH)) {
+ unsigned long max_level = 0, level = 0;
+
+ cdev->ops->get_max_state(cdev, &max_level);
+ level = cdev->ops->get_cooling_level(cdev, tbp->value);
+
+ if (level == THERMAL_CSTATE_INVALID)
+ level = max_level;
+
+ tbp->max = level;
+ }
+#endif
ret = thermal_zone_bind_cooling_device(thermal,
tbp->trip_id, cdev,
tbp->max,
.attrs = exynos_tmu_attrs,
};
+static int exynos_tmu_parse_ect(struct exynos_tmu_data *data)
+{
+ struct thermal_zone_device *tz = data->tzd;
+ struct __thermal_zone *__tz;
+ void *thermal_block;
+ struct ect_ap_thermal_function *function;
+ int i, temperature;
+ int hotplug_threshold_temp = 0, hotplug_flag = 0;
+ unsigned int freq;
+
+ if (!tz)
+ return -EINVAL;
+
+ __tz = (struct __thermal_zone *)tz->devdata;
+
+ thermal_block = ect_get_block(BLOCK_AP_THERMAL);
+ if (thermal_block == NULL) {
+ pr_err("Failed to get thermal block");
+ return -EINVAL;
+ }
+
+ pr_info("%s %d thermal zone_name = %s\n", __func__, __LINE__, tz->type);
+
+ function = ect_ap_thermal_get_function(thermal_block, tz->type);
+ if (function == NULL) {
+ pr_err("Failed to get thermal block %s", tz->type);
+ return -EINVAL;
+ }
+
+ __tz->ntrips = __tz->num_tbps = function->num_of_range;
+ pr_info("Trip count parsed from ECT : %d, zone : %s", function->num_of_range, tz->type);
+
+
+ for (i = 0; i < function->num_of_range; ++i) {
+ temperature = function->range_list[i].lower_bound_temperature;
+ freq = function->range_list[i].max_frequency;
+ __tz->trips[i].temperature = temperature * MCELSIUS;
+ __tz->tbps[i].value = freq;
+
+ pr_info("Parsed From ECT : [%d] Temperature : %d, frequency : %u\n",
+ i, temperature, freq);
+
+ if (function->range_list[i].flag != hotplug_flag) {
+ if (function->range_list[i].flag != hotplug_flag) {
+ hotplug_threshold_temp = temperature;
+ hotplug_flag = function->range_list[i].flag;
+ data->hotplug_out_threshold = temperature;
+
+ if (i)
+ data->hotplug_in_threshold = function->range_list[i-1].lower_bound_temperature;
+
+ pr_info("[ECT]hotplug_threshold : %d\n", hotplug_threshold_temp);
+ pr_info("[ECT]hotplug_in_threshold : %d\n", data->hotplug_in_threshold);
+ pr_info("[ECT]hotplug_out_threshold : %d\n", data->hotplug_out_threshold);
+ }
+ }
+
+ if (hotplug_threshold_temp != 0)
+ data->hotplug_enable = true;
+ else
+ data->hotplug_enable = false;
+
+ }
+ return 0;
+};
+
#ifdef CONFIG_MALI_DEBUG_KERNEL_SYSFS
struct exynos_tmu_data *gpu_thermal_data;
#endif
goto err_sensor;
}
+#if defined(CONFIG_ECT)
+ exynos_tmu_parse_ect(data);
+#endif
+
data->num_probe = (readl(data->base + EXYNOS_TMU_REG_CONTROL1) >> EXYNOS_TMU_NUM_PROBE_SHIFT)
& EXYNOS_TMU_NUM_PROBE_MASK;
struct thermal_zone_device *, unsigned long, u32 *);
int (*power2state)(struct thermal_cooling_device *,
struct thermal_zone_device *, u32, unsigned long *);
- int (*set_cur_temp) (struct thermal_cooling_device *, bool, int);
+ int (*set_cur_temp)(struct thermal_cooling_device *, bool, int);
+ int (*get_cooling_level)(struct thermal_cooling_device *, unsigned long);
};
struct thermal_cooling_device {
* @usage: the percentage (from 0 to 100) of cooling contribution
* @min: minimum cooling state used at this trip point
* @max: maximum cooling state used at this trip point
+ * @value: cooling value corresponding to max state
*/
struct __thermal_bind_params {
unsigned int usage;
unsigned long min;
unsigned long max;
+ unsigned long value;
};
/**