summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-11-15 10:08:50 -0800
committerSimon Wilson <simonwilson@google.com>2011-11-15 10:37:02 -0800
commit1dfd26aaff22fe1ffacf39751d50862786d369d5 (patch)
tree73e5526b137e7a4f5d4610c9d607c389a47303b4 /libcamera
parent627ab66f47c4bdcb79f13fa47f3b42d2ef1a420b (diff)
parent77143165c6ad76614f5fa1c236174783ed765a45 (diff)
downloaddevice_samsung_crespo-1dfd26aaff22fe1ffacf39751d50862786d369d5.zip
device_samsung_crespo-1dfd26aaff22fe1ffacf39751d50862786d369d5.tar.gz
device_samsung_crespo-1dfd26aaff22fe1ffacf39751d50862786d369d5.tar.bz2
resolved conflicts for merge of 77143165 to master
Change-Id: Ic30c853d7f9898206699c3c0e648a54362ed4824
Diffstat (limited to 'libcamera')
-rwxr-xr-xlibcamera/SecCamera.cpp35
-rwxr-xr-x[-rw-r--r--]libcamera/SecCamera.h7
2 files changed, 39 insertions, 3 deletions
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index fdc3bb3..67f9647 100755
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -1557,12 +1557,41 @@ int SecCamera::setAutofocus(void)
int SecCamera::getAutoFocusResult(void)
{
- int af_result;
+ int af_result, count, ret;
- af_result = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_AUTO_FOCUS_RESULT);
+ for (count = 0; count < FIRST_AF_SEARCH_COUNT; count++) {
+ ret = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_AUTO_FOCUS_RESULT_FIRST);
+ if (ret != AF_PROGRESS)
+ break;
+ usleep(AF_DELAY);
+ }
+ if ((count >= FIRST_AF_SEARCH_COUNT) || (ret != AF_SUCCESS)) {
+ ALOGV("%s : 1st AF timed out, failed, or was canceled", __func__);
+ af_result = 0;
+ goto finish_auto_focus;
+ }
- ALOGV("%s : returning %d", __func__, af_result);
+ for (count = 0; count < SECOND_AF_SEARCH_COUNT; count++) {
+ ret = fimc_v4l2_g_ctrl(m_cam_fd, V4L2_CID_CAMERA_AUTO_FOCUS_RESULT_SECOND);
+ /* low byte is garbage. done when high byte is 0x0 */
+ if (!(ret & 0xff00))
+ break;
+ usleep(AF_DELAY);
+ }
+ if (count >= SECOND_AF_SEARCH_COUNT) {
+ ALOGV("%s : 2nd AF timed out, failed, or was canceled", __func__);
+ af_result = 0;
+ goto finish_auto_focus;
+ }
+
+ af_result = 1;
+ ALOGV("%s : AF was successful, returning %d", __func__, af_result);
+finish_auto_focus:
+ if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FINISH_AUTO_FOCUS, 0) < 0) {
+ LOGE("ERR(%s):Fail on V4L2_CID_CAMERA_SET_PRE_FLASH", __func__);
+ return -1;
+ }
return af_result;
}
diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h
index 551eb03..5c62782 100644..100755
--- a/libcamera/SecCamera.h
+++ b/libcamera/SecCamera.h
@@ -146,6 +146,13 @@ namespace android {
#define BPP 2
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX_BUFFERS 9 // 11
+
+#define FIRST_AF_SEARCH_COUNT 80
+#define SECOND_AF_SEARCH_COUNT 80
+#define AF_PROGRESS 0x01
+#define AF_SUCCESS 0x02
+#define AF_DELAY 50000
+
/*
* V 4 L 2 F I M C E X T E N S I O N S
*