summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2014-01-25 03:36:06 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2014-01-25 03:36:06 +0000
commit4e6c2d1fcf233ea4fc0b4d2198c8b22fff51db30 (patch)
tree800ac1a50ec264c4323c3ed22b1dba8359c7c8d7
parent2d0bf37c6ea27a07c3023ddc26ede2dfd01055a4 (diff)
parenta533cbc376c453adb678ddc4e9d799b89b47c200 (diff)
downloaddevice_samsung_smdk4412-common-4e6c2d1fcf233ea4fc0b4d2198c8b22fff51db30.zip
device_samsung_smdk4412-common-4e6c2d1fcf233ea4fc0b4d2198c8b22fff51db30.tar.gz
device_samsung_smdk4412-common-4e6c2d1fcf233ea4fc0b4d2198c8b22fff51db30.tar.bz2
Merge "smdk4412-common: camera: implement CAMERA_MSG_FOCUS_MOVE to report CAF" into cm-11.0
-rw-r--r--camera/exynos_camera.c66
-rw-r--r--camera/exynos_camera.h2
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);