From 7607d3d42484c80b5689e7cb0362bfbe40daf263 Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Sat, 5 Oct 2013 16:29:09 +0200 Subject: camera: Add AWB and AE lock Change-Id: I5ac305414a4d1af61fe4434fc89e794121196bdf --- camera/exynos_camera.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ camera/exynos_camera.h | 8 +++++++ 2 files changed, 72 insertions(+) (limited to 'camera') diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index 0c840dd..3abba99 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,26 @@ 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 +627,13 @@ 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; + int ae_lock = 0; + + char *awb_lock_supported_string; + int awb_lock = 0; + int aeawb = 0; + char *flash_mode_string; int flash_mode; @@ -884,6 +923,31 @@ 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"); + if (ae_lock_supported_string != NULL && strcmp(ae_lock_supported_string, "true") == 0) { + ae_lock = strcmp(exynos_param_string_get(exynos_camera, "auto-exposure-lock"), "true") ? 1 : 0; + } + + // AWB lock + + awb_lock_supported_string = exynos_param_string_get(exynos_camera, "auto-whitebalance-lock-supported"); + if (awb_lock_supported_string != NULL && strcmp(awb_lock_supported_string, "true") == 0) { + awb_lock = strcmp(exynos_param_string_get(exynos_camera, "auto-whitebalance-lock"), "true") ? 1 : 0; + } + + if ( (ae_lock != exynos_camera->ae_lock) || (awb_lock != exynos_camera->awb_lock) || force ) { + 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__); + else { + exynos_camera->ae_lock = ae_lock; + exynos_camera->awb_lock = awb_lock; + } + } + // Flash flash_mode_string = exynos_param_string_get(exynos_camera, "flash-mode"); diff --git a/camera/exynos_camera.h b/camera/exynos_camera.h index 547b90f..8c0977a 100644 --- a/camera/exynos_camera.h +++ b/camera/exynos_camera.h @@ -150,6 +150,12 @@ struct exynos_camera_params { int zoom; int max_zoom; + int auto_exposure_lock_supported; + int auto_exposure_lock; + + int auto_white_balance_lock_supported; + int auto_white_balance_lock; + char *flash_mode; char *flash_mode_values; @@ -412,6 +418,8 @@ struct exynos_camera { int focus_x; int focus_y; int zoom; + int ae_lock; + int awb_lock; int flash_mode; int exposure_compensation; int whitebalance; -- cgit v1.1