devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Add regulator suspend and resume support
@ 2018-01-12 10:18 Chunyan Zhang
  2018-01-12 10:18 ` [PATCH v3 1/5] bindings: regulator: added support for suspend states Chunyan Zhang
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Chunyan Zhang @ 2018-01-12 10:18 UTC (permalink / raw)
  To: Mark Brown, Rob Herring
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ulf Hansson, Arnd Bergmann,
	Chunyan Zhang

Some systems need to set regulators to specific states when they enter low
power modes, especially around CPUs.

Currently the regulator driver, for suspend and resume features, provides
two functions which are exported for being called directly by any modules
or subsystems when they thought the regulator should be entering into
suspend states.

This patchset adds hooks to PM suspend core and provides suspend/resume
callback functions to regulator device, for those who can be switched
off or set low voltage in suspend states only need to implement the
callback functions in the driver, and set the right configurations for
suspend states via device tree and the APIs which regulator core
driver provides.

Those drivers who use the old interfaces - i.e. regulator_suspend_prepare()
and regulator_suspend_finish() should stop using that, since we leave these
two functions empty and plan to remove them one day in the future.

Any comments would be greatly appreciated.

Thanks,
Chunyan

Changes from V1: (https://lkml.org/lkml/2017/12/21/9)
* Rephrased the commit message of patch 0001;
* Declared the property 'regulator-suspend-microvolt' deperated and documented
  the way recommended;
* Revised of_regulator.c, use suspend_state::min_uV as default suspend
  voltage if the property 'regulator-suspend-microvolt' is not used.

Changes from V2: (https://lkml.org/lkml/2018/1/4/75)
* Correct the typo;
* Removed redundant comments;
* Export regulator_suspend_enable/disable(), on't call these two functions in
  regulator_set_suspend_voltage() instead;
* Checking if rstate->min_uV == rstate->max_uV instead of checking the flag.

Chunyan Zhang (5):
  bindings: regulator: added support for suspend states
  regulator: make regulator voltage be an array to support more states
  drivers: regulator: leave one item to record whether regulator is
    enabled
  drivers: regulator: empty the old suspend functions
  regulator: add PM suspend and resume hooks

 .../devicetree/bindings/regulator/regulator.txt    |  15 +-
 drivers/regulator/core.c                           | 336 ++++++++++++++-------
 drivers/regulator/internal.h                       |  18 +-
 drivers/regulator/of_regulator.c                   |  20 +-
 include/linux/regulator/driver.h                   |   2 +
 include/linux/regulator/machine.h                  |  37 ++-
 6 files changed, 302 insertions(+), 126 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH V4 1/5] bindings: regulator: added support for suspend states
@ 2018-01-23 11:59 Chunyan Zhang
  0 siblings, 0 replies; 15+ messages in thread
From: Chunyan Zhang @ 2018-01-23 11:59 UTC (permalink / raw)
  To: Mark Brown, Rob Herring
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Chunyan Zhang

Some systems need to set regulators to specific states when they enter
low power modes, especially around CPUs. There are many of these modes
depending on the particular runtime state.

Currently the regulator consumers are not granted permission to change
suspend state of regulator devices, the constraints are configured at
startup.  In order to allow changes in a vlotage range, we need to add
new properties for voltage range and a flag to give permission to
change the suspend voltage and suspend on/off in suspend mode.

Signed-off-by: Chunyan Zhang <zhang.chunyan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Reviewed-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/regulator/regulator.txt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 378f6dc..e459226 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -42,8 +42,16 @@ Optional properties:
 - regulator-state-[mem/disk] node has following common properties:
 	- regulator-on-in-suspend: regulator should be on in suspend state.
 	- regulator-off-in-suspend: regulator should be off in suspend state.
-	- regulator-suspend-microvolt: regulator should be set to this voltage
-	  in suspend.
+	- regulator-suspend-min-microvolt: minimum voltage may be set in
+	  suspend state.
+	- regulator-suspend-max-microvolt: maximum voltage may be set in
+	  suspend state.
+	- regulator-suspend-microvolt: the default voltage which regulator
+	  would be set in suspend. This property is now deprecated, instead
+	  setting voltage for suspend mode via the API which regulator
+	  driver provides is recommended.
+	- regulator-changeable-in-suspend: whether the default voltage and
+	  the regulator on/off in suspend can be changed in runtime.
 	- regulator-mode: operating mode in the given suspend state.
 	  The set of possible operating modes depends on the capabilities of
 	  every hardware so the valid modes are documented on each regulator
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-01-26 15:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12 10:18 [PATCH v3 0/5] Add regulator suspend and resume support Chunyan Zhang
2018-01-12 10:18 ` [PATCH v3 1/5] bindings: regulator: added support for suspend states Chunyan Zhang
2018-01-19 22:11   ` Rob Herring
2018-01-22  2:16     ` Chunyan Zhang
     [not found]   ` <1515752305-15907-2-git-send-email-zhang.chunyan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-22  7:59     ` [PATCH V4 " Chunyan Zhang
2018-01-22 19:50       ` Rob Herring
2018-01-23 11:28         ` Mark Brown
     [not found]       ` <1516607961-379-1-git-send-email-zhang.chunyan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-26 15:26         ` Applied "regulator: added support for suspend states" to the regulator tree Mark Brown
2018-01-12 10:18 ` [PATCH v3 2/5] regulator: make regulator voltage be an array to support more states Chunyan Zhang
2018-01-12 10:18 ` [PATCH v3 3/5] drivers: regulator: leave one item to record whether regulator is enabled Chunyan Zhang
2018-01-26 15:26   ` Applied "regulator: leave one item to record whether regulator is enabled" to the regulator tree Mark Brown
     [not found] ` <1515752305-15907-1-git-send-email-zhang.chunyan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2018-01-12 10:18   ` [PATCH v3 4/5] drivers: regulator: empty the old suspend functions Chunyan Zhang
2018-01-12 10:18 ` [PATCH v3 5/5] regulator: add PM suspend and resume hooks Chunyan Zhang
2018-01-12 10:23 ` [PATCH v3 0/5] Add regulator suspend and resume support Chunyan Zhang
2018-01-23 11:59 [PATCH V4 1/5] bindings: regulator: added support for suspend states Chunyan Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).