msm: camera: Fix various small issues in cci driver

Remove some unused ioctl exposed, Also add
some bound checks for ioctl user params.

Change-Id: Ifdd441fdb25fd20b005c4e4e1ebe4e203f1216ac
CRs-Fixed: 511382
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>

Conflicts:

	drivers/media/platform/msm/camera_v2/sensor/cci/msm_cci.c
msm: camera: solve twice request MCLK GPIO for camera

In 8x26 MTP/QRD design, main/front camera sensor shares
the same MCLK GPIO, the poweron may fails in some cases
Change the process to output a error message for driver
bringup state to make sure other gpio are handled properly.

Change-Id: I48ee01f32ae5d7e02d3efe8578a747f23a6d8a71
Signed-off-by: Su Liu <suliu@codeaurora.org>
msm: camera: Stream on optimization

Remove sleep in msm_csiphy_lane_config().

Change-Id: Ieede0ed325422c4323ffd69ddcbc20a36889c763
Signed-off-by: Evgeniy Borisov <eborisov@codeaurora.org>
msm: camera: Exit gracefully while camera daemon crashes

Add camera daemon shutdown handling in all camera
sub devices to exit camera gracefully and it helps
to restart camera.

Change-Id: I39643a16f100b873275efe3a0c6184fe54e52830
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm: camera: increase the length of property array

Increase the length of property array as the pageen property may
be longer than 12.

Change-Id: I1b85e9b9eb01af991dd628a08ca5e334c0fdbc82
Signed-off-by: Wang Wenbin <wenbinw@codeaurora.org>
msm_sensor: fix vreg dt parsing logic

Previously, dt parsing code for sensor power up sequence assumes certain
value and order in "qcom,cam-vreg-name".  Such assumption can't be
enforced by dt itself.  It leads to kernel panic when enum value of a vreg
is larger than total number of specified vregs.

New implementation dynamically search and match available vregs, instead of
relying on order and enum assumptions.

Change-Id: Iea519f2e4b4d805fecf6dd699ade2af4a00caa43
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>

Conflicts:

	drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
msm: camera: eeprom: add gpio enable vdig support in eeprom probe

Add support for sensor power up through gpio enable vdig in eeprom
probe.

Change-Id: I84e1bc5a7278bac29db4575fa9fe69f3e464bedc
Signed-off-by: Wang Wenbin <wenbinw@codeaurora.org>
msm: camera: Bound check num_cid from userspace in csid driver

Upper and lower bound checks are enforced for num_cid
which is passed from userspace with lower as 1 and
max of 16.

Change-Id: Ic5456289cb2f2b4ea17610a7672eb2c5225b7954
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
msm: camera: Change CCI I2C write interface

Every CCI I2C write involves one I2C transaction to CCI core.
Since CCI queue has maximum of 64 words, Write CCI commands
to CCI core and handle it in hardware.

Change-Id: Ic3b03bf70b1a5a23d4bdd42d2cbf8528fa8bd413
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
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>
msm:camera: Add support for LED flash as i2c node

Add LED flash driver for adp1660 as i2c node.
Create v4l2 node and add control logic for i2c
LED Flash driver.

Change-Id: Iccdd341c280e58dfa5b374d06b16c2d9d344f748
Signed-off-by: Lokesh Kumar Aakulu <lkumar@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-8610-gpiomux.c
	drivers/media/platform/msm/camera_v2/sensor/flash/msm_led_flash.h
msm: ledflash: Add Debugfs node for I2c based led flash

Add debugfs node for ledflash to power on/off led.

Change-Id: I788bf61b2d47ed8bd58dc28fe185f21f8ffcd375
Signed-off-by: Lokesh Kumar Aakulu <lkumar@codeaurora.org>
msm: camera: add LED torch driver

User space should access the proper torch led sysfs node whose
driver is implemented according to led trigger frame work, so
camera need to provide such a node.

CRs-Fixed: 537513
Change-Id: I67458c16bf823824896051b93a6eb3067d5ae993
Signed-off-by: Xu Kai <kaixu@codeaurora.org>
msm: camera: Add in-sensor mode support for eeprom

Add in-sensor mode calibration support for eeprom.
User are able to the back calibration settings
via i2c interface of the sensor.

Change-Id: I9332ea08f1100bed44c00ac455d07d8ea2b2ee27
Signed-off-by: Wei Ding <weiding@codeaurora.org>

Conflicts:

	drivers/media/platform/msm/camera_v2/sensor/eeprom/msm_eeprom.c
msm: camera: Reset CCI core based on I2C MASTER

CCI core is used by camera sensor, actuator and EEPROM. CCI core gets
reset first time when either one of hardware modules initializes it.
But, as per hardware requirement sensor has to be powered up before
CCI can be reset. This imposes limitation in the sequence in which
camera is opened. To remove this limitation, initialize CCI core
only for corresponding I2C MASTER everytime either of the hardware
modules initilizes it.

Change-Id: If2d7cc26fe23533243714839e6375f73d5efd4f2
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
msm: camera: Add kernel driver for imx134

Support for image sensor imx134 on 8610 platform.

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

Conflicts:

	Documentation/devicetree/bindings/media/video/msm-cci.txt
msm: camera: To prevent the unbounded copy

To prevent the unbounded copy in EEPROM driver
to avoid kernel memory disclosure

Change-Id: Ib7f8719351ff72720c55394fdd0fcd5e876e2c09
CRs-fixed: 553389
Signed-off-by: Cherian Deepak <dcheri@codeaurora.org>
msm: actuator: fix to prevent untrusted pointer to lead DoS

fix to prevent untrusted userspace pointer in actuator kernel
driver to lead DoS

Change-Id: I1b64270deb494530d268539e7b420be5ec79b658
Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org>
msm: actuator: fix to prevent kernel heap buffer overflow

fix to prevent kernel heap buffer overflow allows user
controlled data to be written to the heap via the
msm_camera actuator IOCTLs

Change-Id: I4458831e28e0081fb2f5ae55506be866100e1b4f
Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org>
msm:Camera: Fix Power leak with sp1628 camera sensor

Instead of hard code to  GPIOF_OUT_INIT_LOW .
make use of power setting config value
for sensor power down.

Change-Id: Ib1037af550541b16be1f57c1145d83ea8bce4a27
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>