Revert "Revert "msm_serial_hs: Revert to LGEs hammerhead-3.4-kitkat-mr2 driver""

This reverts commit 6510018efa8c5383959d6aa700268b34ff99ce33.
cpufreq: cpu-boost: Resolve deadlock when waking up sync thread

CPU boost driver receives notification from scheduler when threads
migrate towards a cpu and in turn wakes up a sync thread associated
with that cpu to handle any required frequency transitions. The wakeup
call however can lead to a deadlock inside scheduler under some
circumstance. The deadlock is seen when sync thread is the only thread
running on a cpu and goes to sleep (say by calling wait_event() ->
schedule()). Midway through this sleep (schedule()) call, while cpu is
still running in context of sync thread, scheduler attempts a load
balance (realizing that cpu is about to become idle) which can result
in tasks being migrated towards the cpu going idle. This will cause
migration notification to be issued and in turn a wakeup on sync
thread. The wakeup call however gets stuck in below while() loop
inside scheduler:

try_to_wake_up(struct task_struct *p, ...)
{

        /*
         * If the owning (remote) cpu is still in the middle of
	 * schedule() with this task as prev, wait until its done
	 * referencing the task.
         */
	while (p->on_cpu)
		cpu_relax();

}

A possible fix could be to teach try_to_wake_up() about this
special case. Another fix, implemented in this patch and that helps
minimize scheduler changes, is to have cpu boost driver not issue a
wakeup under this special circumstance, which was found to occur very
infrequently.

Change-Id: I92bc68a22d51595a208673fe2a1eedfa97004f9e
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
cpufreq: cpu-boost: Re-issue boosts above minimum frequency

Frequency boosts where the source CPU frequency is greater than CPU's
minimum frequency should always go through regardless of the destination
CPU's current frequency. This fixes a performance issue where the governor
lowers the CPU frequency shortly after a thread is migrated to it because
the boost wasn't re-issued.

Change-Id: I449545a688d84b0a6e834f5a51dcb499caa84d29
Signed-off-by: Patrick Cain <pcain@codeaurora.org>
cpufreq: Sync on thread migration optimizations

When threads migrate between CPUs the destination CPU will temporarily
have a boosted frequency and the source CPU will have a residual higher
frequency even though the load could have just been reduced. To avoid
leaving CPUs at a high frequencies notify the source CPU after a thread
migration and make the interactive governor's timer reschedule
conditionally.

Change-Id: Id55055f2a116ca7ffd2a34dc3d0ec519c888a111
Signed-off-by: Patrick Cain <pcain@codeaurora.org>
cpufreq: cpu-boost: Use interruptible wait to not affect load average

Using the function wait_event in cpu_boost puts the
process enter to 'D' state which contribute to the
high load average. This change will put the process
boost_sync in the 'S' state (interruptible sleep)

Change-Id: Ie121adbe1fac1d2862ac5342bb97c7c926f7d7a8
CRs-Fixed: 655484
Signed-off-by: Swetha Chikkaboraiah <schikk@codeaurora.org>
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
msm: thermal: Use interruptible wait to not affect load average

This is necessary when using KTM.

Change-Id: I8dfb5d23cacb8543d401e7f47306e15a2d9e731d
msm: Adding mechanism to Stop CAMIF Immediately

Currently we have the mechanism to stop CAMIF immeidately from
Kernel Space. This change provides access to this mechanism.

Improving the procedure for CAMIF Stop:
Implemented the recommended mechanism for CAMIF Stop.

This changes improves latency to meet 100ms requirement for
flush() call.

Bug: 9758581
Change-Id: If015241598ff9134d1ce49def35f6083eff2d9c3
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
msm: camera_v2: cpp: initialize inst info

memset inst_ifo structure to aviod sending
uninitialized data via ioctl

Change-Id: I2e8ee5ccf4180a9004851c51ed6f837ae492e6cc
Signed-off-by: Georgi Hristov <ghristov@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
msm: camera: Add support for RAW streams in camera

Add suport for raw streams in ISP driver.

Change-Id: I5121981f63d656d08a72f362a6a9621031226dab
Signed-off-by: Rajakumar Govindaram <rajakuma@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
msm: camera2: cpp: Append frame buffers to the list

In case of late buffer allocation, allocated buffers
have to be appended to the existing queues.

Change-Id: Ie14f00038e86b9d7c8caa01587a2ed1aee7d80e8
Signed-off-by: Iliya Varadzhakov <ivarad@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
msm: camera_v2: Fix CAMIF stop sequence

Only stop CAMIF immediately if all active PIX and RAW streams
are stopped.

Bug: 13891761
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Change-Id: Idb0bc8da91a46c997c31c8075f9f4152a63d046d
msm: camera: Fix buffer index mismatch for HAL buffer

AXI irq could arrive before EOF irq. Because of this,
folowing changes are made:

1. Set request_frame flag during IOCTL instead of waiting
until EOF, and
2. Set AXI skip flag during SOF instead of EOF.

Bug: 13887745
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Change-Id: I25a238e2cfae0e3a792a3689e00e16bc46dcb9d0
msm: camera: Directly use stride from buffer_plane_info

stride is already in the unit of bytes. Just need to convert
it to units of 64-bit words.

Bug: 14395767
Change-Id: I57960371911c492cab7d5ca5f710ca0f16572d77
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
arm/dt: msm8974: Enable Microphone Activity Detection

Add Microphone Activity Detection(MAD)'s slimbus device ID and configure
MCLK as a supply of MAD to add MAD support.

Reference CAF commit: 43a3f2d086f6f37acc91fc96cf6d4e887da880d7

Change-Id: I1eb8bb38a954f7573f0b19b34ce47d3f9b0a50b8
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
arm/dt: hammerhead: Remove mbhc-audio-jack-type property
power: bq24192: Reset otg gpio during probe

Ensure a proper state for reliable detection of wireless chargers.