fmem: interact properly with DMM

On a system with both FMEM and DMM, FMEM must veto
memory hotremove of section(s) FMEM occupies when
in C-state and allow it (after cleaning up metadata)
in T-state (and then change to O-state).

It must also change back to T-state when all sections
FMEM uses have been powered on.

Change-Id: I9766a07305d1e3e2c6ff48e1cbf6933765b751f8
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
fmem: hotplug notifier should do nothing if fmem is inactive

If fmem discovers it has no memory to manage, it will
stay in an uninitialized state. However, this is
not discovered until long after the hotplug notifier
is set up (which must be in the fmem_init function).

Since fmem has not been initialized, the hotplug notifier
runs and incorrectly causes memory hotremove to fail, as
it bases its decision on uninitialized data.

The fix is for the hotplug notifier to just return
immediately if fmem is in the uninitialized state.

Change-Id: Ia647470d64fe1926be404af419f5f516e6b59c05
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
fmem: add missing zcache_put after zcache_get

The code to flush all objects was missing a needed
zcache_put after a zcache_get.

Change-Id: I03ad33ee74b42567d8c0598bd5c2af7e455ca097
CRs-Fixed: 350617
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
FMEM: allocate non-fixed FMEM from memory pool

On platforms whose FMEM is not at a fixed place
and which don't have DMM (such as 7x27a), FMEM
and the EBI memory pool would incorrectly overlap,
and the same memory would be used both as FMEM
and as memory allocated by allocate_contiguous_memory()
at the same time leading to crashes and strange behavior.

There are some unsolved problems related to
allocating FMEM from unstable memory, so we have
decided not to do this any longer. This decision allows
us to simply allocate non-fixed FMEM from the
EBI memory pool (this will prevent FMEM's memory
from being used by another allocator at the same time).
In this case FMEM will appear to "overlap" with
the memory pool, but this now OK as FMEM is allocated
from it.

This also re-enables FMEM on 7x27a and 8625, which
had been disabled due to the above-mentioned bug.

CRs-Fixed: 354254
Change-Id: I8e0bba332c7ddcac1d280de9642078fdfe61bbcc
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8960.c
	arch/arm/mach-msm/board-msm7x27a.c
	arch/arm/mach-msm/memory.c
fmem: Use alignment property from platform data

Change-Id: I5d3e5f2c022937cd721befdd67a9d2f8f927608e
Revert "input: Disable DVFS and finger up/down logs"

This reverts commit b1eb3061c8fc24702f03f3416b9596596aac17f6.
build script changes for non-kexec
flashable zip content changes for non-kexec
msm: improve handling of DONT_MAP_HOLE_AFTER_MEMBANK0

The code to avoid mapping the hole after memory bank 0
located the start and size of this hole after running
generic initialization code which needed to convert
physical addresses to virtual ones and vice-versa
beyond this hole.

While this didn't prevent the kernel from booting, this
isn't clean, and in fact it was giving us more vmalloc
space than the config file specified (and as a result
there was less lowmem than expected).

The code to locate the hole now runs before this
initialization code.

Change-Id: Id67d8b9ea489b6d6a2c20151b0fc9a9d7b5b662d
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
board-8064 msm: Overlap secure and non secure video firmware heaps.

Moves fixed area start address down, so that non secure
video firmware heap and secure video firmware area overlap.
Both use the region in a mutually exclusive manner.
ALso introduce a hole, that can be used by MM heap
lock down for content protection.

Change-Id: Ic240377da25e00423742ccb73dbb60a1ff037e37
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit eadb7505134a23b8de3cd74c924fd31324978a7e)

Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8064.c
gpu: ion: Fix fragmentation debug message cond.

If an ion allocation fails because of memory fragmentation a debug
message should be printed. However, the logic that decides whether
the debug message should be printed or not is incorrect causing
the debug message to not be printed when the amount of space
available in the heap is equal to the requested size.

Change-Id: Iaaf8cd6742aeffab7bcb4806e485326fb9690945
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
d2: Import FMEM changes to board files

Change-Id: Ie47d4578c77be72704f431d0255aaf41bcfd197c

Conflicts:

	arch/arm/mach-msm/board-m2_att.c
	arch/arm/mach-msm/board-m2_spr.c
msm: move fixed area start lower so that 768M systems work

The start of the fixed area was at 0xb0000000, but
on 768M 8960 systems this memory doesn't exist.
Since the start of the fixed area must be the
same on all 8960s, the fixed area start is
lowered to 0xa0000000.

Change-Id: Ia86513b08ebc4d37bd1afca7263d8a409d2a72bb
CRs-Fixed: 349125
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>

board-8960: Merge secure and non secure firmware heaps.

The secure and non secure firmware heaps are now merged
for a total of 2MB savings

CRs-Fixed: 365291

Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit 6a309d3a5b559495ccfd5a273f12dad30e14c96f)

Change-Id: I968afa950873e038d0a8ce60e8a2a89e9577cecb
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8960.c

msm: Fix for incorrect fmem and mm heap sizes on 8960

Introducing a overlap of secure and unsecure pil heap
overlap, needs to be propogated to fmem logic.
fmem reserved areas and base address need to be adjusted

Change-Id: Ia7b6fd8e1ce3c86d7dd3834c0e80d63575ff2368
CRs-fixed: 373054
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8960.c
Revert "net: wireless: bcmdhd: Add SETSUSPENDMODE command"

This reverts commit 2e2c2678c7bd0e544301be51cf09247ea1587429.
Revert "msm_fb: display: extend mdp debugfs with force blt enable"

This reverts commit 45d9438278405f2e5a86f61db3fadb4927d358a5.
msm_fb: display: Add BLT support to dsi command mode panel

At run time, mdp BLT (writeback) mode is enabled and disabled
base on performance level to avoid mdp underrun. Move BLT
enabled/disabled logic to pan display so that enabled/disable
is done per commit instead of per queue. Since all panels
are shared same logic, dsi video mode and lcdc panle BLT logic
have been changed accordingly.

Change-Id: Iee4854b1bb6cc6f249dce0c2ccb39d5b07abe858
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay.c
msm_fb: display: clean pipe free or unlock calls

A few places have unnecessary mutex unlock calls, and iommu pipe free
depends on pipe parameters so move it before pipe is zeroed.

Change-Id: I67158380ec2d0f1727bebfaf9e6a4a0652d40f30
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay.c
msm_fb: display: add dmap waiting before turn off timing generator

Wait for dmap done to turn off TG to avoid underruns before base
pipe setup and after constant splash during boot time.

Change-Id: I64bc3935d996af1d2d54db4c11319301ea454ced
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm: display: Set max MDP bandwidths for larger primary resolutions

To avoid underruns for larger primary display resolutions,
set max MDP clock/bandwidths for dynamic boot parameter
cases with HDMI as primary and WUXGA panels

Change-Id: I1e020de0cbd4082edd26d4b03ebee4d4b976c26a
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: remove the predefined mdp clk rate tables

Mdp clk rate will be calculated during run time based on pipe
requirements, so the tables in board files are not necessary. Only the
max rate which is target specific is passed to display driver.

Change-Id: Ib42d378e5bb4b6876719c2cebefbd9dc9a4cef15
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8960-display.c