diff options
author | Dheeraj CVR <cvr.dheeraj@gmail.com> | 2014-01-11 15:10:10 +0530 |
---|---|---|
committer | Dheeraj CVR <cvr.dheeraj@gmail.com> | 2014-01-12 05:08:56 +0530 |
commit | a533cbc376c453adb678ddc4e9d799b89b47c200 (patch) | |
tree | 7d9b9e3b70ca002a24ebdce801cedbc9c815eefe /camera | |
parent | ca94408d0d3e5754984b8f1549d53235b079bf02 (diff) | |
download | device_samsung_smdk4412-common-a533cbc376c453adb678ddc4e9d799b89b47c200.zip device_samsung_smdk4412-common-a533cbc376c453adb678ddc4e9d799b89b47c200.tar.gz device_samsung_smdk4412-common-a533cbc376c453adb678ddc4e9d799b89b47c200.tar.bz2 |
smdk4412-common: camera: implement CAMERA_MSG_FOCUS_MOVE to report CAF
Since we are querying the status of CAF in real time, implement
CAMERA_MSG_FOCUS_MOVE to report the CAF status.
Also monitor the state of AutoFocus and report success or failure
only when AutoFocus has started. This prevents reporting false
AutoFocus status which relates to the previous AutoFocus result.
Change-Id: Icb151dca150f932b42b276c45ec392e3dae413cc
Diffstat (limited to 'camera')
-rw-r--r-- | camera/exynos_camera.c | 66 | ||||
-rw-r--r-- | camera/exynos_camera.h | 2 |
2 files changed, 59 insertions, 9 deletions
diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index c112663..f0cb0c3 100644 --- a/camera/exynos_camera.c +++ b/camera/exynos_camera.c @@ -1536,6 +1536,26 @@ int exynos_camera_capture(struct exynos_camera *exynos_camera) } } + // CAF + switch (auto_focus_result) { + case S5C73M3_CAF_STATUS_FOCUSING: + case S5C73M3_CAF_STATUS_FIND_SEARCHING_DIR: + current_af = CAMERA_AF_STATUS_IN_PROGRESS; + break; + case S5C73M3_CAF_STATUS_FOCUSED: + current_af = CAMERA_AF_STATUS_SUCCESS; + break; + case S5C73M3_CAF_STATUS_UNFOCUSED: + default: + current_af = CAMERA_AF_STATUS_RESTART; + } + + rc = exynos_camera_continuous_auto_focus(exynos_camera, current_af); + if (rc < 0) { + ALOGE("%s: Unable to continuous auto focus", __func__); + goto error; + } + if (!decoded) { buffers_count = 1; buffers = (struct exynos_camera_buffer *) calloc(buffers_count, sizeof(struct exynos_camera_buffer)); @@ -3822,21 +3842,48 @@ int exynos_camera_auto_focus(struct exynos_camera *exynos_camera, int auto_focus // ALOGD("%s()", __func__); switch (auto_focus_status) { + case CAMERA_AF_STATUS_SUCCESS: + if (exynos_camera->auto_focus_started) { + if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) + exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS, 1, 0, exynos_camera->callbacks.user); + exynos_camera_auto_focus_finish(exynos_camera); + } + break; + case CAMERA_AF_STATUS_FAIL: + if (exynos_camera->auto_focus_started) { + if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) + exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS, 0, 0, exynos_camera->callbacks.user); + exynos_camera_auto_focus_finish(exynos_camera); + } + break; + case CAMERA_AF_STATUS_IN_PROGRESS: + exynos_camera->auto_focus_started = 1; + break; + case CAMERA_AF_STATUS_RESTART: + default: + break; + } + + return 0; +} + +int exynos_camera_continuous_auto_focus(struct exynos_camera *exynos_camera, int auto_focus_status) +{ + if (exynos_camera == NULL) + return -EINVAL; + + switch (auto_focus_status) { case CAMERA_AF_STATUS_IN_PROGRESS: -/* if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS_MOVE) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS_MOVE, 1, 0, exynos_camera->callbacks.user); -*/ + break; case CAMERA_AF_STATUS_SUCCESS: - if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) - exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS, 1, 0, exynos_camera->callbacks.user); - exynos_camera_auto_focus_finish(exynos_camera); + if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS_MOVE) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) + exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS_MOVE, 0, 0, exynos_camera->callbacks.user); break; - case CAMERA_AF_STATUS_FAIL: - if (EXYNOS_CAMERA_MSG_ENABLED(CAMERA_MSG_FOCUS) && EXYNOS_CAMERA_CALLBACK_DEFINED(notify) && !exynos_camera->callback_lock) - exynos_camera->callbacks.notify(CAMERA_MSG_FOCUS, 0, 0, exynos_camera->callbacks.user); - exynos_camera_auto_focus_finish(exynos_camera); + case CAMERA_AF_STATUS_RESTART: + default: break; } @@ -3885,6 +3932,7 @@ void exynos_camera_auto_focus_finish(struct exynos_camera *exynos_camera) } exynos_camera->auto_focus_enabled = 0; + exynos_camera->auto_focus_started = 0; rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK, AE_UNLOCK_AWB_UNLOCK); if (rc < 0) diff --git a/camera/exynos_camera.h b/camera/exynos_camera.h index 5118539..e3bed92 100644 --- a/camera/exynos_camera.h +++ b/camera/exynos_camera.h @@ -384,6 +384,7 @@ struct exynos_camera { // Auto-focus int auto_focus_enabled; + int auto_focus_started; // Camera params @@ -512,6 +513,7 @@ void exynos_camera_recording_thread_stop(struct exynos_camera *exynos_camera); // Auto-focus int exynos_camera_auto_focus(struct exynos_camera *exynos_camera, int auto_focus_status); +int exynos_camera_continuous_auto_focus(struct exynos_camera *exynos_camera, int auto_focus_status); int exynos_camera_auto_focus_start(struct exynos_camera *exynos_camera); void exynos_camera_auto_focus_finish(struct exynos_camera *exynos_camera); void exynos_camera_auto_focus_stop(struct exynos_camera *exynos_camera); |