Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5795c30f authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

msm: thermal: Add support to online the hotplugged cores



Add support in KTM to online the hotplugged cores when the
thermal condition is cleared.

In newer targets, KTM has the responsibility of
onlining the cores hotplugged due to thermal
condition. This feature is enabled by defining a device
tree property. If this property is not defined, KTM
does the legacy functionality where it doesn't
bring the core back online.

Change-Id: I3c75466774b309846df3176df6029b886bd59896
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 81406751
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -88,6 +88,9 @@ Optional properties
- <consumer_supply_name>-supply = <&phandle_of_regulator>: consumer_supply_name
			is the name that's defined in thermal driver.
			phandle_of_regulator is defined by reuglator device tree.
- qcom,online-hotplug-core: This property should be defined in targets where
			KTM should online cores, which are hotplugged due to
			thermal condition.

Optional child nodes
- qcom,pmic-opt-curr-temp: Threshold temperature for requesting optimum current (request
@@ -251,7 +254,8 @@ Example:
		qcom,mx-restriction-temp = <5>;
		qcom,mx-restriction-temp-hysteresis = <10>;
		qcom,mx-retention-min = <710000>;
		vdd-mx-supply = <&pma8084_s1>
		vdd-mx-supply = <&pma8084_s1>;
		qcom,online-hotplug-core;

		qcom,vdd-dig-rstr{
			qcom,vdd-rstr-reg = "vdd-dig";
+28 −10
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ static bool gfx_phase_ctrl_enabled;
static bool cx_phase_ctrl_enabled;
static bool vdd_mx_enabled;
static bool therm_reset_enabled;
static bool online_core;
static int *tsens_id_map;
static DEFINE_MUTEX(vdd_rstr_mutex);
static DEFINE_MUTEX(psm_mutex);
@@ -1363,8 +1364,7 @@ static int __ref update_offline_cores(int val)
	cpus_offlined = msm_thermal_info.core_control_mask & val;

	for_each_possible_cpu(cpu) {
		if (!(cpus_offlined & BIT(cpu)))
			continue;
		if (cpus_offlined & BIT(cpu)) {
			if (!cpu_online(cpu))
				continue;
			ret = cpu_down(cpu);
@@ -1373,6 +1373,18 @@ static int __ref update_offline_cores(int val)
					cpu, ret);
			else
				pr_debug("Offlined CPU%d\n", cpu);
		} else if (online_core) {
			if (cpu_online(cpu))
				continue;
			ret = cpu_up(cpu);
			if (ret && ret == notifier_to_errno(NOTIFY_BAD))
				pr_debug("Onlining CPU%d is vetoed\n", cpu);
			else if (ret)
				pr_err("Unable to online CPU%d. err:%d\n",
						cpu, ret);
			else
				pr_debug("Onlined CPU%d\n", cpu);
		}
	}
	return ret;
}
@@ -3981,6 +3993,12 @@ static int msm_thermal_dev_probe(struct platform_device *pdev)
	if (ret)
		goto fail;

	key = "qcom,online-hotplug-core";
	if (of_property_read_bool(node, key))
		online_core = true;
	else
		online_core = false;

	key = "qcom,freq-control-mask";
	ret = of_property_read_u32(node, key, &data.bootup_freq_control_mask);