Commit 9bcfb76b authored by Keerthy's avatar Keerthy Committed by Tony Lindgren

ARM: OMAP2+: clockdomain: Inroduce cpu_pm notifiers for context save/restore

Inroduce cpu_pm notifiers for context save/restore. This will be
needed for am43xx family in case of rtc only mode with ddr in
self-refresh.
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 1096d1c1
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/limits.h> #include <linux/limits.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/cpu_pm.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
#include "soc.h" #include "soc.h"
#include "clock.h" #include "clock.h"
#include "clockdomain.h" #include "clockdomain.h"
#include "pm.h"
/* clkdm_list contains all registered struct clockdomains */ /* clkdm_list contains all registered struct clockdomains */
static LIST_HEAD(clkdm_list); static LIST_HEAD(clkdm_list);
...@@ -39,6 +41,8 @@ static LIST_HEAD(clkdm_list); ...@@ -39,6 +41,8 @@ static LIST_HEAD(clkdm_list);
static struct clkdm_autodep *autodeps; static struct clkdm_autodep *autodeps;
static struct clkdm_ops *arch_clkdm; static struct clkdm_ops *arch_clkdm;
void clkdm_save_context(void);
void clkdm_restore_context(void);
/* Private functions */ /* Private functions */
...@@ -449,6 +453,22 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) ...@@ -449,6 +453,22 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia)
return 0; 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)
clkdm_save_context();
break;
case CPU_CLUSTER_PM_EXIT:
if (enable_off_mode)
clkdm_restore_context();
break;
}
return NOTIFY_OK;
}
/** /**
* clkdm_complete_init - set up the clockdomain layer * clkdm_complete_init - set up the clockdomain layer
* *
...@@ -460,6 +480,7 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) ...@@ -460,6 +480,7 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia)
int clkdm_complete_init(void) int clkdm_complete_init(void)
{ {
struct clockdomain *clkdm; struct clockdomain *clkdm;
static struct notifier_block nb;
if (list_empty(&clkdm_list)) if (list_empty(&clkdm_list))
return -EACCES; return -EACCES;
...@@ -474,6 +495,12 @@ int clkdm_complete_init(void) ...@@ -474,6 +495,12 @@ int clkdm_complete_init(void)
clkdm_clear_all_sleepdeps(clkdm); clkdm_clear_all_sleepdeps(clkdm);
} }
/* Only AM43XX can lose clkdm context during rtc-ddr suspend */
if (soc_is_am43xx()) {
nb.notifier_call = cpu_notifier;
cpu_pm_register_notifier(&nb);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment