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

Commit 2924b877 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

power: bcl: Add soc low threshold sysfs node to BCL driver



Add soc low threshold sysfs node to add support for configuring
soc low threshold at runtime. It adds below sysfs node
'/sys/devices/soc.0/qcom,bcl.*/soc_low_thresh'.

Change-Id: I4debc34ddde63bc0f842384e03715bc60ddcc59a
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent 0600f6c1
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -853,6 +853,7 @@ show_bcl(ibat_state, bcl_ibat_state, "%d\n")
show_bcl(hotplug_mask, bcl_hotplug_mask, "%d\n")
show_bcl(hotplug_soc_mask, bcl_soc_hotplug_mask, "%d\n")
show_bcl(hotplug_status, bcl_hotplug_request, "%d\n")
show_bcl(soc_low_thresh, soc_low_threshold, "%d\n")

static ssize_t
mode_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -1207,6 +1208,23 @@ static ssize_t hotplug_soc_mask_store(struct device *dev,

	return count;
}

static ssize_t soc_low_thresh_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t count)
{
	int val = 0;
	int ret = 0;

	ret = convert_to_int(buf, &val);
	if (ret)
		return ret;

	soc_low_threshold = val;
	pr_info("bcl soc low threshold updated to %d\n", soc_low_threshold);

	return count;
}

/*
 * BCL device attributes
 */
@@ -1249,6 +1267,7 @@ static struct device_attribute btm_dev_attr[] = {
	__ATTR(hotplug_mask, 0644, hotplug_mask_show, hotplug_mask_store),
	__ATTR(hotplug_soc_mask, 0644, hotplug_soc_mask_show,
		hotplug_soc_mask_store),
	__ATTR(soc_low_thresh, 0644, soc_low_thresh_show, soc_low_thresh_store),
};

static int create_bcl_sysfs(struct bcl_context *bcl)