msm_fb: display: Flush pipe registers before staging the pipe

Flush pipe registers before staging the pipe for the Mixer with
pull mode panel interfaces. This fixes the IOMMU page fault/underrun
caused by pipe fetching previously unmapped buffers due to missing flush
calls

CRs-Fixed: 356484
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
(cherry picked from commit cfd004fa326a6dc4c7e80da707248b5bddaa39b8)

Conflicts:

	drivers/video/msm/mdp4_overlay.c

Change-Id: I830ef580bf2eb51d83396f1b177ea530fe68eb2f
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
USB: OTG: msm: Fix inconsistent lockdep state warning

=================================
[ INFO: inconsistent lock state ]
3.0.21-g51ce160-00021-g8b33780-dirty #2904
---------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W}

kworker/0:1/32 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&irq_desc_lock_class){?.....}, at: [<c01cfd10>] irq_read_line+0x3c/0x80
{IN-HARDIRQ-W} state was registered at:
  [<c01b8768>] __lock_acquire+0x704/0x9f8
  [<c01b9034>] lock_acquire+0x10c/0x130
  [<c0833ac8>] _raw_spin_lock+0x44/0x54
  [<c01d1c30>] handle_fasteoi_irq+0x14/0x108
  [<c01ce8ac>] generic_handle_irq+0x28/0x3c
  [<c0106f6c>] handle_IRQ+0x7c/0xc0
  [<c0100458>] gic_handle_irq+0xac/0x104
  [<c0834798>] __irq_svc+0x58/0x8c
  [<c01070b4>] default_idle+0x28/0x2c
  [<c010742c>] cpu_idle+0x8c/0xf4
  [<c0808ddc>] rest_init+0xd8/0x100
  [<c0008a90>] start_kernel+0x464/0x4d8
  [<8020803c>] 0x8020803c

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&irq_desc_lock_class);
  <Interrupt>
    lock(&irq_desc_lock_class);

 *** DEADLOCK ***

2 locks held by kworker/0:1/32:
 #0:  (events_nrt){.+.+..}, at: [<c019c49c>] process_one_work+0x1f8/0x518
 #1:  ((&motg->sm_work)){+.+...}, at: [<c019c49c>] process_one_work+0x1f8/0x518

stack backtrace:
[<c010c798>] (unwind_backtrace+0x0/0x12c) from [<c01b53bc>]
[<c01b53bc>] (print_usage_bug+0x248/0x2ac) from [<c01b5804>]
[<c01b5804>] (mark_lock+0x3e4/0x6ec) from [<c01b87f4>]
[<c01b87f4>] (__lock_acquire+0x790/0x9f8) from [<c01b9034>]
[<c01b9034>] (lock_acquire+0x10c/0x130) from [<c0833ac8>]
[<c0833ac8>] (_raw_spin_lock+0x44/0x54) from [<c01cfd10>]
[<c01cfd10>] (irq_read_line+0x3c/0x80) from [<c04e79b8>]
[<c04e79b8>] (msm_otg_sm_work+0x1a0/0x1510) from [<c019c57c>]
[<c019c57c>] (process_one_work+0x2d8/0x518) from [<c019cb94>]
[<c019cb94>] (worker_thread+0x220/0x3a0) from [<c01a2a80>]
[<c01a2a80>] (kthread+0x88/0x94) from [<c0107008>]

CRs-Fixed: 370876

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 431771e5684a35f9ff8f385a8d391e4076b30fdf)

Change-Id: Ida254b3bd839e592d37bd7aad1135ffe17008c4d
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm_fb: hdmi: Guard HDMI related functions

HDMI dependent functions need to be guarded under HDMI panel
macro to avoid compilation errors for non HDMI builds.

CRs-Fixed: 366864

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit 43a72fb470785c90534ba4de964dcd4d3de1ba5c)

Change-Id: I22a7a56bf23d8b8c2f4fdabd7f9c14024f55cc23
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Bluetooth: Check for NULL pointer dereference

The fix in commit ff9718f8254b96dc313dd998c195c1c3769417ba was not
complete.  In l2cap_logical_link_complete the socket pointer was
dereferenced in two places, the previous fix only handled one of
the locations.

This fixes an infrequent crash when performing OPP or FTP transfer
over AMP (Bluetooth 3.0+HS).

CRs-fixed: 360758

Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
(cherry picked from commit 6bba008fbead844722c5dc80b6c4dd59adc637c9)

Change-Id: I311f656682335b43a324710d9224c91b27329cc9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>

Conflicts:
	net/bluetooth/l2cap_core.c
radio: iris: Add calibration mode

Do not queue the FM enabled/disabled events
while calibration is in progress

CRs-Fixed: 358229
Signed-off-by: Ayaz Ahmad <aahmad@codeaurora.org>
(cherry picked from commit c1e6a95c31cc474f809bb7ab3c036e8890be7709)

Change-Id: Ied803ecc284cbcdec036b4b4935db5ffcf5193b3
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: vidc: Fixes bug in handling duplicate frames.

Fixes bug while closing encoder which supports
duplicate input frames. This fix decrements
the reference count of original frames
appropriately.

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

Change-Id: Icf36d82e78588bf4b5becf480bdccd4c7cda94a5
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: wfd: Flush encoder before stop.

