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

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

Merge changes If3fe9e08,I81909845,Ib76c789c into msm-next

* changes:
  regulator: rpmh-regulator: update ARC voltage level masking logic
  regulator: rpmh-regulator: add support for min dropout voltage
  regulator: add rpmh-regulator driver
parents 5b35418b f2367b70
Loading
Loading
Loading
Loading
+269 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. RPMh Regulators

rpmh-regulator devices support PMIC regulator management via the VRM and ARC
RPMh accelerators.  The APPS processor communicates with these hardware blocks
via an RSC using command packets.  The VRM allows changing four parameters for
a given regulator: enable state, output voltage, operating mode, and minimum
headroom voltage.  The ARC allows changing only a single parameter for a given
regulator: its operating level.  This operating level is fed into CPR which then
decides upon a final explicit voltage for the regulator.

=======================
Required Node Structure
=======================

RPMh regulators must be described in two levels of device nodes.  The first
level describes the interface with RPMh (mailbox and resource).  The second
level describes properties of one regulator framework interface (of potentially
many) for the regulator resource.

==================================
First Level Nodes - RPMh Interface
==================================

- compatible
	Usage:      required
	Value type: <string>
	Definition: Must be "qcom,rpmh-vrm-regulator" or
		    "qcom,rpmh-arc-regulator" depending upon the hardware type,
		    VRM or ARC, of the RPMh managed regulator resource.

- mboxes
	Usage:      required
	Value type: <prop-encoded-array>
	Definition: RPMh mailbox phandle and channel indentifiers.  The channel
		    should always be 0.

- qcom,resource-name
	Usage:      required
	Value type: <string>
	Definition: RPMh resource name which encodes the the specific instance
		    of a given type of regulator (LDO, SMPS, VS, etc) within
		    a particular PMIC found in the system.  This name must match
		    to one that is defined by the bootloader.

- qcom,use-awake-state
	Usage:      optional
	Value type: <empty>
	Definition: Boolean flag indicating that active set requests should be
		    made using the awake state instead of the active-only state.
		    This should be used for RSC's which do not have an AMC.

- qcom,always-wait-for-ack
	Usage:      optional
	Value type: <empty>
	Definition: Boolean flag which indicates that the application processor
		    must wait for an ACK or a NACK from RPMh for every request
		    sent for this regulator including those which are for a
		    strictly lower power state.

- <regulator-name>-parent-supply
	Usage:      optional
	Value type: <phandle>
	Definition: phandle of the parent supply regulator of one of the
		    regulators for this RPMh resource.  The property name is
		    defined by the value specified for the regulator-name
		    property.

- qcom,supported-modes
	Usage:      optional; VRM regulators only
	Value type: <prop-encoded-array>
	Definition: A list of integers specifying the PMIC regulator modes
		    supported by this regulator.  Supported values are
		    RPMH_REGULATOR_MODE_* (i.e. 0 to 7).  Elements must be
		    specified in order from lowest to highest.

- qcom,mode-threshold-currents
	Usage:      required if qcom,supported-modes is specified
	Value type: <prop-encoded-array>
	Definition: A list of integers specifying minimum allowed current in
		    microamps for each of the modes listed in
		    qcom,supported-modes.  The first element should always be 0.
		    Elements must be specified in order from lowest to highest.

- qcom,send-defaults
	Usage:      optional
	Value type: <empty>
	Definition: Boolean flag which indicates that the initial parameter
		    values should be sent to RPMh before consumers make their
		    own requests.  If this flag is not specified, then initial
		    parameters values will only be sent after some consumer
		    makes a request.

=========================================
Second Level Nodes - Regulator Interfaces
=========================================

- regulator-name
	Usage:      required
	Value type: <string>
	Definition: Specifies the name for this RPMh regulator.

- regulator-min-microvolt
	Usage:      required
	Value type: <u32>
	Definition: For VRM resources, this is the minimum supported voltage in
		    microvolts.  For ARC resources, this is the minimum
		    supported voltage level from RPMH_REGULATOR_LEVEL_*.

- regulator-max-microvolt
	Usage:      required
	Value type: <u32>
	Definition: For VRM resources, this is the maximum supported voltage in
		    microvolts.  For ARC resources, this is the maximum
		    supported voltage level from RPMH_REGULATOR_LEVEL_*.

 - regulator-enable-ramp-delay
	Usage:      optional
	Value type: <u32>
	Definition: For VRM resources, the time in microseconds to delay after
		    enabling a regulator.

- qcom,set
	Usage:      required
	Value type: <u32>
	Definition: Specifies which sets that requests made with this regulator
		    interface should be sent to.  Regulator requests sent in the
		    active set take effect immediately.  Requests sent in the
		    sleep set take effect when the Apps processor transitions
		    into RPMh assisted power collapse.  Supported values are
		    one of RPMH_REGULATOR_SET_* (i.e. 1, 2, or 3).

