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

Commit 9ad55cd9 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge back earlier cpufreq material for v4.5.

parents a7def561 4157c2fc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -159,8 +159,8 @@ to be strictly associated with a P-state.

2.2 cpuinfo_transition_latency:
-------------------------------
The cpuinfo_transition_latency field is 0. The PCC specification does
not include a field to expose this value currently.
The cpuinfo_transition_latency field is CPUFREQ_ETERNAL. The PCC specification
does not include a field to expose this value currently.

2.3 cpuinfo_cur_freq:
---------------------
+17 −0
Original line number Diff line number Diff line
@@ -242,6 +242,23 @@ nodes to be present and contain the properties described below.
		Definition: Specifies the syscon node controlling the cpu core
			    power domains.

	- dynamic-power-coefficient
		Usage: optional
		Value type: <prop-encoded-array>
		Definition: A u32 value that represents the running time dynamic
			    power coefficient in units of mW/MHz/uVolt^2. The
			    coefficient can either be calculated from power
			    measurements or derived by analysis.

			    The dynamic power consumption of the CPU  is
			    proportional to the square of the Voltage (V) and
			    the clock frequency (f). The coefficient is used to
			    calculate the dynamic power as below -

			    Pdyn = dynamic-power-coefficient * V^2 * f

			    where voltage is in uV, frequency is in MHz.

