USB: gadget: f_acm: Fix NULL pointer check for hs_descriptors

(cherry picked from commit c636cb471160b419bd071d34d6b642563cb64029)

Change-Id: I5d0b08f65a0a4f38f6151bac9ae9be1ffdfe8211
Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
msm: msm_sdcc: fix data/cmd CRC errors during SDR104 mode operation

SDR104 mode requires DLL (Delay locked loop) HW block to be tuned
as clock rate is greater than 100MHz. But we observed multiple CMD
CRC errors while erasing the SD card and DATA/CMD timeout errors
while writing/reading on to SD card if it's running in SDR104 bus
speed mode (SD clock rate @192MHz).

DLL has a mechansim of data tracking (CDR) which can be enabled
during RX transaction so the host will not lose the sampling point.
CMD19 (tuning pattern command) can be sent automatically before
any RX transaction for helping the CDR to track after the correct
sampling point.

But if this data tracking is kept enabled during TX transactions then
it may cause the DATA/CMD CRC errors during TX transactions. So this
patch ensures that data tracking is only enabled during RX transactions
and remains disabled for TX transactions.

In addition to this change, it is found that DLL valid phase windows
may be cyclic so this patch also ensures that 2 different valid phase
windows are treated as single valid window if it's cyclic.

(cherry picked from commit 8b6ee57c9fa744de72c630b22e10e7abb4a670b0)

Change-Id: I9fc39268893b3d77feb676438e598e3659165c95
CRs-fixed: 334000
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
msm: msm7627a_defconfig: Enable HIGHMEM support

CRs-fixed: 337048
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
(cherry picked from commit 991b2f58fb90d47bad2f5e5428f209d669fb1990)

Change-Id: Ic9c1bfb5b1ed432ad17c60625cb6128fbd1c6d63
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Revert "msm8960: revert disable of ETB."

This reverts commit 6e169a84c8591c8e21c43838db6f4dc93d7fd478.

Change-Id: I9ece47ca0b56d71388d473663f0fb8c02b2be11b
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
vidc: check for ION flags.

Get the ION flags before and pass the flag info to
ion_map_kernel() api, the flags indicate if ION
device is opened in cached mode or uncached mode.

Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit 3a2cd43253cd0bc4e4451b7384dbb2ea59a078d2)

Change-Id: I29a6d2a1c7b1983d03d3a366a59dcf5cd5a01289
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8064: Fix overflow in memory calc.

An overflow occurs in locate_unstable_memory() when physical
memory address space ends at 0xFFFFFFFF. Change code to
handle overflow by ensuring that variables are limited to
0xFFFFFFFF and by rearranging additions and subtractions.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit d76e3a8d7714b1cb806a815c3c8ea58000081466)

Change-Id: Ie1d229be13e66827b1f9fb578e86beff18f27815
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8064: Handle unstable section overflow

If the calculation for 'high' overflows, it is set to
0xFFFFFFFF. This will cause the unstable region to be
aligned in the wrong way.

This change avoids the overflow by subtracting the
MIN_MEMORY_BLOCK_SIZE before adding the membank size.

Signed-off-by: Jack Cheung <jackc@codeaurora.org>
(cherry picked from commit 46bfffad6309a22b53ad1cc372a4a786a80e6f0e)

Change-Id: I11ac68eb35f90f4491a8ac561aa436737b6150f2
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8064: Add support for adjacent heaps

ION has to guarantee that the MM heap and FW heaps are
adjacent to each other. This is due to a limitation
in the hardware. Add code to ensure these heaps
are adjacent.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit d3d2968b11420501ce280b1c488cff14ea65bee7)

Change-Id: Ie00e087ca6beccd1ee7e97b422768e042ea734d7
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8064: Add new heap for qse comm

Add new 1MB carveout heap required for Qualcomm Secure Executive (QSE)
communications.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit f45e214c7416133ecb995533a23f23a33d908d07)

Change-Id: Icadfee4eeca6e7c89cc154558bbf5f4fa1f1b192
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8064: Add ION heap for Audio

Add 2.72MB ION heap for Audio to enable Audio
to use ION for memory management. This ION heap
will replace pmem_audio pmem device.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 2c43fac27a9198da023822ddc8eba0f938e953e0)

Change-Id: I3d863a8bda77aa113edfd2469a0d870760c16855
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
gpu: ion: Replace strncpy with strlcpy