- qcom,init-enable
	Usage:      optional; VRM regulators only
	Value type: <u32>
	Definition: Specifies the initial enable state to request for a VRM
		    regulator.  Supported values are 0 (regulator disabled) and
		    1 (regulator enabled).

- qcom,init-voltage
	Usage:      optional; VRM regulators only
	Value type: <u32>
	Definition: Specifies the initial voltage in microvolts to request for a
		    VRM regulator.  Supported values are 0 to 8191000.

- qcom,init-mode
	Usage:      optional; VRM regulators only
	Value type: <u32>
	Definition: Specifies the initial mode to request for a VRM regulator.
		    Supported values are RPMH_REGULATOR_MODE_* (i.e. 0 to 7).

- qcom,init-headroom-voltage
	Usage:      optional; VRM regulators only
	Value type: <u32>
	Definition: Specifies the initial headroom voltage in microvolts to
		    request for a VRM regulator.  RPMh ensures that the parent
		    of this regulator outputs a voltage high enough to satisfy
		    the requested headroom.  Supported values are 0 to 511000.

- qcom,init-voltage-level
	Usage:      optional; ARC regulators only
	Value type: <u32>
	Definition: Specifies the initial voltage level to request for an ARC
		    regulator.  Supported values are RPMH_REGULATOR_LEVEL_*
		    (i.e. 1 to ~513).

- qcom,min-dropout-voltage
	Usage:      optional; VRM regulators only
	Value type: <u32>
	Definition: Specifies the minimum voltage in microvolts that the parent
		    supply regulator must output above the output of this
		    regulator.  It is only meaningful if the property
		    <regulator-name>-parent-supply has been specified in the
		    first level node.

- qcom,min-dropout-voltage-level
	Usage:      optional; ARC regulators only
	Value type: <u32>
	Definition: Specifies the minimum voltage level difference that the
		    parent supply regulator must output above the output of this
		    regulator.  It is only meaningful if the property
		    <regulator-name>-parent-supply has been specified in the
		    first level node.

========
Examples
========

rpmh-regulator-cxlvl {
	compatible = "qcom,rpmh-arc-regulator";
	mboxes = <&apps_rsc 0>;
	qcom,resource-name = "cx.lvl";
	qcom,send-defaults;
	pm8998_s9_level: regulator-s9-level {
		regulator-name = "pm8998_s9_level";
		qcom,set = <RPMH_REGULATOR_SET_ALL>;
		regulator-min-microvolt = <RPMH_REGULATOR_LEVEL_OFF>;
		regulator-max-microvolt = <RPMH_REGULATOR_LEVEL_MAX>;
		qcom,init-voltage-level = <RPMH_REGULATOR_LEVEL_TURBO>;
	};

	pm8998_s9_level_ao: regulator-s9-level-ao {
		regulator-name = "pm8998_s9_level_ao";
		qcom,set = <RPMH_REGULATOR_SET_ACTIVE>;
		regulator-min-microvolt = <RPMH_REGULATOR_LEVEL_OFF>;
		regulator-max-microvolt = <RPMH_REGULATOR_LEVEL_MAX>;
	};
};

rpmh-regulator-smpa2 {
	compatible = "qcom,rpmh-vrm-regulator";
	mboxes = <&apps_rsc 0>;
	qcom,resource-name = "smpa2";
	qcom,supported-modes =
		<RPMH_REGULATOR_MODE_SMPS_AUTO
		 RPMH_REGULATOR_MODE_SMPS_PWM>;
	qcom,mode-threshold-currents = <0 2000000>;
	pm8998_s2: regulator-s2 {
		regulator-name = "pm8998_s2";
		qcom,set = <RPMH_REGULATOR_SET_ALL>;
		regulator-min-microvolt = <1100000>;
		regulator-max-microvolt = <1200000>;
		regulator-enable-ramp-delay = <200>;
		qcom,init-mode = <RPMH_REGULATOR_MODE_SMPS_AUTO>;
		qcom,init-voltage = <1150000>;
	};
};

rpmh-regulator-ldoa3-disp {
	compatible = "qcom,rpmh-vrm-regulator";
	mboxes = <&disp_rsc 0>;
	qcom,use-awake-state;
	qcom,resource-name = "ldoa3";
	qcom,supported-modes =
		<RPMH_REGULATOR_MODE_LDO_LPM
		 RPMH_REGULATOR_MODE_LDO_HPM>;
	qcom,mode-threshold-currents = <0 10000>;
	qcom,always-wait-for-ack;
	pm8998_l3_disp_ao: regulator-l3-ao {
		regulator-name = "pm8998_l3_disp_ao";
		qcom,set = <RPMH_REGULATOR_SET_ACTIVE>;
		regulator-min-microvolt = <1000000>;
		regulator-max-microvolt = <1200000>;
		qcom,init-voltage = <1000000>;
		qcom,init-headroom-voltage = <60000>;
	};
	pm8998_l3_disp_so: regulator-l3-so {
		regulator-name = "pm8998_l3_disp_so";
		qcom,set = <RPMH_REGULATOR_SET_SLEEP>;
		regulator-min-microvolt = <1000000>;
		regulator-max-microvolt = <1200000>;
		qcom,init-mode = <RPMH_REGULATOR_MODE_LDO_LPM>;
		qcom,init-voltage = <1000000>;
		qcom,init-enable = <0>;
	};
};

