msm: ADSPRPC: Fix offset for input and output buffers

The buffers being passed to remote processor did not have
the right offset into the IOMMU VA for cases where the offset
was greater than 4K.

Change-Id: I32360a337ecbb9ebe3d33e5a6d680b1033945641
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
qseecom: Add boundary checks for offset within message.

Qseecom driver does not have boundary checks for offset within the
message. So this patch add checks to validate the offsets sent by
client to modify data within the command request message and it
should not exceed the memory allocated for that message.

Change-Id: I29bfbdc154eebb4f3f4bfbb31789562e37fa5886
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Mallikarjuna Reddy Amireddy <mamire@codeaurora.org>
msm: vidc: Fix race condition in power collapse sequence

There is a race condition if client queued an ETB between
RELEASE_RESOURCE (OCMEM) and PC_PREP commands in power
collapse sequence where the client will never receive
ETB_DONE because the clocks are already turned off.
Avoid the problem by counting the number of commands
queued to video hardware to skip power collapse sequence
if client queues any commands.

Change-Id: I0bb908e11308cfc4f8bdbdc01fd92dac67b78eac
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
diag: Handle spinlock correctly

Currently, if failure happens while writing data over to USB,
spinlock is not released. This leads to deadlock and kernel panic
which re-accessing it. This patch fixes that issue.

Change-Id: Ic34cfdb8c145329177b0b0ab0da9fb8b361196c9
Signed-off-by: Katish Paran <kparan@codeaurora.org>
USB: composite: Fix issue of get interface returning wrong altsetting

Currently composite driver will block and doesn't forward the set
interface with zero index vlaue after set configuration request.
This leads to returning wrong altsetting value for get interface
request from Host for interfaces that does support multiple
alternatesettings when host sends set interface with one followed
by set interface with zero index value after device is configured.
This could cause USB3.0 complaince test fail. Hence fix this value
by forwarding set interface request for interfaces that does
support mutliple altsettings.

CRs-Fixed: 747760
Change-Id: Ib82d4acc90f577308e18f0e0af1e616dbc8ce6a8
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
ASoC: update codec driver to handle new SSR design.

Update codec driver to reduce the time for wait to check Q6 core
is ready.

LNX.LA.3.7 Change-Id: I06f7124dda56bf867df32c3a03a63e1ee0e2bd94

Change-Id: I2067772e2cb66a1b7a59a84ccf072927580a38ee
Signed-off-by: Divya Narayanan Poojary <dnaray@codeaurora.org>
ASoC: msm: qdsp6v2: handle VoIP call recovery during SSR

Add support for VoIP call auto recovery during Sub System Restart(SSR)

Change-Id: Ie8dce8f575ba3af5560c523a00e8520aef1c68c3
Signed-off-by: Venkata Narendra Kumar Gutta <vgutta@codeaurora.org>
ASoC: wcd9xxx: Disable current source in error scenarios

Sometimes during removal, fake electrical removal interrupt
can also get generated. In that case, current source needs
to be disabled after a round of DCE measurements. Otherwise,
next time when the plug is re-inserted, measurements can go
wrong and hence plug type can be wrongly detected.

CRs-Fixed: 759634
Change-Id: I6be5ab5891bd73f63acf2ec0f03c98ccd3938936
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: Handle fake mechanical interrupt

Handle fake mechanical interrupt during slow insertion of
headset usecase when the plug type is detected as lineout.

CRs-Fixed: 754305
Change-Id: I559309915771b633c6f1677f020459b8afc1f574
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Revert "asoc: msm: Check headset insertion for consistency"

 * Superseded by the next patch, which also eliminates the long delay
   when certain types of headsets are inserted.

This reverts commit 7d9a3bf12051d48ee7290a865d25c97654d080f4.

Change-Id: Ifca388cbf78ca281043ecf10e51eba4364a2e34e
ASoC: wcd9xxx: Continue polling for Unsupported plug types

Sometimes slow insertion of headphone could lead to
detection of unsupported plug types. In these cases,
continue polling so that headphone can be detected
once it is fully inserted.

CRs-Fixed: 745214
Change-Id: I4fe40d1afe71a5b1f5c8e8e69ba3afe16750161e
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: qdsp6v2: set stream volume before starting it

Volume gains for a stream should be set before sending
RUN command to DSP. This will avoid any glitch in audio
which might occur because of rapid change in volume level
while setting up the appropriate volume for the stream.

CRs-Fixed: 753619
Change-Id: Ib9270929759852f671bf3677f6e4cc826997b76a
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
msm: mdss: fix pixel extension validation on decimation

When decimating and if chroma is to be downsampled, hw doesn't decimate
for first step. This needs to be considered as part of the pixel
extension values validation.

Change-Id: I58e61776be4dcc11c105bb46e69c9b486ef1f4f9
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: fix check for bwc and decimation

Decimation flag is not sufficient to prevent decimation from being
enabled. Instead check that decimation values are also not set.

Change-Id: Iab5fb4ef96649a2f28f4203643856b9ab9df4bee
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: reduce waiting time before turn off mdp clock

Vsync happens at every 16.6 ms. Currently it waits for
6 vsyncs (100 ms) time before turning off mdp clock if
there is no new frame update. During suspend procedure,
change it to 1 so that mdp clock is turned off 1 vsync
after kickoff has completed if there is kickoff pending.
Otherwise mdp clock is turned off at next vsync.

Change-Id: Ibb000b04cb4204ff63647dda3146c55084330687
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
mdss: mdp: release file node before process node when open fail

Releasing file node after process node causes the kernel
panic because process node is already freed. Correct order
to release nodes should be file node followed by process node
when PM API fails.

CRs-fixed: 753912
Change-Id: I252fc9eabaf0ba81d19b1989b03100849cdeca38
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
msm: mdss: free ion memory after panel is blanked

Frame buffer memory could still be fetched until panel is completely
blanked, in order to avoid potential page faults by unmapping early,
move unmapping of this memory until after panel is blanked.

CRs-Fixed: 763046
Change-Id: Ib7eea73a7549b453cf2fc31a31f5cc3e9e1cce39
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
fs: Fix -Wmaybe-uninitialized

Change-Id: I46e65c678d03d72531729f5423f8fe51da716029
Merge branch 'cm-12.0' of https://github.com/CyanogenMod/android_kernel_oneplus_msm8974 into HEAD