msm_fb: display:  add mdp bandwidth runtime calculation

Currently mdp bandwidth request logic is based on source image size
and number of layers. This logic can not support complicated mdp
usecases and it is not power efficient. The logic is improved by
calculating mdp bandwidth request at runtime from all pipes and mixers.

CRs-fixed: 425823
Change-Id: I63206f00f8d3017a2449f8ac617fce3ba2a4d36c
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm: cpufreq: Add API to allow limiting of min and max cpu frequencies

CPUFreq provides scaling sysfs nodes to set min and max frequencies, but
there are times when the operating range has to be controlled
irrespective of the scaling limits, to ensure the thermal stability of
the device.

The API allows kernel thermal safeguards to pitch in and limit the
frequencies.

Change-Id: I3dc7496747792e6223695131f1644dd87054b025
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
msm: cpufreq: increase priority of thread that increases frequencies

When the cpufreq governors request for increase in frequency from kworker
threads, there is chance that the kworker thread is cpu starved due to
other high priority threads, leading to undesirable increase in frequency
ramp-up latency. Add the calling thread to SCHED_FIFO policy when
requesting for increase in frequency and restore back to original policy
after ramp-up is completed.

Change-Id: Ie4fa199b7f9087717cb94dfcc2eddea27cc0012b
Signed-off-by: Narayanan Gopalakrishnan <nargop@codeaurora.org>
msm: cpuidle: Don't disable irqs again

cpu_idle() disables irqs before calling down into the cpuidle
driver via cpuidle_idle_call(). Disabling irqs again in
msm_cpuidle_enter() is wasteful and unnecessary. It also inhibits
our ability to determine the largest irq latency when the cpu
idles for extended periods of time because the irqsoff trace is
reenabled when the irqs are disabled in msm_cpuidle_enter().

Note that we still reenable irqs before returning, as is required
by the ARM idle loop.

Change-Id: I925478d8fef88ab490959622bc68303f59cc6e79
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm: cpuidle: Update C state time stats in the cpu idle device.

msm_pm_idle_enter function returns time spent by cpu in particular
C state. Update the cpu idle device last residency with the return
value which is required for cpuidle stats.

CRs-fixed: 391456
Change-Id: If9f1b59e05c233e53ba37ae0fe9399f12275f3d8
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
msm: Remove idle stats and cpuidle hooks

Calling RCU functions from within the RCU quiescent state is
illegal and probably a bug. The idlestats code uses an atomic
notifier called from msm_cpuidle_enter() and that atomic notifier
takes an rcu read lock. We could fix this with a raw notifier,
but this code is unused so let's just remove the code entirely.

Change-Id: I319f0eabb56a8721c19a3b2b4bc9a7f416c88384
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
msm_fb: display: add wfd clk ctrl in pipe_commit

mdp_clk_ctrl on is not called when commit is from overlay commit path
which can cause mdp hang. mdp_clk_ctrl off should be after mdp
overlay2 is done, so schedule a work in overlay2 done isr.

Change-Id: I94fd08da27cfda114f5cc0056a5103f0a9b772f6
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
video: msm: wfd: Don't signal HDMIDaemon to mirror on FB1

Remove obsolete code that signalled HDMIDaemon to mirror the
display on FB1.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
CRs-Fixed: 352830
(cherry picked from commit 4102d704243cf0ff297cdbe8d5b731da4c0bb9d5)

Change-Id: I07fabb754a49fe398813e864067f96c66a47f489
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
video: msm: wfd: Send signal HDMI observer to mirror on  FB2.

 - Send KOBJ_ONLINE, KOBJ_OFFLINE events to HDMI observer
   to mirror on  FB2.

This reverts commit 4102d704243cf0ff297cdbe8d5b731da4c0bb9d5.

Change-Id: Ie5f0c4528ee43edf5ff8145520723a8095c0f542
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: Add switch node mechanism for wfd

Add switch node mechanism for WFD to indicate the
connection/disconnection event.

Change-Id: I7623e50ba8053602e4b2924d75c0e23b641e2b9a
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
video: msm: Handle MDP_REV_43 MDP identity