Flushes the encoder before stop to make
sure that encoder does not hold on to
any input/output buffers.

CRs-Fixed: 366268
Signed-off-by: Vinay Kalia <vkalia@codeaurora.org>
(cherry picked from commit b6dd587b602ab3cf7149fa609cf912820d643577)

Change-Id: Ied753e48376a4a9835b5d598a847341f8d0c0816
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: vidc: Invalidate the cache before processing metadata.

- Encoder output bit stream is getting corrupted if cache
  is not invalidated before meta data processing.
- ION_IOC_INV_CACHES is called before meta data processing
  to make sure physical data & cached data are the same.

CRs-Fixed: 358392
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
(cherry picked from commit 999a4d94539cbf3e7deb68c61b1539fcba15964d)

Conflicts:

	drivers/video/msm/vidc/1080p/ddl/vcd_ddl_interrupt_handler.c

Change-Id: I759ad9ca8407d98c810691a905f5b3e9d92e9301
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: sps: add flexible memory allocation for desc cache

When a descriptor FIFO is large, the cache for descriptors also requires
relatively large memory allocation. Use vmalloc for this case. For the
small memory allocation, still use kmalloc.

CRs-Fixed: 369996
Signed-off-by: Yan He <yanhe@codeaurora.org>
(cherry picked from commit 55f35cf5b78b4f5ef74843c45201568854719343)

Change-Id: I44fcb62436c964dc9fbddf4c0a930b41cd98456d
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
tspp: 8960: adding TSPP driver for 8960

Board file changes required for adding TSPP support to 8960
For more information on TSPP, please refer to:
Documentation/arm/msm/tspp.txt

CRs-fixed: 334732
Signed-off-by: Joel Nider <jnider@codeaurora.org>
(cherry picked from commit 266a2648d9828258108c16545e62459149c50323)

Change-Id: Ic8283ec563f5633d1b8d1a164ac105f03c10518a
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Merge "mmc: msm_sdcc: allow auto prog done detection" into ics_chocolate
Merge "msm: Asoc: audio: Migrate to ION from pmem, dma alloc" into ics_chocolate
Merge "msm: memory: Use standard cache routines" into ics_chocolate
Conflicts:
	arch/arm/mach-msm/memory.c
Merge "gpu: ion: Use standard cache routines" into ics_chocolate
mmc: msm_sdcc: merge VCCQ and VDDP regulator as VDD_IO regulator

Typically eMMC card have IO voltage different than card VDD
voltage and specification names it as VCCQ voltage. Currently
driver refers regulator powering VCCQ as sdc_vccq.

UHS-I (Ultra High Speed) SD cards may also have the IO voltage
different then card VDD voltage and there is no specification
defined name for it so driver refers regulator powering this
SD card IO voltage as sdc_vddp.

But ultimately both are referring to regulators powering IO voltage
so it makes sense to refer both (sdc_vccq & sdc_vddp) as
sdc_vdd_io regulator. So this patch combines them as sdc_vdd_io
regulator.

CRs-Fixed: 369258
Change-Id: Ieafffbaebc9843c0b8683b87d2bada6b7666c142
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8930-regulator.c
	drivers/mmc/host/msm_sdcc.c

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
ASoC: qdsp6: Fix device crash issue in LPA seek

Accessing buffer pointer before initialization results in device crash.
To memset the buffer using physical address also results in a device crash.
Fixed this by initializing the buffer pointer before it is accessed and
memset the buffer using the virtual address.

CRs-fixed: 359764
Signed-off-by: Amal Paul <amal@codeaurora.org>
(cherry picked from commit 3e0c932acabfeafcef6d06abc801ba8507ccaa46)

Change-Id: I47296fc224d260fa7549afe4d2531af6123b07e6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm_fb: HDMI: Add proper config check for HDMI on 7x30

Add proper configuration check for allocating external memory
on 7x30 devices

Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
(cherry picked from commit fe5f517a26babfc217235dd89801fd5026b28d7d)

Change-Id: I52206b5c25b8543987ed450966f13d40f0406452
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: pm-8x60: Don't restore ACPU frequency for hotplug cases.

During hotplug if power collapse fails don't try to restore the
ACPU clock frequency. For normal hotplug exit ACPU drivers save
and restore as part of hotplug notifications.

CRs-fixed: 334002
Signed-off-by: Girish Mahadevan <girishm@codeaurora.org>
(cherry picked from commit 4e025d9b72f771e30e1803871ac21dbf9d1a366f)

Change-Id: Ifcba558b17a72c232c60ed38d7849f196db1ad44
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Check whether the ops pointer is valid.

Check that the ops pointer is valid before using it, otherwise we
may fault.

CRs-fixed: 360810
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit be9799810e79340362978979ce1ff2d9f185904e)

Conflicts:

	drivers/gpu/msm/kgsl.h

Change-Id: I59d5ee123c66b044e8d9c502ed6e641e51bf62fa
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: display: Fix compilation error for non-HDMI builds

HDMI dependent functions need to be guarded under HDMI panel
macro to avoid non HDMI builds complilation errors.

CRs-Fixed: 366864

Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
(cherry picked from commit df694561ecc3105707af6bf323cd42f988293e3a)

Change-Id: I66d7dcae78120f7c47b10deef682a2f20751f0bd
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>