ASoC: msm: Safe error recovery for column data and hw delay

Add saftey checks to make sure col data was allocated
before dereferance and that col data input was not NULL.
Add safe error recovery in case of column data or hw delay
kmalloc failure.

Change-Id: I3be233db1cf086de7b9e750d610d41161888ecc5
CRs-Fixed: 572581
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
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>
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: 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: wcd9xxx: Enable PWR_SWCH_OVRD to reduce noise

If headset is inserted slowly, polling noise is heard
for 5 sec. To reduce the level of polling noise set bit2
in 0x133 register.

CRs-Fixed: 578695
Change-Id: Ic56a545730d8a435fe7fe66009dd3fd7022b249e
Signed-off-by: Yeleswarapu, Nagaradhesh <nagaradh@codeaurora.org>
ASoC: msm: Fix HW Delay print

HW delay print allows a possible NULL pointer dereference.
Move print to location that does not allow NULL dereference.

Change-Id: If99531d4b59d1ff78be43ad85e7b5e870798a0ed
CRs-Fixed: 582529
Signed-off-by: Ben Romberger <bromberg@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: 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: 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: msm: update endpoint based DAP table for REMOTE_SUBMIX

Update endpoint parameters table for REMOTE_SUBMIX and FM
endpoints used for Miracast devices in DAP driver.

Change-Id: I9bda1d884f93c131149b3cae0f22a0113020d6e7
Signed-off-by: Jitendra Singh Naruka <jnaruk@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: 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>