Sound Control: Sound control for WCD93xx codec

Fully GPL'ed version.

Signed-off-by: faux123 <reioux@gmail.com>
wlan: Fix for ARP offload issue

Change is to make sure ARP offload works fine
for active sessions when any one out of multiple
session terminated in suspend mode.
Setting of mc/bc filter without considering
ARP offload parameter during DUT suspend mode
was the issue.

CRs-fixed: 452179
Change-Id: I9bd72a43b5bb02df70d63085638b7e8027fcb076
msm 8064: Don't overclock.
Asoc: msm: 8064: Set channel as Mono for Incall Music Delivery

For incall music delivery, there is only one share channel is
supported between MDM and APQ. If the media is stereo, afe tries to
open two share channels and causes music playback failure.
Add fixup fucntion to always set the channel as 1 whenever the media
is stereo or mono. And make sure only one share channel is opened.

CRs-Fixed: 398100
Change-Id: I76eceacef363b204199f40ea40a6166a05ebbf9a
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
ASoC: msm: Fix for improper volume ramp up in lpa playback

-A disturbance was heard when switching from one song
to the other, or when the song is paused for greater
than 3 seconds and then resumed
-This was due to the previous value of the track
volume being used in the lpa driver
-This was fixed by setting 0 as the initial volume

Change-Id: I0f82702152c98c46b37ae40a91bbbaa4fb80f5e1
CRs-fixed: 428015
CRs-fixed: 425722
Signed-off-by: Alexy Joseph <alexyj@codeaurora.org>
Asoc: msm: Add G711 media type support for Voip

G711 is currently not supported in the Voip driver.
Add G711 media type to existing Voip driver.

Change-Id: I4c8ae61e3f9b3a3fd537ca6ac26c6df40c56a78a
Signed-off-by: Prashanth Reddy <pgreddy@codeaurora.org>
ASoC: wcd9310: Disable Mic Bias Pull down prior to enable micbias

Pull down Mic Bias and add a delay of 250ms to avoid issue
of something else pulling up the mic voltage other than mbhc
polling prior to enable micbias when recording starts.

CRs-fixed: 431573
Change-Id: Ib04d8bf536b256a24563c1455393827ca109f548
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
ASoC: msm: Add support for 4-pole extension cable.

- Add the support to report lineout device when inserted plug
  has high impedance on microphone line.
- This feature is enabled only with gpio headset detection.

Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
(cherry picked from commit 07b6bd6a9a1e431a86efa76b14030d882ee7771b)
(cherry picked from commit 39c0e134f67fcab824f1457a256c4fbf2525c347)

Change-Id: I6d4e3f147433ee9c0cc313118b540fee0b90f45f
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: WCD9310: Defer the setup of headphone removal detection.

After the inserted accessory is detected as a valid headphone,
polling is performed on the microphone to correct the accessory
detection in case it was wrongly identified as a headphone.

It was observed that at the end of polling, headphone removal
interrupt was fired, causing headphone playback to stop. Fixed
by deferring the headphone removal setup until either polling is
complete or polling detects a removal

CRs-fixed: 384967
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
(cherry picked from commit afc86431f330ee51f7980b620bef75935422c764)
(cherry picked from commit f87a8b2658964249917c815719d15abedd03771e)

Change-Id: Ic2c04aa300fc029957c71294e153aef479967b84
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: wcd9310: reduce mbhc button release GPIO debounce time.

Current GPIO debounce time is too long so it delays next button
press detection.  Reduce this debounce time so driver can detect
next button press and release quickly.
Typically mic voltage ramps up within few milliseconds after button
release so 50ms is long enough.

Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
(cherry picked from commit db606b0a39452c90e26692c22300c390f5822f29)
(cherry picked from commit 96e92e0a22a0c54f9cfda447d346c1a2dd9f4639)

Change-Id: Ibf0aa4d4c07fab9cd50021cb0e256ee23b320059
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: wcd9310: Turn on EAR DAC and PA at the same time.

Turn on EAR DAC and EAR PA at the same time to avoid pop
at start of playback.

CRs-Fixed: 386288
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
(cherry picked from commit 7c85d71830e1781c113cf1d69234169e8feb31c9)
(cherry picked from commit deb584f6a8788dcda97a9d83038103ebd2576771)

Change-Id: Ib50f6a488fe93595423bae30164073cc25b90076
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: wcd9310: Enhance OCP reporting logic.

