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.

Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ALSA: pcm: check for integer overflow during multiplication

Channel info data structure is parsed from userspace and if
user does not set the no. of channels correctly, it could lead
to security vulnerability if we don't check for overflow when the
no. of channels is multiplied with pcm bit width. Add a condition
to check for overflow during multiplication.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ALSA: core: Fix crash by avoiding appl_ptr crossing 32-bit boundary

Incase of A2DP usecase using proxy driver, appl_ptr has
boundary value as 0x60000000 frames in sw_params for stereo(2 channels).
When this value crosses 0x40000000, then userspace calculating
appl_ptr at bytes results in crossing 32-bit value 0x100000000,
and points to 0x0 offset which can result in crash or pop.
To avoid above scenario, set the sw_params appl_ptr boundary value
within 0x40000000. Added proper check at sw_params update
to set this value correctly within 32-bit boundary(frames).

Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Update the topology if there is no ACDB

The topology for ASM and ADM is passed down from ACDB to adsp.
If there is no ACDB, then the topology ID is zero. In the current
implementation, whenever the topolpgy ID is zero, then the default
topology is used for asm and adm. The problem arises for msm8x10
because it support only null/none topolgy. It causes audio playback
failure in factory test mode when ACDB loader is disabled by factory
test application. Update the topology to null/none from default to
cover all the platforms.

Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Copy frame data based on frame length

Copying data based on count will result in copying
uninitialized data to userspace which can potentially
disclose sensitive data. Fix by copying data based on
frame instead.

Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Fix for power collapse hostless usecase

For hostless pcm usecases apps processor is not needed
for data path. Once data path is established hostless
driver will remove the pm_qos_request to allow the host
CPU to power collapse. Change adds the support to remove
the pm_qos_request once data path is setup.

Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Fix playback failure with tinyalsa test app

PCM playback through tinyplay test app fails as it tries
to write data in chunks of ring buffer size instead of
period size. msm_pcm_playback_copy function checks the
available bytes in the shared buffer and rejects if the
bytes received are more.
Instead of rejecting the buffer, copy bytes equal to available
size i.e. period size. The ALSA framework will take care of
updating the offsets and looping through the remaining data.

Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: qdsp6v2: Buffer address for Record and playback is 32-byte aligned.

Use 32-byte aligned buffer address to ADSP for playback
and record usecases. ADSP expects 32-byte aligned buffers,
and if they are not received, ADSP will return them.
This causes failure in record and playback.

Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Handle SSR for audio playback over BT usecase

Proxy afe and pcm afe instances are not reset to 0 when
adsp ssr happens during audio playback over BT. Reset these
instances to 0 to avoid playback failures after subsystem restart.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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.

Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm8974: Add support for HFP

Add support for HFP for 8974 target.
Front end dai for HFP hostless for RX and MM6 for TX for HFP

Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Update device tree node for msm-pcm-dsp

Update the name and properties for msm-pcm-dsp. Use qti instead
of qcom for device node and its properties.

Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Update the name for pcm platform driver.

Update the name of pcm platform driver to match with device tree
node.

Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Add timestamp in voip frame header

Uplink timestamp needs to propagate to userspace for AV sync.
timestamp field is added in voip frame header to
capture the timestamp from LPASS for each uplink packet.

Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Add low latency level to device tree

Add low latency level to device tree. Values for low latency level is
regular and ultra. Regular stands for regular low latency and ultra
stands for ultra low latency. ULL is used on 8x10 and LL is used on
8974/8x26.

Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ARM: dts: msm: Add device tree node for ASM loopback

Add ASM loopback device tree node

Signed-off-by: Vimal Puthanveed <vimalp@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: change to enable audio

Use the soc-compress platform driver for all compress FEs.
Update the device tree to include the new platform driver.

Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6v2: Add support for probe deferral in audio ocmem driver

It is possible that ocmem notifier register would return
EPROBE_DEFER when ocmem driver probe is not completed
successfully. Add support to handle this probe deferral
in audio-ocmem driver.

Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: Change RTAC to use ION memory

Change the RTAC driver to use shared memory for
Q6 communication. This is needed for calibration
parameters that use more then 4k of memory.

Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
ASoC: msm: qdsp6: add support to query RMS during recording

Recorder app requires RMS value of the recording when using
tunnel mode AMR-WB encoding. Add mixer control so app can query
the RMS value from DSP

Signed-off-by: Jitendra Singh Naruka <jnaruk@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>