msm: camera: prevent invalid access through mmap

Disable access to invalid addresses through mmap.
Add appropriate range checks to ensure valid accesses
through framebuffer mmap. This prevents illegal
access into memory.

Change-Id: Ie053d9d8efe951b88f28b020dd9c2356e54723a7
CRs-Fixed: 475794
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
msm: camera: Handle incorrect parameter properly

By this change, when incorrect size is passed, we
return back rather than proceeding forward.

CRs-Fixed: 477936

Change-Id: I8f3ea3c7680a468e36ed0cdb026e95cc29e3f4be
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
msm: gemini: Fix the error irq handling sequence

Update the gemini IRQ handling sequence in ISR.

Change-Id: Ia47e1600174462341027540247a79cba7ffd9c56
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
msm: gemini: Reset the core incase of overflow error

Reset the gemini core for the overflow usecases.

Change-Id: I64b4283806d67615b2963e0d6a42f04a40d6a892
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
msm:camera: Fix signedness issue in hw_exec_cmds

  In hw_exec_cmds()second argument m_cmds should be
  of type unsigned interger

Change-Id: Idad2eb1a59481f3fe9f90221ff2061e8dae57013
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
msm: gemini: Fix the size argument of hw_region_dump function.

The size argument for the msm_gemini_hw_region_dump function is
signed which is not correct, since the function operates on
it as if it is unsigned. Change this to unsigned parameter.

Change-Id: Icea70ad20b010651047b911e7b6ae57889e610e7
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
 msm:camera: Fix overflow issue in ioctl_hw_cmds function

    'len' is of type signed int 32bit,but the assigned value
    may exceed maximum unsigned int32 range.Add overflow check
    and graceful exit if 'm'exceeds UINT32_MAX value.

Change-Id: I38f0d10a0cb44d08d0054f91044fc891c246ebd1
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
msm-camera: Removing MSM_GMN_IOCTL_TEST_DUMP_REGION ioctl

Removing the MSM_GMN_IOCTL_TEST_DUMP_REGION call because this
is not used.

CRs-Fixed: 496905
Depends-on: 372524

Change-Id: I91147bbf67055351a115687a18a1172a649d5d6a
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>
msm-camera: Added the  NULL check in gemini driver.

Adding NULL check for ionhandle and y_off in gemini driver files.

CRs-Fixed: 504159

Change-Id: I6d20298183bec0c3c2c16088a936ac6f7d307da4
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>
display: samsung: Disable creation of power_reduce sysfs node

Change-Id: I405adf64c2eb483ec8e557ef746cf47193eed190
serrano: add support for panel color shifting based on a sysfs interface

Adapted from work by morfic and ktoonsez

Creates a syfs interface here:
  /sys/devices/virtual/sec/tsp/panel_colors

Will accept 0-4 for parameters:
  0 - Cold (more blues)
  1 - Cool
  2 - Normal (stock colors)
  3 - Warm
  4 - Hot (more reds)

Change-Id: I238f4bb0572c677b9c51de486e4274b54662db06
msm: camera: Fix for kernel panic

check if buffer instance handle is zero while
getting pcam instance based on instance handle
in msm_mctl_reserve_free_buf function

Change-Id: Id3861c4f29fb4f7fd62ad6de6597e65c7c4f656b
Signed-off-by: manish gotefode <mgote@codeaurora.org>
msm: camera: Check for valid pcam before using it

When event notify is called, check if pcam is valid or not
to avoid NULL pointer deferences.

CRs-Fixed: 462215
Change-Id: I78590c06ff5132dce0a629e8496d11360201aafc
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
msm: camera: Fix for properly configuring AXI bus when using dual_enabled mode

When lp_mode=0 and dual_enabled=1, the msm_camio_bus_scale_cfg API is not
called in axi_start() i.e. the AXI bus is not configured properly

Change-Id: Ifca9ca97ea21b8442ae801802e38d7d98433ba97
CRs-Fixed: 458802
Signed-off-by: Krupal Divvela <kdivvela@codeaurora.org>
msm: camera: Fix flash issue timeout

Add timer and refresh logic for flash to work
in torch mode until user changes flash stae.

Change-Id: I9f6e5fb8de60015d354234c65fd0e53733bcb4f5
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm: camera: remove frame delay at start_stream in msm_sensor

required for latency optimization

Change-Id: I3d039e21ee8736cf8df1373d5386671f77f2382c
Signed-off-by: Punit Soni <punits@codeaurora.org>
Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
msm: camera: fix the out of order of frames issue

observed that if the frame processing in the userspace
is delayed, the incoming frames from the hardware are being sent
to user before the diverted frame returns.so dropping the
the delayed postprocessing frame to prevent out of order

Change-Id: I43b0f9ea7a7683a419ce142b7d4fdf9e13d11d95
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
msm: camera: Release mutex lock in case of failure

Release mutex lock in camera driver in case of a
failure.

Change-Id: Idc7de63b320df69754ad26fa9ae9639a08c96fc4
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm: camera: Fix event queue drain issue

when camera daemon is killed, then command processing
timeout happens and there is a possibility of pending
event payload data. It creates a problem for further
command processing due to mismatch of event ids.
Drain the event payload queue when there is a timeout
for any event.

Change-Id: I046baf5ecc8abc8e795f96f8a1701da5c8506b88
CRs-Fixed: 467053
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm: camera: Check if client is NULL before calling ion_free

NULL check was added inorder to prevent a target reboot in ion_free
in case client is already NULL

Change-Id: I263f56ff06ad7907c459b4f7254fc1435a41c61d
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>