Re: [PATCH 1/4] mfd: twl4030-power: Add recommended idle configuration

2014-04-28 Thread Lee Jones
 These settings are based on the Recommended Sleep Sequences for
 the Zoom Platform pdf at:
 
 http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf
 
 These settings assume most of the regulators are under control of
 Linux, and cuts off VDD1 and VDD2 during off-idle as Linux cannot
 do it.

Linux does it becuase Linux can't do it. Eh?

 For any board specific changes to these, let's patch them in as
 changes to the generic data in the follow-up patches. This keeps
 the board specific changes small.
 
 Note that this does not consider the twl5030 errata 27. That
 can be added later on after it has been tested.
 
 Cc: Peter De Schrijver pdeschrij...@nvidia.com
 Cc: Samuel Ortiz sa...@linux.intel.com
 Cc: Lee Jones lee.jo...@linaro.org
 Signed-off-by: Tony Lindgren t...@atomide.com
 ---
  .../devicetree/bindings/mfd/twl4030-power.txt  |   4 +
  drivers/mfd/twl4030-power.c| 165 
 +

driver/mfd changes look good to me:
  Acked-by: Lee Jones lee.jo...@linaro.org

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] mfd: twl4030-power: Add recommended idle configuration

2014-04-28 Thread Tony Lindgren
* Lee Jones lee.jo...@linaro.org [140428 04:42]:
  These settings are based on the Recommended Sleep Sequences for
  the Zoom Platform pdf at:
  
  http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf
  
  These settings assume most of the regulators are under control of
  Linux, and cuts off VDD1 and VDD2 during off-idle as Linux cannot
  do it.
 
 Linux does it becuase Linux can't do it. Eh?

Heh yeah that's confusing, will update to:

These settings assume most of the regulators are under control of
Linux, and twl4030 only cuts off VDD1 and VDD2 during off-idle as
Linux cannot do it.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] mfd: twl4030-power: Add recommended idle configuration

2014-04-28 Thread Lee Jones
On Mon, 28 Apr 2014, Tony Lindgren wrote:

 * Lee Jones lee.jo...@linaro.org [140428 04:42]:
   These settings are based on the Recommended Sleep Sequences for
   the Zoom Platform pdf at:
   
   http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf
   
   These settings assume most of the regulators are under control of
   Linux, and cuts off VDD1 and VDD2 during off-idle as Linux cannot
   do it.
  
  Linux does it becuase Linux can't do it. Eh?
 
 Heh yeah that's confusing, will update to:
 
 These settings assume most of the regulators are under control of
 Linux, and twl4030 only cuts off VDD1 and VDD2 during off-idle as
 Linux cannot do it.

+1, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] mfd: twl4030-power: Add recommended idle configuration

2014-04-23 Thread Tony Lindgren
These settings are based on the Recommended Sleep Sequences for
the Zoom Platform pdf at:

http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf

These settings assume most of the regulators are under control of
Linux, and cuts off VDD1 and VDD2 during off-idle as Linux cannot
do it.

For any board specific changes to these, let's patch them in as
changes to the generic data in the follow-up patches. This keeps
the board specific changes small.

Note that this does not consider the twl5030 errata 27. That
can be added later on after it has been tested.

Cc: Peter De Schrijver pdeschrij...@nvidia.com
Cc: Samuel Ortiz sa...@linux.intel.com
Cc: Lee Jones lee.jo...@linaro.org
Signed-off-by: Tony Lindgren t...@atomide.com
---
 .../devicetree/bindings/mfd/twl4030-power.txt  |   4 +
 drivers/mfd/twl4030-power.c| 165 +
 2 files changed, 169 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/twl4030-power.txt 
b/Documentation/devicetree/bindings/mfd/twl4030-power.txt
index b906116..bbd6603 100644
--- a/Documentation/devicetree/bindings/mfd/twl4030-power.txt
+++ b/Documentation/devicetree/bindings/mfd/twl4030-power.txt
@@ -8,10 +8,14 @@ Required properties:
 - compatible : must be one of the following
ti,twl4030-power
ti,twl4030-power-reset
+   ti,twl4030-power-idle
 
 The use of ti,twl4030-power-reset is recommended at least on
 3530 that needs a special configuration for warm reset to work.
 
