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>
Merge branch 'cm-12.0' of https://github.com/BrianAllred/android_kernel_oneplus_msm8974 into cm-12.0