OMAPDSS: DISPC: Fix rounding error in scaling decision

When checking if we are downscaling by more than a factor,
we were dividing the source dimensions instead of multiplying
back the target dimensions.  This allowed downscaling by
slightly more than the max supported downscaling, resulting
in out-of-range register settings and ultimately SYNC_LOST.

Change-Id: Ic039789c5011d64da870121eeb227a803af1fa83
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAP: clock: fix race in disable all clocks

clk_disable_unused is invoked when CONFIG_OMAP_RESET_CLOCKS=y.
Since clk_disable_unused is called as lateinitcall, there can
be more than a few workqueues executing off secondary CPU(s).
The current code does the following:
a) checks if clk is unused
b) holds lock
c) disables clk
d) unlocks

Between (a) and (b) being executed on CPU0, It is possible to
have a driver executing on CPU1 which could do a get_sync->clk_get
(and increase the use_count) of the clock which was just about
to be disabled by clk_disable_unused.

We ensure instead that the entire list traversal is protected by
the lock allowing for parent child clock traversal which could be
potentially be done by runtime operations to be safe as well.

Change-Id: Iea5201233d89b8417576df4ed9026e1c05001596
Reported-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
ARM: omap: sched_clock: Don't let sched_clock tick during suspend

The register used by sched_clock continues to count while in suspend.
The timer that is used to prevent wraps, which normally fires after
90% of the register wrap time, does not count in suspend.  This
causes the timer to fire after the register has wrapped, which can
cause sched_clock to wrap.

Track an offset value that is updated in suspend and resume to cause
the register read by sched_clock to appear not to count in suspend.
This will cause the sched_clock time before and after suspend to
be the same, but will prevent sched_clock wraps after 131072 seconds
(36.4 hours).

Change-Id: I37054a13232c3a4320a5a49fd99e8ab0c2d1c4fb
Signed-off-by: Colin Cross <ccross@android.com>