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_v2: Don't touch CCI if camera daemon crashed.

If daemon crashes, refrain from writing to the CCI. This is needed
because these writes will not wait in a process crash scenario and can
potentially leave the CCI in a bad state.

Change-Id: I785cb4af8dc3893b8a7f11e1d1c2a2e1ad775665
Signed-off-by: Satyavaraprasad Yerramsetti <satyav@codeaurora.org>
Signed-off-by: Satyavaraprasad Yerramsetti <satyav@codeaurora.org>
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: cci: fix for invalid error handle

fix for invalid error handle in msm cci
- msm_cci_flush_queue function never return
error because variable rc is unsigned int
- msm_cci_init function return result int32_t
but variable rc is int

Change-Id: I2610b08f4eceedfbb8bd07d8027310f43b9ee6bf
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>
msm: camera: Checking an enum value greater than zero

An enum value cci_i2c_master is not checked to be greater than 0.
Add the check.

Change-Id: Ibe75ab7155def45d81b8127c5eda3fa2ed570bce
Signed-off-by: Xu Han <hanxu@codeaurora.org>
msm: camera: Add user definied LED brightness

In current implementation the led brightness value
is defined in dts files and can't be changed runtime.

This fix add interface to provide new brightness.

Change-Id: I647cab7f97b6049cfed4dde9ad4966cb9b7e8c80
Signed-off-by: Ivan Tiyanov <ivant@codeaurora.org>

Conflicts:

	drivers/media/platform/msm/camera_v2/sensor/flash/msm_led_trigger.c
msm: camera: Update sensor mount angle and position

Update sensor driver to add sensor mount angle and
position as part of media entity flag. This info
is used by upper layers to get the info from
media device entity insted of opening camera
to reduce the launch latency.

Change-Id: I33e047cd52a87e9770de10c101631864b8737501
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
msm: camera: Extend LED current for Dual LED support.

Extend LED current for Dual LED support.
Need two different current values for Dual LED.

Change-Id: I3ab2f3b0dd0ec665344fd5c5398957716fe3d0c4
Signed-off-by: Ivan Tiyanov <ivant@codeaurora.org>
msm: camera: Fix for memory leaks and error handlers.

(a) Fix leak during error cases.
(b) Handle error cases like releasing devices in case of
    failures.

Change-Id: I9e01855e1de968cac6708aaf6a2522d277f93f7c
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
msm: camera_v2: cci: check for NULL pointer

in function "msm_cci_subdev_g_chip_ident"
check for NULL pointer and return error
instead of assert

Change-Id: Ia27751c4d6f3d5ead1749e396ffa5c2773f1582b
Signed-off-by: Georgi Hristov <ghristov@codeaurora.org>