msm: display: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

(cherry picked from commit 6c7b2d322826aaf12b7682079cadb8ac9179fbce)

Change-Id: Icf170c8d0e0b59f7d5754a71220257e061b54deb
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: board-8064: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

(cherry picked from commit cc827ace8a6d523156ebd3b2a882310a41a0973a)

Change-Id: I6f82c610de21e225d1c18dabe0041e03ba3fad43
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: board-8930: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

(cherry picked from commit d0b5da0404e57339dd15a2e5748403e5d284931f)

Change-Id: If39a34dfc3648c07943382a8070fdc9f3c0c9c6b
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: include msm-specific ion header

All msm_ion clients need to use <linux/msm_ion.h> instead of
<linux/ion.h>

(cherry picked from commit af2e5c54827a85efc3662df70ff8a4e42f91747c)

Change-Id: Idca45827c1bd5f7b05afe788b0f5e2eb361350bf
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: move msm-specific ioctls to custom_ioctl

To avoid collisions with future ioctls that may be added to ion,
msm-specific ioctls should use the `custom_ioctl' interface provided
by struct ion_device, as originally intended.

(cherry picked from commit d88b8eb288bd2d4c5da827d546c4ce56ff169bfb)

Change-Id: I424cdcad0b104c0a8c1a4af2a12d75a3be74230e
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: Add compatibility with future changes

Several changes are pending to be pulled in which are
not compatible with our changes:

* a new field to the allocation ioctl is added
* the ioctl numbers for cache flushing need to be changed.
* the size of the structure passed to ION_IOC_IMPORT
has changed

Add these changes now until full changes can be pulled
in the future.

(cherry picked from commit 0eec15100e6fc46e7ae5b7cd18dfe3a329661a1f)

Change-Id: I38c884c71bbeee009bb082ae7aa22ea5835c08fa
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: remove ion_validate_buffer_flag

ion_validate_buffer_flag is no longer needed since its only callers
are moving to a new format for buffer flags.

(cherry picked from commit b6e920c1e371d940f2e3824ffaf157132b95284c)

Change-Id: I92486d8444ae8d095c14234cd66ca848129d33b8
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
gpu: ion: IOCTL return success when error occurs

ION_IOC_IMPORT may return success when an error occurs. Add correct
error handling to ION_IOC_IMPORT.

[mitchelh@codeaurora.org: re-adding patch that fell out]
(cherry picked from commit 865e97f4943d9bf0c11763b694569fb4797c52b0)

Change-Id: I139c6e2e1cbae4f259df57bbf886c99ab28a5391
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: change ion buffer flags

This syncs up our ion buffer flags in ion.h with upstream (using
ION_FLAG_CACHED instead of CACHED and UNCACHED).

[lauraa@codeaurora.org: Remove file not in tree]
(cherry picked from commit d117f2544498e98c62436237d6da88e89f4c7e0b)

Change-Id: I40e1e2cd82fe5bb276521e4ffe5984b14577258a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: Port heap mask change to ion

Heap mask field passes as argument at allocation time to specify ion
heap.

[lauraa@codeaurora.org: Remove non-existent functions/files]
(cherry picked from commit af182ba479e042fefc0edb0ce3747ad51258871f)

Change-Id: Iaa71a27fd82b14b0ec78138ff45cccb29ede68b3
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: change ion kernel map function to not take flags argument

Buffer flags are going to be specified at allocation time rather than
map time. This removes the flags argument from the ion kernel map
function.

[lauraa@codeaurora.org: Remove non-existent functions/files]
(cherry picked from commit 23a4aa5bb76dfde84eb2234903910cd73221a0a9)

Change-Id: Iabf5225666b89935c5f21287bfe9758e23796bfa
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: remove obsolete ion flags

The symbols CACHED and UNCACHED have been replaced by ION_FLAG_CACHED
upstream. This removes them from the kernel.

[lauraa@codeaurora.org: Small argument change]
(cherry picked from commit 256e4ca6eb6c2caf040f9e3a8be3ee6afab547c4)

Change-Id: If5506ec9f5a861c6bfe8e40bf5025c235724abb5
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
ion: isolate msm-specific ion extensions

This is another step in the process of isolating msm-specific ion
features from stock ion.

(cherry picked from commit 362b52b141cd63b1b8a43ec37905b688daa18dce)

Change-Id: I667938f40a1c529f22366854b34c914647859299
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ion: remove ion_share_set_flags

Due to changes in the semantics of the `flags' field of `struct
ion_buffer', it is no longer necessary to set the flags when setting
up an ion share.

(cherry picked from commit 036494e80da7a6330e549413c3c22bc03d3eda6e)

Change-Id: I121b87771d8f4ee8eab1b98872a2ac8184665ddd
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: vidc: port heap mask change to ion for secure session

Changes to pass ION_SECURE in the correct argument field
while calling ion_alloc. Without this change secure session
fails.

[lauraa@codeaurora.org: minor context fixups]
(cherry picked from commit 4738f62b5e69e6d3703e59fbf9fb598fe73d0942)

Change-Id: I576c616b9f84c14cc5ed63d292c5a258ee83e279
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
power: pm8921-bms: fix divide by 0 issue when charging

The current code can divide by zero in the scale_soc_while_chg
function if calculated_soc drops while charging.

Fix the issue by not scaling soc if catch_up_time_us is zero.

(cherry picked from commit bccae61ccd29b1b7a2c2dc8f934853391072dff3)

Change-Id: If0d39107847b8e20831ad8a0dcec9af94d8cd710
CRs-Fixed: 418419
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>

Conflicts:
	drivers/power/pm8921-bms.c
power: pm8921-bms: Prevent SoC from rising during discharge

In a previous patch, scale_soc_while_chg was made to not be called when
catch_up_sec equals zero to prevent a kernel divide by zero bug.

However, this caused SoC to increase at times with multiple calls to
calculate_state_of_charge in quick succession.

Fix this by always calling scale_soc_while_chg and skip calculations only
when catch_up_sec is equal to zero.

(cherry picked from commit d3ce98631768ff0f7f4715b89deb6aaa090e2e75)

Change-Id: Id066f9e697348f714f078c0a2327fcfd2ca2e900
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
common: DMA-mapping: add DMA_ATTR_NO_KERNEL_MAPPING attribute

This patch adds DMA_ATTR_NO_KERNEL_MAPPING attribute which lets the
platform to avoid creating a kernel virtual mapping for the allocated
buffer. On some architectures creating such mapping is non-trivial task
and consumes very limited resources (like kernel virtual address space
or dma consistent address space). Buffers allocated with this attribute
can be only passed to user space by calling dma_mmap_attrs().

Change-Id: Id12b93fa2b02d5f3d01ab48eb61cda79f533d695
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit fdf1f8b820d649e760a075b08027fba038c400ed)

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
common: DMA-mapping: Add strongly ordered memory attribute

Strongly ordered memory is occasionally needed for some DMA
allocations for specialized use cases. Add the corresponding
DMA attribute.

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

Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
arm: dma: Expand the page protection attributes

Currently, the decision on which page protection to use
is limited to writecombine and coherent. Expand to include
strongly ordered memory and non consistent memory.

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

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