Fix not able to disconnect from the Host after SMP requests

The following fixes were added:
1. While using whitelist API for connection, if SMP requests are received
before the L2CAP channel is correctly setup, queue the SMP requets
and execute them once the channel state is bounded and connected and
therefore maintaining the correct connection reference count.
2. If the status LE start encryption command is not successful,
then call hci_conn put which would decrement the HCI connection
reference count.

CRs-fixed: 447092
Change-Id: Ibb11ecf94f28e0b0aff5eacc86d1660e7ec2e25d
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
msm_serial_hs: Wait for discard flush completion for UART Rx channel

Completion of requested flush command with ADM driver is having more
latency then previously. Hence now it is required to wait for discard
flush complete if there is more events expected with UART driver which
would go out of sync without it. Below are 2 instances where it is must
to wait for discard flush completion requested on UART Rx channel.

1. Changing Baud Rate of UART
UART application can send baud rate change request based on its requirement
of communication with connected device on remote uart. Serial core also
does set by default baud rate when application is opening the uart port. As
Rx command is queued always with ADM driver from UART driver, for above
events it is required to flush the same after setting the baud rate. Not
waiting for completion of Rx flush would allow application to send command
on Tx or any other ioctl which would reach to connected device but response
may not be received as Rx flush completion is not received to queue next Rx
command to ADM. Hence with this there are chances that received data with
UART wil be lost when Rx flush completion is not received in-time. Hence
wait for Rx flush completion from set_termios() with timeout as 300 jiffie.
Rx flush completion time is non-deterministic as it depends on number of
commands queued to ADM driver from ADM client drivers.

2. While going for UART clock off
UART clock off has multiple state machines and before going into last
state it makes sure that there are no pending data in UART Tx and Rx FIFO.
Although there would be one Rx command queued which is flushed before
moving to last state and going ahead with UART clock off. If UART clock is
turned off before Rx flush request is being executed and ADM tried to flush
Rx command, ADM encounters data bus error on UART Rx Channel. Hence with
waiting for Rx flush completion, and then doing UART clock off on receving
the same would resolve ADM data bus error issue on UART Rx channel.

CRs-Fixed: 457769
Change-Id: I9344277224a2dc3f28140a1f42aa3feed5411b97
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Bluetooth: Dont retry eSCO for WBS

This fix will allow the hci event handler
to notify the eSCO connection failure for mSBC,
to BT host which can fallback to CVSD and retry
the eSCO again with a new codec negotiation.
This behavior will allow PTS test case
TC_AG_ACC_BI_12_I to pass as it expects
a codec negotiation after the first attempt
for mSBC is rejected from the PTS.

CRs-Fixed: 390563
Change-Id: I93973d14a035a743f582e751047bf23b66681932
Signed-off-by: Nitin Srivastava <nitinsr@codeaurora.org>
msm:crypto: Add validation checks for memory cleanup

Add validation checks to handle memory freeing &
prevent NULL pointer access.

Change-Id: I6e82ea56754fb12b467d5ecb642411017c1e18c6
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
msm_fb: hdmi: proper vic for 576p

Corrected the AVI info data with right VIC for 576p@50 16:9

CRs-Fixed: 457252
Change-Id: I8536c141823e9d8436bdd8df0038d3e203ec0c4b
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
ASoc: msm: Add support for VoLTE

- Add VoLTE_STUB FE for VoLTE stub session
- Add routing controls for VoLTE stub session

Change-Id: If2de711422320425dbb71ffcca88d78e354322bc
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
msm: sps: Fix BAM ISR race with pipe disconnect

Pipe EOT can occur while SPS pipe disconnect is being done.
The pipe disconnect can free up resources and pointers that
are used by bam_isr() in parallel in SMP environment and can
cause null pointer dereference.

Fix this by calling synchronize_irq() before freeing up resources
and by spin_lock to avoid race conditions.

Change-Id: I51eb88e1d68123d13d4aaf654e729236a4a3f144
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
msm_fb: display: no native frame buffer memory operations

Since we don't use pan_display, the native frame buffer memory is not
necessary any more. This is driver change, mainly disabling memory
operations that are associated with native frame buffers.

