18c2ecf20Sopenharmony_ci* ams AS3722 Power management IC.
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciRequired properties:
48c2ecf20Sopenharmony_ci-------------------
58c2ecf20Sopenharmony_ci- compatible: Must be "ams,as3722".
68c2ecf20Sopenharmony_ci- reg: I2C device address.
78c2ecf20Sopenharmony_ci- interrupt-controller: AS3722 has internal interrupt controller which takes the
88c2ecf20Sopenharmony_ci  interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well
98c2ecf20Sopenharmony_ci  as external input.
108c2ecf20Sopenharmony_ci- #interrupt-cells: Should be set to 2 for IRQ number and flags.
118c2ecf20Sopenharmony_ci  The first cell is the IRQ number. IRQ numbers for different interrupt source
128c2ecf20Sopenharmony_ci  of AS3722 are defined at dt-bindings/mfd/as3722.h
138c2ecf20Sopenharmony_ci  The second cell is the flags, encoded as the trigger masks from binding document
148c2ecf20Sopenharmony_ci	interrupts.txt, using dt-bindings/irq.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciOptional properties:
178c2ecf20Sopenharmony_ci--------------------
188c2ecf20Sopenharmony_ci- ams,enable-internal-int-pullup: Boolean property, to enable internal pullup on
198c2ecf20Sopenharmony_ci	interrupt pin. Missing this will disable internal pullup on INT pin.
208c2ecf20Sopenharmony_ci- ams,enable-internal-i2c-pullup: Boolean property, to enable internal pullup on
218c2ecf20Sopenharmony_ci	i2c scl/sda pins. Missing this will disable internal pullup on i2c
228c2ecf20Sopenharmony_ci	scl/sda lines.
238c2ecf20Sopenharmony_ci- ams,enable-ac-ok-power-on: Boolean property, to enable exit out of power off
248c2ecf20Sopenharmony_ci	mode with AC_OK pin (pin enabled in power off mode).
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciOptional submodule and their properties:
278c2ecf20Sopenharmony_ci=======================================
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciPinmux and GPIO:
308c2ecf20Sopenharmony_ci===============
318c2ecf20Sopenharmony_ciDevice has 8 GPIO pins which can be configured as GPIO as well as the special IO
328c2ecf20Sopenharmony_cifunctions.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciPlease refer to pinctrl-bindings.txt in this directory for details of the
358c2ecf20Sopenharmony_cicommon pinctrl bindings used by client devices, including the meaning of the
368c2ecf20Sopenharmony_ciphrase "pin configuration node".
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciFollowing are properties which is needed if GPIO and pinmux functionality
398c2ecf20Sopenharmony_ciis required:
408c2ecf20Sopenharmony_ci    Required properties:
418c2ecf20Sopenharmony_ci    -------------------
428c2ecf20Sopenharmony_ci	- gpio-controller: Marks the device node as a GPIO controller.
438c2ecf20Sopenharmony_ci	- #gpio-cells: Number of GPIO cells. Refer to binding document
448c2ecf20Sopenharmony_ci			gpio/gpio.txt
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci    Optional properties:
478c2ecf20Sopenharmony_ci    --------------------
488c2ecf20Sopenharmony_ci	Following properties are require if pin control setting is required
498c2ecf20Sopenharmony_ci	at boot.
508c2ecf20Sopenharmony_ci	- pinctrl-names: A pinctrl state named "default" be defined, using the
518c2ecf20Sopenharmony_ci		bindings in pinctrl/pinctrl-bindings.txt.
528c2ecf20Sopenharmony_ci	- pinctrl[0...n]: Properties to contain the phandle that refer to
538c2ecf20Sopenharmony_ci		different nodes of pin control settings. These nodes represents
548c2ecf20Sopenharmony_ci		the pin control setting of state 0 to state n. Each of these
558c2ecf20Sopenharmony_ci		nodes contains different subnodes to represents some desired
568c2ecf20Sopenharmony_ci		configuration for a list of pins. This configuration can
578c2ecf20Sopenharmony_ci		include the mux function to select on those pin(s), and
588c2ecf20Sopenharmony_ci		various pin configuration parameters, such as pull-up,
598c2ecf20Sopenharmony_ci		open drain.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci		Each subnode have following properties:
628c2ecf20Sopenharmony_ci		Required properties:
638c2ecf20Sopenharmony_ci		    - pins: List of pins. Valid values of pins properties are:
648c2ecf20Sopenharmony_ci				gpio0, gpio1, gpio2, gpio3, gpio4, gpio5,
658c2ecf20Sopenharmony_ci				gpio6, gpio7
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci		Optional properties:
688c2ecf20Sopenharmony_ci			function, bias-disable, bias-pull-up, bias-pull-down,
698c2ecf20Sopenharmony_ci			bias-high-impedance, drive-open-drain.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci			Valid values for function properties are:
728c2ecf20Sopenharmony_ci				gpio, interrupt-out, gpio-in-interrupt,
738c2ecf20Sopenharmony_ci				vsup-vbat-low-undebounce-out,
748c2ecf20Sopenharmony_ci				vsup-vbat-low-debounce-out,
758c2ecf20Sopenharmony_ci				voltage-in-standby, oc-pg-sd0, oc-pg-sd6,
768c2ecf20Sopenharmony_ci				powergood-out, pwm-in, pwm-out, clk32k-out,
778c2ecf20Sopenharmony_ci				watchdog-in, soft-reset-in
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciRegulators:
808c2ecf20Sopenharmony_ci===========
818c2ecf20Sopenharmony_ciDevice has multiple DCDC and LDOs. The node "regulators" is require if regulator
828c2ecf20Sopenharmony_cifunctionality is needed.
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciFollowing are properties of regulator subnode.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci    Optional properties:
878c2ecf20Sopenharmony_ci    -------------------
888c2ecf20Sopenharmony_ci	The input supply of regulators are the optional properties on the
898c2ecf20Sopenharmony_ci	regulator node. The input supply of these regulators are provided
908c2ecf20Sopenharmony_ci	through following properties:
918c2ecf20Sopenharmony_ci		vsup-sd2-supply: Input supply for SD2.
928c2ecf20Sopenharmony_ci		vsup-sd3-supply: Input supply for SD3.
938c2ecf20Sopenharmony_ci		vsup-sd4-supply: Input supply for SD4.
948c2ecf20Sopenharmony_ci		vsup-sd5-supply: Input supply for SD5.
958c2ecf20Sopenharmony_ci		vin-ldo0-supply: Input supply for LDO0.
968c2ecf20Sopenharmony_ci		vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
978c2ecf20Sopenharmony_ci		vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
988c2ecf20Sopenharmony_ci		vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
998c2ecf20Sopenharmony_ci		vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
1008c2ecf20Sopenharmony_ci		vin-ldo11-supply: Input supply for LDO11.
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci    Optional sub nodes for regulators:
1038c2ecf20Sopenharmony_ci    ---------------------------------
1048c2ecf20Sopenharmony_ci	The subnodes name is the name of regulator and it must be one of:
1058c2ecf20Sopenharmony_ci	sd[0-6], ldo[0-7], ldo[9-11]
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	Each sub-node should contain the constraints and initialization
1088c2ecf20Sopenharmony_ci	information for that regulator. See regulator.txt for a description
1098c2ecf20Sopenharmony_ci	of standard properties for these sub-nodes.
1108c2ecf20Sopenharmony_ci	Additional optional custom properties  are listed below.
1118c2ecf20Sopenharmony_ci		ams,ext-control: External control of the rail. The option of
1128c2ecf20Sopenharmony_ci			this properties will tell which external input is
1138c2ecf20Sopenharmony_ci			controlling this rail. Valid values are 0, 1, 2 ad 3.
1148c2ecf20Sopenharmony_ci			0: There is no external control of this rail.
1158c2ecf20Sopenharmony_ci			1: Rail is controlled by ENABLE1 input pin.
1168c2ecf20Sopenharmony_ci			2: Rail is controlled by ENABLE2 input pin.
1178c2ecf20Sopenharmony_ci			3: Rail is controlled by ENABLE3 input pin.
1188c2ecf20Sopenharmony_ci			Missing this property on DT will be assume as no
1198c2ecf20Sopenharmony_ci			external control. The external control pin macros
1208c2ecf20Sopenharmony_ci			are defined @dt-bindings/mfd/as3722.h
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci		ams,enable-tracking: Enable tracking with SD1, only supported
1238c2ecf20Sopenharmony_ci			by LDO3.
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ciPower-off:
1268c2ecf20Sopenharmony_ci=========
1278c2ecf20Sopenharmony_ciAS3722 supports the system power off by turning off all its rails.
1288c2ecf20Sopenharmony_ciThe device node should have the following properties to enable this
1298c2ecf20Sopenharmony_cifunctionality
1308c2ecf20Sopenharmony_ciams,system-power-controller: Boolean, to enable the power off functionality
1318c2ecf20Sopenharmony_ci        through this device.
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ciExample:
1348c2ecf20Sopenharmony_ci--------
1358c2ecf20Sopenharmony_ci#include <dt-bindings/mfd/as3722.h>
1368c2ecf20Sopenharmony_ci...
1378c2ecf20Sopenharmony_ciams3722 {
1388c2ecf20Sopenharmony_ci	compatible = "ams,as3722";
1398c2ecf20Sopenharmony_ci	reg = <0x48>;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	ams,system-power-controller;
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci	interrupt-parent = <&intc>;
1448c2ecf20Sopenharmony_ci	interrupt-controller;
1458c2ecf20Sopenharmony_ci	#interrupt-cells = <2>;
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	gpio-controller;
1488c2ecf20Sopenharmony_ci	#gpio-cells = <2>;
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci	pinctrl-names = "default";
1518c2ecf20Sopenharmony_ci	pinctrl-0 = <&as3722_default>;
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci	as3722_default: pinmux {
1548c2ecf20Sopenharmony_ci			gpio0 {
1558c2ecf20Sopenharmony_ci				pins = "gpio0";
1568c2ecf20Sopenharmony_ci				function = "gpio";
1578c2ecf20Sopenharmony_ci				bias-pull-down;
1588c2ecf20Sopenharmony_ci			};
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci			gpio1_2_4_7 {
1618c2ecf20Sopenharmony_ci				pins = "gpio1", "gpio2", "gpio4", "gpio7";
1628c2ecf20Sopenharmony_ci				function = "gpio";
1638c2ecf20Sopenharmony_ci				bias-pull-up;
1648c2ecf20Sopenharmony_ci			};
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci			gpio5 {
1678c2ecf20Sopenharmony_ci				pins = "gpio5";
1688c2ecf20Sopenharmony_ci				function = "clk32k_out";
1698c2ecf20Sopenharmony_ci			};
1708c2ecf20Sopenharmony_ci	}
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci	regulators {
1738c2ecf20Sopenharmony_ci			vsup-sd2-supply = <...>;
1748c2ecf20Sopenharmony_ci			...
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci			sd0 {
1778c2ecf20Sopenharmony_ci				regulator-name = "vdd_cpu";
1788c2ecf20Sopenharmony_ci				regulator-min-microvolt = <700000>;
1798c2ecf20Sopenharmony_ci				regulator-max-microvolt = <1400000>;
1808c2ecf20Sopenharmony_ci				regulator-always-on;
1818c2ecf20Sopenharmony_ci				ams,ext-control = <2>;
1828c2ecf20Sopenharmony_ci			};
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci			sd1 {
1858c2ecf20Sopenharmony_ci				regulator-name = "vdd_core";
1868c2ecf20Sopenharmony_ci				regulator-min-microvolt = <700000>;
1878c2ecf20Sopenharmony_ci				regulator-max-microvolt = <1400000>;
1888c2ecf20Sopenharmony_ci				regulator-always-on;
1898c2ecf20Sopenharmony_ci				ams,ext-control = <1>;
1908c2ecf20Sopenharmony_ci			};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci			sd2 {
1938c2ecf20Sopenharmony_ci				regulator-name = "vddio_ddr";
1948c2ecf20Sopenharmony_ci				regulator-min-microvolt = <1350000>;
1958c2ecf20Sopenharmony_ci				regulator-max-microvolt = <1350000>;
1968c2ecf20Sopenharmony_ci				regulator-always-on;
1978c2ecf20Sopenharmony_ci			};
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci			sd4 {
2008c2ecf20Sopenharmony_ci				regulator-name = "avdd-hdmi-pex";
2018c2ecf20Sopenharmony_ci				regulator-min-microvolt = <1050000>;
2028c2ecf20Sopenharmony_ci				regulator-max-microvolt = <1050000>;
2038c2ecf20Sopenharmony_ci				regulator-always-on;
2048c2ecf20Sopenharmony_ci			};
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci			sd5 {
2078c2ecf20Sopenharmony_ci				regulator-name = "vdd-1v8";
2088c2ecf20Sopenharmony_ci				regulator-min-microvolt = <1800000>;
2098c2ecf20Sopenharmony_ci				regulator-max-microvolt = <1800000>;
2108c2ecf20Sopenharmony_ci				regulator-always-on;
2118c2ecf20Sopenharmony_ci			};
2128c2ecf20Sopenharmony_ci			....
2138c2ecf20Sopenharmony_ci	};
2148c2ecf20Sopenharmony_ci};
215