* [PATCHv5 1/3] regulator: of: Add support for parsing regulator_state for suspend state
2014-10-10 11:35 [PATCHv5 0/3] regulator: of: Add support for parsing regulator suspend state Chanwoo Choi
@ 2014-10-10 11:35 ` Chanwoo Choi
2014-10-13 13:19 ` Mark Brown
2014-10-10 11:35 ` [PATCHv5 2/3] dt-bindings: regulator: Add regulator suspend state for PM state Chanwoo Choi
2014-10-10 11:35 ` [PATCHv5 3/3] ARM: dts: Add sleep mode of regulator for exynos3250-rinato board Chanwoo Choi
2 siblings, 1 reply; 7+ messages in thread
From: Chanwoo Choi @ 2014-10-10 11:35 UTC (permalink / raw)
To: broonie
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree, Chanwoo Choi
The regulation_constraints structure includes specific field to support
suspend state for global PMIC SUSPEND/HIBERNATE mode. This patch add support
for parsing regulator_state for suspend state.
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/regulator/of_regulator.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 7a51814..b375ffe 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -19,12 +19,19 @@
#include "internal.h"
+const char *const regulator_states[PM_SUSPEND_MAX + 1] = {
+ [PM_SUSPEND_MEM] = "regulator-state-mem",
+ [PM_SUSPEND_MAX] = "regulator-state-disk",
+};
+
static void of_get_regulation_constraints(struct device_node *np,
struct regulator_init_data **init_data)
{
const __be32 *min_uV, *max_uV;
struct regulation_constraints *constraints = &(*init_data)->constraints;
- int ret;
+ struct regulator_state *suspend_state;
+ struct device_node *suspend_np;
+ int ret, i;
u32 pval;
constraints->name = of_get_property(np, "regulator-name", NULL);
@@ -73,6 +80,36 @@ static void of_get_regulation_constraints(struct device_node *np,
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
if (!ret)
constraints->enable_time = pval;
+
+ for (i = 0; i < ARRAY_SIZE(regulator_states); i++) {
+ switch (i) {
+ case PM_SUSPEND_MEM:
+ suspend_state = &constraints->state_mem;
+ break;
+ case PM_SUSPEND_MAX:
+ suspend_state = &constraints->state_disk;
+ break;
+ case PM_SUSPEND_ON:
+ case PM_SUSPEND_FREEZE:
+ case PM_SUSPEND_STANDBY:
+ default:
+ continue;
+ };
+
+ suspend_np = of_get_child_by_name(np, regulator_states[i]);
+ if (!suspend_np || !suspend_state)
+ continue;
+
+ if (of_property_read_bool(suspend_np,
+ "regulator-on-in-suspend"))
+ suspend_state->enabled = true;
+ else if (of_property_read_bool(suspend_np,
+ "regulator-off-in-suspend"))
+ suspend_state->disabled = true;
+
+ suspend_state = NULL;
+ suspend_np = NULL;
+ }
}
/**
--
1.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCHv5 1/3] regulator: of: Add support for parsing regulator_state for suspend state
2014-10-10 11:35 ` [PATCHv5 1/3] regulator: of: Add support for parsing regulator_state for " Chanwoo Choi
@ 2014-10-13 13:19 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-10-13 13:19 UTC (permalink / raw)
To: Chanwoo Choi
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree
[-- Attachment #1: Type: text/plain, Size: 282 bytes --]
On Fri, Oct 10, 2014 at 08:35:33PM +0900, Chanwoo Choi wrote:
> The regulation_constraints structure includes specific field to support
> suspend state for global PMIC SUSPEND/HIBERNATE mode. This patch add support
> for parsing regulator_state for suspend state.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCHv5 2/3] dt-bindings: regulator: Add regulator suspend state for PM state
2014-10-10 11:35 [PATCHv5 0/3] regulator: of: Add support for parsing regulator suspend state Chanwoo Choi
2014-10-10 11:35 ` [PATCHv5 1/3] regulator: of: Add support for parsing regulator_state for " Chanwoo Choi
@ 2014-10-10 11:35 ` Chanwoo Choi
2014-10-13 13:20 ` Mark Brown
2014-10-10 11:35 ` [PATCHv5 3/3] ARM: dts: Add sleep mode of regulator for exynos3250-rinato board Chanwoo Choi
2 siblings, 1 reply; 7+ messages in thread
From: Chanwoo Choi @ 2014-10-10 11:35 UTC (permalink / raw)
To: broonie
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree, Chanwoo Choi
This patch add regulator suspend state to constraint in dt file. The regulation_
constraints structure already has regulator suspend state field as following.
The regulator suspend state control the state of regulator according to
PM (Power Management) state.
- struct regulator_state state_disk
- struct regulator_state state_mem
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
Documentation/devicetree/bindings/regulator/regulator.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 8607433..aaad615 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -19,6 +19,15 @@ Optional properties:
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.
+- regulator-state-mem sub-root node for Suspend-to-RAM mode
+ : suspend to memory, the device goes to sleep, but all data stored in memory,
+ only some external interrupt can wake the device.
+- regulator-state-disk sub-root node for Suspend-to-DISK mode
+ : suspend to disk, this state operates similarly to Suspend-to-RAM,
+ but includes a final step of writing memory contents to disk.
+- 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.
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
@@ -34,6 +43,10 @@ Example:
regulator-max-microvolt = <2500000>;
regulator-always-on;
vin-supply = <&vin>;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
};
Regulator Consumers:
--
1.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCHv5 2/3] dt-bindings: regulator: Add regulator suspend state for PM state
2014-10-10 11:35 ` [PATCHv5 2/3] dt-bindings: regulator: Add regulator suspend state for PM state Chanwoo Choi
@ 2014-10-13 13:20 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-10-13 13:20 UTC (permalink / raw)
To: Chanwoo Choi
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
On Fri, Oct 10, 2014 at 08:35:34PM +0900, Chanwoo Choi wrote:
> This patch add regulator suspend state to constraint in dt file. The regulation_
> constraints structure already has regulator suspend state field as following.
Applied, thanks. Please use subject lines matching the style for the
subsystem.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCHv5 3/3] ARM: dts: Add sleep mode of regulator for exynos3250-rinato board
2014-10-10 11:35 [PATCHv5 0/3] regulator: of: Add support for parsing regulator suspend state Chanwoo Choi
2014-10-10 11:35 ` [PATCHv5 1/3] regulator: of: Add support for parsing regulator_state for " Chanwoo Choi
2014-10-10 11:35 ` [PATCHv5 2/3] dt-bindings: regulator: Add regulator suspend state for PM state Chanwoo Choi
@ 2014-10-10 11:35 ` Chanwoo Choi
2014-10-13 13:20 ` Mark Brown
2 siblings, 1 reply; 7+ messages in thread
From: Chanwoo Choi @ 2014-10-10 11:35 UTC (permalink / raw)
To: broonie
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree, Chanwoo Choi, Kukjin Kim
This patch add sleep mode of regulator for exynos3250-rinato board to optimize
power-consumption in sleep state.
The power-consumption in suspend state is 0.6mA after applied this patch.
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
---
arch/arm/boot/dts/exynos3250-rinato.dts | 108 ++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/arch/arm/boot/dts/exynos3250-rinato.dts b/arch/arm/boot/dts/exynos3250-rinato.dts
index 63861e7..002e396 100644
--- a/arch/arm/boot/dts/exynos3250-rinato.dts
+++ b/arch/arm/boot/dts/exynos3250-rinato.dts
@@ -166,6 +166,10 @@
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
};
ldo2_reg: LDO2 {
@@ -173,6 +177,10 @@
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo3_reg: LDO3 {
@@ -180,6 +188,10 @@
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo4_reg: LDO4 {
@@ -187,6 +199,10 @@
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo5_reg: LDO5 {
@@ -194,12 +210,20 @@
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo6_reg: LDO6 {
regulator-name = "VAP_VMIPI_1.0V";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo7_reg: LDO7 {
@@ -207,6 +231,10 @@
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo8_reg: LDO8 {
@@ -214,6 +242,10 @@
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo9_reg: LDO9 {
@@ -221,12 +253,20 @@
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
};
ldo10_reg: LDO10 {
regulator-name = "UNUSED_LDO10";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo11_reg: LDO11 {
@@ -247,60 +287,100 @@
regulator-name = "CAM_AVDD_2.8V";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo14_reg: LDO14 {
regulator-name = "UNUSED_LDO14";
regulator-min-microvolt = <2700000>;
regulator-max-microvolt = <2700000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo15_reg: LDO15 {
regulator-name = "TSP_AVDD_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo16_reg: LDO16 {
regulator-name = "LCD_VDD_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo17_reg: LDO17 {
regulator-name = "V_IRLED_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo18_reg: LDO18 {
regulator-name = "CAM_AF_2.8V";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo19_reg: LDO19 {
regulator-name = "TSP_VDD_1.8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo20_reg: LDO20 {
regulator-name = "LCD_VDD_1.8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo21_reg: LDO21 {
regulator-name = "CAM_IO_1.8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo22_reg: LDO22 {
regulator-name = "CAM_DVDD_1.2V";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo23_reg: LDO23 {
@@ -314,12 +394,20 @@
regulator-name = "HRM_VCC_3.3V";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
ldo25_reg: LDO25 {
regulator-name = "UNUSED_LDO25";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3000000>;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
buck1_reg: BUCK1 {
@@ -327,6 +415,10 @@
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <900000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
buck2_reg: BUCK2 {
@@ -334,6 +426,10 @@
regulator-min-microvolt = <850000>;
regulator-max-microvolt = <1150000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
buck3_reg: BUCK3 {
@@ -341,6 +437,10 @@
regulator-min-microvolt = <850000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-off-in-suspend;
+ };
};
buck4_reg: BUCK4 {
@@ -348,6 +448,10 @@
regulator-min-microvolt = <1950000>;
regulator-max-microvolt = <1950000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
};
buck5_reg: BUCK5 {
@@ -355,6 +459,10 @@
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
+
+ regulator-state-mem {
+ regulator-on-in-suspend;
+ };
};
};
};
--
1.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCHv5 3/3] ARM: dts: Add sleep mode of regulator for exynos3250-rinato board
2014-10-10 11:35 ` [PATCHv5 3/3] ARM: dts: Add sleep mode of regulator for exynos3250-rinato board Chanwoo Choi
@ 2014-10-13 13:20 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-10-13 13:20 UTC (permalink / raw)
To: Chanwoo Choi
Cc: lgirdwood, grant.likely, robh+dt, kyungmin.park, javier,
linux-kernel, devicetree, Kukjin Kim
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
On Fri, Oct 10, 2014 at 08:35:35PM +0900, Chanwoo Choi wrote:
> This patch add sleep mode of regulator for exynos3250-rinato board to optimize
> power-consumption in sleep state.
>
> The power-consumption in suspend state is 0.6mA after applied this patch.
Reviwed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread