ARM: OMAP: add support for oscillator setup
authorTero Kristo <t-kristo@ti.com>
Tue, 25 Sep 2012 16:33:39 +0000 (19:33 +0300)
committerKevin Hilman <khilman@ti.com>
Mon, 5 Nov 2012 23:12:40 +0000 (15:12 -0800)
This contains startup and shutdown times for the oscillator. By default
use ULONG_MAX. Oscillator setup is used for calculating and setting up
latencies for sleep modes that disable oscillator.

Based on a patch from Nishanth Menon <nm@ti.com>.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm.h

index ea61c32957bdaeeb69f5f21467dcc291b05d397f..109a02e02d72eb6fa72d7e60d129e87a753081e0 100644 (file)
@@ -39,6 +39,36 @@ static struct omap_device_pm_latency *pm_lats;
  */
 int (*omap_pm_suspend)(void);
 
+/**
+ * struct omap2_oscillator - Describe the board main oscillator latencies
+ * @startup_time: oscillator startup latency
+ * @shutdown_time: oscillator shutdown latency
+ */
+struct omap2_oscillator {
+       u32 startup_time;
+       u32 shutdown_time;
+};
+
+static struct omap2_oscillator oscillator = {
+       .startup_time = ULONG_MAX,
+       .shutdown_time = ULONG_MAX,
+};
+
+void omap_pm_setup_oscillator(u32 tstart, u32 tshut)
+{
+       oscillator.startup_time = tstart;
+       oscillator.shutdown_time = tshut;
+}
+
+void omap_pm_get_oscillator(u32 *tstart, u32 *tshut)
+{
+       if (!tstart || !tshut)
+               return;
+
+       *tstart = oscillator.startup_time;
+       *tshut = oscillator.shutdown_time;
+}
+
 static int __init _init_omap_device(char *name)
 {
        struct omap_hwmod *oh;
index 67d66131cfa796c9f0724e43a2820a0752e1fa73..429028852103ca806e7ad40f41325da870a94751 100644 (file)
@@ -129,4 +129,12 @@ static inline int omap4_twl_init(void)
 }
 #endif
 
+#ifdef CONFIG_PM
+extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut);
+extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut);
+#else
+static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { }
+static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { }
+#endif
+
 #endif