msm: camera: synchronize vfe start/stop operations.

In monkey runs due to race condition vfe_start gets triggered
before vfe_stop. Add synchoronization mechanism to avoid this.

Change-Id: I78f1820e78dd1cd94098c5edb3ad92548e874713
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
(cherry picked from commit eeca82f2028f888f4895c6530879446cb3a2693f)
msm: camera: Fix color invert issue

The bayer pattern will invert if the frame lenght line
is odd. The change ensures frame length line is always
even.

Change-Id: I7f796b8b0580a563c376f13ed781535df7f54389
Signed-off-by: Rajakumar Govindaram <rajakuma@codeaurora.org>
(cherry picked from commit ad09ecea54bb88dea5145a08f5b0c380f053d2c4)
msm: bam_dmux: Extend locking around SPS transfer call

When a new receive packet is created in queue_rx(), it is added to the
receive packet queue and also queued with the SPS driver.  Once the
packet is filled, then BAM DMUX calls sps_get_iovec() to get the filled
receive buffer.  BAM DMUX then pulls the receive packet info off of the
RX queue and compares the DMA address from the sps_get_iovec() call to
the expected DMA address.  In some cases, they do not match resulting in
BAM DMUX processing the wrong RX buffer.

Going back to the queue_rx() processing, the packet is added to the
receive queue with a mutex locked, but then the mutex is unlocked before
the call to sps_transfer_one() which allows a race condition to exist if
multiple threads call queue_rx().

During normal operation, queue_rx() is only called by the
single-threaded receive workqueue, but during the call to
reconnect_to_bam(), a race condition is expected between the call to
rx_siwtch_to_interrupt_mode() and the final call to queue_rx() if a
packet comes in and is processed before the queue_rx() call is
completed.

This change extends the receive pool mutex locking around
sps_transfer_one() call which resolves the issue.

CRs-Fixed: 377609
Change-Id: Iba5b10e291a1612846fa58dae87aadbd79aa297b
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
(cherry picked from commit 00cf869cf08158aae15e568d687603512f99dfd6)
vidc: 1080p: Handle flush for interlaced clips.

Video core expects one field per buffer for interlaced
clip playback.If a flush is issued we should reset the
need next field flag, so that new bitstream is processed
after flush is completed.
Reconfig flag shouldn't be reset in case of EOS.

Change-Id: Idf50a24c29e904a958b0b1e850813e2d9fc4346d
CRs-fixed: 382368
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
(cherry picked from commit f19f4d27088015842f9bd0945f62b34e90fd784d)
vidc: 1080p: IDR picture type support for H264 format

Read IDR picture type from 1080p core register set
and propagate it to user space using IDR frame type
enumeration in api header file. The IDR frame type
info is used in SYNCFRAME logic for H264 format in
userspace.

Change-Id: Ic677eb4d28469f6712832b7e09050467420eb70b
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit b2295e885966a000cceedcfd4a6462113fe3be4a)
msm: wfd: Add error handling for input buffer ion map failure

Target reset happens when trying to do a ion_unmap_iommu
on the above fd, which was never mapped. Added a check for
non-zero virtual address.

Change-Id: If77c268062fbf6e31aa930f09c0088e8844db5ea
CRs-fixed: 394779
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: video: wfd: Add error handling while wfd open.

- Error handling is not performed when memory allocation failed.
- Reset wfd driver status to false.

Change-Id: Ied77ca1a607c007f5b182e81915f92c9ebc60fee
CRs-fixed: 383712
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
vidc: Handle EOS with Codec config buffer.

Change will handle codec config buffer with EOS.
Video driver will make sure that the codec config buffer with
EOS will be requeued in case of reconfig and non-reconfig paths.

(cherry picked from commit 43b203869814fe5f0ddcb265a8f859aebdaa652f)

Change-Id: I424df5628aaededcbd65c36d369410909e46c515
CRs-fixed: 399347
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
msm: camera: fix for preview rotated by 180 degrees

Change sensor mount angle from 0 to 180 to make the
camera preview proper

Change-Id: I5cd959d6ea6546236ee4be256b7346ae77866fbb
Signed-off-by: Roja Rani Yarubandi <rojay@codeaurora.org>
msm: usb: Tune USB PHY squelch threshold settings

