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

Commit c00e21cd authored by Ke Liu's avatar Ke Liu
Browse files

msm: cpr-regulator: add support for increasing cpr quotient value



Add support for the specification of a fixed offset value to be added to
the CPR target quotient for each voltage corner. This can be used to
increase the static voltage margin of a supply managed by a CPR controller.

CRs-fixed: 605127
Change-Id: I0e8f71b35b8ea3bb1724d6e01944015d5fbcb045
Signed-off-by: default avatarKe Liu <keliu@codeaurora.org>
parent 906fa2b2
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -213,10 +213,14 @@ Optional properties:
				the virtual corner value. For example, the first element in the list is the fuse corner
				value that virtual corner 1 maps to.
				This is required if qcom,cpr-quot-adjust-table is present.
- qcom,cpr-quotient-adjustment:	Present: CPR adjusts quotient value. The
				adjustment equals to the quotient adjustment
				in millivolts multiply the KV value.
				Not Present: CPR will not adjust quotient value.
- qcom,cpr-quotient-adjustment:	Array of three elements of CPR quotient adjustments for each corner.
				The 3 quotient adjustments with index[0..2] are:
				[0] => amount to add to the SVS quotient
				[1] => amount to add to the NORM quotient
				[2] => amount to add to the TURBO quotient
				If this property is specified, then the quotient adjustment values are added to the target
				quotient values read from fuses before writing them into the CPR GCNT target control registers.
				This property can be used to add static margin to the voltage rail managed by the CPR controller.
- vdd-apc-optional-prim-supply:	Present: Regulator of highest priority to supply VDD APC power
				Not Present: No such regulator.
- vdd-apc-optional-sec-supply:	Present: Regulator of second highest priority to supply VDD APC power.
+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@
				<1 9 187>,
				<1 10 150>,
				<1 11 75>;
	qcom,cpr-quotient-adjustment = <96>;
	qcom,cpr-quotient-adjustment = <0 96 96>;
	vdd-apc-optional-prim-supply = <&ncp6335d>;
	vdd-apc-optional-sec-supply = <&fan53555>;
};
+12 −8
Original line number Diff line number Diff line
@@ -231,7 +231,6 @@ struct cpr_regulator {
	int		*corner_map;
	u32		num_corners;
	int		*quot_adjust;
	u32		quotient_adjustment;
};

#define CPR_DEBUG_MASK_IRQ	BIT(0)
@@ -1105,7 +1104,7 @@ static int cpr_pvs_init(struct platform_device *pdev,
	u64 efuse_bits;
	int rc, process;
	u32 pvs_fuse[4], pvs_fuse_redun_sel[5];
	u32 init_v, quot_adjust;
	u32 init_v;
	bool redundant;
	size_t pvs_bins;

@@ -1182,11 +1181,6 @@ static int cpr_pvs_init(struct platform_device *pdev,

	cpr_vreg->process = process;

	rc = of_property_read_u32(of_node,
			"qcom,cpr-quotient-adjustment", &quot_adjust);
	if (!rc)
		cpr_vreg->quotient_adjustment = quot_adjust;

	return 0;
}

@@ -1401,6 +1395,7 @@ static int cpr_init_cpr_efuse(struct platform_device *pdev,
	int bp_ro_sel[CPR_FUSE_CORNER_MAX];
	u32 ro_sel, val;
	u64 fuse_bits, fuse_bits_2;
	u32 quot_adjust[CPR_FUSE_CORNER_MAX];

	rc = of_property_read_u32_array(of_node, "qcom,cpr-fuse-redun-sel",
					cpr_fuse_redun_sel, 5);
@@ -1502,13 +1497,22 @@ static int cpr_init_cpr_efuse(struct platform_device *pdev,
				& CPR_FUSE_RO_SEL_BITS_MASK;
		val = (fuse_bits >> bp_target_quot[i])
				& CPR_FUSE_TARGET_QUOT_BITS_MASK;
		val += cpr_vreg->quotient_adjustment;
		cpr_vreg->cpr_fuse_target_quot[i] = val;
		cpr_vreg->cpr_fuse_ro_sel[i] = ro_sel;
		pr_info("Corner[%d]: ro_sel = %d, target quot = %d\n",
			i, ro_sel, val);
	}

	rc = of_property_read_u32_array(of_node, "qcom,cpr-quotient-adjustment",
				&quot_adjust[1], CPR_FUSE_CORNER_MAX - 1);
	if (!rc) {
		for (i = CPR_FUSE_CORNER_SVS; i < CPR_FUSE_CORNER_MAX; i++) {
			cpr_vreg->cpr_fuse_target_quot[i] += quot_adjust[i];
			pr_info("Corner[%d]: adjusted target quot = %d\n",
				i, cpr_vreg->cpr_fuse_target_quot[i]);
		}
	}

	if (cpr_vreg->flags & FLAGS_UPLIFT_QUOT_VOLT) {
		cpr_voltage_uplift_wa_inc_quot(cpr_vreg, of_node);
		for (i = CPR_FUSE_CORNER_SVS; i < CPR_FUSE_CORNER_MAX; i++) {