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

Commit 3d278ad8 authored by Tirupathi Reddy's avatar Tirupathi Reddy Committed by Gerrit - the friendly Code Review server
Browse files

regulator: cpr4: add online-core and temp based voltage adjustment support



Add support for hardware managed per-online-core and per-temperature
voltage adjustment. These adjustment methods may be used together or
independently. The configuration data for these adjustments including
the amount of adjustment for a given corner should be parsed from device
tree. Update the cpr3-regulator driver so that it writes the adjustment
values when enabled into the SDELTA hardware registers.

Change-Id: Idae9018f6a185202d38d210834ca337991fe83d9
Signed-off-by: default avatarTirupathi Reddy <tirupath@codeaurora.org>
parent 1fdcf773
Loading
Loading
Loading
Loading
+167 −0
Original line number Diff line number Diff line
@@ -112,6 +112,40 @@ APSS specific properties:
		    do not use PMIC voltage control register LSBs per actually
		    unique PMIC regulator output voltage.

- qcom,cpr-temp-point-map
	Usage:      required if qcom,corner-allow-temp-adjustment is specified
		    for at least one of the CPR3 regulators.
	Value type: <prop-encoded-array>
	Definition: The temperature points in decidegrees Celsius which indicate
		    the range of temperature bands supported. If t1, t2, and t3
		    are the temperature points, then the temperature bands are:
		    (-inf, t1], (t1, t2], (t2, t3], and (t3, inf).

- qcom,cpr-initial-temp-band
	Usage:      required if qcom,corner-allow-temp-adjustment is specified
		    for at least one of the CPR3 regulators.
	Value type: <u32>
	Definition: The initial temp band considering 0-based index at which
		    the baseline target quotients are derived and fused.

- qcom,cpr-step-quot-fixed
	Usage:      optional
	Value type: <u32>
	Definition: Fixed step quotient value used by controller for applying
		    the SDELTA margin adjustments on the programmed target
		    quotient values. The step quotient is the number of
		    additional ring oscillator ticks observed for each
		    qcom,voltage-step increase in vdd-supply output voltage.
		    Supported values: 0 - 63.

- qcom,cpr-voltage-settling-time
	Usage:      optional
	Value type: <u32>
		    The time in nanoseconds that it takes for the vdd-supply
		    voltage to settle after being increased or decreased by
		    qcom,voltage-step microvolts. This is used as the wait
		    time after applying SDELTA voltage margin adjustments.

=================================================
Second Level Nodes - CPR Threads for a Controller
=================================================
@@ -181,6 +215,82 @@ APSS specific properties:
		    interpolated CPR target quotient values.  These values are
		    interpolated between the target quotient Fmax fuse values.

- qcom,corner-allow-core-count-adjustment
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: A list of integer tuples which each define the CPR core
		    count adjustment feature enable state for each voltage
		    corner in order from lowest to highest. Each element in
		    the tuple should be either 0 (per-core-count adjustment
		    not allowed) or 1 (per-core-count adjustment allowed).

		    The list must contain qcom,cpr-fuse-combos number of tuples
		    in which case the tuples are matched to fuse combinations
		    1-to-1 or qcom,cpr-speed-bins number of tuples in which case
		    the tuples are matched to speed bins 1-to-1 or exactly 1
		    tuple which is used regardless of the fuse combination and
		    speed bin found on a given chip.

		    Each tuple must be of the length defined in the
		    corresponding element of the qcom,cpr-corners property or
		    the qcom,cpr-speed-bins property.  A single tuple may only
		    be specified if all of the corner counts in qcom,cpr-corners
		    are the same.

- qcom,max-core-count
	Usage:      required if qcom,corner-allow-core-count-adjustment is
		    specified for this CPR3 regulator.
	Value type: <u32>
	Definition: The maximum number of cores considered for core-count vmin
		    adjustments specified for this regulator voltage corners.