Currently, USB PHY squelch threshold settings(SQRXTUNE) is having
the power on reset value(0x3), due to which enumeration failures
are observed, if amplitude of the USB signal received is less than
threshold. Fix this issue by updating the SQRXTUNE value using
OVERRIDE B register from 3 to 6.

Change-Id: Ib04165bb295c65b6c068a17bba6392611cc1a6d6
Signed-off-by: Chiranjeevi Velempati <cvelempa@codeaurora.org>
msm: vidc: Reset data corrupt flag for non-H264 decoder

Core does not set display correctness flag on decoder
output buffers for non H264 video codec. With this change,
we reset the data corrupt flag for non-H264 codec.

CRs-fixed: 397599
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit fde67e239d8ac3a1e983b7d82d0c37af47464138)

Change-Id: I8247e9dff7a66b9538b102df158dfe1bca0d937c
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Bluetooth: Add sockopts for LE Connection Params

Various LE profiles require very specific LE parameters for
both establishing and maintaining LE connections to remote
peripherals. These LE only parameters are encapsulated into
a single sockopts structure, and may be passed from user space.

CRs-fixed: 335971 387146
Signed-off-by: Brian Gix <bgix@codeaurora.org>
(cherry picked from commit a94b6122f4f7a44dc1d6e6a5dfd2533cad7a3abf)

Change-Id: Iaa2e6a8b371a5463d335d5ea30fd96493a1688b6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>

Conflicts:

	include/net/bluetooth/bluetooth.h
	include/net/bluetooth/hci_core.h
	include/net/bluetooth/l2cap.h
	net/bluetooth/hci_conn.c
	net/bluetooth/hci_event.c
	net/bluetooth/l2cap_core.c
	net/bluetooth/l2cap_sock.c
	net/bluetooth/mgmt.c
fix mismerge from a previous commit
lcdc_ld9040.c: fix includes for gcc 4.6
Bluetooth: Fix for supervision timeout must be 6X connection interval

Added a new function to verify whether the LE Connection Update
parameters are valid instaed of verifying all the LE Connection
parameters since only update parameters are set in the Connection
Update Request.

CRs-Fixed: 387146
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
(cherry picked from commit 95319af0612d58788279748f586cc57221c3443e)

Change-Id: I3b803235150fc2b4508977d766b0f309a74de0c0
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: audio: qdsp6v2: Fix WMV stream resume issue

- Suspend phone while WMV clip playback is going on.
Resume it, clip fails to play.
- At resume of WMV clip, Pause is issued initially
to driver. But there is a bug in pause API which is
not returning appropriate result. OMX component when
starts playback, it now issues resume to driver and
driver is setting DSP to run state even before ENC_DEC
params are set.
- Fix pause code to return error value if driver is not
enabled. This will avoid driver in sending CMD_RUN
before ENC_DEC command.

CRs-Fixed: 394756
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
(cherry picked from commit 92ad28cd56803b451ae4bde72bfd20021c769649)

Change-Id: I8435fa5fe21f8d01802fbef70e0994584382b460
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: Qdsp5v2: audio: Migrate to ION

PMEM is deprecated, switch to ION.

Change-Id: Ia15c444e26961d8aa40bd5db3ece1fd9368e02ef
Signed-off-by: Sidipotu Ashok <sashok@codeaurora.org>
Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>
msm: kgsl: Check for valid pointer before dereferencing

Check to make sure that there is a valid context pointer before
dereferencing it when adding commands to the ringbuffer.

Change-Id: Icf9824de8f62a28cdeeef4378246d9fb334d39fa
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Always submit an interrupt request to the GPU

A context does not have to be present to send an internal dummy
command to the GPU.  Remove BUG() in this case and instead send
a NULL context which will still cause the interrupt to get submitted
to the GPU.

CRs-fixed: 392688
Change-Id: I66b6eebe899ab09e6615d08faddea7ea73de5c6d
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm-camera: Add Double Padding Support in Gemini

Add support to handle the padding
on both sides of the input buffers
to the Gemini driver to support
rotation in ZSL mode

Change-Id: I4bc0ef5a3d0f551021afbb93fd57acdcc83875b4
Signed-off-by: Ashwini Rao <ashwinik@codeaurora.org>
(cherry picked from commit 7a632c64debde89a280b20ca01e5ec1f27fe947f)