arm: dma-mapping: Add APIs for other memory types

Currently, the only attributes supported for DMA memory are
writecombine and coherent. Both of these allow speculative
prefetches to occur. For certain use cases (e.g. content
protection) there are requirements to disallow prefetching.
Relatedly, there may be cases where buffering is not enough
for high performance use cases and the full cache should
be used. Add appropriate APIs for the strongly ordered and
cached memory types for the needed use cases.

Change-Id: Ibe17b3d002f9615e2cb34183f47f6d1bcd045611
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit e78ee491b0bdebc214bbb06f687518f983700d2a)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
arm: dma: Allow CMA pages to not have a kernel mapping.

Currently, there are use cases where not having any kernel
mapping is required; if the CMA memory needs to be used as
a pool which can have both cached and uncached mappings we
need to remove the mapping to avoid the multiple mapping
problem. Extend the dma APIs to use the DMA_ATTR_NO_KERNEL_MAPPING
with CMA. This doesn't end up saving any virtual address space
but the mapping will still not be present.

Change-Id: I64d21250abbe615c43e2b5b1272ee2b6d106705a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 4f5b9debd2a5050b5a1c36c54911376ff7ecb408)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
fix ion_platform_data definition

fix ion_platform_heap to make is use an usual way in board configuration file.

Change-Id: I8686108a9fe0aa2ba9f9c84990d555f947f78f86
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[lauraa: Fixup msm board files]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 63d81039558219c9ef04404927ab2851eda56d96)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
add private field in ion_heap and ion_platform_heap structure

copy private field from platform configuration to internal heap structure.

Change-Id: Ia7571d88fc2f72f5d655fb6f6b54fde389d96c85
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[laura: Rebase context fixes]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 8dff0a6bc5e36c7479ae817b02df4cbaaefead1e)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
add CMA heap

New heap type ION_HEAP_TYPE_DMA where allocation is done with dma_alloc_coherent API.
device coherent_dma_mask must be set to DMA_BIT_MASK(32).
ion_platform_heap private field is used to retrieve the device linked to CMA,
if NULL the default CMA area is used.
ion_cma_get_sgtable is a copy of dma_common_get_sgtable function which should
be in kernel 3.5

Change-Id: I9ae54a3a021cb3513c2b0e8c58b69f3ae118561b
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[lauraa: Fix context in ion_priv.h/ion.h and omit Makefile change for now]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 07b590eb0e736337f8b1faf5ef23aab66ad42d90)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
gpu: ion: Add msm specific extensions to CMA heap

A number of changes have been made to the Ion framework for the
msm target. Add the necessary changes on top of the CMA heap to
allow the CMA heap to be fully utilized.

Change-Id: Ie006dcd4c41481e4d914c67bafbf42d1afdb1a76
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 4979d9787b015f87f081d26f3d1ee51f72ce8b02)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
gpu: ion: Factor out common code on first alloc/last free

Currently, fmem must be transitioned on first allocation/
last free. Going forward, there may be other use cases to
call functions on first allocation/last free. Factor some of
this code out to avoid duplication.

Change-Id: I2649309318bc65aa2d0401c90e71ade4cc14c729
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 94ad25eb30765e46b4e2fb573eeded8f5d781b3f)

Conflicts:

	drivers/gpu/ion/ion_cp_heap.c

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
gpu: ion: Rename request/release region

request_region and release_region are macro names defined
in the linux kernel. Under some circumstances, the C compiler
can't differentiate between the macro name and the field name.
Changing the field name is the easiest way to prevent this
problem.

Change-Id: I2c8d61bdaa20e332e0215f0bb3237e8332f0f3ac
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit aedbe42e8daeec7d060de89f84aef2de9097b52f)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: camera: Update the status of the ctrlcmd to userspace

When the cmd sent by HAL is notified to the daemon, copy the
result of the processing of that ctrl command like status, back
to the userspace.

(cherry picked from commit 24b4787b8657080339265468fd8191a2baa4f80f)

Change-Id: I54ec91d9f36429514ead975c8b9d57bafde2ff3d
CRs-Fixed: 411688
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>

Conflicts:
	drivers/media/video/msm/server/msm_cam_server.c
msm: vidc: Add free buffer api to flush state

This change adds free buffer api to video
client's flushing state to allow buffer
freeing in flush state.

(cherry picked from commit a88317c2014d5f07e8d1e0ec0d8b0891fa8b52cd)

Change-Id: I12b0013ea07aee8b3db40c5e35f36113d814560c
CRs-fixed: 430214
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
ASoC: msm: Fix for improper volume ramp up in lpa playback

-A disturbance was heard when switching from one song
to the other, or when the song is paused for greater
than 3 seconds and then resumed
-This was due to the previous value of the track
volume being used in the lpa driver
-This was fixed by setting 0 as the initial volume

(cherry picked from commit f17f796f91ad0373bbb5a2aaa579e33e458d8e0c)

Change-Id: I1c20628b5cfd268b396a937238302e96b326d5b0
CRs-fixed: 428015
CRs-fixed: 425722
Signed-off-by: Alexy Joseph <alexyj@codeaurora.org>
Revert "gpu: ion: Rename request/release region"

This reverts commit 913e8c6b21d18528271ae1eb64f0f314b056db8d.

Change-Id: I42648be8415f3eb58446b5b26268430fe05d2388
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "gpu: ion: Factor out common code on first alloc/last free"

This reverts commit b22fd8f7fe07822171c7c80598515bad9f936148.

Change-Id: Ic2958e22a60e787ac4ab3aaa68cea30d57c72c5e
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "gpu: ion: Add msm specific extensions to CMA heap"

This reverts commit f8fd647b91146a8a590c68b13f042e77492d7c80.

Change-Id: If15ef988d3d4b510f2f457c97b5de8861122dd31
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "add CMA heap"

This reverts commit 6d1613ac06bbbde11dcc45e75db002386d48549d.

Change-Id: Ie03312c71d144a1a577eecf2f5383d72930ac0b1
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "add private field in ion_heap and ion_platform_heap structure"

This reverts commit 1331b1ce19fb0b39518158ae30c5be51100563af.

Change-Id: I0dc98fb6ed2063cb9aa38450a87d7eac5bcf08d4
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "fix ion_platform_data definition"

This reverts commit bb1ea208f1e8f8609a51c45fa5a84a1424116264.

Change-Id: I8926d0a8ff4faf09e42c9d0cb3c74fa49e17ec3b
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "arm: dma: Allow CMA pages to not have a kernel mapping."

This reverts commit a37195c644d25ffa3259881002745c8304fc3968.

Change-Id: I2b31cd431659649c3e6c076e0a23fbec4ff1b55e
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "arm: dma-mapping: Add APIs for other memory types"

This reverts commit 3260cc6f70e4a8a94d28c03c16b676a150536689.

Change-Id: I6dbc3be24a3602dcab145646e5c2f1e5aadcecb7
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
Revert "arm: dma: Expand the page protection attributes"

This reverts commit d50761eab463a9ece91d233cb967a4d1e9a9d9c5.

Change-Id: I0700adee167e5ed27afa1fb9d9c8434749077305
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>