ASoC: msm: Disable gapless offload playback by default

Add a flag to platform private data to enable/disable gapless
playback. The platform data is updated by mixer control.
If gapless playback is disabled ignore next track and handle
partial drain as full drain. The stream is opened in gapless
mode based on the paltform data.

Change-Id: I36cea976bcb53f50069653aec4f0f8cc869f491a
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>

Conflicts:

	sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
ALSA: compress: Memset timestamp structure to zero.

snd_compr_tstamp is initialized using aggregate initialization
that does not zero out the padded bytes. Initialize timestamp
structure to zero using memset to avoid this.

CRs-Fixed: 568717
Change-Id: I7a7d188705161f06201f1a1f2945bb6acd633d5d
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
ASoC: wcd9xxx: Maintain micbias for headsets with threshold on mic

There are headsets that require to maintain  micbias while
it's plugged since mic of headsets have threshold to turn
on mic. Maintain micbias when this type of headset is detected
in order to detect headset button press.

Change-Id: Ie5079aedc4876c56a79f2b3639e75ceacc82cd16
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>

Conflicts:
	sound/soc/codecs/wcd9306.c
ASoC: wcd9xxx: Don't change button threshold registers

If registers which effect button detection are changed
when mbhc is still in recovering state, sometimes release
interrupt is not getting triggered.So don't modify registers
which effect button detection.

CRs-Fixed: 576855
Change-Id: I307ea4a112d81fecfe23eb58733913b4453284cd
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
ASoC: wcd9xxx: Account for inconsistency in dce_z during button press

It is observed that dce gnd recalibration value will change
during button press. Currently dce_z is recalibrated only during
first button press. But this would cause issues in further button
detection due to the measurement inconsistancies in dce_z.
Fix this by recalibrating everytime during button press.

Change-Id: I425a3c57f669d8467170d8c0b78a997c4c0708ec
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
wcd9306: Fix compile with CONFIG_SND_SOC_TPA6165A2 enabled

Change-Id: Ifc220c94c5f488a079c1332c1a63a8b7291d1703
ASoC: wcd9xxx: Notify mbhc when TX3 path is enabled

On Tapan, ADC2/3 both being the same, it is possible that
polling noise can be captured in the recorded audio when
IN3 path is used for the recording with headset inserted.
Notify MBHC when IN3/TX3 path is enabled so that micbias
source can be switched to VDDIO to avoid polling noise to
be captured in the recorded audio.

CRs-fixed: 573616
Change-Id: I7db0ff91021e069bcc510d1d9cdbc8f2b0ee72c7
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: wcd9xxx: Do not use current source if micbias is already enabled

Some targets share the same micbias for handset mic and headset mic.
When any recording is in progress from handset mic and if headset
is inserted, we shouldn't be using current source for the detection
as the micbias is already enabled. Check if micbias is already enabled
or not and if it is already enabled, detect the headset insertion using
micbias not with current source.

Change-Id: I269c2320ed735fa07f6b77ebffe4d2a1a8163da9
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: qdsp6v2: Fix APR de-register issues during session close

APR de-register should get called for all open streams. The
change handles a case where de-register is not called.

CRs-fixed: 584533
Change-Id: Ied50b68cdf675583e1451954f7ddf40e9c4f53df
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
ASoC: msm: Add routing controls from MM6 to MM8 to MI2S_RX_AUDIO

Add the routing between QUAT_MI2S_RX and Multimedia6-8 for
multi tunnel playback.

Change-Id: I6b8494d057cabd306c45a262b74a54ecdecce66d
CRs-fixed: 566756
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
ASoC: msm: Add support for RTAC version 1.1

Add support for RTAC v1.1 which includes POPP topology.
To support backwards compatibility an ADM RTAC v1.0
structure is created as well as a 1.1.

Change-Id: Ia87109263f4176534043d6eaceddd24f9f83cfec
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoC: msm: qdsp6v2: update default channel mapping

- Update default 5.1 and 7.1 channel mapping in q6adm.c
  for compress offload multi-channel playback.
- Update default 5.1 and 7.1 channel mapping in q6asm.c
  for PCM format multi-channel playback.
- Channel mapping can be overwritten by mixer controls
  passed from user space/HAL.

Change-Id: I168277f08790773411b7965784143318f72df64b
CRs-Fixed: 582601
Signed-off-by: Mingming Yin <mingming@codeaurora.org>
ASoC: msm: qdsp6v2: enhance multi-channel playback support

-Add multi-channel playback support for non standard
 channel mappings such as 3-ch, 4-ch, 5-ch, and 7-ch

Change-Id: I712ef28e9fdb2e35b59dd5fbbaddd9d38a2bad69
Signed-off-by: Mingming Yin <mingming@codeaurora.org>
ASoC: msm8x10-wcd: Fix bug in DMIC configuration

For TX MUX inputs, either ADCs or DMICs can be selected depending on the
selection from application. Fix the bug in current code where input to
TX MUX is always selected as ADC, due to which DMIC is not functional.

CRs-fixed: 585675
Change-Id: Ib1db353f90ee09764621009ed6e446d15c238f97
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm8x10: Add digital MIC widgets

Add the digital MIC widgets for msm8x10 to add the DMIC
support for the platform.

CRs-fixed: 585675
Change-Id: Ib01da8ee6a39aa68b02d1e996899aff938d21ab8
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
ASoC: msm: Add support for ASM loopback

Add ASM loopback driver. When audio path wants to use filters in DSP,
it will do a loopback in ASM.  The new ASM loopback driver enables
the loopback.

Change-Id: I3ddfbf0a1be5b3b1d37b47b44d321ea7da93da83
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
ASoC: msm: Fix for incall music delivery on VoLTE

Add support for incall music delivery on VoLTE.
VoLTE session will use the same pseudo port ID
as the voice session, so for port 8005 we start
playback on both voice and VoLTE session.

CRs-fixed: 583740
Change-Id: I20e03ab27287807f0afcc432269673b7ef5dbda0
Signed-off-by: Vicky Sehrawat <vickys@codeaurora.org>
ASoC: msm: flush if prior and current backends rate not matching

It is found that during device switch from one backend
with one sample rate to another backend with another sample rate
the command to QDSP6 ADM which maps audio stream session to a
particular backend would not get carried out until pending
data of audio stream session from previous backend is either
read out or flushed. This scenario occurs when application
stops providing more buffers to retrieve captured data.
Remedy is to flush upon detection of rate mismatching.

Change-Id: Ia9d9a1819c6e21a44f2778185420ca43cca30258
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
ASoC: msm: Handle data loss at device switch for FM

- When device switch happens there are underflow errors
in LPASS. And there is some break in audio observed for
around 2 sec.
- To handle this, ASM run command needs to be sent again
to DSP at device switch.

Change-Id: Ie75dbb1fede4fc88cf827795a176891501202abe
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
ASoC: msm: Add MM6 routing

Add MM6 routing commands. This will enable to route
data through ASM loopback through MM6. MM6 will be
used to make the connections for the asm loopback.

Change-Id: Ia59a174d4250d9c0946c78e86dd868853f026657
Signed-off-by: Damir Didjusto <damird@codeaurora.org>