Commit 54d8f4c2980f44963c528ad12fa96462813e3426

Authored by Nishanth Menon
Committed by Afzal Mohammed
1 parent ed2b2fb2a7
Exists in master

OMAP2+: Ensure that PM inits are done before allowing DVFS

Ensure that PM initializations are all ready before we proceed.

This allows drivers such as gfx, cpufreq which are ready earlier
than pm to not not attempt to use the scaling infrastructure before
it is ready.

Signed-off-by: Nishanth Menon <nm@ti.com>
[vaibhav.bedia@ti.com: Pull in for AM33xx]
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>

Showing 3 changed files with 32 additions and 0 deletions Side-by-side Diff

arch/arm/mach-omap2/dvfs.c
... ... @@ -26,6 +26,7 @@
26 26 #include <plat/dvfs.h>
27 27 #include "smartreflex.h"
28 28 #include "powerdomain.h"
  29 +#include "pm.h"
29 30  
30 31 /**
31 32 * DOC: Introduction
... ... @@ -837,6 +838,11 @@
837 838 if (IS_ERR_OR_NULL(pdev)) {
838 839 pr_err("%s: pdev is null!\n", __func__);
839 840 return -EINVAL;
  841 + }
  842 +
  843 + if (!omap_pm_is_ready()) {
  844 + dev_dbg(target_dev, "%s: pm is not ready yet\n", __func__);
  845 + return -EBUSY;
840 846 }
841 847  
842 848 /* Lock me to ensure cross domain scaling is secure */
arch/arm/mach-omap2/pm.c
... ... @@ -26,6 +26,10 @@
26 26  
27 27 static struct omap_device_pm_latency *pm_lats;
28 28  
  29 +static int _init_omap_device(char *name);
  30 +
  31 +bool omap_pm_is_ready_status;
  32 +
29 33 static int _init_omap_device(char *name)
30 34 {
31 35 struct omap_hwmod *oh;
... ... @@ -287,6 +291,10 @@
287 291  
288 292 /* Smartreflex device init */
289 293 omap_devinit_smartreflex();
  294 +
  295 + omap_pm_is_ready_status = true;
  296 + /* let the other CPU know as well */
  297 + smp_wmb();
290 298  
291 299 return 0;
292 300 }
arch/arm/mach-omap2/pm.h
... ... @@ -134,5 +134,23 @@
134 134 }
135 135 #endif
136 136  
  137 +#ifdef CONFIG_PM
  138 +extern bool omap_pm_is_ready_status;
  139 +/**
  140 + * omap_pm_is_ready() - tells if OMAP pm framework is done it's initialization
  141 + *
  142 + * In few cases, to sequence operations properly, we'd like to know if OMAP's PM
  143 + * framework has completed all it's expected initializations.
  144 + */
  145 +static inline bool omap_pm_is_ready(void)
  146 +{
  147 + return omap_pm_is_ready_status;
  148 +}
  149 +#else
  150 +static inline bool omap_pm_is_ready(void)
  151 +{
  152 + return false;
  153 +}
  154 +#endif
137 155 #endif