msm: camera: Add defensive check in ISPIF driver

In case of error handling, call ispif release only if ispif handle
is valid. In case of mm-qcamara-daemon crash when camera is not open,
these handles are not valid. Hence it leads to kernel crash in ispif
release handler.

Change-Id: Ifb402b6907052594d12fcf9495694e6c5184af1b
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
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>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Fix file perm

Signed-off-by: Dan Trifan <jimsth@gmail.com>
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>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Limit print in default case of JPEG

Change JPEG_PR_ERR to pr_err_ratelimited in default
case in JPEG ioctl. JPEG_PR_ERR would keep prinitng
when passing invalid parameters in ioctl which will
cause watchdog reset.

Change-Id: Ia8871fda4f10e44e3d2c1216765e26c2e9823038
CRs-fixed: 588260
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera_v2: Use stream cnt for unique stream id

Add new atomic counter for keeping track of stream counts.
The exisitng open_cnt counter is not full-proff since there could
be multiple streams with the stream id in the folowing
scenario:
a) Create stream 1, 2, and 3
b) Destroy stream 2
c) Add new stream; will result in another stream with id 3.

CRs-fixed: 493632
Change-Id: Icfa3cb2fd2c34c6da7e5f09d016fef4577331264
Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
camera_v2: Add IOCTL to set jpeg core clock rate

Adds a new IOCTL that provides ability to set the JPEG clock rate
dynamically.

Change-Id: Ifd8e4d57f6688e5f09c9ef049bcf928483bf1f79
Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
camera_v2: jpeg_10: Don't enable clock when changing rate

Only change rate, avoid two clock enables.

Change-Id: I7573bbb1b0802e000b1de80ae7c044fd642ce852
Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Fix unterminated of_device_id table

Add a NULL table entry at end for msm, ispif and
msm_generic_buf_mgr device tree match tables.

Change-Id: I05f08c77a8a25112cd17955e98018ac88b7a834c
CRs-Fixed: 582110
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Error prints added in during camera open

Error prints are added in few function in order to help
debugging process.

Change-Id: I0d214b6b44fdbd44a46db1704aa796fa08d5fb78
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
camera_v2: jpeg_10: Set state before hw start

The setting of driver state is now done before the JPEG
engine is started.

Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
CRs-fixed: 598605
Change-Id: I0960c925386d22efb11aebf99ad7718abd4f83e8
Signed-off-by: Dan Trifan <jimsth@gmail.com>
camera_v2: jpeg_10: Fix return value of MSM_JPEG_IOCTL_HW_CMD

The ioctl MSM_JPEG_IOCTL_HW_CMD was returning -1,
when using MSM_JPEG_HW_CMD_TYPE_WRITE due to incorrect input
validation logic.

Signed-off-by: Kamen Kirov <kkirov@codeaurora.org>
Change-Id: Ib47973fe6e2c398ef11e6ec3179388a7823e0b3f
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: Fix RDI1 interface for VFE32

The RDI registers are not defined properly
for VFE32. Fixing this issue by making the
register addresses properly.

Change-Id: I19fb50a53ae239b5fc306684b5bb6c6f65c61382
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: camera: Cleanup msm_generic_buff list while close

Cleanup the camera msm generic buffer manager list
when all v4l2 nodes are closed.

Change-Id: I27636533621d3329bcc5dffba8c003d2cdc252c2
CRs-Fixed: 599983
Signed-off-by: Azam Sadiq Pasha Kapatrala Syed <akapatra@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>