···11+* Generic system power control capability22+33+Power-management integrated circuits or miscellaneous hardware components are44+sometimes able to control the system power. The device driver associated with these55+components might need to define this capability, which tells the kernel that66+it can be used to switch off the system. The corresponding device must have the77+standard property "system-power-controller" in its device node. This property88+marks the device as able to control the system power. In order to test if this99+property is found programmatically, use the helper function1010+"of_device_is_system_power_controller" from of.h .1111+1212+Example:1313+1414+act8846: act8846@5 {1515+ compatible = "active-semi,act8846";1616+ status = "okay";1717+ system-power-controller;1818+}
···55- compatible: "active-semi,act8846" or "active-semi,act8865"66- reg: I2C slave address7788+Optional properties:99+- system-power-controller: Telling whether or not this pmic is controlling1010+ the system power. See Documentation/devicetree/bindings/power/power-controller.txt .1111+812Any standard regulator properties can be used to configure the single regulator.9131014The valid names for regulators are:
···2525 example: LDO1, LDO2, LDO35.2626 -BUCKn : for BUCKs, where n can lie in range 1 to 10.2727 example: BUCK1, BUCK5, BUCK10.2828+2929+The max77802 regulator supports two different operating modes: Normal and Low3030+Power Mode. Some regulators support the modes to be changed at startup or by3131+the consumers during normal operation while others only support to change the3232+mode during system suspend. The standard regulator suspend states binding can3333+be used to configure the regulator operating mode.3434+3535+The regulators that support the standard "regulator-initial-mode" property,3636+changing their mode during normal operation are: LDOs 1, 3, 20 and 21.3737+3838+The possible values for "regulator-initial-mode" and "regulator-mode" are:3939+ 1: Normal regulator voltage output mode.4040+ 3: Low Power which reduces the quiescent current down to only 1uA4141+4242+The list of valid modes are defined in the dt-bindings/clock/maxim,max77802.h4343+header and can be included by device tree source files.4444+4545+The standard "regulator-mode" property can only be used for regulators that4646+support changing their mode to Low Power Mode during suspend. These regulators4747+are: BUCKs 2-4 and LDOs 1-35. Also, it only takes effect if the regulator has4848+been enabled for the given suspend state using "regulator-on-in-suspend" and4949+has not been disabled for that state using "regulator-off-in-suspend".5050+2851Example:29523053 max77802@09 {···5936 #size-cells = <0>;60376138 regulators {3939+ ldo1_reg: LDO1 {4040+ regulator-name = "vdd_1v0";4141+ regulator-min-microvolt = <1000000>;4242+ regulator-max-microvolt = <1000000>;4343+ regulator-always-on;4444+ regulator-initial-mode = <MAX77802_OPMODE_LP>;4545+ };4646+6247 ldo11_reg: LDO11 {6348 regulator-name = "vdd_ldo11";6449 regulator-min-microvolt = <1900000>;6550 regulator-max-microvolt = <1900000>;6651 regulator-always-on;5252+ regulator-state-mem {5353+ regulator-on-in-suspend;5454+ regulator-mode = <MAX77802_OPMODE_LP>;5555+ };6756 };68576958 buck1_reg: BUCK1 {
···1919 design requires. This property describes the total system ramp time2020 required due to the combination of internal ramping of the regulator itself,2121 and board design issues such as trace capacitance and load on the supply.2222+- regulator-state-mem sub-root node for Suspend-to-RAM mode2323+ : suspend to memory, the device goes to sleep, but all data stored in memory,2424+ only some external interrupt can wake the device.2525+- regulator-state-disk sub-root node for Suspend-to-DISK mode2626+ : suspend to disk, this state operates similarly to Suspend-to-RAM,2727+ but includes a final step of writing memory contents to disk.2828+- regulator-state-[mem/disk] node has following common properties:2929+ - regulator-on-in-suspend: regulator should be on in suspend state.3030+ - regulator-off-in-suspend: regulator should be off in suspend state.3131+ - regulator-suspend-microvolt: regulator should be set to this voltage3232+ in suspend.3333+ - regulator-mode: operating mode in the given suspend state.3434+ The set of possible operating modes depends on the capabilities of3535+ every hardware so the valid modes are documented on each regulator3636+ device tree binding document.3737+- regulator-initial-mode: initial operating mode. The set of possible operating3838+ modes depends on the capabilities of every hardware so each device binding3939+ documentation explains which values the regulator supports.22402341Deprecated properties:2442- regulator-compatible: If a regulator chip contains multiple···5234 regulator-max-microvolt = <2500000>;5335 regulator-always-on;5436 vin-supply = <&vin>;3737+3838+ regulator-state-mem {3939+ regulator-on-in-suspend;4040+ };5541 };56425743Regulator Consumers:
···11+/*22+ * Copyright (C) 2014 Google, Inc33+ *44+ * This program is free software; you can redistribute it and/or modify55+ * it under the terms of the GNU General Public License version 2 as66+ * published by the Free Software Foundation.77+ *88+ * Device Tree binding constants for the Maxim 77802 PMIC regulators99+ */1010+1111+#ifndef _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H1212+#define _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H1313+1414+/* Regulator operating modes */1515+#define MAX77802_OPMODE_LP 11616+#define MAX77802_OPMODE_NORMAL 31717+1818+#endif /* _DT_BINDINGS_REGULATOR_MAXIM_MAX77802_H */
-7
include/linux/mfd/max77686.h
···131131 MAX77686_OPMODE_STANDBY,132132};133133134134-enum max77802_opmode {135135- MAX77802_OPMODE_OFF,136136- MAX77802_OPMODE_STANDBY,137137- MAX77802_OPMODE_LP,138138- MAX77802_OPMODE_NORMAL,139139-};140140-141134struct max77686_opmode_data {142135 int id;143136 int mode;
+11
include/linux/of.h
···922922/* CONFIG_OF_RESOLVE api */923923extern int of_resolve_phandles(struct device_node *tree);924924925925+/**926926+ * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node927927+ * @np: Pointer to the given device_node928928+ *929929+ * return true if present false otherwise930930+ */931931+static inline bool of_device_is_system_power_controller(const struct device_node *np)932932+{933933+ return of_property_read_bool(np, "system-power-controller");934934+}935935+925936#endif /* _LINUX_OF_H */
+4
include/linux/regulator/driver.h
···243243 *244244 * @enable_time: Time taken for initial enable of regulator (in uS).245245 * @off_on_delay: guard time (in uS), before re-enabling a regulator246246+ *247247+ * @of_map_mode: Maps a hardware mode defined in a DeviceTree to a standard mode246248 */247249struct regulator_desc {248250 const char *name;···287285 unsigned int enable_time;288286289287 unsigned int off_on_delay;288288+289289+ unsigned int (*of_map_mode)(unsigned int mode);290290};291291292292/**