diff mbox

[4/4] omap2: powerdomain: Inroduce cpu_pm notifiers for context save/restore

Message ID 1526483821-25585-5-git-send-email-j-keerthy@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

J, KEERTHY May 16, 2018, 3:17 p.m. UTC
Inroduce cpu_pm notifiers for context save/restore. This is
needed for am43xx family during rtc only mode with ddr in
self-refresh.

Signed-off-by: Keerthy <j-keerthy@ti.com>
---
 arch/arm/mach-omap2/powerdomain.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Tony Lindgren May 17, 2018, 9:45 p.m. UTC | #1
* Keerthy <j-keerthy@ti.com> [180516 15:21]:
> +	/* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
> +	if (soc_is_am43xx()) {
> +		nb.notifier_call = cpu_notifier;
> +		cpu_pm_register_notifier(&nb);
> +	}
> +

Hmm in patch 3/4 you add omap4_pwrdm_save_context(), I think
that we'd want to run with the notifier for cpuidle on omap4?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
J, KEERTHY May 18, 2018, 4:32 a.m. UTC | #2
On Friday 18 May 2018 03:15 AM, Tony Lindgren wrote:
> * Keerthy <j-keerthy@ti.com> [180516 15:21]:
>> +	/* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
>> +	if (soc_is_am43xx()) {
>> +		nb.notifier_call = cpu_notifier;
>> +		cpu_pm_register_notifier(&nb);
>> +	}
>> +
> 
> Hmm in patch 3/4 you add omap4_pwrdm_save_context(), I think
> that we'd want to run with the notifier for cpuidle on omap4?

Okay i believe that is not needed for cpuidle on omap4. PRCM on wakeup
domain so save/restore not needed for powerdomain on omap4.

Tero can confirm the same.

Should i rename omap4_pwrdm_save_context to am43xx_pwrdm_save_context to
avoid confusion?

Regards,
Keerthy

> 
> Regards,
> 
> Tony
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tero Kristo May 18, 2018, 7 a.m. UTC | #3
On 18/05/18 07:32, Keerthy wrote:
> 
> 
> On Friday 18 May 2018 03:15 AM, Tony Lindgren wrote:
>> * Keerthy <j-keerthy@ti.com> [180516 15:21]:
>>> +	/* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
>>> +	if (soc_is_am43xx()) {
>>> +		nb.notifier_call = cpu_notifier;
>>> +		cpu_pm_register_notifier(&nb);
>>> +	}
>>> +
>>
>> Hmm in patch 3/4 you add omap4_pwrdm_save_context(), I think
>> that we'd want to run with the notifier for cpuidle on omap4?
> 
> Okay i believe that is not needed for cpuidle on omap4. PRCM on wakeup
> domain so save/restore not needed for powerdomain on omap4.
> 
> Tero can confirm the same.

Yea I don't believe this is needed. Only certain portions of the OMAP4 
PRCM lose context during device off mode (which is currently not 
supported by linux), and whatever portions do lose, they should use the 
SAR_RAM approach for context save/restore, as that is supported by 
HW/ROM code.

-Tero

> 
> Should i rename omap4_pwrdm_save_context to am43xx_pwrdm_save_context to
> avoid confusion?
> 
> Regards,
> Keerthy
> 
>>
>> Regards,
>>
>> Tony
>>

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren May 18, 2018, 1:54 p.m. UTC | #4
* Tero Kristo <t-kristo@ti.com> [180518 07:02]:
> On 18/05/18 07:32, Keerthy wrote:
> > 
> > 
> > On Friday 18 May 2018 03:15 AM, Tony Lindgren wrote:
> > > * Keerthy <j-keerthy@ti.com> [180516 15:21]:
> > > > +	/* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
> > > > +	if (soc_is_am43xx()) {
> > > > +		nb.notifier_call = cpu_notifier;
> > > > +		cpu_pm_register_notifier(&nb);
> > > > +	}
> > > > +
> > > 
> > > Hmm in patch 3/4 you add omap4_pwrdm_save_context(), I think
> > > that we'd want to run with the notifier for cpuidle on omap4?
> > 
> > Okay i believe that is not needed for cpuidle on omap4. PRCM on wakeup
> > domain so save/restore not needed for powerdomain on omap4.
> > 
> > Tero can confirm the same.
> 
> Yea I don't believe this is needed. Only certain portions of the OMAP4 PRCM
> lose context during device off mode (which is currently not supported by
> linux), and whatever portions do lose, they should use the SAR_RAM approach
> for context save/restore, as that is supported by HW/ROM code.

OK

> > Should i rename omap4_pwrdm_save_context to am43xx_pwrdm_save_context to
> > avoid confusion?

No need to, it follows the naming prm44xx.c.

Regards,

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

Patch

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index b97b308..1a0f69c 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -14,6 +14,7 @@ 
  */
 #undef DEBUG
 
+#include <linux/cpu_pm.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/list.h>
@@ -39,6 +40,9 @@ 
 
 #define PWRDM_TRACE_STATES_FLAG	(1<<31)
 
+void pwrdms_save_context(void);
+void pwrdms_restore_context(void);
+
 enum {
 	PWRDM_STATE_NOW = 0,
 	PWRDM_STATE_PREV,
@@ -333,6 +337,22 @@  int pwrdm_register_pwrdms(struct powerdomain **ps)
 	return 0;
 }
 
+static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
+{
+	switch (cmd) {
+	case CPU_CLUSTER_PM_ENTER:
+		if (enable_off_mode)
+			pwrdms_save_context();
+		break;
+	case CPU_CLUSTER_PM_EXIT:
+		if (enable_off_mode)
+			pwrdms_restore_context();
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
 /**
  * pwrdm_complete_init - set up the powerdomain layer
  *
@@ -347,6 +367,7 @@  int pwrdm_register_pwrdms(struct powerdomain **ps)
 int pwrdm_complete_init(void)
 {
 	struct powerdomain *temp_p;
+	static struct notifier_block nb;
 
 	if (list_empty(&pwrdm_list))
 		return -EACCES;
@@ -354,6 +375,12 @@  int pwrdm_complete_init(void)
 	list_for_each_entry(temp_p, &pwrdm_list, node)
 		pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON);
 
+	/* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
+	if (soc_is_am43xx()) {
+		nb.notifier_call = cpu_notifier;
+		cpu_pm_register_notifier(&nb);
+	}
+
 	return 0;
 }