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>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
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: Shuzhen Wang <shuzhenw@codeaurora.org>
msm: camera2: cpp: Set exact size for firmware loading.

The poll reads after during and after firmware loading fails.
This is because the exact size of firmware changes with the
version of the firmware. This change uses the firmware size
based on actual firmware file being loaded.

Bug: 10577806
Change-Id: I949954347a48d0b388b11b3c81fd5d1a4627cbf7
Signed-off-by: Rajakumar Govindaram <rajakuma@codeaurora.org>
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
(cherry picked from commit 48219c02786bae8216833022fceee3079f5c2755)
msm: camera: return -EIO if daemon hasn't fully launched

Media server depends on camera daemon to be fully launched
to be able to get camera info. Return -EIO if daemon hasn't
subscribed to v4l2 device node. This gives HAL opportunity
to try again.

Bug: 10577806
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
(cherry picked from commit d562b2f9774d9251068dbded5ad15a1c7407824f)

Change-Id: Iebc51c8e56352e02ef5f0554c9eb5ac2bf629595
msm: camera: Do not ignore ERESTARTSYS return from wait function

By ignoring ERESTARTSYS return from wait function, the thread
could potentially hold up the freezing of the task for a long
time, causing battery drain.

Bug: 10577806
Signed-off-by: Shuzhen Wang <shuzhenw@codeaurora.org>
Change-Id: I653c06c6bf41b07c811d6bab33e3c839460f45b6
(cherry picked from commit db69933cd572bb7f6fc6ede66175dc4adfdd8217)