Example 1 (dual-cluster big.LITTLE system 32-bit):

	cpus {
+91 −0
Original line number Diff line number Diff line
Binding for ST's CPUFreq driver
===============================

ST's CPUFreq driver attempts to read 'process' and 'version' attributes
from the SoC, then supplies the OPP framework with 'prop' and 'supported
hardware' information respectively.  The framework is then able to read
the DT and operate in the usual way.

For more information about the expected DT format [See: ../opp/opp.txt].

Frequency Scaling only
----------------------

No vendor specific driver required for this.

Located in CPU's node:

- operating-points		: [See: ../power/opp.txt]

Example [safe]
--------------

cpus {
	cpu@0 {
				 /* kHz     uV   */
		operating-points = <1500000 0
				    1200000 0
				    800000  0
				    500000  0>;
	};
};

Dynamic Voltage and Frequency Scaling (DVFS)
--------------------------------------------

This requires the ST CPUFreq driver to supply 'process' and 'version' info.

Located in CPU's node:

- operating-points-v2		: [See ../power/opp.txt]

Example [unsafe]
----------------

cpus {
	cpu@0 {
		operating-points-v2	= <&cpu0_opp_table>;
	};
};

cpu0_opp_table: opp_table {
	compatible = "operating-points-v2";

	/* ############################################################### */
	/* # WARNING: Do not attempt to copy/replicate these nodes,      # */
	/* #          they are only to be supplied by the bootloader !!! # */
	/* ############################################################### */
	opp0 {
		/*			   Major       Minor       Substrate */
		/*			   2           all         all       */
		opp-supported-hw	= <0x00000004  0xffffffff  0xffffffff>;
		opp-hz			= /bits/ 64 <1500000000>;
		clock-latency-ns	= <10000000>;

		opp-microvolt-pcode0	= <1200000>;
		opp-microvolt-pcode1	= <1200000>;
		opp-microvolt-pcode2	= <1200000>;
		opp-microvolt-pcode3	= <1200000>;
		opp-microvolt-pcode4	= <1170000>;
		opp-microvolt-pcode5	= <1140000>;
		opp-microvolt-pcode6	= <1100000>;
		opp-microvolt-pcode7	= <1070000>;
	};

	opp1 {
		/*			   Major       Minor       Substrate */
		/*			   all         all         all       */
		opp-supported-hw	= <0xffffffff  0xffffffff  0xffffffff>;
		opp-hz			= /bits/ 64 <1200000000>;
		clock-latency-ns	= <10000000>;

		opp-microvolt-pcode0	= <1110000>;
		opp-microvolt-pcode1	= <1150000>;
		opp-microvolt-pcode2	= <1100000>;
		opp-microvolt-pcode3	= <1080000>;
		opp-microvolt-pcode4	= <1040000>;
		opp-microvolt-pcode5	= <1020000>;
		opp-microvolt-pcode6	= <980000>;
		opp-microvolt-pcode7	= <930000>;
	};
};
+93 −39
Original line number Diff line number Diff line
@@ -45,21 +45,10 @@ Devices supporting OPPs must set their "operating-points-v2" property with
phandle to a OPP table in their DT node. The OPP core will use this phandle to
find the operating points for the device.

Devices may want to choose OPP tables at runtime and so can provide a list of
phandles here. But only *one* of them should be chosen at runtime. This must be
accompanied by a corresponding "operating-points-names" property, to uniquely
identify the OPP tables.

If required, this can be extended for SoC vendor specfic bindings. Such bindings
should be documented as Documentation/devicetree/bindings/power/<vendor>-opp.txt
and should have a compatible description like: "operating-points-v2-<vendor>".

Optional properties:
- operating-points-names: Names of OPP tables (required if multiple OPP
  tables are present), to uniquely identify them. The same list must be present
  for all the CPUs which are sharing clock/voltage rails and hence the OPP
  tables.

* OPP Table Node

This describes the OPPs belonging to a device. This node can have following
@@ -100,6 +89,14 @@ Optional properties:
  Entries for multiple regulators must be present in the same order as
  regulators are specified in device's DT node.

- opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to
  the above opp-microvolt property, but allows multiple voltage ranges to be
  provided for the same OPP. At runtime, the platform can pick a <name> and
  matching opp-microvolt-<name> property will be enabled for all OPPs. If the
  platform doesn't pick a specific <name> or the <name> doesn't match with any
  opp-microvolt-<name> properties, then opp-microvolt property shall be used, if
  present.

- opp-microamp: The maximum current drawn by the device in microamperes
  considering system specific parameters (such as transients, process, aging,
  maximum operating temperature range etc.) as necessary. This may be used to
@@ -112,6 +109,9 @@ Optional properties:
  for few regulators, then this should be marked as zero for them. If it isn't
  required for any regulator, then this property need not be present.

- opp-microamp-<name>: Named opp-microamp property. Similar to
  opp-microvolt-<name> property, but for microamp instead.

- clock-latency-ns: Specifies the maximum possible transition latency (in
  nanoseconds) for switching to this OPP from any other OPP.

@@ -123,6 +123,26 @@ Optional properties:
- opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
  the table should have this.

- opp-supported-hw: This enables us to select only a subset of OPPs from the
  larger OPP table, based on what version of the hardware we are running on. We
  still can't have multiple nodes with the same opp-hz value in OPP table.

  It's an user defined array containing a hierarchy of hardware version numbers,
  supported by the OPP. For example: a platform with hierarchy of three levels
  of versions (A, B and C), this field should be like <X Y Z>, where X
  corresponds to Version hierarchy A, Y corresponds to version hierarchy B and Z
  corresponds to version hierarchy C.

  Each level of hierarchy is represented by a 32 bit value, and so there can be
  only 32 different supported version per hierarchy. i.e. 1 bit per version. A
  value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
  level. And a value of 0x00000000 will disable the OPP completely, and so we
  never want that to happen.

  If 32 values aren't sufficient for a version hierarchy, than that version
  hierarchy can be contained in multiple 32 bit values. i.e. <X Y Z1 Z2> in the
  above example, Z1 & Z2 refer to the version hierarchy Z.

- status: Marks the node enabled/disabled.

Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
@@ -157,20 +177,20 @@ Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
		compatible = "operating-points-v2";
		opp-shared;

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000 975000 985000>;
			opp-microamp = <70000>;
			clock-latency-ns = <300000>;
			opp-suspend;
		};
		opp01 {
		opp@1100000000 {
			opp-hz = /bits/ 64 <1100000000>;
			opp-microvolt = <980000 1000000 1010000>;
			opp-microamp = <80000>;
			clock-latency-ns = <310000>;
		};
		opp02 {
		opp@1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt = <1025000>;
			clock-latency-ns = <290000>;
@@ -236,20 +256,20 @@ independently.
		 * independently.
		 */

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000 975000 985000>;
			opp-microamp = <70000>;
			clock-latency-ns = <300000>;
			opp-suspend;
		};
		opp01 {
		opp@1100000000 {
			opp-hz = /bits/ 64 <1100000000>;
			opp-microvolt = <980000 1000000 1010000>;
			opp-microamp = <80000>;
			clock-latency-ns = <310000>;
		};
		opp02 {
		opp@1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt = <1025000>;
			opp-microamp = <90000;
@@ -312,20 +332,20 @@ DVFS state together.
		compatible = "operating-points-v2";
		opp-shared;

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000 975000 985000>;
			opp-microamp = <70000>;
			clock-latency-ns = <300000>;
			opp-suspend;
		};
		opp01 {
		opp@1100000000 {
			opp-hz = /bits/ 64 <1100000000>;
			opp-microvolt = <980000 1000000 1010000>;
			opp-microamp = <80000>;
			clock-latency-ns = <310000>;
		};
		opp02 {
		opp@1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt = <1025000>;
			opp-microamp = <90000>;
@@ -338,20 +358,20 @@ DVFS state together.
		compatible = "operating-points-v2";
		opp-shared;

		opp10 {
		opp@1300000000 {
			opp-hz = /bits/ 64 <1300000000>;
			opp-microvolt = <1045000 1050000 1055000>;
			opp-microamp = <95000>;
			clock-latency-ns = <400000>;
			opp-suspend;
		};
		opp11 {
		opp@1400000000 {
			opp-hz = /bits/ 64 <1400000000>;
			opp-microvolt = <1075000>;
			opp-microamp = <100000>;
			clock-latency-ns = <400000>;
		};
		opp12 {
		opp@1500000000 {
			opp-hz = /bits/ 64 <1500000000>;
			opp-microvolt = <1010000 1100000 1110000>;
			opp-microamp = <95000>;
@@ -378,7 +398,7 @@ Example 4: Handling multiple regulators
		compatible = "operating-points-v2";
		opp-shared;

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000>, /* Supply 0 */
					<960000>, /* Supply 1 */
@@ -391,7 +411,7 @@ Example 4: Handling multiple regulators

		/* OR */

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000 975000 985000>, /* Supply 0 */
					<960000 965000 975000>, /* Supply 1 */
@@ -404,7 +424,7 @@ Example 4: Handling multiple regulators

		/* OR */

		opp00 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <970000 975000 985000>, /* Supply 0 */
					<960000 965000 975000>, /* Supply 1 */
@@ -417,7 +437,8 @@ Example 4: Handling multiple regulators
	};
};

Example 5: Multiple OPP tables
Example 5: opp-supported-hw
(example: three level hierarchy of versions: cuts, substrate and process)

/ {
	cpus {
@@ -426,40 +447,73 @@ Example 5: Multiple OPP tables
			...

			cpu-supply = <&cpu_supply>
			operating-points-v2 = <&cpu0_opp_table_slow>, <&cpu0_opp_table_fast>;
			operating-points-names = "slow", "fast";
			operating-points-v2 = <&cpu0_opp_table_slow>;
		};
	};

	cpu0_opp_table_slow: opp_table_slow {
	opp_table {
		compatible = "operating-points-v2";
		status = "okay";
		opp-shared;

		opp00 {
		opp@600000000 {
			/*
			 * Supports all substrate and process versions for 0xF
			 * cuts, i.e. only first four cuts.
			 */
			opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
			opp-hz = /bits/ 64 <600000000>;
			opp-microvolt = <900000 915000 925000>;
			...
		};

		opp01 {
		opp@800000000 {
			/*
			 * Supports:
			 * - cuts: only one, 6th cut (represented by 6th bit).
			 * - substrate: supports 16 different substrate versions
			 * - process: supports 9 different process versions
			 */
			opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0>
			opp-hz = /bits/ 64 <800000000>;
			opp-microvolt = <900000 915000 925000>;
			...
		};
	};
};

	cpu0_opp_table_fast: opp_table_fast {
Example 6: opp-microvolt-<name>, opp-microamp-<name>:
(example: device with two possible microvolt ranges: slow and fast)

/ {
	cpus {
		cpu@0 {
			compatible = "arm,cortex-a7";
			...

			operating-points-v2 = <&cpu0_opp_table>;
		};
	};

	cpu0_opp_table: opp_table0 {
		compatible = "operating-points-v2";
		status = "okay";
		opp-shared;

		opp10 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			...
			opp-microvolt-slow = <900000 915000 925000>;
			opp-microvolt-fast = <970000 975000 985000>;
			opp-microamp-slow =  <70000>;
			opp-microamp-fast =  <71000>;
		};

		opp11 {
			opp-hz = /bits/ 64 <1100000000>;
			...
		opp@1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt-slow = <900000 915000 925000>, /* Supply vcc0 */
					      <910000 925000 935000>; /* Supply vcc1 */
			opp-microvolt-fast = <970000 975000 985000>, /* Supply vcc0 */
					     <960000 965000 975000>; /* Supply vcc1 */
			opp-microamp =  <70000>; /* Will be used for both slow/fast */
		};
	};
};
+14 −14
Original line number Diff line number Diff line
@@ -64,73 +64,73 @@
		compatible = "operating-points-v2";
		opp-shared;

		opp00 {
		opp@200000000 {
			opp-hz = /bits/ 64 <200000000>;
			opp-microvolt = <900000>;
			clock-latency-ns = <200000>;
		};
		opp01 {
		opp@300000000 {
			opp-hz = /bits/ 64 <300000000>;
			opp-microvolt = <900000>;
			clock-latency-ns = <200000>;
		};
		opp02 {
		opp@400000000 {
			opp-hz = /bits/ 64 <400000000>;
			opp-microvolt = <925000>;
			clock-latency-ns = <200000>;
		};
		opp03 {
		opp@500000000 {
			opp-hz = /bits/ 64 <500000000>;
			opp-microvolt = <950000>;
			clock-latency-ns = <200000>;
		};
		opp04 {
		opp@600000000 {
			opp-hz = /bits/ 64 <600000000>;
			opp-microvolt = <975000>;
			clock-latency-ns = <200000>;
		};
		opp05 {
		opp@700000000 {
			opp-hz = /bits/ 64 <700000000>;
			opp-microvolt = <987500>;
			clock-latency-ns = <200000>;
		};
		opp06 {
		opp@800000000 {
			opp-hz = /bits/ 64 <800000000>;
			opp-microvolt = <1000000>;
			clock-latency-ns = <200000>;
			opp-suspend;
		};
		opp07 {
		opp@900000000 {
			opp-hz = /bits/ 64 <900000000>;
			opp-microvolt = <1037500>;
			clock-latency-ns = <200000>;
		};
		opp08 {
		opp@1000000000 {
			opp-hz = /bits/ 64 <1000000000>;
			opp-microvolt = <1087500>;
			clock-latency-ns = <200000>;
		};
		opp09 {
		opp@1100000000 {
			opp-hz = /bits/ 64 <1100000000>;
			opp-microvolt = <1137500>;
			clock-latency-ns = <200000>;
		};
		opp10 {
		opp@1200000000 {
			opp-hz = /bits/ 64 <1200000000>;
			opp-microvolt = <1187500>;
			clock-latency-ns = <200000>;
		};
		opp11 {
		opp@1300000000 {
			opp-hz = /bits/ 64 <1300000000>;
			opp-microvolt = <1250000>;
			clock-latency-ns = <200000>;
		};
		opp12 {
		opp@1400000000 {
			opp-hz = /bits/ 64 <1400000000>;
			opp-microvolt = <1287500>;
			clock-latency-ns = <200000>;
		};
		opp13 {
		opp@1500000000 {
			opp-hz = /bits/ 64 <1500000000>;
			opp-microvolt = <1350000>;
			clock-latency-ns = <200000>;
Loading