From: Keerthy <j-keerthy@ti.com> To: tony@atomide.com Cc: t-kristo@ti.com, j-keerthy@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] omap2: clockdomain: Inroduce cpu_pm notifiers for context save/restore Date: Wed, 16 May 2018 20:46:59 +0530 [thread overview] Message-ID: <1526483821-25585-3-git-send-email-j-keerthy@ti.com> (raw) In-Reply-To: <1526483821-25585-1-git-send-email-j-keerthy@ti.com> 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> --- arch/arm/mach-omap2/clockdomain.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 0906380..6d44fe0 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -23,6 +23,7 @@ #include <linux/limits.h> #include <linux/err.h> #include <linux/clk-provider.h> +#include <linux/cpu_pm.h> #include <linux/io.h> @@ -31,6 +32,7 @@ #include "soc.h" #include "clock.h" #include "clockdomain.h" +#include "pm.h" /* clkdm_list contains all registered struct clockdomains */ static LIST_HEAD(clkdm_list); @@ -39,6 +41,8 @@ static struct clkdm_autodep *autodeps; static struct clkdm_ops *arch_clkdm; +void clkdm_save_context(void); +void clkdm_restore_context(void); /* Private functions */ @@ -449,6 +453,22 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) 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 * @@ -460,6 +480,7 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) int clkdm_complete_init(void) { struct clockdomain *clkdm; + static struct notifier_block nb; if (list_empty(&clkdm_list)) return -EACCES; @@ -474,6 +495,12 @@ int clkdm_complete_init(void) 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; } -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: j-keerthy@ti.com (Keerthy) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] omap2: clockdomain: Inroduce cpu_pm notifiers for context save/restore Date: Wed, 16 May 2018 20:46:59 +0530 [thread overview] Message-ID: <1526483821-25585-3-git-send-email-j-keerthy@ti.com> (raw) In-Reply-To: <1526483821-25585-1-git-send-email-j-keerthy@ti.com> 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> --- arch/arm/mach-omap2/clockdomain.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 0906380..6d44fe0 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -23,6 +23,7 @@ #include <linux/limits.h> #include <linux/err.h> #include <linux/clk-provider.h> +#include <linux/cpu_pm.h> #include <linux/io.h> @@ -31,6 +32,7 @@ #include "soc.h" #include "clock.h" #include "clockdomain.h" +#include "pm.h" /* clkdm_list contains all registered struct clockdomains */ static LIST_HEAD(clkdm_list); @@ -39,6 +41,8 @@ static struct clkdm_autodep *autodeps; static struct clkdm_ops *arch_clkdm; +void clkdm_save_context(void); +void clkdm_restore_context(void); /* Private functions */ @@ -449,6 +453,22 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) 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 * @@ -460,6 +480,7 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia) int clkdm_complete_init(void) { struct clockdomain *clkdm; + static struct notifier_block nb; if (list_empty(&clkdm_list)) return -EACCES; @@ -474,6 +495,12 @@ int clkdm_complete_init(void) 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; } -- 1.9.1
next prev parent reply other threads:[~2018-05-16 15:16 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-16 15:16 [PATCH 0/4] arm: mach-omap2: clkdm/pwrdm: Save/restore context Keerthy 2018-05-16 15:16 ` Keerthy 2018-05-16 15:16 ` [PATCH 1/4] ARM: OMAP2: Add functions to save and restore clockdomain context en-masse Keerthy 2018-05-16 15:16 ` Keerthy 2018-05-16 15:16 ` Keerthy [this message] 2018-05-16 15:16 ` [PATCH 2/4] omap2: clockdomain: Inroduce cpu_pm notifiers for context save/restore Keerthy 2018-05-17 21:43 ` Tony Lindgren 2018-05-17 21:43 ` Tony Lindgren 2018-05-18 5:57 ` Keerthy 2018-05-18 5:57 ` Keerthy 2018-05-18 8:38 ` Tero Kristo 2018-05-18 8:38 ` Tero Kristo 2018-05-18 13:54 ` Tony Lindgren 2018-05-18 13:54 ` Tony Lindgren 2018-05-16 15:17 ` [PATCH 3/4] ARM: OMAP2: Add functions to save and restore powerdomain context Keerthy 2018-05-16 15:17 ` Keerthy 2018-05-16 15:17 ` [PATCH 4/4] omap2: powerdomain: Inroduce cpu_pm notifiers for context save/restore Keerthy 2018-05-16 15:17 ` Keerthy 2018-05-17 21:45 ` Tony Lindgren 2018-05-17 21:45 ` Tony Lindgren 2018-05-18 4:32 ` Keerthy 2018-05-18 4:32 ` Keerthy 2018-05-18 7:00 ` Tero Kristo 2018-05-18 7:00 ` Tero Kristo 2018-05-18 13:54 ` Tony Lindgren 2018-05-18 13:54 ` Tony Lindgren
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1526483821-25585-3-git-send-email-j-keerthy@ti.com \ --to=j-keerthy@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=t-kristo@ti.com \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.