kfree(cpufreq_cdev);
}
EXPORT_SYMBOL_GPL(cpufreq_cooling_unregister);
+
+struct thermal_cooling_device *
+exynos_cpufreq_cooling_register(const struct cpumask *clip_cpus)
+{
+ struct device *dev;
+ struct device_node *np;
+ u32 capacitance = 0;
+
+ dev = get_cpu_device(cpumask_first(clip_cpus));
+
+ if (!dev)
+ return ERR_PTR(-EINVAL);
+
+ np = of_node_get(dev->of_node);
+
+ if (!np)
+ return ERR_PTR(-EINVAL);
+
+ return __cpufreq_cooling_register(np, clip_cpus, capacitance,
+ NULL);
+}
+EXPORT_SYMBOL_GPL(exynos_cpufreq_cooling_register);
.get_trend = exynos_get_trend,
};
-static int exynos_cpufreq_cooling_register(struct exynos_tmu_data *data)
-{
- struct device_node *np, *child = NULL, *gchild, *ggchild;
- struct device_node *cool_np;
- struct of_phandle_args cooling_spec;
- struct cpumask mask_val;
- int cpu, ret;
- const char *governor_name;
- u32 power_coefficient = 0;
- void *gen_block;
- struct ect_gen_param_table *pwr_coeff;
-
- np = of_find_node_by_name(NULL, "thermal-zones");
- if (!np)
- return -ENODEV;
-
- /* Register cpufreq cooling device */
- for_each_child_of_node(np, child) {
- struct device_node *zone_np;
- zone_np = of_parse_phandle(child, "thermal-sensors", 0);
-
- if (zone_np == data->np) break;
- }
-
- gchild = of_get_child_by_name(child, "cooling-maps");
- ggchild = of_get_next_child(gchild, NULL);
- ret = of_parse_phandle_with_args(ggchild, "cooling-device", "#cooling-cells",
- 0, &cooling_spec);
- if (ret < 0)
- pr_err("%s do not get cooling spec(err = %d) \n", data->tmu_name, ret);
-
- cool_np = cooling_spec.np;
-
- for_each_possible_cpu(cpu)
- if (cpu < NR_CPUS && cpu_topology[cpu].cluster_id == data->id)
- cpumask_copy(&mask_val, topology_core_cpumask(cpu));
-
- if (!of_property_read_string(child, "governor", &governor_name)) {
- if (!strncasecmp(governor_name, "power_allocator", THERMAL_NAME_LENGTH)) {
- gen_block = ect_get_block("GEN");
- if (gen_block == NULL) {
- pr_err("%s: Failed to get gen block from ECT\n", __func__);
- return -EINVAL;
- }
- pwr_coeff = ect_gen_param_get_table(gen_block, "DTM_PWR_Coeff");
- if (pwr_coeff == NULL) {
- pr_err("%s: Failed to get power coeff from ECT\n", __func__);
- return -EINVAL;
- }
- power_coefficient = pwr_coeff->parameter[data->id];
- }
- }
-
- data->cool_dev = of_cpufreq_power_cooling_register(cool_np, &mask_val, power_coefficient, NULL);
-
- if (IS_ERR(data->cool_dev)) {
- data->cool_dev = NULL;
- pr_err("cooling device register fail (mask = %x) \n", *(unsigned int*)cpumask_bits(&mask_val));
- return -ENODEV;
- }
-
- return ret;
-}
-
#ifdef CONFIG_GPU_THERMAL
#ifdef CONFIG_MALI_DEBUG_KERNEL_SYSFS
if (ret)
goto err_sensor;
- if (data->id == 0 || data->id == 1) {
- ret = exynos_cpufreq_cooling_register(data);
- if (ret) {
- dev_err(&pdev->dev, "Failed cooling register \n");
- goto err_sensor;
- }
- } else if (data->id == 2) {
+ if (data->id == 2) {
ret = gpu_cooling_table_init(pdev);
if (ret)
goto err_sensor;
struct cpufreq_policy *policy,
u32 capacitance,
get_static_t plat_static_func);
+
+struct thermal_cooling_device *
+exynos_cpufreq_cooling_register(const struct cpumask *clip_cpus);
+
#else
static inline struct thermal_cooling_device *
of_cpufreq_cooling_register(struct device_node *np,
{
return NULL;
}
+
+static inline struct thermal_cooling_device *
+exynos_cpufreq_cooling_register(const struct cpumask *clip_cpus);
+{
+ return NULL;
+}
+
#endif
/**
return NULL;
}
+static inline struct thermal_cooling_device *
+exynos_cpufreq_cooling_register(const struct cpumask *clip_cpus);
+{
+ return NULL;
+}
+
static inline
void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
{