rpmh-regulator-ldoa4 {
	compatible = "qcom,rpmh-vrm-regulator";
	mboxes = <&apps_rsc 0>;
	qcom,resource-name = "ldoa4";
	pm8998_l4-parent-supply = <&pm8998_s2>;
	pm8998_l4: regulator-l4 {
		regulator-name = "pm8998_l4";
		qcom,set = <RPMH_REGULATOR_SET_ALL>;
		regulator-min-microvolt = <1000000>;
		regulator-max-microvolt = <1000000>;
		qcom,init-voltage = <1000000>;
	};
};
+10 −0
Original line number Diff line number Diff line
@@ -937,6 +937,16 @@ config REGULATOR_WM8994
	  This driver provides support for the voltage regulators on the
	  WM8994 CODEC.

config REGULATOR_RPMH
	tristate "Qualcomm Technologies, Inc. RPMh regulator driver"
	depends on OF
	depends on QTI_RPMH_API
	help
	  This driver supports control of PMIC regulators via the RPMh hardware
	  block found on Qualcomm Technologies Inc. SoCs.  RPMh regulator
	  control allows for voting on regulator state between multiple
	  processors within the SoC.

config REGULATOR_STUB
	tristate "Stub Regulator"
	help
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o

obj-$(CONFIG_REGULATOR_RPMH) += rpmh-regulator.o
obj-$(CONFIG_REGULATOR_STUB) += stub-regulator.o

ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
+1674 −0

File added.

Preview size limit exceeded, changes collapsed.

+28 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
/* This offset is needed as 0 is considered an invalid voltage. */
#define RPMH_REGULATOR_LEVEL_OFFSET	1

/* These levels may be used for RPMH ARC resource regulators */
#define RPMH_REGULATOR_LEVEL_MIN	(0 + RPMH_REGULATOR_LEVEL_OFFSET)

#define RPMH_REGULATOR_LEVEL_OFF	(0 + RPMH_REGULATOR_LEVEL_OFFSET)
@@ -26,8 +27,35 @@
#define RPMH_REGULATOR_LEVEL_SVS_L1	(192 + RPMH_REGULATOR_LEVEL_OFFSET)
#define RPMH_REGULATOR_LEVEL_NOM	(256 + RPMH_REGULATOR_LEVEL_OFFSET)
#define RPMH_REGULATOR_LEVEL_NOM_L1	(320 + RPMH_REGULATOR_LEVEL_OFFSET)
#define RPMH_REGULATOR_LEVEL_NOM_L2	(336 + RPMH_REGULATOR_LEVEL_OFFSET)
#define RPMH_REGULATOR_LEVEL_TURBO	(384 + RPMH_REGULATOR_LEVEL_OFFSET)
#define RPMH_REGULATOR_LEVEL_TURBO_L1	(416 + RPMH_REGULATOR_LEVEL_OFFSET)

#define RPMH_REGULATOR_LEVEL_MAX	(65535 + RPMH_REGULATOR_LEVEL_OFFSET)

/*
 * These set constants may be used as the value for qcom,set of an RPMh
 * resource device.
 */
#define RPMH_REGULATOR_SET_ACTIVE	1
#define RPMH_REGULATOR_SET_SLEEP	2
#define RPMH_REGULATOR_SET_ALL		3

/*
 * These mode constants may be used for qcom,supported-modes and qcom,init-mode
 * properties of an RPMh resource.  Modes should be matched to the physical
 * PMIC regulator type (i.e. LDO, SMPS, or BOB).
 */
#define RPMH_REGULATOR_MODE_LDO_LPM	5
#define RPMH_REGULATOR_MODE_LDO_HPM	7

#define RPMH_REGULATOR_MODE_SMPS_PFM	5
#define RPMH_REGULATOR_MODE_SMPS_AUTO	6
#define RPMH_REGULATOR_MODE_SMPS_PWM	7

#define RPMH_REGULATOR_MODE_BOB_PASS	0
#define RPMH_REGULATOR_MODE_BOB_PFM	1
#define RPMH_REGULATOR_MODE_BOB_AUTO	2
#define RPMH_REGULATOR_MODE_BOB_PWM	3

#endif