ASoC: msm: Add timestamp support for compressed audio

The timestamp would be used by applications for AVSYNC purpose.

Change-Id: I416c38e82fbd51b58df119c0122bcd629ccd88fd
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
(cherry picked from commit 8664b25449fb50d07bf7404734ffce380f13dd46)
msm-pcm-lpa: 8960: DSP timestamp support for LPA

CRs-fixed: 338065
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
(cherry picked from commit 727416f477140afdf83a7f93d8eca7d6c1eafadd)

Change-Id: I4d9a9880c24c56d93187670ce267da2e1efb1ee8
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
ASoC: msm: avoid routing setup on established path

During voice call, it was found that ADM COPP is left opened.
Since there is no music playback nor recording, ADM COPP should
not be opened. The problem is due to user-space application issue
mixer command again to join front-end and back-end when front-end
and back-end are already joined and active. PCM routing driver
just blindly create ADM COPP again as the condition of active
front-end and back-end is met. Update logic to avoid routing
setup twice.

CRs-fixed: 339027
Signed-off-by: Patrick Lai <plai@codeaurora.org>
(cherry picked from commit 6231458cedbfae1bb96f04046cf470b8ece42c6a)

Change-Id: I91a5e5bd2f60b245c837cb185f88c4fc75e456a9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
ASoC: msm: Fix a bug in the audio FE check

It is found that recording from MI2S audio HW path
is broken. The reason is that the check to validate
the front-end ID is compared to wrong ID.

Update the comparson so that the correct front-end
ID is used.

CRs-Fixed: 339027
Signed-off-by: Kuirong Wang <kuirongw@codeaurora.org>
(cherry picked from commit 1bd26c67fb7b7579d02ae248b169be0218f08778)

Change-Id: Id6ff22184edd80807e193969df404826b5633460
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
ASoC: msm: Provide linear DSP volume

To give the higher resolution, provide the linear DSP volume gain
instead of percentage through ALSA mixer control

Change-Id: I08e3e8194fab00e36398fc1fd8c2d2e7e0693975
CRs-Fixed: 351468
Signed-off-by: Jay Wang <jaywang@codeaurora.org>
ASoc: msm: Improve error checking in code

Improve code by adding more error checking,
fixing case statments and removing unnecessary
logic.

Change-Id: Ic4d07f5dd9a7079248d8320fab95ee6f4d150b88
CRs-fixed: 344634
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
ASoc: msm: Fix error checking

Fix error checks to look at returned value
instead of passed variable. Updates copyrights
for files altered by previous patch.

Change-Id: Ice69e58bf33a1c451c1324ff0286f743d436d32f
CRs-fixed: 344634
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Asoc: msm: Remove the condition check before sending FENS command

If FENS is disabled before starting voice call, FENS disable
command is not sent to CVD.
Remove the condition check, fens disable and enable command will
send to CVD when starting voice call.

Change-Id: I0cfa21db428cd9cc635442c34321f5482d3b3018
CRs-fixed: 349234
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>

Conflicts:

	sound/soc/msm/qdsp6/q6voice.c
ASoC: msm8960: Decrease period and buffer size for LPA driver

Deacreasing the buffer size for LPA buffer helps to improve the
overall audio quality and latency related issues

(cherry picked from commit b08560da3b365be1990b3c6a11db50e521c06bc4)

Change-Id: I7b92302c7bca8bc385a931b8602c9221b8beb5b3
CRs-Fixed: 344793
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
ASoc: msm: Fix the kernel panic issue in dapm

- Widget list in dapm is getting corrupted during concurrent
use cases where dapm_power_widget is accessed from core,
machine driver, codec driver and soc-dsp. This corruption
is resulting in kernel crash in dapm.
- Fix the issue by adding protection in dapm_power_widgets
API.

CRs-fixed: 351250
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
(cherry picked from commit 247d36e2d8df019f77007c8eed30190b8dfaae6a)

Change-Id: Id486d1cea7f5f6edc94f71711035c0dba17512c2
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
ASoc: msm: Avoid memory allocation failure in proxy driver.

- Allocating memory using dma_alloc_coherent is resulting
failures due to fragmentation
- Fix the issue by replacing the API with
allocate_contiguous_ebi_nomap.

