msm_fb: display: add iommu mapping for mdp cursor buffer address

The mdp h/w cursor buffer physical address needs to be mapped to an
iommu virtual address when iommu domain is enabled.

Change-Id: I73b4492fc4d63632117074136e4d908f5089eb93
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: enable sending uevent as default

Enable sending vsync uevent as default so that uevent will
be sent to usersapce frame work when first request recevied

Change-Id: If72248007d68cba8fc814d449b46a58d842544ba
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: vsync support for HDMI as primary

When HDMI is primary, dtv is associated with node 0. In this case,
DTV vsync and ctrl need to be called for node 0.

CRs-Fixed: 383877
Change-Id: I425cddf453dd159259883e71f92c32918ca8e6c7
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
video: msm: Add DMA busy wait to Samsung MIPI driver

 * Fixes lockups on resume

Change-Id: I42c460f4fc0130714c74606b2512507e0d96b2b0
msm: rotator: Add secure session flag to rotator start data

Add flag for handling secure session to rotator data passed during
start ioctl call.

Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
(cherry picked from commit 1eca352482747613e90cbd6f2eeaa91e21351de6)

Change-Id: I155a794329d2f104d493bae5f8a8037e8520b287
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
msm_fb: display: Increase MDP IOMMU buffer mapping size

Double the MDP IOMMU buffer mapping size to allow overfetching
by hardware for boundary conditions and avoid system crashes
due to page faults.

CRs-Fixed: 378108
CRs-Fixed: 364478
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>
Change-Id: Ib19af6b06ab06455acaffcca33830e0487bb0836
(cherry picked from commit 1ed0dae869f6384d23322b78691852d70c573174)

Conflicts:

	drivers/video/msm/mdp4_overlay.c

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

Conflicts:

	drivers/video/msm/mdp4_overlay.c
msm: camera: Squashed set of bugfixes from CAF

Change-Id: I7e50e0799351468a06ef92d1cb07772c9213322c

msm: camera: Not allocate memory for the buffer done event.

Unnecessary code cleaned.

Change-Id: I9ffd389156a971a867475ff9ea6d4a7f8ca70cab
Signed-off-by: Mingcheng Zhu <mingchen@codeaurora.org>

Conflicts:

	drivers/media/video/msm/msm_vfe31_v4l2.c
	drivers/media/video/msm/msm_vfe32.c
	drivers/media/video/msm/msm_vfe7x27a_v4l2.c

msm: Camera: clear control queue

Clear control queue everytime before entering wait in msm_control as
there might be invalid payloads in the queue and this can lead to
not waiting at all and exit before the valid command completes.

Change-Id: Iee83bc51e0c3568f73c1f900d72df41c63a3ace6
Signed-off-by: Manogna Reddy Alle <cmalle@codeaurora.org>
(cherry picked from commit 008ccc5b4e2b7e05d1dd4d6054c31828ef29d17f)
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>

msm: camera: Fix the VPE state machine to avoid multiple VPE disable.

Patch to ensure VPE state machine is handled properly in case of
monkey runs. This is a corner case where vpe disable got triggered
twice.

(cherry picked from commit 257b4192a9e73f55457cd56c890ba2d8de3c8f3f)

Change-Id: I21282a0adcdf978f1b65c81d07b15702a0ab7061
CRs-Fixed: 330166
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>

Camera : Change to retreive system time from Kernel

This timestamp is needed in the userspace to flush old
video frames.

Change-Id: I432e5f5d35581b10857b41930d7751500ea131dc
Signed-off-by: Guruprasad Gaonkar <ggaonk@codeaurora.org>

Conflicts:

	include/media/msm_camera.h

msm: camera: Add plane's data offset in address calculation.

When a frame is diverted for postprocessing, and returned
back to kernel, the address of plane 0 is used to find
the buffer in the queue. Use the data offset field of
plane 0 in the address calculation, otherwise we will
not be able to find the buffer.

Change-Id: I91b1c61e4fe04a44f5d76457ab91aaba3e815ad3
CRs-Fixed: 324846, 323332
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>

msm: v4l2: fix support for test app.

This commit fixes bug in query-cap ioctl and
adds ION support for case where buffers are
allocated in the kernel with mmap. This change
is required to fix the V4L2 command line test app.

Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
(cherry picked from commit d814743600bf0b5c26ec4a532d47fce828c18d6f)

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

Conflicts:

	drivers/media/video/videobuf2-msm-mem.c
	include/media/videobuf2-msm-mem.h

msm: Camera: Reset base csi address to NULL

Reset base csi address to NULL after unmapping the memory region
to make sure that the csi hardware registers are not programmed until
base address is mapped to fix the data abort in kernel which occurred
randomly during a stability test.

