cpufreq: ondeamnd tweaks

Signed-off-by: houst0nn <houstonn@gmail.com>
ASoC: msm: Ignore unexpected events from dsp

If dsp responds with an expected event, audio driver
should ignore the response and continue. Change removes
the BUG_ON and handles the error gracefully.

Change-Id: I9ae067c4ffbbcac3b2a3ad4c63fe882854348df8
CRs-fixed: 495205
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Shashank Babu Chinta Venkata <sbchin@codeaurora.org>
SoC: msm: qdsp6v2: return DEFER code when probe is not done

Probe may not be done when first alloc api is called. Need to return
DEFER error so that client can try later.

Change-Id: I4aa8da928aa2b9f6d22ad9aaae9a8cb27b93d424
Signed-off-by: Fred Oh <fred@codeaurora.org>
Soc: msm: qdsp6v2: Fix invalid params handling

Alloc and free apis should sanity check all input params.
If allocation fails set client and ion handle to NULL.

Change-Id: Ide3bd782eb90ee8b033e39de232929a1ca7174b7
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
msm: audio: qdsp6v2: Change acdb_mmap size variable to unsigned

The acdb_mmap fuction does a size calculation but
stores the result in an int which makes negitive
numbers possible. Changing the variable to unsigned
ensures that the size used is never out of bounds.

Change-Id: Iffd9c1440d2f28b703a77993fdbb3ccd18f30694
CRs-fixed: 548145
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
msm: audio: qdsp6v2: Zero the cfg stack var

Write zeroes into the stack variable cfg to ensure
no previously written stack data is sent to
user-space.

Change-Id: Ie571949e3613c9e5a916b23e1dc19605496d9dbf
CRs-Fixed: 551574
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
msm: audio: qdsp6v2: memeset msm_audio_stats to zero

memeset msm_audio_stats to zero before copying to user space.

Change-Id: I5f47bf85e36d46f726dddae68962a3d1cd06213b
CRs-fixed: 549307
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
ASOC: qdsp6: Add pause/resume support for AAC encoder

-  If session is stopped, AUDIO_START should
   trigger session to be started again. This way
   pause/resume becomes stop/start for AAC encoder.

Change-Id: Id44a5342bb90b049d9c617ede60bf41a5289c581
Signed-off-by: Sharad Sangle <assangle@codeaurora.org>
msm: qdsp6v2: memset stack buffer allocation.

This is needed to avoid garbage data in uninitialized variables.

Change-Id: Ia8e6148eef2cafe6931c6fdc35d7aafeb0c0bd97
CRs-Fixed: 556792
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
msm: soundrecorder: Add support for pause/resume in HW AAC mode

- Use "stopped" notification to indicate pause/resume. This avoids
  null pointer exception while playing a recently recorded file

Change-Id: Ie5782381e816f76c34677e5863c9849609089eba
Signed-off-by: quic_mqiu <quic_mqiu@codeaurora.org>
msm: qdsp6v2: memset stack buffer allocation.

This is needed to avoid garbage data in uninitialized variables.

Change-Id: I20e56ee32d3b9d1eecc4fa7761ff164a210fbbde
CRs-Fixed: 561611
CRs-Fixed: 561615
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
msm: qdsp6v2: Deleting kernel driver from arch/arm/mach-msm

Drivers are registering under misc driver but exists under arch/arm/mach

Change-Id: I6210ed2ffbc38608914fb765b8e50ac6d97950ff
CRs-Fixed: 554492
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
ASoc: msm: qdsp6v2: add vm page offset validation

Lack of range validation can lead wrong mapping or expose arbitrary
memory page to userspace

Change-Id: I8c6eb1b7255d444bffd9d3748ca4815b11bdf16a
Signed-off-by: Fred Oh <fred@codeaurora.org>
Soc: msm: qdsp6v2: Fix invalid params handling

when ion_import_legacy api fails then we should not
call ion_free as the handle returned is not proper to
dereference so instead just destroy the ion client and
bail out.Sanity checks for all the input params is also
added.

Change-Id: I6c51986bf2ce334ff7405e38a12c1c1db50e2417
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
msm: qdsp6v2: Deleting kernel driver from arch/arm/mach-msm/qdsp6v2

Driver is registering under misc driver but exists under arch/arm/mach

Change-Id: I0930d3f56767569edefa1af3c7d45a724a219ce3
CRs-Fixed: 548017
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
ALSA: core: Expose sound card online/offline state

Expose sound card online/offline state to procfs so userspace application
can poll and read sound card's state.

Change-Id: Icafb2a8b970fb53ebc3eb7c44d075f1c01985072
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Glenn Kasten <gkasten@google.com>
ASoC: msm: qdsp6v2: Fix for invalid mem handle after ADSP SSR

Setup a voice call and end the call. Trigger ADSP SSR, then make another
voice call. The memory handle got from the first call is provided to CVD
for calibration data for the second call. The memory handle is not valid
after ADSP restarts.
To fix the issue, after ADSP SSR is triggered, set calibration memory
handle to zero. When starting a new call, send VSS_IMEMORY_CMD_MAP_PHYSICAL
to cvd to get a new memory handle. Use the new memory handle to register
calibration.

Change-Id: Ie89e16c8e64e1acc1c324d25bead93945d3282d4
CRs-fixed: 504113
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
ASoC: msm: Fix RTAC to use VSID

All voice sessions use unique VSID for active
sessions in CVD. RTAC get param for voice
sessions require this VSID to work correctly with
CVD. This change fixes the issue of using proper
VSID in RTAC.

from caf
commit	73965fa98be12097e72c8fc0cd4201329ca9b520

Change-Id: I6eb8e64ee5d7fad212b77882c897e5feb3cc96c5
CRs-fixed: 506008
Signed-off-by: Venkat Sudhir <vsudhir@codeaurora.org>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
ASoC: msm: qdsp6v2: defer probe if memory allocation fails

During bootup, on targets which use SMMU, msm_audio_ion wrapper
will allocate and return memory even if SMMU device node is not
ready. Mapping such memory with LPASS will fail as LPASS is
expecting SMMU memory. msm_audio_ion_alloc will now return
EPROBE_DEFER if SMMU device is not ready and as result voice and
voip driver's probe() will defer. Any other memory allocation
errors other than EPROBE_DEFER from msm_audio_ion will result in
voice calls with degraded voice quality since calibration cannot
be applied and voip calls will fail since voip buffers cannot be
allocated.

CRs-fixed: 503096
Change-Id: I2eda29055f088c5d2c14362c47c3484c53d1f3f4
Signed-off-by: Shiv Maliyappanahalli <smaliyap@codeaurora.org>

Conflicts:
	sound/soc/msm/qdsp6v2/q6voice.h