CRs-fixed: 458938
Change-Id: If33bff32ee1d9228ff8a74ca09961a0f10f1fcdd
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
media: dvb: Seperate secure demuxing to secure feeds only

In current implementation secure demux performs demuxing on all filters
including non-secure filters.
This implementation fails in case output buffer is externally allocated by
the user from a heap that does not allocate physically contiguous memory,
which is allowed for non-secure filters.
Secure filters buffers are guranteed to be allocated from a heap that
allocates physically contiguous memory.
To overcome this problem, this patch splits the processing between
normal sw demux filters, and secure demux filters.
Filters which user defined as secured will be processed only by the secure
demux, while other filters will be processed by the normal sw demux.

Change-Id: I25c2e0a8e37cf0d3590de85a10c80b84a4f950c6
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
msm:camera: Increase the UB sizes for stats

Increase the depth of unified buffers for bayer stats

Change-Id: I0296d02e2850b95f7af3bc00101660b2a8433113
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
msm: pm: Add support for retention on each core

Allow each core on 8974 to enter retention and retain
the state of the CPU. On 8960 as hardware restriction does
not permit all cores to enter retention at the same time,
allow only core 0 to enter retention when all other cores
are offline to maintain backward compatibility.

CRs-fixed: 437281
Change-Id: I6690e901afc9fa3a27010c264fa3acc9a0722c1a
Signed-off-by: Priyanka Mathur <pmathur@codeaurora.org>
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
msm: pm: Update spm retention sequence to support per core retention

On krait revision < 3, power driver is not using full spm sequence and
calling into trustzone as a part of executing krait retention.
Also krait retention is not supported on secondary cores.

krait pass3 is upgraded to use full spm sequence, hence add support
for per core retention and avoid calling into trustzone
while executing retention.

CRs-fixed: 437281
Change-Id: I6a2b3d7c4d0fd5b9a340957b16b940b7a09bbd91
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
msm: avs: Restore core voltage when disabling AVS

AVS changes the core voltage to match the current operating conditions
on the part. Not all frequencies supported by the target have characterized
AVS delay synthesizer (AVSDSCR) values. For frequencies that do not have
AVSDSCR set, AVS is not enabled and so need to operate at the
characterized voltage for that frequency. Disabling AVS does not
however, restore the operating voltage to the value the rail was
configured to. This may cause frequencies that do not have AVSDSCR to
run at lower voltage than prescibed.
Set up the core voltage back to the last known good value when disabling
AVS.

Change-Id: I5389996288fa49e45c469d2a8917e00900261de7
CRs-fixed: 457772
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
msm: wfd: Return proper error if mmap fails

Change amends the check condition for mmap return
values appropriately to fix the allocate buffer
failure cases.

CRs-Fixed: 453057
Change-Id: I05ceb4f2960c26e4bc024e0c5f530f874c90a048
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
Revert "power: pm8921-charger: add boundary check for out of bounds issues"

This reverts commit 13c972d87f309a326449b42b50b1b923ef3e168f,
which is a duplicate cherry-pick already done by a mega cherry-pick patch
from msm-3.4 branch.

Change-Id: I8a394645d4a80f236cec63fb0ea7a09ff896319a
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
Merge "media: dvb: Seperate secure demuxing to secure feeds only"
msm_fb: display: don't enable blt mode

The switch of blt mode may cause mdp hang on some targets. To avoid
blt switch, we won't allocate the pipe that requires blt
mode. Basically this implies two things: downscaling is done by
rotator and gpu composition is used in case of blt mode is needed.

Change-Id: I2d6f1a0e33a40af90e3a1a013a1b48b0df0c8ea2
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Merge "Bluetooth: Dont retry eSCO for WBS"
ASoC: msm: Fix for improper volume ramp up in tunnel playback

A disturbance is heard when resuming the playback after
switching from headset to speaker and back to headset with the
music paused for more than 3 sec. This is due to, data getting
rendered with the speaker volume where it had to played with headset
volume. Fix is to set the '0' as the initial volume.

Change-Id: Ie4726a7898620fb912279270e24fa15a45a437f9
CRs-fixed: 453704
Signed-off-by: Amal Paul <amal@codeaurora.org>
Merge "msm: wfd: Return proper error if mmap fails"