msm: mdss: refactor ping pong completion logic

Replace completion structures with waitq and track the completion of
ping pong transfer with a single kickoff count variable. This prevents
race conditions when using completion structure and provides a cleaner
way to identify whether wait is required.

CRs-Fixed: 720541
Change-Id: Iebb8077d520649db427470fc4963d892967a920c
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Krishna Chaitanya Devarakonda <kdevarak@codeaurora.org>
msm: isp: Fix bus halt acknowledgement.

In dual ISP case, we are not receiving the halt
ack for VFE1. So, instead of depending on irq
we need to poll the bus status to find out bus is
halted or not.

Change-Id: I380dded0dcf6f7f35894b31272792cb44b5de486
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
msm: camera: Assign NULL after freeing memory

In msm_actuator we need to assign memory
pointer to  NULL after freeing that memory
using kfree.

Change-Id: I2dd5983f56367983eb3005e95bc1ed7ace7d2b66
Signed-off-by: Figo Wang <figow@codeaurora.org>
Merge "msm: mdss: refactor ping pong completion logic"
Merge "msm: camera: Assign NULL after freeing memory"
Merge "msm: isp: Fix bus halt acknowledgement."
slim_msm: Handle external-modem shutdown differently than restart

External modem may shutdown in cases other than subsystem-restart.
In that case, the power-up notification may not happen.
Handle such a scenario and make sure runtime-pm vote is not held
for more time than required, and that slave-device up/down/reset
notifications happen as expected if slimbus was down.

CRs-Fixed: 645450
Change-Id: I5fef2393c835d06c5ce1dc4f9cb62d418620211b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
slim_msm_ngd: Add IPC logging support

Add IPC logging support for improved debugging
per device, and in memory to avoid using kernel
dmesg logs.

Logs are captured in four levels.
1) error level ---> All fatal errors are logged
2) warn level  ---> error level logs +
Warning messages are logged
3) Info level  ---> Error level +
warn level + the required information
for debugging is logged
4) Debug level ----> error level + warn level +
info level logs + extra information
for debugging are logged

Procedure to change the debug level at runtime:
==============================================
cd sys/devices/ctrl_num(eg:1234).slim
echo <log_level> > debug_mask

Procedure to collect the logs at run time:
=========================================
adb shell cat sys/kernel/debug/ipc_logging/ctrl_num.slim/log_cont
|tee slimbus.txt

CRs-Fixed: 645838
Change-Id: If183533472ee61b2d8cf458d228dd4ae2124dd37
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
ngd_slim: Decouple clock pause from power down/up

NGD slimbus driver itself can never send out clock pause sequence
for slimbus protocol on the HW lines since it can only be sent by
a manager device (which is controlled by ADSP when NGD driver is
instantiated from apps side).
Previously, clock pause of slimbus framework was coupled with power
down/up. That is not correct, since manager device may or may not
decide to send clock-pause on the HW lines. (e.g. if apps is inactive,
but some client on ADSP is active, clock-pause sequence won't be sent
over the bus.
Decouple power-on/off from clock pause to avoid giving incorrect
impression to clients on apps side about clock-pause state. Mark
clock-pause as unsupported by setting wakup function pointer to NULL
instead since this controller on apps cannot send it on HW lines.

CRs-Fixed: 667165
Change-Id: I382bca153deb2fed1d0f0672adaebde1e122dc68
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
msm: ipc_logging: add client version support

If clients use custom serialization functions, then they may need to
define a version for deserialization support for log extraction

Add client version support

Change-Id: Id135f06d4142de39275b5d0caab88708d5496b5e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
ngd_slim: Register with QMI service in the slave-notification thread

Slave notification thread is used to notify slaves when QMI server
(hosted by slimbus msater driver) on the remote execution environment
has come up. Use that thread's entry point to do QMI service
registration as well since doing so in probe may trigger another
probe by the QMI service leading to boot-up stalling.

Change-Id: I06b1bcfd9aa3d570554971acacd5d7b1dc20fd1c
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
ngd_slim: Fix return paths in transfer function

Return right away if resume fails when runtime-pm is not
enabled. Consolidate return paths if controller power-on
vote fails when runtime-pm is enabled

CRs-Fixed: 677689
Change-Id: Ia8887dd87df6dba4f93638650794bfcdc7d1ff75
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Venumadhav Kurva <kurva@codeaurora.org>
Merge "slim_msm: Handle external-modem shutdown differently than restart"
Merge "slim_msm_ngd: Add IPC logging support"
Merge "ngd_slim: Decouple clock pause from power down/up"
Merge "msm: ipc_logging: add client version support"
Merge "ngd_slim: Register with QMI service in the slave-notification thread"
Merge "ngd_slim: Fix return paths in transfer function"
mdss: mdp: Appropriate check to see if right LM is needed

New fixes rely on selecting right layer mixer by changing
destination layer x offset to be >= left layer mixer's width.
This patch is to allow for this logic to be corrected on
chipsets that do not support x offset being greater than
layer mixer's width.

Change-Id: I860e87a8092c81a0a1523ee7b47b02b57160f4af
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Merge "mdss: mdp: Appropriate check to see if right LM is needed"