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: 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>
msm: camera: Return current lens position in actuator driver

Actuator user space driver requires lens position after move focus
call returns. Return lens position as part cfg params for move focus
ioctl.

Change-Id: I8fdce16c192db8685b1a2ac66a2cba052d64423c
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
msm: camera2: add api for set actuator for manual af

this is to support fr18291 manually set focus position

Change-Id: Idec86177abc265c38fd48e18d1320c5ae40b7f03
Signed-off-by: Yongui Mao <yongguim@codeaurora.org>

Conflicts:

	include/media/msm_cam_sensor.h
msm: camera: Add retry mechanism to detect camera sensor

When device power up, probe happens where camera sensors
connected in each slot are detected by reading its chip id. Add
retry mechanism to try 3 times to read chip id for detecting
camera sensors.

Change-Id: Id2788f32fd7255eb9ca748ddce6e92267a1326ef
Signed-off-by: Wei Ding <weiding@codeaurora.org>
msm: camera: Fix sensor info parsing logic

Fix parsing logic as below to fix camera preview rotation
and camera app detection in UI.

0-7: media entity flags
8-15: mount angle
15-23: facing

Change-Id: If5c386abb8507743486e6a286b84d0542a06bace
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm:camera: Limit prints in default cases

Change pr_err to pr_err_ratelimited in default
case prints of userspace ioctl. pr_err would
keep printing when passing invalid parameters
in ioctl which would cause watchdog reset.

Change-Id: Ic35f63c4e8923aa49ac013a59af08cae4d3d176b
CRs-fixed: 586318
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
msm: camera: Make ISP and camera kernel not interruptible

Change wait_event_interruptible_timeout to wait_completion_timeout
in camera kernel and change wait_completion_timeout_interruptible
to wait_event_timeout to avoid getting interrupts from kernel.

Change-Id: Ibf17d0f11ed705e68294257a90f7770676e63cbb
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
msm-camera: Reset ISPIF h/w

Reseting ISPIF hardware after ISPIF is stopped without frame
boundaries.Enabling all clocks for same.

Change-Id: I3712a2af9a3011769e14fab14ddaa5a32f6bcb90
Signed-off-by: Megha Tak <mtak@codeaurora.org>
msm: camera: Fix crash in ispif release

There is a BUG_ON in ispif release function for
ispif base address. but in case of just open and close
of ispif subdevice leads to ispif base NULL.

BUG_ON is removed and proper error is added in ispif
release function to fix the issue.

Change-Id: I0cc12d52aff9db0d9bb8844473f9bd6547270e27
CRs-Fixed: 642603
Signed-off-by: Suresh Vankadara <svankada@codeaurora.org>
msm: Camera: Return proper value for msm_camera_qup_i2c_txdata().

msm_camera_qup_i2c_txdata() is not returning proper value.
Due to which session tear down is not happening properly
in case of i2c failure.
CRs-Fixed: 640328

Change-Id: Iac8be9d4755f807b45a6ede4f660b52cb88aedd4
Signed-off-by: Vivek Veenam <vveenam@codeaurora.org>
msm: camera: sensor: Update CCI WR comamnd buffer size to 11 bytes

I2C command length is of 11 bytes, it includes 10 bytes of data and
one byte of WR command. Use 11 bytes char array to create command.

Change-Id: Idf330fef6b8da79c6b7f5a2839d88a68e10a96f9
Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
msm: camera: sensor: Update to use wait_for_completion.

Use wait_for_completion in place of wait_for_completion_interruptible

Change-Id: I960b334128e2b811b27c64721a65f7c7e773b085
Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
msm: camera: Fix various small issues in Actuator driver

Bound check and validate userspace parameters direction,
number of steps and direction sign. Also fix possible
memory leak in certain error cases.

CRs-Fixed: 511349
Change-Id: Icaa324468574494fb40f2de78e522090806744cb
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
msm: camera: Removed CCI_RELEASE call.

CCI_RELEASE not needed when CCI_INIT is failed.
Cleanup is done internally in msm_cci_init.

Change-Id: I44b82eeb40fc4e14c1720c17fefa309d17a469da
Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
msm: camera: sensor: remove unnecessary logs

Use CDBG instead of pr_err for non-error logs.

Change-Id: If09d576040011e4036dda830b50d84473ec806b7
Signed-off-by: Xu Han <hanxu@codeaurora.org>
camera_v1/v2: Fix multiple JPEG integer overflow issues

Fixes multiple issues in the gemini and jpeg 1.0 cores when parsing
hw commands:

1. Fixes integer overflow issue when calculating the length of the
command buffer.
2. Fixes signedness issue with the command count.

CRs-fixed: 504640
Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Change-Id: I0a701c67b93cc97af119b31639db699e5ae58489
camera_v2: JPEG 1.0: add alignment check on register offset

Adds a check on the offset value in msm_jpeg_hw_cmd structure
for correct alignment.

Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Change-Id: I9233cf6b7b300958188d2c95fb5a2c5f7a1e9cfb
camera_v2: Use JPEG_DBG instead of JPEG_ERR for some messages

Avoid printing by default a number of debug messages, to decrease
the ioctl latency in the dual JPEG use case.

Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Change-Id: I1cfd16270282587cbf1821d34f658af80fe69fd1