Earlier code improperly labeled MSM8960v3 devices as MDP_REV_42. When this
bug is fixed the devices fails to boot. Update checks that exclusively
check against MDP_REV_42 to allow MDP_REV_42 and greater.

Change-Id: I34909cd3cb4a6b937f641737328a0b2ea45a22fc
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
video: msm: Add logical display id for post processing

Define logical id for display backend processing.
These ids are independent with hw implementation, could be used
for MDP4, MDP5 and future ASICs. Kernel driver implementation will
also be abstracted to the post processing user.

Change-Id: I0ce92120e2e008f9acbb934fef0ff7654f27b39b
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
(cherry picked from commit 6a431631728d2d217447079dd636bd1e26d56ac4)
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Update the display board file to reflect the correct MDP revision.

Change-Id: I4147fe1d90b6667a3f7b7d16392036c5651f703c
CRs-Fixed: 417080
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
video: msm: Remove an ifndef from mdp_isr

Remove ifndef so later patch does not require adding more ifndefs.

Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit 20582a5cf3fad8e9fda7ded6478ed8a32b376b97)

Change-Id: I5a19d3ef835281b209cda2487e4a1f25e3c36cd1
video: msm: Finish histogram collection framework for MDP blocks

The patch "Add Histogram collection framework for MDP blocks" was included
on this branch; however, it was an incomplete version. The additions are
more histogram function pointers and better comment formatting.

Change-Id: Id5fb20f07f2c50eb678fd8f57238f4ef3d77acb0
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit 7b8b64075ee4b61c15e28f3042672b26674e0b45)
msm_fb: Add histogram support for MPQ 8064

Currently, there is no support for histogram on MPQ 8064. Add
support for histogram ioctls to support histogram testing.

CRs-fixed: 375580
Change-Id: I24ccf73c6ea6d230da4624ea196cba2d8195f8b2
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
(cherry picked from commit c8430bd159039340c5a50e6897b256631f5dc7bb)
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msmfb: Add Enable/Disable flag definition

Fix compilation error, due to mm-core library supporting MDSS HW.

Change-Id: I50afc5e85129172e6b1774a0bc6b8ceff2aad45a
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm: Ensure droop detectors do not affect krait PLLs

The Droop detector mechanism present in Glitch-Free (GFMUX)
goes to nondeterministic state during frequent
standalone power collapse operation. It affects
Krait PLL output so that the PLL won't lock to
required frequency.

Since Droop detector isn't used, set sc_pdn (PLL_CLAMP)
permanently high to ensure droop detector is off and it
does not affect Krait PLL.

CRs-Fixed: 381144
Change-Id: I94ee03e0e9439c5195909a8646ff9e3c3f667893
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
(cherry picked from commit 06e444f9cd8106816a2874886cb4c165d4b03b81)
msm: platsmp: Update Krait reset sequence

The SMP CPU initialization code incorrectly applied the
KPSS 2.x CPU reset sequence to Krait Pass 3, even on
targets using KPSS 1.x. Modify the SMP code to apply the
KPSS 1.x reset sequence where appropriate, regardless of
the CPU version. Also incorporate updated register settings
to avoid having to later reconfigure the Krait PLL clamps.

CRs-Fixed: 431744
Change-Id: Ie18cf5b2e1a91ae574934e64a487ee27d70ea1a5
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
(cherry picked from commit 986b5153852a01149ec967434b4a95acdb0ac5d9)

Conflicts:

	arch/arm/mach-msm/platsmp.c

Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>
ARM: decompressor: avoid speculative prefetch from non-RAM areas

We setup identity MMU mappings across the entire 4GB of space, which
are permissionless because the domain is set to manager.

This unfortunately allows ARMv6 and later CPUs to speculatively
prefetch from the entire address space, which can cause undesirable
side effects if those regions contain devices.

As we setup the mappings with read/write permission, we can switch
the domain to client mode, and then use the XN bit for ARMv6 and
above to control speculative prefetch to non-RAM areas.

CRs-Fixed: 415757
Change-Id: I24bacf244b1e987e1b966eee64a2578cbdb12080
Reported-by: R Sricharan <r.sricharan@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
(cherry picked from commit 3463f07a22f288c6230aa8c230f623d9183c5a10)

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