msm: qdsp6v2: Increase max ports in APR

Increase the maximum ports in APR. Some Apps may support
multiple clients which exceeds the number of clients
supported in APR. This change increases number of ports
used in APR upto 8 sessions.

Change-Id: I06624330845681b4414dd470ab7aed669d690ba0
Signed-off-by: Aravind Kumar <akumark@codeaurora.org>
ASoC: msm: qdsp6: Add support to configure ISO and ARIB coefficients

Add support for configuring ISO or ARIB stereo mixing
coefficients. This change introduces a function with which,
AAC multi-channel driver can configure ISO or ARIB coefficients
according to configuration done by the client.

CRs-Fixed: 623127
Change-Id: I00845bdef075631f93a0c65a335b7edb5d10497b
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>

Conflicts:
	include/sound/apr_audio-v2.h
ASoC: msm: Do not deregister APR mmap handle for ASM Custom Topology

Remove APR deregister call from ASM Custom Topology to
ensure that the RESET event is called during SSR to
signal that ASM custom topology needs to be sent.

Various error handling is also added so that reference
count for apr deregister and register also happens properly.

Change-Id: Ib127f20442dd457bc265d93c01ab0fb94beff2f3
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
Signed-off-by: Fred Oh <fred@codeaurora.org>
ASoC: msm: Fix for wma playback after SSR

After SSR apr session doesn't get destroyed as
the callback from apr driver doesn't come.Fix
this by not doing NULL allocation in q6asm callback.

Change-Id: Idfec89dfd06075fec4199869354bdcb9e01a3dc9
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
ASoC: msm: qdsp6v2: Do not free memory that has not been unmapped from DSP

The memory that is not unmapped from DSP should not be used until
DSP clears it. Do not free iom memory if the DSP unmap has
failed.

CRs-fixed: 599780
Change-Id: I4ceae34e0f8d6381efc34ce642babbc30ca5e57e
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
ASoC: msm8x10-wcd: Add gain controls for ADC gains

Add the mixer controls to control the analog gain on the TX path
of the codec. This gain is applies to the ADC on the path. These
mixer controls will be used by higher layer to set desired gain.

Change-Id: Ic255f83238e8e06d31786c149743ec67cdfd6f87
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm: fix RX3 MIX1 INP3 path setting

The path RX3 MIX1 INP3 is not functional as its setting a wrong
regiser.

CRs-Fixed: 631013
Change-Id: I1916a4c6e1b2399c146471ca7a20791c36e14962
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
ASoC: wcd9xxx: Set HPH PA register to volatile

Set HPH PA register to volatile to make sure the register will be
updated with proper bits during bringup

CRs-Fixed: 625324
Change-Id: I5a0caec730a902d6f8f251d5d87f407f9c1777ac
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
ASoC: wcd9320: remove runtime PM voting.

All the codec reads/writes go through slimbus satellite driver on APPS.
Slimbus satellite driver is already voting for slimbus clock before any
codec read or write so remove the vote from codec driver

Change-Id: If54f33739ff82b9388fa9417ef0f6152a4cddeea
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
ASoC: wcd9xxx: Update button release thresholds based on current micbias

During short button press, the button release threshold
registers are updated based on the determined button number
so that when mic voltage goes above the programmed value,
release interrupt will be triggered. This reduces delay in
reporting button release. However, the release thresholds
should be programmed based on the current micbias voltage
instead of programming based on 2.7V micbias. Otherwise,
it is possible that during playback where micbias is switched
to VDDIO (1.8V), the mic voltage would never go beyond the
voltage programmed in release threshold registers there by
not generating release interrupt at all.

CRs-Fixed: 641486
Change-Id: Ied9891f88b89d6f972db5e197200886c6aab3ab2
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: Avoid enabling button polling from event notify handler

During insertion, it is possible that recording is already
enabled from handset which will switch to headset. During
POST_MICBIAS_2_ON event, though button polling is not actually
enabled, due to polling_active becomes true, the event
notification handler pauses and re-starts button polling.
This could lead to unknown state for button polling state
machine.

CRs-Fixed: 639116
Change-Id: Ie379e5ff58c2e99f8e21e534cbcdb914bc98b7ec
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: qdsp6v2: fix possible integer overflow

Check integer overflow before multiplying struct size. If that happens
should return immediately. In addition if param length is greater than
MAX size from spec, better return error.

Change-Id: Ib96cb419ade042d21a1213f6d8c2ff339f5d1c56
CRs-fixed: 605273
Signed-off-by: Fred Oh <fred@codeaurora.org>
Revert "ASoC: Add external EC reference"

This reverts commit d7ac6fdda57293f2ce86d9c1342eee82902e3755.

Change-Id: I6e94c6130a73154a4943e8102a7f8ad1be075a62
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
ASoC: msm: Reset the stream open flag after CMD_CLOSE is sent to DSP

In case of gapless playback, driver does not wait for EOS. CMD_CLOSE
for stream one or two can be called from compress driver free before
EOS ACK for stream one is received. This can result in CMD_CLOSE to
be sent for already closed stream. Reset the stream open flag after
CMD_CLOSE is sent to DSP to prevent multiple CMD_CLOSE on same
stream.

CRs-Fixed: 611416
Change-Id: Ic186ae37a760a2996ebd7b9b5dc5d5846621ab66
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: msm: qdsp6v2: Avoid DS1 and SRS topology on low latency path

Currently, the low latency path go through tuning of the post
processing with the default as well as third party post
processing topologies such as DS1 and TruMedia topology. Avoid
enabling the DS1 and TruMedia topology on low latency path
retaining the tuning functionality on the default topology.

CRs-Fixed: 643857
Change-Id: I8ae6b4ecb0be530c8d72218d39498cff7f8a7fd9
Signed-off-by: Subhash Chandra Bose Naripeddy <snariped@codeaurora.org>
ASoC: msm8974: add devices for incall music delivery

Add backend dai link and frond end dai link to enable
incall music delivery on the second sub.
The feature is required to play LCH tone on second sub.

CRs-Fixed: 626562
Change-Id: Ibbea1e2102ea10b2d114b8d57ff96dd09863ffa1
Signed-off-by: Avinash Vaish <avaish@codeaurora.org>
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>

Conflicts:
	sound/soc/msm/msm8974.c
ARM: dts: msm8974: Add support for incall LCH tone playback

Update the device tree to add AFE port id needed to enable
incall music delivery on the second subscription.

CRs-Fixed: 626562
Change-Id: Idf6ae3cd9c916c250ea587837031c80f4522a11f
Signed-off-by: Avinash Vaish <avaish@codeaurora.org>
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
shinano: merge of 17.1.2.A.0.314 audio changes

Change-Id: I4922cd645d4ad90b2a02acb1d7f2213530ad9210