msm: camera: Fix various small issues in sensor driver

Add size check for zero the userspace arguments
before passing to kzalloc. Upper bound will be
max to uint16_t as these changes between different
sensors.

CRs-fixed: 507874
Change-Id: I13fb5740ab83c5719244d012a27d50abb26083d0
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
(cherry picked from commit ec7c07a972c3b1f1145237cae40162b577f2e602)
msm: mdss: Account for null ctl passed to line count

Line count could be passed a null ctl structure,
which would cause a kernel panic. To prevent this,
line count will just return 0 if a null parameter
is passed.

Change-Id: I2b52533e6b67b842542de5b81be5b43fccc364dc
CRs-Fixed: 551701
Signed-off-by: Casey Piper <cpiper@codeaurora.org>
(cherry picked from commit c5fc758447ac4e82ef39d7d9b62f169047eddb46)
ASoC: msm: Fix for passing correct data to userspace

The Copy_to_user function copies the whole frame structure
to the userspace. Only len bytes should be copied.
As the whole frame is being copied
(HPCM_MAX_VOC_PKT_SIZE bytes) the uninitialized bytes
in the buffer will be disclosed to the calling
user-space process.

Conflicts:
	sound/soc/msm/msm-pcm-host-voice.c

CRs-fixed: 552524
Change-Id: I7d7f58d358aaf56d91a79cfe95c04d937b48da53
Signed-off-by: Vicky Sehrawat <vickys@codeaurora.org>
Signed-off-by: Vignesh Veeramani <quicvignes@codeaurora.org>
ARM: fix executability of CMA mappings

The CMA region was being marked executable:

0xdc04e000-0xdc050000           8K     RW x      MEM/CACHED/WBRA
0xdc060000-0xdc100000         640K     RW x      MEM/CACHED/WBRA
0xdc4f5000-0xdc500000          44K     RW x      MEM/CACHED/WBRA
0xdcce9000-0xe0000000       52316K     RW x      MEM/CACHED/WBRA

This is mainly due to the badly worded MT_MEMORY_DMA_READY symbol, but
there are also a few other places in dma-mapping which should be
corrected to use the right constant.  Fix all these places:

0xdc04e000-0xdc050000           8K     RW NX     MEM/CACHED/WBRA
0xdc060000-0xdc100000         640K     RW NX     MEM/CACHED/WBRA
0xdc280000-0xdc300000         512K     RW NX     MEM/CACHED/WBRA
0xdc6fc000-0xe0000000       58384K     RW NX     MEM/CACHED/WBRA

Change-Id: I044360a8f08b1a4ae3e3e9e623fb77af2b427c51
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Git-commit: 71b55663c5d0a6f8473045db1c8b376803780191
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[lauraa@codeaurora.org: Context fixups due to __dma_remap signature change]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Merge "ARM: fix executability of CMA mappings"
net: ipc_router: Defer workqueue initialization

IPC Router workqueue is initialized before some of the core IPC router
data structures are initialized leading to uninitialized data structure
access.
Initialize the workqueue after initializing the core data structures.

CRs-Fixed: 611234
Change-Id: Ia6fbd2f517afcde30b2c924507fbb9f28ccc01e3
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
Merge "msm: camera: Fix various small issues in sensor driver"
Merge "msm: mdss: Account for null ctl passed to line count"
Merge "net: ipc_router: Defer workqueue initialization"
Merge "ASoC: msm: Fix for passing correct data to userspace"
msm: kgsl: Mark the IOMMU setstate memory as read only

Mark the IOMMU setstate memory as read only in the pagetable.

Change-Id: Ic0dedbadb19e499c749cd744c3e89be3bcb4c2a2
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Setup a3xx protection in its start function

Setup the protection registers for a3xx towards the end of its
start function instead of doing it in generic ringbuffer start

Change-Id: I66df496afa5d1fdf7dea790306f5358c2098674d
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Protect CP_STATE_DEBUG_INDEX

Put CP_STATE_DEBUG_INDEX and CP_STATE_DEBUG_DATA under protection
to keep it from being written from an IB1. Doing so however opens
up a subtle "feature" in the microcode: memory read opcodes turn off
protected mode in the microcode to do the read and then turns it
back on regardless of the initial state. This is a problem if the
memory read happens while protected mode is turned off and then we
try to access a protected register which then complains and goes boom.

To account for this irregularity explicitly turn back off protected
mode in all the places where we know this will be a problem.

Change-Id: Ic0dedbad1397ca9b80132241ac006560a615e042
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Merge "msm: kgsl: Mark the IOMMU setstate memory as read only"
Merge "msm: kgsl: Setup a3xx protection in its start function"
Merge "msm: kgsl: Protect CP_STATE_DEBUG_INDEX"
drivers: usb: hbm: Disable async scheduler when init a pipe

When we touch the HBM we need to make sure that the async
scheduler is not running. Otherwise it might stuck the controller
sooner or later. Since the controller uses the BAM for direct access
if anything gets stuck with the HBM, it might get the whole
controller unresponsive. (even endpoints unrelated to HBM, like
the control endpoint).
This change also adds the correct reset sequence steps
to the HBM pipes.

CRs-fixed: 613557, 591930
Change-Id: I13069909aafd682f52178f11debb95af45be28f4
Signed-off-by: Lena Salman <esalman@codeaurora.org>
Signed-off-by: Ido Shayevitz <idos@codeaurora.org>
Merge "drivers: usb: hbm: Disable async scheduler when init a pipe"