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

Commit 1435bbcc authored by Ram Chandrasekar's avatar Ram Chandrasekar Committed by Gerrit - the friendly Code Review server
Browse files

power: bcl: Add support to use CPU phandles for hotplug



Add support in BCL module to use phandles to refer the
CPUs that are to be hotplugged during battery current
limiting conditions.

This removes the previous support for using the hotplug
bit mask to input the CPUs to be hotplugged.

Change-Id: I47cd0dd5fd719e75dd350822a796731a524960e0
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent 7dd146b7
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -42,11 +42,9 @@ Optional parameters:
		'vph-high-threshold-uv', 'vph-low-threshold-uv' and
		'thermal-handle' properties should be defined in the
		'qcom,ibat-monitor' node.
- qcom,bcl-hotplug-mask = <hotplug-mask>: Mask indicating the cores to hotplug,
		when battery current limit condition is reached. Here the bits
		0-7 corresponds to cores 0-7 respectively. If the value of the
		bit is set to 1, then the corresponding core will be
		hotplugged on battery current limit condition.
- qcom,bcl-hotplug-list = <hotplug-phandle-list>: List of phandles to the cores
		that are to be hotplugged, when battery current limit condition
		is reached.

Optional nodes:
- qcom,ibat-monitor: This optional node defines all the parameters for the
@@ -112,7 +110,7 @@ For Using BCL peripheral interface:
	qcom,bcl {
		compatible = "qcom,bcl";
		qcom,bcl-framework-interface;
		qcom,bcl-hotplug-mask = <0xFO>;
		qcom,bcl-hotplug-list = <&CPU5 &CPU6 &CPU7>;
		qcom,ibat-monitor {
			high-threshold-uamp = <1500>;
			low-threshold-uamp = <500>;
+16 −8
Original line number Diff line number Diff line
@@ -1138,6 +1138,9 @@ static ssize_t hotplug_mask_store(struct device *dev,
{
	int ret = 0, val = 0;

	if (!bcl_hotplug_enabled)
		return -ENODEV;

	ret = convert_to_int(buf, &val);
	if (ret)
		return ret;
@@ -1549,8 +1552,9 @@ btm_probe_exit:
static int bcl_probe(struct platform_device *pdev)
{
	struct bcl_context *bcl = NULL;
	int ret = 0;
	int ret = 0, i = 0, cpu = 0;
	enum bcl_device_mode bcl_mode = BCL_DEVICE_DISABLED;
	struct device_node *core_phandle = NULL;

	bcl = devm_kzalloc(&pdev->dev, sizeof(struct bcl_context), GFP_KERNEL);
	if (!bcl) {
@@ -1578,15 +1582,19 @@ static int bcl_probe(struct platform_device *pdev)
			bcl_type[BCL_IAVAIL_MONITOR_TYPE]);
	bcl->bcl_poll_interval_msec = BCL_POLL_INTERVAL;

	ret = of_property_read_u32(pdev->dev.of_node,
			"qcom,bcl-hotplug-mask",
			&bcl_hotplug_mask);
	if (ret) {
		bcl_hotplug_enabled = false;
		ret = 0;
	} else {
	core_phandle = of_parse_phandle(pdev->dev.of_node,
			"qcom,bcl-hotplug-list", i++);
	while (core_phandle) {
		bcl_hotplug_enabled = true;
		for_each_possible_cpu(cpu) {
			if (of_get_cpu_node(cpu, NULL) == core_phandle)
				bcl_hotplug_mask |= BIT(cpu);
		}
		core_phandle = of_parse_phandle(pdev->dev.of_node,
			"qcom,bcl-hotplug-list", i++);
	}
	if (!bcl_hotplug_mask)
		bcl_hotplug_enabled = false;

	if (of_property_read_bool(pdev->dev.of_node,
		"qcom,bcl-framework-interface"))