summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2011-12-18 10:38:15 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2011-12-18 10:38:15 +0700
commit299715ec9ea61e01cec10fb965b4e25b5e7571dc (patch)
treee977a73addd1783612c0930f4057dc7886adfd53
parent6da003c0f69648716179abf7cc466c49e819bb0d (diff)
downloaddevice_samsung_aries-common-299715ec9ea61e01cec10fb965b4e25b5e7571dc.zip
device_samsung_aries-common-299715ec9ea61e01cec10fb965b4e25b5e7571dc.tar.gz
device_samsung_aries-common-299715ec9ea61e01cec10fb965b4e25b5e7571dc.tar.bz2
Adjust libcamera for CE147
-rw-r--r--libcamera/Android.mk4
-rwxr-xr-xlibcamera/SecCamera.cpp91
-rwxr-xr-xlibcamera/SecCamera.h3
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp41
4 files changed, 136 insertions, 3 deletions
diff --git a/libcamera/Android.mk b/libcamera/Android.mk
index e286cea..60f975e 100644
--- a/libcamera/Android.mk
+++ b/libcamera/Android.mk
@@ -18,5 +18,9 @@ LOCAL_MODULE := camera.aries
LOCAL_MODULE_TAGS := optional
+ifdef BOARD_SECOND_CAMERA_DEVICE
+ LOCAL_CFLAGS += -DFFC_PRESENT
+endif
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/libcamera/SecCamera.cpp b/libcamera/SecCamera.cpp
index 9c2d023..cfa0075 100755
--- a/libcamera/SecCamera.cpp
+++ b/libcamera/SecCamera.cpp
@@ -1,6 +1,7 @@
/*
* Copyright 2008, The Android Open Source Project
* Copyright 2010, Samsung Electronics Co. LTD
+ * Copyright 2011, The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -764,9 +765,63 @@ int SecCamera::startPreview(void)
CHECK(ret);
}
+ if (m_camera_id == CAMERA_ID_BACK) {
+ // Init some parameters required for CE147
+ // Force antibanding for back camera - only value supported
+ m_anti_banding = ANTI_BANDING_50HZ;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ANTI_BANDING, m_anti_banding);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ISO, m_params->iso);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BRIGHTNESS, m_params->brightness);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FRAME_RATE, m_params->capture.timeperframe.denominator);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_METERING, m_params->metering);
+ CHECK(ret);
+ // TODO
+ m_video_gamma = 0;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_GAMMA, m_video_gamma);
+ CHECK(ret);
+ // TODO
+ m_slow_ae = 0;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SET_SLOW_AE, m_slow_ae);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EFFECT, m_params->effects);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_WHITE_BALANCE, m_params->white_balance);
+ CHECK(ret);
+ }
+
ret = fimc_v4l2_streamon(m_cam_fd);
CHECK(ret);
+ if (m_camera_id == CAMERA_ID_BACK) {
+ // More parameters for CE147
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FOCUS_MODE, m_params->focus_mode);
+ CHECK(ret);
+ // TODO
+ m_face_detect = 0;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_FACE_DETECTION, m_face_detect);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SHARPNESS, m_params->sharpness);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_SATURATION, m_params->saturation);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CONTRAST, m_params->contrast);
+ CHECK(ret);
+ // TODO
+ m_beauty_shot = 0;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BEAUTY_SHOT, m_beauty_shot);
+ CHECK(ret);
+ // TODO
+ m_zoom_level = 0;
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_ZOOM, m_zoom_level);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_BATCH_REFLECTION, 1);
+ CHECK(ret);
+ }
+
m_flag_camera_start = 1;
ret = fimc_v4l2_s_parm(m_cam_fd, &m_streamparm);
@@ -1114,6 +1169,41 @@ int SecCamera::setSnapshotCmd(void)
ret = fimc_v4l2_streamon(m_cam_fd);
CHECK(ret);
+
+ // Additional calls needed for CE147
+ // TODO: GPS
+
+ // Time
+ time_t rawtime;
+ time(&rawtime);
+ struct tm *timeinfo = localtime(&rawtime);
+ ret = fimc_v4l2_s_ext_ctrl(m_cam_fd, V4L2_CID_CAMERA_EXIF_TIME_INFO, timeinfo);
+ CHECK(ret);
+
+ // Orientation
+ int orientation;
+ switch (m_exif_orientation) {
+ case 0:
+ orientation = EXIF_ORIENTATION_UP;
+ break;
+ case 90:
+ orientation = EXIF_ORIENTATION_90;
+ break;
+ case 180:
+ orientation = EXIF_ORIENTATION_180;
+ break;
+ case 270:
+ orientation = EXIF_ORIENTATION_270;
+ break;
+ default:
+ orientation = EXIF_ORIENTATION_UP;
+ break;
+ }
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_EXIF_ORIENTATION, orientation);
+ CHECK(ret);
+ ret = fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_CAPTURE, 0);
+ CHECK(ret);
+
LOG_TIME_END(1)
return 0;
@@ -2568,6 +2658,7 @@ int SecCamera::setExifOrientationInfo(int orientationInfo)
}
//======================================================================
+// Must call after parameter update on CE147 (so the changes are reflected in batch)
int SecCamera::setBatchReflection()
{
if (m_flag_camera_start) {
diff --git a/libcamera/SecCamera.h b/libcamera/SecCamera.h
index ec0e470..cc36a74 100755
--- a/libcamera/SecCamera.h
+++ b/libcamera/SecCamera.h
@@ -43,7 +43,8 @@
namespace android {
-#define ENABLE_ESD_PREVIEW_CHECK
+// Not supported by CE147
+// #define ENABLE_ESD_PREVIEW_CHECK
#if defined(LOG_NDEBUG) && LOG_NDEBUG == 0
#define LOG_CAMERA LOGD
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index fd25127..9a91ca6 100755
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -238,6 +238,7 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
p.set(CameraParameters::KEY_SUPPORTED_EFFECTS, parameterString.string());
if (cameraId == SecCamera::CAMERA_ID_BACK) {
+#ifdef HAVE_FLASH
parameterString = CameraParameters::FLASH_MODE_ON;
parameterString.append(",");
parameterString.append(CameraParameters::FLASH_MODE_OFF);
@@ -249,6 +250,7 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
parameterString.string());
p.set(CameraParameters::KEY_FLASH_MODE,
CameraParameters::FLASH_MODE_OFF);
+#endif
parameterString = CameraParameters::SCENE_MODE_AUTO;
parameterString.append(",");
@@ -271,8 +273,9 @@ void CameraHardwareSec::initDefaultParameters(int cameraId)
parameterString.append(CameraParameters::SCENE_MODE_PARTY);
parameterString.append(",");
parameterString.append(CameraParameters::SCENE_MODE_CANDLELIGHT);
- p.set(CameraParameters::KEY_SUPPORTED_SCENE_MODES,
- parameterString.string());
+ // TODO: CE147 doesn't understand scene mode
+ //p.set(CameraParameters::KEY_SUPPORTED_SCENE_MODES,
+ // parameterString.string());
p.set(CameraParameters::KEY_SCENE_MODE,
CameraParameters::SCENE_MODE_AUTO);
@@ -1613,7 +1616,9 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK) {
int new_scene_mode = -1;
+#ifdef HAVE_FLASH
const char *new_flash_mode_str = params.get(CameraParameters::KEY_FLASH_MODE);
+#endif
// fps range is (15000,30000) by default.
mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(15000,30000)");
@@ -1622,64 +1627,86 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
if (!strcmp(new_scene_mode_str, CameraParameters::SCENE_MODE_AUTO)) {
new_scene_mode = SCENE_MODE_NONE;
+#ifdef HAVE_FLASH
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "on,off,auto,torch");
+#endif
} else {
// defaults for non-auto scene modes
if (mSecCamera->getCameraId() == SecCamera::CAMERA_ID_BACK) {
new_focus_mode_str = CameraParameters::FOCUS_MODE_AUTO;
}
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
+#endif
if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_PORTRAIT)) {
new_scene_mode = SCENE_MODE_PORTRAIT;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_AUTO;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "auto");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_LANDSCAPE)) {
new_scene_mode = SCENE_MODE_LANDSCAPE;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_SPORTS)) {
new_scene_mode = SCENE_MODE_SPORTS;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_PARTY)) {
new_scene_mode = SCENE_MODE_PARTY_INDOOR;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_AUTO;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "auto");
+#endif
} else if ((!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_BEACH)) ||
(!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_SNOW))) {
new_scene_mode = SCENE_MODE_BEACH_SNOW;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_SUNSET)) {
new_scene_mode = SCENE_MODE_SUNSET;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_NIGHT)) {
new_scene_mode = SCENE_MODE_NIGHTSHOT;
mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FPS_RANGE, "(4000,30000)");
mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE,
"4000,30000");
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_FIREWORKS)) {
new_scene_mode = SCENE_MODE_FIREWORKS;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else if (!strcmp(new_scene_mode_str,
CameraParameters::SCENE_MODE_CANDLELIGHT)) {
new_scene_mode = SCENE_MODE_CANDLE_LIGHT;
+#ifdef HAVE_FLASH
new_flash_mode_str = CameraParameters::FLASH_MODE_OFF;
mParameters.set(CameraParameters::KEY_SUPPORTED_FLASH_MODES, "off");
+#endif
} else {
LOGE("%s::unmatched scene_mode(%s)",
__func__, new_scene_mode_str); //action, night-portrait, theatre, steadyphoto
@@ -1724,6 +1751,7 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
}
}
+#ifdef HAVE_FLASH
// flash..
if (new_flash_mode_str != NULL) {
int new_flash_mode = -1;
@@ -1749,6 +1777,7 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
}
}
}
+#endif
// scene..
if (0 <= new_scene_mode) {
@@ -2022,6 +2051,12 @@ status_t CameraHardwareSec::setParameters(const CameraParameters& params)
ret = UNKNOWN_ERROR;
}
}
+
+ if (mSecCamera->setBatchReflection()) {
+ LOGE("ERR(%s):Fail on mSecCamera->setBatchReflection()", __func__);
+ ret = UNKNOWN_ERROR;
+ }
+
LOGV("%s return ret = %d", __func__, ret);
return ret;
@@ -2113,10 +2148,12 @@ static CameraInfo sCameraInfo[] = {
CAMERA_FACING_BACK,
90, /* orientation */
},
+#ifdef FFC_PRESENT
{
CAMERA_FACING_FRONT,
270, /* orientation */
}
+#endif
};
/** Close this device */