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
bacon/find7: add custom defconfig

Change-Id: Iea007941971e5c2d66ee572991653250daaa5f59
find7: sync defconfig with cm

Change-Id: Ie9b5dfeeee041f3006a7751076eaeb0185ceb7cf
defconfig: enable CIFS

Change-Id: I6525cff867843c5d0583e7401789c09bdb42df8f
bacon/find7: enable NETFILTER_XT_TARGET_IDLETIMER

Change-Id: Ifd23329d901461748381cdcd5dcc387f0147e6d4
Remove '+' symbol from kernel version string

Change-Id: I169942394a1a0bfd1b95b299168e95715cc3340b
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
lib/int_sqrt.c: optimize square root algorithm

Optimize the current version of the shift-and-subtract (hardware)
algorithm, described by John von Newmann[1] and Guy L Steele.

Iterating 1,000,000 times, perf shows for the current version:

 Performance counter stats for './sqrt-curr' (10 runs):

         27.170996 task-clock                #    0.979 CPUs utilized            ( +-  3.19% )
                 3 context-switches          #    0.103 K/sec                    ( +-  4.76% )
                 0 cpu-migrations            #    0.004 K/sec                    ( +-100.00% )
               104 page-faults               #    0.004 M/sec                    ( +-  0.16% )
        64,921,199 cycles                    #    2.389 GHz                      ( +-  0.03% )
        28,967,789 stalled-cycles-frontend   #   44.62% frontend cycles idle     ( +-  0.18% )
   <not supported> stalled-cycles-backend
       104,502,623 instructions              #    1.61  insns per cycle
                                             #    0.28  stalled cycles per insn  ( +-  0.00% )
        34,088,368 branches                  # 1254.587 M/sec                    ( +-  0.00% )
             4,901 branch-misses             #    0.01% of all branches          ( +-  1.32% )

       0.027763015 seconds time elapsed                                          ( +-  3.22% )

And for the new version:

Performance counter stats for './sqrt-new' (10 runs):

          0.496869 task-clock                #    0.519 CPUs utilized            ( +-  2.38% )
                 0 context-switches          #    0.000 K/sec
                 0 cpu-migrations            #    0.403 K/sec                    ( +-100.00% )
               104 page-faults               #    0.209 M/sec                    ( +-  0.15% )
           590,760 cycles                    #    1.189 GHz                      ( +-  2.35% )
           395,053 stalled-cycles-frontend   #   66.87% frontend cycles idle     ( +-  3.67% )
   <not supported> stalled-cycles-backend
           398,963 instructions              #    0.68  insns per cycle
                                             #    0.99  stalled cycles per insn  ( +-  0.39% )
            70,228 branches                  #  141.341 M/sec                    ( +-  0.36% )
             3,364 branch-misses             #    4.79% of all branches          ( +-  5.45% )

       0.000957440 seconds time elapsed                                          ( +-  2.42% )

Furthermore, this saves space in instruction text:

   text    data     bss     dec     hex filename
    111       0       0     111      6f lib/int_sqrt-baseline.o
     89       0       0      89      59 lib/int_sqrt.o

[1] http://en.wikipedia.org/wiki/First_Draft_of_a_Report_on_the_EDVAC

Change-Id: Ief93505d0084e916a349c3ef78978ca37b308997
Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Reviewed-by: Jonathan Gonzalez <jgonzlez@linets.cl>
Tested-by: Jonathan Gonzalez <jgonzlez@linets.cl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
zlib: clean up some dead code

Cleanup unused `if 0'-ed functions, which have been dead since 2006
(commits 87c2ce3b9305 ("lib/zlib*: cleanups") by Adrian Bunk and
4f3865fb57a0 ("zlib_inflate: Upgrade library code to a recent version")
by Richard Purdie):

 - zlib_deflateSetDictionary
 - zlib_deflateParams
 - zlib_deflateCopy
 - zlib_inflateSync
 - zlib_syncsearch
 - zlib_inflateSetDictionary
 - zlib_inflatePrime

Change-Id: Ia898f77f3b257d1dc5bf6ef316d8b67e2870f117
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
msm-of: Remove init macros to avoid "section mismatch" error during compilation

Change-Id: Ibcb0ffa9e11a200d866f11bf151a7705b2f3b343
Disable -fconserve-stack on ARM v2

There are reports that -fconserve-stack misaligns variables on the stack.
Disable it for ARM to work around this gcc bug.

v2: Move top level flags definition up

Change-Id: I4a3b058b7a50bc513580e695995f77cd721e1fb9
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>