Loading Documentation/devicetree/bindings/thermal/qti-cpu-isolation-cdev.txt 0 → 100644 +50 −0 Original line number Diff line number Diff line QTI CPU isolation cooling devices. The CPU isolation cooling device will be used for isolating a CPU on a thermal condition. This cooling device driver can register one cooling device per CPU, which can be used by thermal zone to mitigate. Each child node will represent a cooling device and the child node should point to the CPU, which will be mitigated by that cooling device instance. Properties: - compatible: Usage: required Value type: <string> Definition: should be "qcom,cpu-isolate" Cooling device node: - qcom,cpu: Usage: required Value type: <phandle> Definition: phandle to the CPU device that this cooling device will mitigate. -#cooling-cells: Usage: required Value type: <integer> Definition: Must be 2. Needed for of_thermal as cooling device identifier. Please refer to <devicetree/bindings/thermal/thermal.txt> for more details. Example: qcom,cpu-isolation { compatible = "qcom,cpu-isolate"; cpu0_isolate: cpu0-isolate { qcom,cpu = <&CPU0>; #cooling-cells = <2>; }; cpu1_isolate: cpu1-isolate { qcom,cpu = <&CPU1>; #cooling-cells = <2>; }; cpu2_isolate: cpu2-isolate { qcom,cpu = <&CPU2>; #cooling-cells = <2>; }; cpu3_isolate: cpu3-isolate { qcom,cpu = <&CPU3>; #cooling-cells = <2>; }; }; drivers/thermal/qcom/msm_lmh_dcvs.c +11 −8 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */ #define pr_fmt(fmt) "%s:%s " fmt, KBUILD_MODNAME, __func__ Loading @@ -21,6 +21,7 @@ #include <linux/cpu_cooling.h> #include <linux/atomic.h> #include <linux/regulator/consumer.h> #include <linux/cpufreq.h> #include <asm/smp_plat.h> #include <asm/cacheflush.h> Loading Loading @@ -401,28 +402,30 @@ static void register_cooling_device(struct work_struct *work) { struct limits_dcvs_hw *hw; unsigned int cpu = 0, idx = 0; struct cpufreq_policy *policy = NULL; mutex_lock(&lmh_dcvs_list_access); list_for_each_entry(hw, &lmh_dcvs_hw_list, list) { if (hw->max_freq[0] == U32_MAX) limits_dcvs_get_freq_limits(hw); if (cpumask_weight(&hw->online_mask) == 0) continue; idx = 0; for_each_cpu(cpu, &hw->core_map) { cpumask_t cpu_mask = { CPU_BITS_NONE }; if (hw->cdev_data[idx].cdev) { if (hw->cdev_data[idx].cdev || !cpumask_test_cpu(cpu, &hw->online_mask)) { idx++; continue; } cpumask_set_cpu(cpu, &cpu_mask); policy = cpufreq_cpu_get(cpu); if (!policy) { pr_err("no policy for cpu%d\n", cpu); continue; } hw->cdev_data[idx].max_freq = U32_MAX; hw->cdev_data[idx].min_freq = 0; hw->cdev_data[idx].cdev = cpufreq_platform_cooling_register( &cpu_mask, &cd_ops); policy, &cd_ops); if (IS_ERR_OR_NULL(hw->cdev_data[idx].cdev)) { pr_err("CPU:%u cdev register error:%ld\n", cpu, PTR_ERR(hw->cdev_data[idx].cdev)); Loading Loading
Documentation/devicetree/bindings/thermal/qti-cpu-isolation-cdev.txt 0 → 100644 +50 −0 Original line number Diff line number Diff line QTI CPU isolation cooling devices. The CPU isolation cooling device will be used for isolating a CPU on a thermal condition. This cooling device driver can register one cooling device per CPU, which can be used by thermal zone to mitigate. Each child node will represent a cooling device and the child node should point to the CPU, which will be mitigated by that cooling device instance. Properties: - compatible: Usage: required Value type: <string> Definition: should be "qcom,cpu-isolate" Cooling device node: - qcom,cpu: Usage: required Value type: <phandle> Definition: phandle to the CPU device that this cooling device will mitigate. -#cooling-cells: Usage: required Value type: <integer> Definition: Must be 2. Needed for of_thermal as cooling device identifier. Please refer to <devicetree/bindings/thermal/thermal.txt> for more details. Example: qcom,cpu-isolation { compatible = "qcom,cpu-isolate"; cpu0_isolate: cpu0-isolate { qcom,cpu = <&CPU0>; #cooling-cells = <2>; }; cpu1_isolate: cpu1-isolate { qcom,cpu = <&CPU1>; #cooling-cells = <2>; }; cpu2_isolate: cpu2-isolate { qcom,cpu = <&CPU2>; #cooling-cells = <2>; }; cpu3_isolate: cpu3-isolate { qcom,cpu = <&CPU3>; #cooling-cells = <2>; }; };
drivers/thermal/qcom/msm_lmh_dcvs.c +11 −8 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */ #define pr_fmt(fmt) "%s:%s " fmt, KBUILD_MODNAME, __func__ Loading @@ -21,6 +21,7 @@ #include <linux/cpu_cooling.h> #include <linux/atomic.h> #include <linux/regulator/consumer.h> #include <linux/cpufreq.h> #include <asm/smp_plat.h> #include <asm/cacheflush.h> Loading Loading @@ -401,28 +402,30 @@ static void register_cooling_device(struct work_struct *work) { struct limits_dcvs_hw *hw; unsigned int cpu = 0, idx = 0; struct cpufreq_policy *policy = NULL; mutex_lock(&lmh_dcvs_list_access); list_for_each_entry(hw, &lmh_dcvs_hw_list, list) { if (hw->max_freq[0] == U32_MAX) limits_dcvs_get_freq_limits(hw); if (cpumask_weight(&hw->online_mask) == 0) continue; idx = 0; for_each_cpu(cpu, &hw->core_map) { cpumask_t cpu_mask = { CPU_BITS_NONE }; if (hw->cdev_data[idx].cdev) { if (hw->cdev_data[idx].cdev || !cpumask_test_cpu(cpu, &hw->online_mask)) { idx++; continue; } cpumask_set_cpu(cpu, &cpu_mask); policy = cpufreq_cpu_get(cpu); if (!policy) { pr_err("no policy for cpu%d\n", cpu); continue; } hw->cdev_data[idx].max_freq = U32_MAX; hw->cdev_data[idx].min_freq = 0; hw->cdev_data[idx].cdev = cpufreq_platform_cooling_register( &cpu_mask, &cd_ops); policy, &cd_ops); if (IS_ERR_OR_NULL(hw->cdev_data[idx].cdev)) { pr_err("CPU:%u cdev register error:%ld\n", cpu, PTR_ERR(hw->cdev_data[idx].cdev)); Loading