From 199a88beb4c9dc88d11176e6db6e0acdabcc50c7 Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Tue, 8 Oct 2013 17:47:29 +0200 Subject: camera: Add AWB and AE lock Signed-off-by: Paul Kocialkowski Change-Id: Idea7b7af7eb7adb4e02e6f527dda96e78f3e0f16 --- camera/exynos_camera.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'camera/exynos_camera.c') diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index 0c840dd..ef9ee6b 100644 --- a/camera/exynos_camera.c +++ b/camera/exynos_camera.c @@ -113,6 +113,12 @@ struct exynos_camera_preset exynos_camera_presets_smdk4x12[] = { .zoom = 0, .max_zoom = 30, + .auto_exposure_lock_supported = 1, + .auto_exposure_lock = 0, + + .auto_white_balance_lock_supported = 1, + .auto_white_balance_lock = 0, + .flash_mode = "off", .flash_mode_values = "off,auto,on,torch", @@ -191,6 +197,12 @@ struct exynos_camera_preset exynos_camera_presets_smdk4x12[] = { .zoom_supported = 0, + .auto_exposure_lock_supported = 0, + .auto_exposure_lock = 0, + + .auto_white_balance_lock_supported = 0, + .auto_white_balance_lock = 0, + .flash_mode = NULL, .flash_mode_values = NULL, @@ -476,6 +488,28 @@ int exynos_camera_params_init(struct exynos_camera *exynos_camera, int id) exynos_param_string_set(exynos_camera, "zoom-supported", "false"); } + // AE lock + + if (exynos_camera->config->presets[id].params.auto_exposure_lock_supported == 1) { + exynos_param_string_set(exynos_camera, "auto-exposure-lock-supported", "true"); + + if (exynos_camera->config->presets[id].params.auto_exposure_lock) + exynos_param_string_set(exynos_camera, "auto-exposure-lock", "true"); + else + exynos_param_string_set(exynos_camera, "auto-exposure-lock", "false"); + } + + // AWB lock + + if (exynos_camera->config->presets[id].params.auto_white_balance_lock_supported == 1) { + exynos_param_string_set(exynos_camera, "auto-whitebalance-lock-supported", "true"); + + if (exynos_camera->config->presets[id].params.auto_white_balance_lock) + exynos_param_string_set(exynos_camera, "auto-whitebalance-lock", "true"); + else + exynos_param_string_set(exynos_camera, "auto-whitebalance-lock", "false"); + } + // Flash exynos_param_string_set(exynos_camera, "flash-mode", @@ -595,6 +629,15 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera, int force) char *zoom_supported_string; int zoom, max_zoom; + char *ae_lock_supported_string; + char *ae_lock_string; + int ae_lock = 0; + + char *awb_lock_supported_string; + char *awb_lock_string; + int awb_lock = 0; + int aeawb = 0; + char *flash_mode_string; int flash_mode; @@ -884,6 +927,33 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera, int force) } + // AE lock + + ae_lock_supported_string = exynos_param_string_get(exynos_camera, "auto-exposure-lock-supported"); + ae_lock_string = exynos_param_string_get(exynos_camera, "auto-exposure-lock"); + if (ae_lock_supported_string != NULL && ae_lock_string != NULL && strcmp(ae_lock_supported_string, "true") == 0 && strcmp(ae_lock_string, "true") == 0) + ae_lock = 1; + else + ae_lock = 0; + + // AWB lock + + awb_lock_supported_string = exynos_param_string_get(exynos_camera, "auto-whitebalance-lock-supported"); + awb_lock_string = exynos_param_string_get(exynos_camera, "auto-whitebalance-lock"); + if (awb_lock_supported_string != NULL && awb_lock_string != NULL && strcmp(awb_lock_supported_string, "true") == 0 && strcmp(awb_lock_string, "true") == 0) + awb_lock = 1; + else + awb_lock = 0; + + if (ae_lock != exynos_camera->ae_lock || awb_lock != exynos_camera->awb_lock || force) { + exynos_camera->ae_lock = ae_lock; + exynos_camera->awb_lock = awb_lock; + aeawb = (ae_lock ? 0x1 : 0x0) | (awb_lock ? 0x2 : 0x0); + rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK, aeawb); + if (rc < 0) + ALOGE("%s: Unable to set AEAWB lock", __func__); + } + // Flash flash_mode_string = exynos_param_string_get(exynos_camera, "flash-mode"); -- cgit v1.2.3