CRs-fixed: 358301
Change-Id: I726623d23c0080b7207911181590fa417c3e9886
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
(cherry picked from commit de48faf59a41bd47a360983407a27fd0fd3dbcc1)
ASoC: msm: Fix mute issue in LPA

In event of an under-run, driver is not able to start again.
Memset the buffer to play silence while userspace recieves the
next set of data and copies it into the mmap buffer.

CRs-Fixed: 356297
CRs-Fixed: 359764
Signed-off-by: Tejas Shikhare <tshikhar@codeaurora.org>
(cherry picked from commit 0c2a7704c764371e63e27d1cbbcfe4646d7ea84f)

Change-Id: I3b01599753f3cbe5fa3f0711f08b90de63e00166
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
ASoC: qdsp6: Fix device crash issue in LPA seek

Accessing buffer pointer before initialization results in device crash.
To memset the buffer using physical address also results in a device crash.
Fixed this by initializing the buffer pointer before it is accessed and
memset the buffer using the virtual address.

CRs-fixed: 359764
Signed-off-by: Amal Paul <amal@codeaurora.org>
(cherry picked from commit 3e0c932acabfeafcef6d06abc801ba8507ccaa46)

Change-Id: I47296fc224d260fa7549afe4d2531af6123b07e6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
msm: kgsl: remove unneeded idle calls from context create

These idles were necessary when the context switch code
preserved PM_OVERRIDE registers. That was removed some time
ago so now the idles are not needed.

(cherry picked from commit 2794ab6dfe3ae8d88de8bad1022b8b5f2a194041)

Change-Id: I8f168ac6745ad5fa6de0ae41d1e38b9b01e22514
CRs-Fixed: 331325
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Clarify the circumstances to enable SLUMBER state

Use the restore_slumber variable at as low a level as possible
to remove confusion from the state machine.  Also do not let
restore_slumber impact the function of NAP state.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
(cherry picked from commit a985adf60ef350c3924587e7b4d11fb05be453ad)

Conflicts:

	drivers/gpu/msm/kgsl_pwrctrl.c

Change-Id: If88de825949c77306b4c46f02bf2679cc06b9ac8
Signed-off-by: Swetha Basineni <sbasin@codeaurora.org>
msm: kgsl: Idle the core before changing the gpu clock.

Idle the core before changing the gpu clock as instability
is caused on some platforms on changing the clock freq when
core is busy.

CRs-fixed: 328249
Signed-off-by: Kedar Joshi <kjoshi@codeaurora.org>
(cherry picked from commit c11d098f53dd1fb07ea03475510c29c39b9671ab)

Change-Id: I11fc58128560b131f60a84fc94b8bc48134a9eaa
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/devices-msm7x30.c
msm: kgsl: remove readl/writel use for dma memory

For dma_alloc_coherent() you don't need writel/readl because
it's just a plain old void *. Linux tries very hard to make a
distinction between io memory (void __iomem *) and memory
(void *) so that drivers are portable to architectures that
don't have a way to access registers via pointer dereferences.
You can see http://lwn.net/Articles/102232/ and the Linus rant
http://lwn.net/Articles/102240/ here for more details behind
the motivation.

Change-Id: I3da075c30304e4adf321cfb3edb1baa4a93fc2ce
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Dereference pagetable pointer after checking it's not NULL

The pt pointer was being checked against NULL value after it was
dereferenced

Change-Id: Ifbdeb7bec5e3f28396196d8f55356e5dbf1a2e55
CRs-Fixed: 336516
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit c0f21b6bc1fcb73900ea845e05a42a2de6fd8dde)
msm: kgsl: flush outer cache for alloc_page() pages

The outer cache needs to be flushed for these pages
after they are allocated so that the GPU and CPU
have a consistent view of them.

CRs-Fixed: 346921
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 7018a21bf2b52f1296557d1f6ec9ed64e9169de7)

Change-Id: Id5c11ab8d856fc270330fd3258baa51b8efca192
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: kgsl: Resolve conflicts in state changes

Only check requested state once, and fully transition to that
specific state.  This will resolve any conflicts arising from
changes to the requested_state as the state transition occurs.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
(cherry picked from commit e4a7c1a365ea32aebfe3995e13fc63ca8c2916c5)

Change-Id: I9d351d9d7e479389e473fc6e54d9d06d7ef200b9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>