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

Commit 579f3ae0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "regulator: cpr-regulator: Add a per cpr corner to mem-acc corner map"

parents 6bd008ac a3d8f517
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -554,6 +554,9 @@ Optional properties:
				This property is required if qcom,cpr-fuse-init-voltage is present.
				This property is required if qcom,cpr-fuse-init-voltage is present.
- mem-acc-supply:		Regulator to vote for the memory accelerator configuration.
- mem-acc-supply:		Regulator to vote for the memory accelerator configuration.
				Not Present: memory accelerator configuration not supported.
				Not Present: memory accelerator configuration not supported.
- qcom,mem-acc-corner-map:	Array of integer which defines the mapping from mem-acc corner value for each
				virtual corner. Each element is a mem-acc state for the corresponding virtual corner.
				The elements in the array are ordered from lowest voltage corner to highest voltage corner.
- qcom,fuse-remap-source:	Array of quadruples in which each quadruple specifies a fuse location to
- qcom,fuse-remap-source:	Array of quadruples in which each quadruple specifies a fuse location to
				remap.  The 4 elements in one quadruple are:
				remap.  The 4 elements in one quadruple are:
				[0]: => the fuse row number of the bits
				[0]: => the fuse row number of the bits
+33 −4
Original line number Original line Diff line number Diff line
@@ -298,6 +298,7 @@ struct cpr_regulator {
	int		*corner_map;
	int		*corner_map;
	u32		num_corners;
	u32		num_corners;
	int		*quot_adjust;
	int		*quot_adjust;
	int		*mem_acc_corner_map;


	int			num_adj_cpus;
	int			num_adj_cpus;
	int			online_cpus;
	int			online_cpus;
@@ -701,7 +702,7 @@ static int cpr_scale_voltage(struct cpr_regulator *cpr_vreg, int corner,
			     int new_apc_volt, enum voltage_change_dir dir)
			     int new_apc_volt, enum voltage_change_dir dir)
{
{
	int rc = 0, vdd_mx_vmin = 0;
	int rc = 0, vdd_mx_vmin = 0;
	int fuse_corner = cpr_vreg->corner_map[corner];
	int mem_acc_corner = cpr_vreg->mem_acc_corner_map[corner];
	int apc_corner;
	int apc_corner;


	/* Determine the vdd_mx voltage */
	/* Determine the vdd_mx voltage */
@@ -711,7 +712,7 @@ static int cpr_scale_voltage(struct cpr_regulator *cpr_vreg, int corner,
	if (dir == DOWN) {
	if (dir == DOWN) {
		if (!rc && cpr_vreg->mem_acc_vreg)
		if (!rc && cpr_vreg->mem_acc_vreg)
			rc = regulator_set_voltage(cpr_vreg->mem_acc_vreg,
			rc = regulator_set_voltage(cpr_vreg->mem_acc_vreg,
					fuse_corner, fuse_corner);
					mem_acc_corner, mem_acc_corner);
		if (!rc && cpr_vreg->rpm_apc_vreg) {
		if (!rc && cpr_vreg->rpm_apc_vreg) {
			apc_corner = cpr_vreg->rpm_apc_corner_map[corner];
			apc_corner = cpr_vreg->rpm_apc_corner_map[corner];
			rc = regulator_set_voltage(cpr_vreg->rpm_apc_vreg,
			rc = regulator_set_voltage(cpr_vreg->rpm_apc_vreg,
@@ -733,7 +734,7 @@ static int cpr_scale_voltage(struct cpr_regulator *cpr_vreg, int corner,
	if (dir == UP) {
	if (dir == UP) {
		if (!rc && cpr_vreg->mem_acc_vreg)
		if (!rc && cpr_vreg->mem_acc_vreg)
			rc = regulator_set_voltage(cpr_vreg->mem_acc_vreg,
			rc = regulator_set_voltage(cpr_vreg->mem_acc_vreg,
					fuse_corner, fuse_corner);
					mem_acc_corner, mem_acc_corner);
		if (!rc && cpr_vreg->rpm_apc_vreg) {
		if (!rc && cpr_vreg->rpm_apc_vreg) {
			apc_corner = cpr_vreg->rpm_apc_corner_map[corner];
			apc_corner = cpr_vreg->rpm_apc_corner_map[corner];
			rc = regulator_set_voltage(cpr_vreg->rpm_apc_vreg,
			rc = regulator_set_voltage(cpr_vreg->rpm_apc_vreg,
@@ -4583,7 +4584,9 @@ static int cpr_voltage_plan_init(struct platform_device *pdev,
static int cpr_mem_acc_init(struct platform_device *pdev,
static int cpr_mem_acc_init(struct platform_device *pdev,
				struct cpr_regulator *cpr_vreg)
				struct cpr_regulator *cpr_vreg)
{
{
	int rc;
	int rc, size;
	struct property *prop;
	char *corner_map_str;


	if (of_find_property(pdev->dev.of_node, "mem-acc-supply", NULL)) {
	if (of_find_property(pdev->dev.of_node, "mem-acc-supply", NULL)) {
		cpr_vreg->mem_acc_vreg = devm_regulator_get(&pdev->dev,
		cpr_vreg->mem_acc_vreg = devm_regulator_get(&pdev->dev,
@@ -4597,6 +4600,32 @@ static int cpr_mem_acc_init(struct platform_device *pdev,
			return rc;
			return rc;
		}
		}
	}
	}

	corner_map_str = "qcom,mem-acc-corner-map";
	prop = of_find_property(pdev->dev.of_node, corner_map_str, NULL);
	if (!prop) {
		corner_map_str = "qcom,cpr-corner-map";
		prop = of_find_property(pdev->dev.of_node, corner_map_str,
					NULL);
		if (!prop) {
			cpr_err(cpr_vreg, "qcom,cpr-corner-map missing\n");
			return -EINVAL;
		}
	}

	size = prop->length / sizeof(u32);
	cpr_vreg->mem_acc_corner_map = devm_kzalloc(&pdev->dev,
					sizeof(int) * (size + 1),
					GFP_KERNEL);

	rc = of_property_read_u32_array(pdev->dev.of_node, corner_map_str,
			&cpr_vreg->mem_acc_corner_map[CPR_FUSE_CORNER_MIN],
			size);
	if (rc) {
		cpr_err(cpr_vreg, "%s missing, rc = %d\n", corner_map_str, rc);
		return rc;
	}

	return 0;
	return 0;
}
}