CRs-fixed: 332716
Signed-off-by: Manogna Reddy Alle <cmalle@codeaurora.org>
(cherry picked from commit 966020a3e78a70ba8d7c86c5a721715fc56c6eb8)

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

msm: camera: send error to HAL if daemon crashed.

When camera userspace daemon crashes, the server fd
will be close, which trigger the msm_server_close
function, we will check if there is an active camera
session. If camera is active, we will send a v4l2
event to HAL layer to signal an error. Application
will exit gracefully and close other open fds and
exit camera session.

Change-Id: I14ebc864d6cace7ca6f4dbfb935623a76eeccaa8
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>

Conflicts:

	drivers/media/video/msm/msm.c
	drivers/media/video/msm/msm.h
	drivers/media/video/msm/msm_mctl.c

msm: camera: Fix crash issue while enabling regular stats

Update the AEC, AWB, AF, HIST and RS/CS buffers and fds
before passing the stats message to the upper layer

Change-Id: I98b03638ea27669263cd11798ca2af8dda6a98df
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
(cherry picked from commit d803a63cbc771e1685f976e2964a16a0468c8bb0)

msm: camera: Assign Null to unmapped addresses

Observed unhandled virtual addresses with all the camera drivers
while performing reads and writes to the ioremap addresses in different
scenarios, Hence assigining NULL to all the hardware remapped addresses
immediately after the iounmap calls

Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
(cherry picked from commit 72ee044121488cc9f4cde91c5e3a2b820d7a0fad)

Change-Id: Ia0a74ca35e8575b18da8350cb6de83752ee0b11b
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>

Conflicts:

	drivers/media/video/msm/csi/msm_csic.c

msm: camera: handle mediaserver crash elegantly.

This change stops the VFE first, before unmapping the buffers
registered in the kernel in the scenario of a mediaserver
crash.

(cherry picked from commit f3ae3699dd3140c857835901b68d293fb0629f85)

Change-Id: I38a4e62b3adf12582b07084056975f74db56086b
Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
(cherry picked from commit a7c397f44e5c28ae9c0fed21771acc12837ee1d4)
(cherry picked from commit 01e1261625181f00e42335ccc16942f6b3928b87)

msm: camera: Flush event queue during close.

Event queue needs to be drained to avoid picking any
stale entries in the future iterations

CRs-Fixed: 360672

Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
(cherry picked from commit 34fc95b423796e7b1d474171af67784a5678cfd2)

Change-Id: I9fbbf0cc82482642fd7906e91a88781045e58494
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>

msm: camera: allocate memory properly to avoid passing local variable as reference.

1. allocate memory in msm_server_control to avoid passing local variable as
   reference to event queue
2. Safe coding: Set pointer to NULL in some kfree
3. only dqbuf when streamon
4. Add per instance lock to serialize stream operation

Change-Id: I6e87faa1bd05ada9dc94510cb6414c2a670dae63
Signed-off-by: Mingcheng Zhu <mingchen@codeaurora.org>
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
(cherry picked from commit 49253c236c00ffa5d83e809a7d6f68db28aa3852)

Conflicts:

	drivers/media/video/msm/actuators/msm_actuator.c

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>

Conflicts:

	drivers/media/video/msm/msm.c
	drivers/media/video/msm/msm_vfe32.c

msm: camera: Fix camera devices disable sequence

Ensure clocks are turned off after tasklet is kill
and device is not in active state. This is to
prevent bus lockdown if the device is accessing
the bus and clock is turn off
Also ensure clocks are on, when accessing hardware
registers.

(cherry picked from commit 57701f7109efafa8d38b69808e307fbda2e90224)

Change-Id: I0f9fb6d4b60eba5afb47814315f07e0efa15251c
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>

Conflicts:

	drivers/media/video/msm/csi/msm_csid.c
	drivers/media/video/msm/csi/msm_ispif.c
	drivers/media/video/msm/msm_vfe32.c
	drivers/media/video/msm/msm_vpe.c

msm: camera: Correct the reserve buffer logic in mctl_pp.

When the daemon asks to reserve a free buffer, get the
correct address by using the image mode to get to the
correct camera instance and populating the buffer address.

Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
(cherry picked from commit 318d7cbd8eaaced74293b90bec8533a280d41bdc)

Change-Id: I21f329a52bfe51501f1a87bb8a62c51213e5d1bb
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
msm: camera: Fix IRQ handling in vfe32

 * Only request during probe, enable and disable in correct place
 * Properly initialize the tasklet

Change-Id: Ie1fabea93ef0d0eff4aaa0cd29fae47b81dbc6ed