Skip to content

Commit

Permalink
ARM: OMAP2+: prm44xx: Inroduce cpu_pm notifiers for context save/restore
Browse files Browse the repository at this point in the history
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: Keerthy <j-keerthy@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Keerthy authored and Tony Lindgren committed May 18, 2018
1 parent e37fbf0 commit a9f7363
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions arch/arm/mach-omap2/prm44xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* published by the Free Software Foundation.
*/

#include <linux/cpu_pm.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/errno.h>
Expand All @@ -30,6 +31,7 @@
#include "prcm44xx.h"
#include "prminst44xx.h"
#include "powerdomain.h"
#include "pm.h"

/* Static data */

Expand Down Expand Up @@ -768,6 +770,22 @@ void prm_restore_context(void)
omap4_prcm_irq_setup.pm_ctrl);
}

static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
{
switch (cmd) {
case CPU_CLUSTER_PM_ENTER:
if (enable_off_mode)
prm_save_context();
break;
case CPU_CLUSTER_PM_EXIT:
if (enable_off_mode)
prm_restore_context();
break;
}

return NOTIFY_OK;
}

/*
* XXX document
*/
Expand All @@ -788,6 +806,7 @@ static const struct omap_prcm_init_data *prm_init_data;

int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
{
static struct notifier_block nb;
omap_prm_base_init();

prm_init_data = data;
Expand All @@ -809,6 +828,12 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
omap4_prcm_irq_setup.mask = AM43XX_PRM_IRQENABLE_MPU_OFFSET;
}

/* Only AM43XX can lose prm context during rtc-ddr suspend */
if (soc_is_am43xx()) {
nb.notifier_call = cpu_notifier;
cpu_pm_register_notifier(&nb);
}

return prm_register(&omap44xx_prm_ll_data);
}

Expand Down

0 comments on commit a9f7363

Please sign in to comment.