CODEC has over current protection(OCP) finite state
machine for both left and right headphone while CODEC
driver tries to delay reporting of OCP event after
CODEC reporting OCP two times. Current CODEC driver
implementation results in unlocking one of headphone
power amplifier when OCP reported on both headphone.
Change the behavior to report OCP event for a give
headphone immediately if OCP already occurs on opposite
headphone.

CRs-fixed: 339620
Signed-off-by: Patrick Lai <plai@codeaurora.org>
(cherry picked from commit c2d833d524c1230c72f2d078b543baba7a8db26f)
(cherry picked from commit 6b8cacf2d5ed669048c3813b56851c10fe5c5af1)

Change-Id: Iea28c8baa1a6372dcb4c0214ec0e74bfc483f563
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: wcd9310: Fix NULL pointer dereference.

If sound card is not yet initialized the platform device's private data
is not set either.  Check if private data is NULL before use it.

CRs-fixed: 400055
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
(cherry picked from commit d6e48bd07516ecc683a995ebf8eedf080f14016d)
(cherry picked from commit 87ba6ce49d4f50ad089702135e84ecad5446bfad)

Change-Id: I94e45366d8f316ea8e69def48cc926cdd971f5a6
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
ASoC: wcd9310: Resend edge triggered GPIO IRQ

If MBHC GPIO IRQ for mechanical headset detection asserted while power
management's suspend call chain is being called, wcd9xxx_lock_sleep will
fail to wait for system's resume since power management interface has
to finish suspend in order to resume system.
In this case, interrupt cannot be handled as codec driver cannot
guarantee if underlying bus is awake.
Wake up system and resend the IRQ for this situation.

(cherry picked from commit ecf379cd17b7fe94e6f0df0598a472b6f1828ad5)
(cherry picked from commit bdda99b93915d217150f5484f9c718c905703f1e)
CRs-fixed: 404167
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>

Change-Id: Id5970b359b80e0cd1f701b30c61ade23e0f67b9e
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
ASoC: wcd9310: Update wcd9310 compander configuration

Update the Compander register settings to remain the default
settings after the system bootup and optimize compander
configuration sequence.
CRs-Fixed: 421282

Change-Id: Ib475f3bb84414546b4ead1d3f013dc173317e1b3
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
(cherry picked from commit bc5ac04549d59aaf207a241f1b6a965c83144ae0)

Conflicts:

	include/linux/mfd/wcd9xxx/wcd9310_registers.h
	sound/soc/codecs/wcd9310.c
Signed-off-by: faux123 <reioux@gmail.com>
ASoC: wcd9310: Correct the mixer controls for Compander switches

- Compander1 never gets enabled though the user space sets the
  corresponding mixer control.
- Compander switch kcontrols are configured wrongly as integer
  type with max value as 0.
- Correct kcontrol creation to fix the issue.

CRs-Fixed: 441091

Change-Id: Iad99b44c9226da3bcc1132e61ea989a0543ae56e
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
(cherry picked from commit 4e3f5247bcd098ad1488caa3ecdc3b506e9efbf7)
ASoC: add missing updates from CAF

CAF patch updated board file for 8064 but LGE split the files and the update
was not applied to mako board

Signed-off-by: faux123 <reioux@gmail.com>
Revert "android: lowmemorykiller: add lmk parameters tunning code."

This reverts commit 22d990a58fc17b3f0155e15eb2dc3efa037bea1c.
android/lowmemorykiller: Check all tasks for death pending

The lowmemorykiller uses the TIF_MEMDIE flag to help ensure it doesn't
kill another task until the memory from the previously killed task has
been returned to the system.

However the lowmemorykiller does not currently look at tasks who do not
have a tasks->mm, but just because a process doesn't have a tasks->mm
does not mean that the task's memory has been fully returned to the
system yet.

In order to prevent the lowmemorykiller from unnecessarily killing
multiple applications in a row the lowmemorykiller has been changed to
ensure that previous killed tasks are no longer in the process list
before attempting to kill another task.

Change-Id: I7d8a8fd39ca5625e6448ed2efebfb621f6e93845
Signed-off-by: Liam Mark <lmark@codeaurora.org>
android/lowmemorykiller: Wait for memory to be freed

The memory reclaim code needs to give time to the system to
return the memory from a killed process otherwise the memory
reclaim code could run continuously, in multiple threads,
which could starve both the watchdog thread and the thread
which is responsible for returning the memory from the
killed process.

Change-Id: Ieded4bfe038ca936247fa4b638070e979b02eaa1
CRs-fixed: 447740
Signed-off-by: Liam Mark <lmark@codeaurora.org>

Conflicts:
	drivers/staging/android/lowmemorykiller.c