strncpy is unsafe because it does not guarantee
that the resultant string is NULL-terminated.

Replace strncpy with strlcpy and remove explicit
NULL-termination. Also correct allocation of
string buffer.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 6625c7d1f8c173b1ec49c88b62f7978a094470c2)

Change-Id: I656d13ab16e4b2ab6fd9288e3bf629059c6d095e
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm_fb: display: Cleanup log messages for ION buffer management

Cleanup log messages for ION buffer allocation and de-allocation
functions

Change-Id: I87f44273a9de1899fdb7c30e90a8a1a5715c4dc5
(cherry picked from commit 175d1281a5c1635cffc911dac261efc67d807c9d)

Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board: Reduce kernel EBI reserved size

Kernel EBI is currently used by Audio only and it
needs 2.5MB (it was 5MB). Other components (Video, QSE)
moved to other ION heaps, so the kernel EBI is adjusted accordingly.

Reduce the kernel EBI carveout memory size to
2.5MB.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit edcf68350ece4453fd93b99d38abf845bb542c02)

Change-Id: I619a8b11f0353f7a67b78e5fb9eeb61906b1436b
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: board-8660: Add ION heap for Audio

Add 2.556MB ION heap for Audio to enable Audio
to use ION for memory management. This ION heap
will replace pmem_audio pmem device.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 3a55e32ca70abb0d462c03688cae93717d10a6fd)

Change-Id: I15a7d6cceb102375b67ec22d8af1ef104ab7c9dd
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
gpu: ion: Add EXPORT_SYMBOL to functions

Several functions in the ion interface is missing
EXPORT_SYMBOL. This is needed to allow clients to
use these functions from kernel modules.

Add EXPORT_SYMBOL to functions that are supposed
to be exposed.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit bd2b6925deedc5ae0f10c9d75b4cfcae7d1acc03)

Change-Id: Ie44d7532ed74d2ce6788b44cf6522f7546df4c39
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
gpu: ion: Limit scope of local functions

Several functions that should not be used outside of
the ion.c file does not have static keyword. In
addition two of the functions should not be exported.

Add static keyword to functions that are local to the
translation unit and remove EXPORT_SYMBOL declarations
that are not needed.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 0fa9b60cc8a91b20f4c335f7bac844867506885b)

Change-Id: I1b3344cbc191dae9bc3126fbc1bcd381a3dc1ad1
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: copper: Add support for ION

ION is a memory manager used by kernel and user
space clients to efficiently share buffers.

Add support for ION to copper target.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit b800c8c33f2f0c4202a106abc1094cd29eea48b2)

Change-Id: I12025c5510830bf9d09f51394eed53581f83c1c8
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
gpu: ion: Remove protection of heap on first alloc

ION protects the heap when the first secure allocation
is done while unprotecting when the last secure allocation
is freed. In addition ION provides a separate API for protecting
and unprotecting a heap allowing users to better time the
protection of a heap.

The protection/unprotection done during first allocation and
last free is not needed anymore. Clients need better control
and thus use the separate API.

Remove protection of heap that is occuring when the
first secure allocation is done. Remove unprotecting of
the heap when the last secure allocation is freed.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit ea66e7aa4b5e668de0ee9875be723c59260c5544)

Change-Id: I971d844120ff35adfb7142d3d229772b212b187a
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
gpu: ion: Add check for cached kernel mappings

An ION content protection heap should not allow
cached kernel space mapping for a heap that is
protected. Also, ION should not allow a heap that
has outstanding cached kernel space mappings to
be protected. These checks will ensure that the kernel
doesn't try to access memory that is locked down and
it cannot access.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 2a5404bfd9273efe7e6d938093f828994bccabb0)

Change-Id: I33d7594676642fccbac05b990a2c7c38403e70ca
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
fmem: Add reserved_size to fmem

Due to a limitation in how the video hardware is able
to access memory, fmem needs to be able to allocate a
physically contiguous block of memory that can be split into
two pieces. One piece will be managed by fmem
while the other piece (reserved) will not be handled by fmem.
The hardware limitation requires the reserved part to be at
a lower address than the other piece managed by fmem.

Add a new parameter to fmem that allows platform
data to specify the size of the piece that should not
be managed by fmem.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit cf10e5846db9a5727da5bad2d4b45f64dca20588)

Change-Id: Ibfdde3d6b1294400d67a854d4ba51fa3cc71221e
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>