+When using ti,twl4030-power-idle, the TI recommended configuration
+for idle modes is loaded to the tlw4030 PMIC.
+
 Optional properties:
 - ti,use_poweroff: With this flag, the chip will initiates an ACTIVE-to-OFF or
   SLEEP-to-OFF transition when the system poweroffs.
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 1db0560..89a8528 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -595,11 +595,176 @@ static struct twl4030_power_data omap3_reset = {
.resource_config= omap3_rconfig,
 };
 
+/* Recommended generic default idle configuration for off-idle */
+
+/* Broadcast message to put res to sleep */
+static struct twl4030_ins omap3_idle_sleep_on_seq[] = {
+   { MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL,
+   0, RES_STATE_SLEEP), 2 },
+};
+
+static struct twl4030_script omap3_idle_sleep_on_script = {
+   .script = omap3_idle_sleep_on_seq,
+   .size   = ARRAY_SIZE(omap3_idle_sleep_on_seq),
+   .flags  = TWL4030_SLEEP_SCRIPT,
+};
+
+/* Broadcast message to put res to active */
+static struct twl4030_ins omap3_idle_wakeup_p12_seq[] = {
+   { MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL,
+   0, RES_STATE_ACTIVE), 2 },
+   };
+
+static struct twl4030_script omap3_idle_wakeup_p12_script = {
+   .script = omap3_idle_wakeup_p12_seq,
+   .size   = ARRAY_SIZE(omap3_idle_wakeup_p12_seq),
+   .flags  = TWL4030_WAKEUP12_SCRIPT,
+};
+
+/* Broadcast message to put res to active */
+static struct twl4030_ins omap3_idle_wakeup_p3_seq[] = {
+   { MSG_SINGULAR(DEV_GRP_NULL, RES_CLKEN, RES_STATE_ACTIVE), 0x37 },
+   { MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, RES_TYPE_ALL,
+  0, RES_STATE_ACTIVE), 2 },
+};
+
+static struct twl4030_script omap3_idle_wakeup_p3_script = {
+   .script = omap3_idle_wakeup_p3_seq,
+   .size   = ARRAY_SIZE(omap3_idle_wakeup_p3_seq),
+   .flags  = TWL4030_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_script omap3_idle_wrst_script = {
+   .script = omap3_wrst_seq,
+   .size   = ARRAY_SIZE(omap3_wrst_seq),
+   .flags  = TWL4030_WRST_SCRIPT,
+};
+
+static struct twl4030_script *omap3_idle_scripts[] = {
+   omap3_idle_wakeup_p12_script,
+   omap3_idle_wakeup_p3_script,
+   omap3_idle_wrst_script,
+   omap3_idle_sleep_on_script,
+};
+
+/*
+ * Usable values for .remap_sleep and .remap_off
+ * Based on table 5.3.3 Resource Operating modes
+ */
+enum {
+   TWL_REMAP_OFF = 0,
+   TWL_REMAP_SLEEP = 8,
+   TWL_REMAP_ACTIVE = 9,
+};
+
+#define TWL_DEV_GRP_P123   (DEV_GRP_P1 | DEV_GRP_P2 | DEV_GRP_P3)
+
+/*
+ * Recommended configuration based on Recommended Sleep
+ * Sequences for the Zoom Platform:
+ * http://omappedia.com/wiki/File:Recommended_Sleep_Sequences_Zoom.pdf
+ */
+static struct twl4030_resconfig omap3_idle_rconfig[] = {
+   { .resource = RES_VAUX1, .devgroup = DEV_GRP_NULL,
+ .type = 0, .type2 = 0, .remap_off = TWL_REMAP_OFF,
+ .remap_sleep = TWL_REMAP_SLEEP, },
+   { .resource = RES_VAUX2, .devgroup =  DEV_GRP_NULL,
+ .type = 0, .type2 = 0, .remap_off = TWL_REMAP_OFF,
+ .remap_sleep = TWL_REMAP_SLEEP, },
+   { .resource = RES_VAUX3, .devgroup =  DEV_GRP_NULL,
+ .type = 0, .type2 = 0, .remap_off = TWL_REMAP_OFF,
+ .remap_sleep = TWL_REMAP_SLEEP, },
+   { .resource = RES_VAUX4, .devgroup =