+static ssize_t cpu_temp_target_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t n)
+{
+ int ret = 0;
+
+ mutex_lock(&temp_limit_mutex);
+ if (clk_cpu_b_dvfs_node) {
+ ret = kstrtouint(buf, 0, &clk_cpu_b_dvfs_node->target_temp);
+ if (ret < 0)
+ goto error;
+ }
+ if (clk_cpu_l_dvfs_node) {
+ ret = kstrtouint(buf, 0, &clk_cpu_l_dvfs_node->target_temp);
+ if (ret < 0)
+ goto error;
+ }
+ if (clk_cpu_dvfs_node) {
+ ret = kstrtouint(buf, 0, &clk_cpu_dvfs_node->target_temp);
+ if (ret < 0)
+ goto error;
+ }
+error:
+ mutex_unlock(&temp_limit_mutex);
+ return n;
+}
+static ssize_t cpu_temp_target_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ int ret = 0;
+
+ if (clk_cpu_b_dvfs_node)
+ ret += sprintf(buf + ret, "cpu_b:%d\n",
+ clk_cpu_b_dvfs_node->target_temp);
+ if (clk_cpu_l_dvfs_node)
+ ret += sprintf(buf + ret, "cpu_l:%d\n",
+ clk_cpu_l_dvfs_node->target_temp);
+ if (clk_cpu_dvfs_node)
+ ret += sprintf(buf + ret, "cpu:%d\n",
+ clk_cpu_dvfs_node->target_temp);
+
+ return ret;
+}
+
+static ssize_t cpu_temp_enable_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t n)
+{
+ int ret = 0;
+
+ mutex_lock(&temp_limit_mutex);
+ if (clk_cpu_b_dvfs_node) {
+ ret = kstrtouint(buf, 0,
+ &clk_cpu_b_dvfs_node->temp_limit_enable);
+ if (ret < 0)
+ goto error;
+ clk_cpu_b_dvfs_node->temp_limit_rate =
+ clk_cpu_b_dvfs_node->max_rate;
+ }
+ if (clk_cpu_l_dvfs_node) {
+ ret = kstrtouint(buf, 0,
+ &clk_cpu_l_dvfs_node->temp_limit_enable);
+ if (ret < 0)
+ goto error;
+ clk_cpu_l_dvfs_node->temp_limit_rate =
+ clk_cpu_l_dvfs_node->max_rate;
+ }
+ if (clk_cpu_dvfs_node) {
+ ret = kstrtouint(buf, 0, &clk_cpu_dvfs_node->temp_limit_enable);
+ if (ret < 0)
+ goto error;
+ clk_cpu_dvfs_node->temp_limit_rate =
+ clk_cpu_dvfs_node->max_rate;
+ }
+error:
+ mutex_unlock(&temp_limit_mutex);
+ return n;
+}
+static ssize_t cpu_temp_enable_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ int ret = 0;
+
+ if (clk_cpu_b_dvfs_node)
+ ret += sprintf(buf + ret, "cpu_b:%d\n",
+ clk_cpu_b_dvfs_node->temp_limit_enable);
+ if (clk_cpu_l_dvfs_node)
+ ret += sprintf(buf + ret, "cpu_l:%d\n",
+ clk_cpu_l_dvfs_node->temp_limit_enable);
+ if (clk_cpu_dvfs_node)
+ ret += sprintf(buf + ret, "cpu:%d\n",
+ clk_cpu_dvfs_node->temp_limit_enable);
+
+ return ret;
+}