ksm: check and skip page, if it is already scanned

On system like Android where most of the process are forked
from parent w/o execve, KSM can scan same page multiple times
in one scan cycle. There is no advantage in scanning same page
multiple times for merging. During testing with Android, it was
observed around 60% pages are skipped for each scan cycle.

Change-Id: I0cf01802f0b4d61fcab92558beb9e1c660dc9a77
Link: http://lkml.kernel.org/r/CAMrOTPgBtANS_ryRjan0-dTL97U7eRvtf3dCsss=Kn+Uk89fuA@mail.gmail.com
Signed-off-by: Pradeep Sawlani <sawlani@amazon.com>

Signed-off-by: Paul Reioux <reioux@gmail.com>
ksm: check and skip page, if it is already scanned (part 2)
defconfig: enable KSM
fastcharge: initial Nexus 5 adaptation

added custom charge levels for better control over fastcharge

Signed-off-by: Paul Reioux <reioux@gmail.com>

Signed-off-by: DooMLoRD <metoo.mememe@gmail.com>

Conflicts:
	arch/arm/mach-msm/Makefile
fastcharge: initial port to Xperia Z1
fastcharge: some more fixes specific to Xperia Z1
defconfig: enable fastcharge
WLAN subsystem: Sysctl support for key TCP/IP parameters

It has been observed that default values for some of key tcp/ip
parameters are affecting the tput/performance of the system. Hence
extending configuration capabilities to TCP/Ip stack through
sysctl interface

CRs-Fixed: 507581

Change-Id: Ie9c4c43ae4205f0fd3e2a903949fb3bc0acea85f
Signed-off-by: Kiran Kumar Lokere <klokere@codeaurora.org>
msm: mdss: Clean up merge damage

* Commit 'msm: mdss: Check extra mmb allocated to a pipe'
  actually removes this, but this was re-introduced as part of a Sony
  upstream merge.

Change-Id: I907c404fb7aa28251d9d674fd36c14b36914a399
msm: mdss: On sharing dma pipe increment pipe ref_cnt

When DMA pipe is being shared and if mdss_mdp_pipe_map is called,
there could be a race condition when the pipe being shared
is unmapped, will lead to map failure as map is used for operations
on pipe which are already having positive ref_cnt.
This can result in potential map failure and attempt to free of
unmapped pipe resulting in crash.

Hence in this scenario of shared pipe usage atomic_inc should
be used instead of mdss_mdp_pipe_map.

CRs-Fixed: 590736
Change-Id: Ibaba20ac96662b5cd8aba3585f10d9cfe6e72d22
Signed-off-by: Justin Philip <jphili@codeaurora.org>
msm: mdss: Reserve single SMP block for writeback mixer pipes

Writeback does not have stringent requirement for latency
buffers. So, SMP blocks reservation for the pipes attached
to writeback block can be restricted to single SMP block for
each plane. This makes more SMP block available for other
clients.

Change-Id: I3d788bcf7fcbc5667b4a3a0c52256f55cc0aa1e7
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Add SMP parameters into hw capabilites

To handle use cases better, expose smp_mb_cnt and
smp_mb_per_pipe to userspace as part of hardware capability.
Pipes availablity for a use case can be computed taking these
values, based on which, composition decisions can be made.

Change-Id: Ia7cc4db153cdb164a29ae2369d3e991b95aaba65
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: optimize MDP pipes cleanup

There are cases where pipe cleanup can happen without display commit.
This means that the pipe was never programmed to hardware, in these
cases the pipe can be cleaned up without the need of display commit
cycle to happen. Also there is no need to access hardware to release
resources such as SMPs since they have not been programmed yet.

Change-Id: I57a46471dc1fba4e45e55c3543940ba4fba0540a
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Add SMP per pipe parameter into hw capabilites

Additional SMP parameter 'smp_mb_per_pipe' is required by
userspace as part of hardware capability made available
through sysfs node.

Pipes availablity for a use case can be computed taking these
values, based on which, composition decisions can be made.

Change-Id: I2d790506ca895357762e1eca098ea1734077a097
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Don't call pan_idle for MSMFB_OVERLAY_PREPARE ioctl

We keep calling MSMFB_OVERLAY_PREPARE for each composition
cycle, even if there are no changes in params. Because of this
we can hit performance degradation due to pan idle wait.
This change removes pan_idle wait for prepare call.

CRs-Fixed: 600539
CRs-Fixed: 608848
Change-Id: Ie99f4dbc4671caf9bfbd49bd9b200c3180002d56
Signed-off-by: Radhika Ranjan Soni <rrsoni@codeaurora.org>
msm: mdss: refactor command mode vsync control logic

Current logic is prone to corner case when mdss_mdp_remove_vsync_handler
is called twice: once from mdss_mdp_cmd_stop and again from vsync ctrl
logic. Need to properly identify the second call and avoid resetting the
rdptr ticks which prevent from clocks being turned off properly.

Change-Id: I9eeebd0c16e67a249508980427c81fa2e339edec
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Sanitize overlay kickoff inputs

Overlay kickoff in certain situations can be called without a ctl
attached to the frame buffer device. These situations need to
be captured and logical path should return safely.

CRs-fixed: 619588
Change-Id: Ibee6b59be667b7e5c9841ffb49c67d86bde45026
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: keep clocks on during kickoff operation

There is deadlock scenario where work thread to turn clocks off is
trying to acquire DSI's mdp_busy lock while holding clk_mtx to turn
mdp clocks on.  Meanwhile kickoff thread holds mdp_busy lock and
trying to acquire clk_mtx to turn on clock.
This patch ensure that clocks are kept on and work thread is not
scheduled while kickoff is in progress so that deadlock will not happen.

Change-Id: Iceb5db431a7f9f0e1f56a0e3c1ced2d08d762b86
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
msm: mdss: wait for dma done before issuing dsi bta request

In the command mode panel, the mdp pixel data is using the
dsi command mode engine which is shared with the dsi dma
transaction.  This change makes sure there is no pending
mdp dma before issuing the dsi bta request.

Change-Id: Ida99e973c2bf73757726134ba7e2ad2df9e6eb02
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
msm: mdss: Prevent race condition between dsi off and bta status check

fb_event_callback() is what is responsible for cancelling the
delayed_work when it gets the FB_BLANK_POWERDOWN event. However,
this event occurs after the panel & DSI have been turned off. So
if the check_status function was being called right when the panel
is being turned off, we have a race conditon. Hence check
shutdown flag to avoid bta status check when dsi is being turned off.

Change-Id: I103bafb4ab63be83c47dfd6b3bad06d36704ff68
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>