- qcom,corner-allow-temp-adjustment
	Usage:      optional
	Value type: <prop-encoded-array>
	Definition: A list of integer tuples which each define the CPR
		    temperature adjustment feature enable state for each voltage
		    corner in order from lowest to highest. Each element in the
		    tuple should be either 0 (temperature adjustment not
		    allowed) or 1 (temperature adjustment allowed).

		    The list must contain qcom,cpr-fuse-combos number of tuples
		    in which case the tuples are matched to fuse combinations
		    1-to-1 or qcom,cpr-speed-bins number of tuples in which case
		    the tuples are matched to speed bins 1-to-1 or exactly 1
		    tuple which is used regardless of the fuse combination and
		    speed bin found on a given chip.

		    Each tuple must be of the length defined in the
		    corresponding element of the qcom,cpr-corners property or
		    the qcom,cpr-speed-bins property.  A single tuple may only
		    be specified if all of the corner counts in qcom,cpr-corners
		    are the same.

- qcom,cpr-cornerX-temp-core-voltage-adjustment
	Usage:      required if qcom,corner-allow-core-count-adjustment
		    specified for this CPR3 regulator.
	Value type: <prop-encoded-array>
	Definition: A grouping of integer tuple lists for cornerX. The possible
		    values for X are 1 to the max value specified in
		    qcom,cpr-corners. Each tuple defines the temperature based
		    voltage adjustment in microvolts for each temperature band
		    from lowest to highest for a given number of online cores.
		    Each tuple must have a number of elements equal to either
		    (the number of elements in qcom,cpr-ctrl-temp-point-map
		    + 1), if qcom,cpr-ctrl-temp-point-map is specified, or 1.

		    Each tuple list must contain a number of tuples equal to
		    either qcom,max-core-count, if qcom,max-core-count is
		    specified, or 1. The tuples should be ordered from lowest
		    to highest core count.

		    The tuple list grouping must contain qcom,cpr-fuse-combos
		    number of tuple lists in which case the lists are matched to
		    fuse combinations 1-to-1 or qcom,cpr-speed-bins number of
		    tuple lists in which case the lists are matched to
		    speed bins 1-to-1 or exactly 1 list which is used regardless
		    of the fuse combination and speed bin found on a given chip.

=======
Example
=======
@@ -216,6 +326,11 @@ apc_cpr: cpr4-ctrl@b018000 {
	qcom,cpr-enable;
	qcom,cpr-hw-closed-loop;

	qcom,cpr-temp-point-map = <0 250 850>;
	qcom,cpr-initial-temp-band = <3>;
	qcom,cpr-step-quot-fixed = <16>;
	qcom,cpr-voltage-settling-time = <1600>;

	thread@0 {
		qcom,cpr-thread-id = <0>;
		qcom,cpr-consecutive-up = <1>;
@@ -253,6 +368,58 @@ apc_cpr: cpr4-ctrl@b018000 {
			qcom,allow-voltage-interpolation;
			qcom,allow-quotient-interpolation;
			qcom,cpr-scaled-open-loop-voltage-as-ceiling;

			qcom,corner-allow-temp-adjustment =
					<0 0 0 1 0 1 1 1>;

			qcom,corner-allow-core-count-adjustment =
					<0 0 0 0 1 1 1 1>;
			qcom,max-core-count = <8>;
			qcom,cpr-corner4-temp-core-voltage-adjustment =
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>,
				<(-20000) (-10000) (-5000) 0>;
			qcom,cpr-corner5-temp-core-voltage-adjustment =
				<(-50000) (-50000) (-50000) (-50000)>,
				<(-50000) (-50000) (-50000) (-50000)>,
				<(-40000) (-40000) (-40000) (-40000)>,
				<(-40000) (-40000) (-40000) (-40000)>,
				<(-30000) (-30000) (-30000) (-30000)>,
				<(-30000) (-30000) (-30000) (-30000)>,
				<(-20000) (-20000) (-20000) (-20000)>,
				<(-20000) (-20000) (-20000) (-20000)>;
			qcom,cpr-corner6-temp-core-voltage-adjustment =
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-20000) (-10000)  (-5000)       0 >,
				<(-20000) (-10000)  (-5000)       0 >;
			qcom,cpr-corner7-temp-core-voltage-adjustment =
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-20000) (-10000)  (-5000)       0 >,
				<(-20000) (-10000)  (-5000)       0 >;
			qcom,cpr-corner8-temp-core-voltage-adjustment =
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-50000) (-40000) (-30000) (-20000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-40000) (-30000) (-20000) (-10000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-30000) (-20000) (-10000)  (-5000)>,
				<(-20000) (-10000)  (-5000)       0 >,
				<(-20000) (-10000)  (-5000)       0 >;
		};
	};
};