import exynos 7570 bsp
authorTO21Consortium <51391510+TO21Consortium@users.noreply.github.com>
Tue, 11 Jun 2019 09:50:50 +0000 (18:50 +0900)
committerJan Altensen <info@stricted.net>
Sun, 5 Apr 2020 01:03:28 +0000 (03:03 +0200)
 * source taken from https://github.com/TO21Consortium/SGSWPlatform

Change-Id: Ieb7de313efec30c402ef125c2c94697c49d5760d

31 files changed:
Android.mk [new file with mode: 0644]
CleanSpec.mk [new file with mode: 0644]
NOTICE [new file with mode: 0644]
exynos5.mk [new file with mode: 0644]
include/Exynos.h [new file with mode: 0644]
include/ExynosCamera.h [new file with mode: 0644]
include/ExynosRect.h [new file with mode: 0644]
include/content_protect.h [new file with mode: 0644]
include/exynos_mem.h [new file with mode: 0644]
include/s3c_lcd.h [new file with mode: 0644]
include/sec_g2d.h [new file with mode: 0644]
include/sec_g2ddrm.h [new file with mode: 0644]
include/videodev2_exynos_camera.h [new file with mode: 0644]
include/videodev2_exynos_camera_ext.h [new file with mode: 0644]
libgscaler/Android.mk [new file with mode: 0644]
libgscaler/libgscaler_obj.cpp [new file with mode: 0644]
libkeymaster/Android.mk [new file with mode: 0644]
libkeymaster/NOTICE [new file with mode: 0644]
libkeymaster/keymaster_mobicore.cpp [new file with mode: 0644]
libkeymaster/tci.h [new file with mode: 0644]
libkeymaster/tlTeeKeymaster_Api.h [new file with mode: 0644]
libkeymaster/tlTeeKeymaster_log.h [new file with mode: 0644]
libkeymaster/tlcTeeKeymaster_if.c [new file with mode: 0644]
libkeymaster/tlcTeeKeymaster_if.h [new file with mode: 0644]
libscaler/libscaler-m2m1shot.cpp [new file with mode: 0644]
libscaler/libscaler-v4l2.cpp [new file with mode: 0644]
original-kernel-headers/linux/fimc-is-metadata.h [new file with mode: 0644]
original-kernel-headers/linux/media.h [new file with mode: 0644]
original-kernel-headers/linux/v4l2-mediabus.h [new file with mode: 0644]
original-kernel-headers/linux/v4l2-subdev.h [new file with mode: 0644]
original-kernel-headers/linux/videodev2_exynos_media.h [new file with mode: 0644]

diff --git a/Android.mk b/Android.mk
new file mode 100644 (file)
index 0000000..6154f91
--- /dev/null
@@ -0,0 +1,25 @@
+#
+#
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ifeq ($(TARGET_BOARD_PLATFORM),exynos5)
+
+exynos5_dirs := \
+       libkeymaster
+
+include $(call all-named-subdir-makefiles,$(exynos5_dirs))
+
+endif
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644 (file)
index 0000000..461cf26
--- /dev/null
@@ -0,0 +1,50 @@
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libMcClient_intermediates)
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..316b4eb
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2014, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/exynos5.mk b/exynos5.mk
new file mode 100644 (file)
index 0000000..3218933
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# hw composer HAL
+PRODUCT_PACKAGES += \
+       hwcomposer.exynos5
+
+PRODUCT_PACKAGES += \
+       gralloc.exynos5
+
+PRODUCT_PACKAGES += \
+       memtrack.exynos5
+
+# MobiCore
+#PRODUCT_PACKAGES += \
+#      mcDriverDaemon
diff --git a/include/Exynos.h b/include/Exynos.h
new file mode 100644 (file)
index 0000000..bca11c8
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright Samsung Electronics Co.,LTD.
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file      Exynos.h
+ * \brief     header file for Exynos
+ * \author    Sangwoo, Park(sw5771.park@samsung.com)
+ * \date      2012/03/14
+ *
+ * <b>Revision History: </b>
+ * - 2012/03/14 : Sangwoo, Park(sw5771.park@samsung.com) \n
+ *   Initial version
+ *
+ */
+
+/**
+ * @mainpage Exynos SDK API Reference
+ *
+ * @section Introduction
+ *  This library is common development API on S.LSI chip of Samsung.
+ *
+ * @section Sub-module
+ *
+ * @subpage ExynosBuffer
+ *  \n
+ * @subpage ExynosRect
+ *  \n
+ * @subpage ExynosMutex
+ *  \n
+ * @subpage ExynosJpegEncoder
+ *  \n
+ * @subpage ExynosJpegDecoder
+ *  \n
+ * @subpage ExynosCamera
+ *  \n
+ * @subpage ExynosHdmi
+ *  \n
+ * @subpage ExynosDC
+ *  \n
+ * @subpage exynos_gscaler
+ *  \n
+ * @subpage exynos_v4l2
+ *  \n
+ * @subpage exynos_rotator
+ *  \n
+ *
+ * @section Copyright
+ *  Copyright (c) 2008-2011 Samsung Electronics Co., Ltd.All rights reserved. \n
+ *  Proprietary and Confidential
+ *
+ * @image html samsung.png
+ */
+
+/*!
+ * \defgroup Exynos S/W Platform
+ * \brief Exynos SDK for S.LSI's chip
+ */
+
+#ifndef EXYNOS_H_
+#define EXYNOS_H_
+
+#endif //EXYNOS_H_
+
diff --git a/include/ExynosCamera.h b/include/ExynosCamera.h
new file mode 100644 (file)
index 0000000..0d28021
--- /dev/null
@@ -0,0 +1,939 @@
+/*
+**
+** Copyright 2008, The Android Open Source Project
+** Copyright 2010, Samsung Electronics Co. LTD
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed toggle an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+/*!
+ * \file      ExynosCamera.h
+ * \brief     hearder file for CAMERA HAL MODULE
+ * \author    thun.hwang(thun.hwang@samsung.com)
+ * \date      2010/06/03
+ *
+ * <b>Revision History: </b>
+ * - 2011/12/31 : thun.hwang(thun.hwang@samsung.com) \n
+ *   Initial version
+ *
+ * - 2012/01/18 : Sangwoo, Park(sw5771.park@samsung.com) \n
+ *   Adjust Doxygen Document
+ *
+ * - 2012/02/01 : Sangwoo, Park(sw5771.park@samsung.com) \n
+ *   Adjust libv4l2
+ *   Adjust struct ExynosCameraInfo
+ *   External ISP feature
+ *
+ * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n
+ *   Change file, class name to ExynosXXX.
+ */
+
+#ifndef EXYNOS_CAMERA_H__
+#define EXYNOS_CAMERA_H__
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <videodev2.h>
+#include <videodev2_exynos_camera.h>
+#include <linux/vt.h>
+
+#include <utils/RefBase.h>
+#include <utils/String8.h>
+#include "cutils/properties.h"
+
+#include "exynos_format.h"
+#include "ExynosBuffer.h"
+#include "ExynosRect.h"
+#include "ExynosJpegEncoderForCamera.h"
+#include "ExynosExif.h"
+#include "exynos_v4l2.h"
+
+#define ALIGN(x,  a)       (((x) + (a) - 1) & ~((a) - 1))
+namespace android {
+
+#define GAIA_FW_BETA                        1
+/* FIXME: This is for test. We remove this after test */
+#define USE_DIGITAL_ZOOM
+
+//! struct for Camera sensor information
+/*!
+ * \ingroup Exynos
+ */
+struct ExynosCameraInfo
+{
+public:
+    // Google Official API : Camera.Parameters
+    // http://developer.android.com/reference/android/hardware/Camera.Parameters.html
+    int  previewW;
+    int  previewH;
+    int  previewColorFormat;
+    int  videoW;
+    int  videoH;
+    int  videoColorFormat;
+    int  pictureW;
+    int  pictureH;
+    int  pictureColorFormat;
+    int  thumbnailW;
+    int  thumbnailH;
+
+    int  antiBandingList;
+    int  antiBanding;
+
+    int  effectList;
+    int  effect;
+
+    int  flashModeList;
+    int  flashMode;
+
+    int  focusModeList;
+    int  focusMode;
+
+    int  sceneModeList;
+    int  sceneMode;
+
+    int  whiteBalanceList;
+    int  whiteBalance;
+    bool autoWhiteBalanceLockSupported;
+    bool autoWhiteBalanceLock;
+
+    int  rotation;
+    int  minExposure;
+    int  maxExposure;
+    int  exposure;
+
+    bool autoExposureLockSupported;
+    bool autoExposureLock;
+
+    int  fps;
+    int  focalLengthNum;
+    int  focalLengthDen;
+    bool supportVideoStabilization;
+    bool applyVideoStabilization;
+    bool videoStabilization;
+    int  maxNumMeteringAreas;
+    int  maxNumDetectedFaces;
+    int  maxNumFocusAreas;
+    int  maxZoom;
+    bool hwZoomSupported;
+    int  zoom;
+
+    long gpsLatitude;
+    long gpsLongitude;
+    long gpsAltitude;
+    long gpsTimestamp;
+
+    // Additional API.
+    int  angle;
+    bool antiShake;
+    bool beautyShot;
+    int  brightness;
+    int  contrast;
+    bool gamma;
+    bool odc;
+    int  hue;
+    int  iso;
+    int  metering;
+    bool objectTracking;
+    bool objectTrackingStart;
+
+    int  saturation;
+    int  sharpness;
+    int  shotMode;
+    bool slowAE;
+    bool smartAuto;
+    bool touchAfStart;
+    bool wdr;
+    bool tdnr;
+
+public:
+    ExynosCameraInfo();
+};
+
+struct ExynosCameraInfoM5M0 : public ExynosCameraInfo
+{
+public:
+    ExynosCameraInfoM5M0();
+};
+
+struct ExynosCameraInfoS5K6A3 : public ExynosCameraInfo
+{
+public:
+    ExynosCameraInfoS5K6A3();
+};
+
+struct ExynosCameraInfoS5K4E5 : public ExynosCameraInfo
+{
+public:
+    ExynosCameraInfoS5K4E5();
+};
+
+struct ExynosCameraInfoS5K3H7 : public ExynosCameraInfo
+{
+public:
+    ExynosCameraInfoS5K3H7();
+};
+
+//! ExynosCamera
+/*!
+ * \ingroup Exynos
+ */
+class ExynosCamera : public virtual RefBase {
+
+///////////////////////////////////////////////////
+// Google Official API : Camera.Parameters
+// http://developer.android.com/reference/android/hardware/Camera.Parameters.html
+///////////////////////////////////////////////////
+public:
+    //! Camera ID
+    enum CAMERA_ID {
+        CAMERA_ID_BACK  = 0,   //!<
+        CAMERA_ID_FRONT = 1,   //!<
+    };
+
+    //! Anti banding
+    enum {
+        ANTIBANDING_AUTO = (1 << 0), //!< \n
+        ANTIBANDING_50HZ = (1 << 1), //!< \n
+        ANTIBANDING_60HZ = (1 << 2), //!< \n
+        ANTIBANDING_OFF  = (1 << 3), //!< \n
+    };
+
+    //! Effect
+    enum {
+        EFFECT_NONE       = (1 << 0), //!< \n
+        EFFECT_MONO       = (1 << 1), //!< \n
+        EFFECT_NEGATIVE   = (1 << 2), //!< \n
+        EFFECT_SOLARIZE   = (1 << 3), //!< \n
+        EFFECT_SEPIA      = (1 << 4), //!< \n
+        EFFECT_POSTERIZE  = (1 << 5), //!< \n
+        EFFECT_WHITEBOARD = (1 << 6), //!< \n
+        EFFECT_BLACKBOARD = (1 << 7), //!< \n
+        EFFECT_AQUA       = (1 << 8), //!< \n
+    };
+
+    //! Flash mode
+    enum {
+        FLASH_MODE_OFF     = (1 << 0), //!< \n
+        FLASH_MODE_AUTO    = (1 << 1), //!< \n
+        FLASH_MODE_ON      = (1 << 2), //!< \n
+        FLASH_MODE_RED_EYE = (1 << 3), //!< \n
+        FLASH_MODE_TORCH   = (1 << 4), //!< \n
+    };
+
+    //! Focus mode
+    enum {
+        FOCUS_MODE_AUTO               = (1 << 0), //!< \n
+        FOCUS_MODE_INFINITY           = (1 << 1), //!< \n
+        FOCUS_MODE_MACRO              = (1 << 2), //!< \n
+        FOCUS_MODE_FIXED              = (1 << 3), //!< \n
+        FOCUS_MODE_EDOF               = (1 << 4), //!< \n
+        FOCUS_MODE_CONTINUOUS_VIDEO   = (1 << 5), //!< \n
+        FOCUS_MODE_CONTINUOUS_PICTURE = (1 << 6), //!< \n
+        FOCUS_MODE_TOUCH              = (1 << 7), //!< \n
+    };
+
+    //! Scene mode
+    enum {
+        SCENE_MODE_AUTO           = (1 << 0), //!< \n
+        SCENE_MODE_ACTION         = (1 << 1), //!< \n
+        SCENE_MODE_PORTRAIT       = (1 << 2), //!< \n
+        SCENE_MODE_LANDSCAPE      = (1 << 3), //!< \n
+        SCENE_MODE_NIGHT          = (1 << 4), //!< \n
+        SCENE_MODE_NIGHT_PORTRAIT = (1 << 5), //!< \n
+        SCENE_MODE_THEATRE        = (1 << 6), //!< \n
+        SCENE_MODE_BEACH          = (1 << 7), //!< \n
+        SCENE_MODE_SNOW           = (1 << 8), //!< \n
+        SCENE_MODE_SUNSET         = (1 << 9), //!< \n
+        SCENE_MODE_STEADYPHOTO    = (1 << 10), //!< \n
+        SCENE_MODE_FIREWORKS      = (1 << 11), //!< \n
+        SCENE_MODE_SPORTS         = (1 << 12), //!< \n
+        SCENE_MODE_PARTY          = (1 << 13), //!< \n
+        SCENE_MODE_CANDLELIGHT    = (1 << 14), //!< \n
+    };
+
+    //! White balance
+    enum {
+        WHITE_BALANCE_AUTO             = (1 << 0), //!< \n
+        WHITE_BALANCE_INCANDESCENT     = (1 << 1), //!< \n
+        WHITE_BALANCE_FLUORESCENT      = (1 << 2), //!< \n
+        WHITE_BALANCE_WARM_FLUORESCENT = (1 << 3), //!< \n
+        WHITE_BALANCE_DAYLIGHT         = (1 << 4), //!< \n
+        WHITE_BALANCE_CLOUDY_DAYLIGHT  = (1 << 5), //!< \n
+        WHITE_BALANCE_TWILIGHT         = (1 << 6), //!< \n
+        WHITE_BALANCE_SHADE            = (1 << 7), //!< \n
+    };
+
+    //! Jpeg Qualtiy
+    enum JPEG_QUALITY {
+        JPEG_QUALITY_MIN        = 0,    //!<
+        JPEG_QUALITY_ECONOMY    = 70,   //!<
+        JPEG_QUALITY_NORMAL     = 80,   //!<
+        JPEG_QUALITY_SUPERFINE  = 90,   //!<
+        JPEG_QUALITY_MAX        = 100,  //!<
+    };
+
+private:
+    //! Constructor
+    ExynosCamera();
+    //! Destructor
+    virtual ~ExynosCamera();
+
+public:
+    //! Gets the Camera instance
+    static ExynosCamera* createInstance(void)
+    {
+        static ExynosCamera singleton;
+        return &singleton;
+    }
+
+    //! Create the instance
+    bool            create(int cameraId);
+    //! Destroy the instance
+    bool            destroy(void);
+    //! Check if the instance was created
+    bool            flagCreate(void);
+
+    //! Gets current camera_id
+    int             getCameraId(void);
+    //! Gets camera sensor name
+    char           *getCameraName(void);
+
+    //! Gets file descriptor by gotten open() for preview
+    int             getPreviewFd(void);
+    //! Gets file descriptor by gotten open() for recording
+    int             getVideoFd(void);
+    //! Gets file descriptor by gotten open() for snapshot
+    int             getPictureFd(void);
+
+    //! Starts capturing and drawing preview frames to the screen.
+    bool            startPreview(void);
+    //! Stop preview
+    bool            stopPreview(void);
+    //! Check preview start
+    bool            flagStartPreview(void);
+    //! Gets preview's max buffer
+    int             getPreviewMaxBuf(void);
+    //! Sets preview's buffer
+    bool            setPreviewBuf(ExynosBuffer *buf);
+    //! Gets preview's buffer
+    bool            getPreviewBuf(ExynosBuffer *buf);
+    //! Put(dq) preview's buffer
+    bool            putPreviewBuf(ExynosBuffer *buf);
+
+    //! Sets video's width, height
+    bool            setVideoSize(int w, int h);
+    //! Gets video's width, height
+    bool            getVideoSize(int *w, int *h);
+
+    //! Sets video's color format
+    bool            setVideoFormat(int colorFormat);
+    //! Gets video's color format
+    int             getVideoFormat(void);
+
+    //! Start video
+    bool            startVideo(void);
+    //! Stop video
+    bool            stopVideo(void);
+    //! Check video start
+    bool            flagStartVideo(void);
+    //! Gets video's buffer
+    int             getVideoMaxBuf(void);
+    //! Sets video's buffer
+    bool            setVideoBuf(ExynosBuffer *buf);
+    //! Gets video's buffer
+    bool            getVideoBuf(ExynosBuffer *buf);
+    //! Put(dq) video's buffer
+    bool            putVideoBuf(ExynosBuffer *buf);
+
+    //! Start snapshot
+    bool            startPicture(void);
+    //! Stop snapshot
+    bool            stopPicture(void);
+    //! Check snapshot start
+    bool            flagStartPicture(void);
+    //! Gets snapshot's buffer
+    int             getPictureMaxBuf(void);
+    //! Sets snapshot's buffer
+    bool            setPictureBuf(ExynosBuffer *buf);
+    //! Gets snapshot's buffer
+    bool            getPictureBuf(ExynosBuffer *buf);
+    //! Put(dq) snapshot's buffer
+    bool            putPictureBuf(ExynosBuffer *buf);
+
+    //! Encode JPEG from YUV
+    bool            yuv2Jpeg(ExynosBuffer *yuvBuf, ExynosBuffer *jpegBuf, ExynosRect *rect);
+
+    //! Starts camera auto-focus and registers a callback function to run when the camera is focused.
+    bool            autoFocus(void);
+    //! Cancel auto-focus operation
+    bool            cancelAutoFocus(void);
+    //! Gets auto-focus result whether success or not
+    int             getFucusModeResult(void);
+
+    //! Starts the face detection.
+    bool            startFaceDetection(void);
+    //! Stop face detection
+    bool            stopFaceDetection(void);
+    //! Gets the face detection started
+    bool            flagStartFaceDetection(void);
+    //! Lock or unlock face detection operation
+    bool            setFaceDetectLock(bool toggle);
+
+    //! Zooms to the requested value smoothly.
+    bool            startSmoothZoom(int value);
+    //! Stop the face detection.
+    bool            stopSmoothZoom(void);
+
+    //! Gets the current antibanding setting.
+    int             getAntibanding(void);
+
+    //! Gets the state of the auto-exposure lock.
+    bool            getAutoExposureLock(void);
+
+    //! Gets the state of the auto-white balance lock.
+    bool            getAutoWhiteBalanceLock(void);
+
+    //! Gets the current color effect setting.
+    int             getColorEffect(void);
+
+    //! Gets the detected faces areas.
+    int             getDetectedFacesAreas(int num, int *id, int *score, ExynosRect *face, ExynosRect *leftEye, ExynosRect *rightEye, ExynosRect *mouth);
+
+    //! Gets the detected faces areas. (Using ExynosRect2)
+    int             getDetectedFacesAreas(int num, int *id, int *score, ExynosRect2 *face, ExynosRect2 *leftEye, ExynosRect2 *rightEye, ExynosRect2 *mouth);
+
+    //! Gets the current exposure compensation index.
+    int             getExposureCompensation(void);
+
+    //! Gets the exposure compensation step.
+    float           getExposureCompensationStep(void);
+
+    //! Gets the current flash mode setting.
+    int             getFlashMode(void);
+
+    //! Gets the focal length (in millimeter) of the camera.
+    bool            getFocalLength(int *num, int *den);
+
+    //! Gets the current focus areas.
+    int             getFocusAreas(ExynosRect *rects);
+
+    //! Gets the distances from the camera to where an object appears to be in focus.
+    int             getFocusDistances(float *output);
+
+    //! Gets the current focus mode setting.
+    int             getFocusMode(void);
+
+    //! Gets the horizontal angle of view in degrees.
+    float           getHorizontalViewAngle(void);
+
+    //int             getInt(String key);
+
+    //! Returns the quality setting for the JPEG picture.
+    int             getJpegQuality(void);
+
+    //! Returns the quality setting for the EXIF thumbnail in Jpeg picture.
+    int             getJpegThumbnailQuality(void);
+
+    //! Returns the dimensions for EXIF thumbnail in Jpeg picture.
+    bool            getJpegThumbnailSize(int *w, int *h);
+
+    //! Gets the maximum exposure compensation index.
+    int             getMaxExposureCompensation(void);
+
+    //! Gets the maximum number of detected faces supported.
+    int             getMaxNumDetectedFaces(void);
+
+    //! Gets the maximum number of focus areas supported.
+    int             getMaxNumFocusAreas(void);
+
+    //! Gets the maximum number of metering areas supported.
+    int             getMaxNumMeteringAreas(void);
+
+    //! Gets the maximum zoom value allowed for snapshot.
+    int             getMaxZoom(void);
+
+    //! Gets the current metering areas.
+    int             getMeteringAreas(ExynosRect *rects);
+
+    //! Gets the minimum exposure compensation index.
+    int             getMinExposureCompensation(void);
+
+    //! Returns the image format for pictures.
+    int             getPictureFormat(void);
+
+    //! Returns the dimension setting for pictures.
+    bool            getPictureSize(int *w, int *h);
+
+    //Camera.Size     getPreferredPreviewSizeForVideo();
+
+    //! Returns the image format for preview frames got from Camera.PreviewCallback.
+    int             getPreviewFormat(void);
+
+    //! Returns the current minimum and maximum preview fps.
+    bool            getPreviewFpsRange(int *min, int *max);
+
+    //! This method is deprecated. replaced by getPreviewFpsRange(int[])
+    int             getPreviewFrameRate(void);
+
+    //! Returns the dimensions setting for preview pictures.
+    bool            getPreviewSize(int *w, int *h);
+
+    //! Gets scene mode
+    int             getSceneMode(void);
+
+    //! Gets the supported antibanding values.
+    int             getSupportedAntibanding(void);
+
+    //! Gets the supported color effects.
+    int             getSupportedColorEffects(void);
+
+    //! Check whether the target support Flash
+    int             getSupportedFlashModes(void);
+
+    //! Gets the supported focus modes.
+    int             getSupportedFocusModes(void);
+
+    //! Gets the supported jpeg thumbnail sizes.
+    bool            getSupportedJpegThumbnailSizes(int *w, int *h);
+
+    // List<Integer>  getSupportedPictureFormats()
+
+    //! Gets the supported picture sizes.
+    bool            getSupportedPictureSizes(int *w, int *h);
+
+    //List<Integer>   getSupportedPreviewFormats()
+
+    //List<int[]>     getSupportedPreviewFpsRange()
+
+    //List<Integer>   getSupportedPreviewFrameRates()
+
+    //! Gets the supported preview sizes.
+    bool            getSupportedPreviewSizes(int *w, int *h);
+
+    //! Gets the supported scene modes.
+    int             getSupportedSceneModes(void);
+
+    //! Gets the supported video frame sizes that can be used by MediaRecorder.
+    bool            getSupportedVideoSizes(int *w, int *h);
+
+    //! Gets the supported white balance.
+    int             getSupportedWhiteBalance(void);
+
+    //! Gets the vertical angle of view in degrees.
+    float           getVerticalViewAngle(void);
+
+    //! Gets the current state of video stabilization.
+    bool            getVideoStabilization(void);
+
+    //! Gets the current white balance setting.
+    int             getWhiteBalance(void);
+
+    //! Gets current zoom value.
+    int             getZoom(void);
+
+    //List<Integer>   getZoomRatios()
+    //! Gets max zoom ratio
+    int             getMaxZoomRatio(void);
+
+    //! Returns true if auto-exposure locking is supported.
+    bool            isAutoExposureLockSupported(void);
+
+    //! Returns true if auto-white balance locking is supported.
+    bool            isAutoWhiteBalanceLockSupported(void);
+
+    //! Returns true if smooth zoom is supported.
+    bool            isSmoothZoomSupported(void);
+
+    //! Returns true if video snapshot is supported.
+    bool            isVideoSnapshotSupported(void);
+
+    //! Returns true if video stabilization is supported.
+    bool            isVideoStabilizationSupported(void);
+
+    //! Returns true if zoom is supported.
+    bool            isZoomSupported(void);
+
+    //void            remove(String key)
+
+    //void            removeGpsData()
+
+    //void            set(String key, String value)
+
+    //void            set(String key, int value)
+
+    //! Sets the antibanding.
+    bool            setAntibanding(int value);
+
+    //! Sets the auto-exposure lock state.
+    bool            setAutoExposureLock(bool toggle);
+
+    //! Sets the auto-white balance lock state.
+    bool            setAutoWhiteBalanceLock(bool toggle);
+
+    //! Sets the current color effect setting.
+    bool            setColorEffect(int value);
+
+    //! Sets the exposure compensation index.
+    bool            setExposureCompensation(int value);
+
+    //! Sets the flash mode.
+    bool            setFlashMode(int value);
+
+    //! Sets focus z.
+    bool            setFocusAreas(int num, ExynosRect* rects, int *weights);
+
+    //! Sets focus areas. (Using ExynosRect2)
+    bool            setFocusAreas(int num, ExynosRect2* rect2s, int *weights);
+
+    //! Sets the focus mode.
+    bool            setFocusMode(int value);
+
+    //! Sets GPS altitude.
+    bool            setGpsAltitude(const char *gpsAltitude);
+
+    //! Sets GPS latitude coordinate.
+    bool            setGpsLatitude(const char *gpsLatitude);
+
+    //! Sets GPS longitude coordinate.
+    bool            setGpsLongitude(const char *gpsLongitude);
+
+    //! Sets GPS processing method.
+    bool            setGpsProcessingMethod(const char *gpsProcessingMethod);
+
+    //! Sets GPS timestamp.
+    bool            setGpsTimeStamp(const char *gpsTimestamp);
+
+    //! Sets Jpeg quality of captured picture.
+    bool            setJpegQuality(int quality);
+
+    //! Sets the quality of the EXIF thumbnail in Jpeg picture.
+    bool            setJpegThumbnailQuality(int quality);
+
+    //! Sets the dimensions for EXIF thumbnail in Jpeg picture.
+    bool            setJpegThumbnailSize(int w, int h);
+
+    //! Sets metering areas.
+    bool            setMeteringAreas(int num, ExynosRect  *rects, int *weights);
+
+    //! Sets metering areas.(Using ExynosRect2)
+    bool            setMeteringAreas(int num, ExynosRect2 *rect2s, int *weights);
+
+    //! Cancel metering areas.
+    bool            cancelMeteringAreas();
+
+    //! Sets the image format for pictures.
+    bool            setPictureFormat(int colorFormat);
+
+    //! Sets the dimensions for pictures.
+    bool            setPictureSize(int w, int h);
+
+    //! Sets the image format for preview pictures.
+    bool            setPreviewFormat(int colorFormat);
+
+    //void            setPreviewFpsRange(int min, int max)
+
+    // ! This method is deprecated. replaced by setPreviewFpsRange(int, int)
+    bool            setPreviewFrameRate(int fps);
+
+    //! Sets the dimensions for preview pictures.
+    bool            setPreviewSize(int w, int h);
+
+    //! Sets recording mode hint.
+    bool            setRecordingHint(bool hint);
+
+    //! Sets the rotation angle in degrees relative to the orientation of the camera.
+    bool            setRotation(int rotation);
+
+    //! Gets the rotation angle in degrees relative to the orientation of the camera.
+    int             getRotation(void);
+
+    //! Sets the scene mode.
+    bool            setSceneMode(int value);
+
+    //! Enables and disables video stabilization.
+    bool            setVideoStabilization(bool toggle);
+
+    //! Sets the white balance.
+    bool            setWhiteBalance(int value);
+
+    //! Sets current zoom value.
+    bool            setZoom(int value);
+
+    //void            unflatten(String flattened)
+
+private:
+    enum MODE
+    {
+        PREVIEW_MODE  = 0,
+        VIDEO_MODE,
+        PICTURE_MODE,
+    };
+
+    struct devInfo {
+        int    fd;
+        pollfd events;
+        bool   flagStart;
+    };
+
+    bool            m_flagCreate;
+
+    int             m_cameraId;
+
+    ExynosCameraInfo  *m_defaultCameraInfo;
+    ExynosCameraInfo  *m_curCameraInfo;
+
+    int             m_jpegQuality;
+    int             m_jpegThumbnailQuality;
+
+    int             m_currentZoom;
+    bool            m_recordingHint;
+
+    // v4l2 sub-dev file description
+    devInfo         m_sensorDev;
+    devInfo         m_mipiDev;
+    devInfo         m_fliteDev;
+    devInfo         m_gscPreviewDev;
+    devInfo         m_gscVideoDev;
+    devInfo         m_gscPictureDev;
+
+#ifdef USE_DIGITAL_ZOOM
+    devInfo         m_gscBayerDev;
+    devInfo        *m_bayerDev;
+#endif
+
+    devInfo        *m_previewDev;
+    devInfo        *m_videoDev;
+    devInfo        *m_pictureDev;
+
+    bool            m_tryPreviewStop;
+    bool            m_tryVideoStop;
+    bool            m_tryPictureStop;
+
+    bool            m_flagStartFaceDetection;
+    bool            m_flagAutoFocusRunning;
+
+    char            m_cameraName[32];
+    bool            m_internalISP;
+    bool            m_touchAFMode;
+    bool            m_isTouchMetering;
+
+    bool            m_focusIdle;
+
+    // media controller variable
+    struct media_device *m_media;
+    struct media_entity *m_sensorEntity;
+    struct media_entity *m_mipiEntity;
+    struct media_entity *m_fliteSdEntity;
+    struct media_entity *m_fliteVdEntity;
+    struct media_entity *m_gscSdEntity;
+    struct media_entity *m_gscVdEntity;
+    struct media_entity *m_ispSensorEntity;
+    struct media_entity *m_ispFrontEntity;
+    struct media_entity *m_ispBackEntity;
+    struct media_entity *m_ispBayerEntity;
+    struct media_entity *m_ispScalercEntity;
+    struct media_entity *m_ispScalerpEntity;
+    struct media_entity *m_isp3dnrEntity;
+
+    bool   m_validPreviewBuf[VIDEO_MAX_FRAME];
+    bool   m_validVideoBuf[VIDEO_MAX_FRAME];
+    bool   m_validPictureBuf[VIDEO_MAX_FRAME];
+
+    struct ExynosBuffer m_previewBuf[VIDEO_MAX_FRAME];
+    struct ExynosBuffer m_videoBuf[VIDEO_MAX_FRAME];
+    struct ExynosBuffer m_pictureBuf[VIDEO_MAX_FRAME];
+
+    exif_attribute_t mExifInfo;
+
+private:
+    bool            m_setWidthHeight(int mode,
+                                     int fd,
+                                     struct pollfd *event,
+                                     int w,
+                                     int h,
+                                     int colorFormat,
+                                     struct ExynosBuffer *buf,
+                                     bool *validBuf);
+    bool            m_setZoom(int fd, int zoom, int w, int h);
+    bool            m_setCrop(int fd, int w, int h, int zoom);
+    bool            m_getCropRect(unsigned int  src_w,  unsigned int   src_h,
+                              unsigned int  dst_w,  unsigned int   dst_h,
+                              unsigned int *crop_x, unsigned int *crop_y,
+                              unsigned int *crop_w, unsigned int *crop_h,
+                              int           zoom);
+
+    void            m_setExifFixedAttribute(void);
+    void            m_setExifChangedAttribute(exif_attribute_t *exifInfo, ExynosRect *rect);
+    void            m_secRect2SecRect2(ExynosRect *rect, ExynosRect2 *rect2);
+    void            m_secRect22SecRect(ExynosRect2 *rect2, ExynosRect *rect);
+    void            m_printFormat(int colorFormat, const char *arg);
+
+///////////////////////////////////////////////////
+// Additional API.
+///////////////////////////////////////////////////
+public:
+    //! Focus mode
+    enum {
+        FOCUS_MODE_CONTINUOUS_PICTURE_MACRO = (1 << 8), //!< \n
+    };
+
+    //! Metering
+    enum {
+        METERING_MODE_AVERAGE = (1 << 0), //!< \n
+        METERING_MODE_CENTER  = (1 << 1), //!< \n
+        METERING_MODE_MATRIX  = (1 << 2), //!< \n
+        METERING_MODE_SPOT    = (1 << 3), //!< \n
+    };
+
+    //! Contrast
+    enum {
+        CONTRAST_AUTO    = (1 << 0), //!< \n
+        CONTRAST_MINUS_2 = (1 << 1), //!< \n
+        CONTRAST_MINUS_1 = (1 << 2), //!< \n
+        CONTRAST_DEFAULT = (1 << 3), //!< \n
+        CONTRAST_PLUS_1  = (1 << 4), //!< \n
+        CONTRAST_PLUS_2  = (1 << 5), //!< \n
+    };
+    //! Camera Shot mode
+    enum SHOT_MODE {
+        SHOT_MODE_SINGLE        = 0, //!<
+        SHOT_MODE_CONTINUOUS    = 1, //!<
+        SHOT_MODE_PANORAMA      = 2, //!<
+        SHOT_MODE_SMILE         = 3, //!<
+        SHOT_MODE_SELF          = 6, //!<
+    };
+
+    //! Sets camera angle
+    bool            setAngle(int angle);
+
+    //! Gets camera angle
+    int             getAngle(void);
+
+    //! Sets metering areas.
+    bool            setMeteringMode(int value);
+    //! Gets metering
+    int             getMeteringMode(void);
+
+    //! Sets Top-down mirror
+    bool            setTopDownMirror(void);
+    //! Sets Left-right mirror
+    bool            setLRMirror(void);
+
+    //! Sets brightness
+    bool            setBrightness(int brightness);
+    //! Gets brightness
+    int             getBrightness(void);
+
+    //! Sets ISO
+    bool            setISO(int iso);
+    //! Gets ISO
+    int             getISO(void);
+
+    //! Sets Contrast
+    bool            setContrast(int value);
+    //! Gets Contrast
+    int             getContrast(void);
+
+    //! Sets Saturation
+    bool            setSaturation(int saturation);
+    //! Gets Saturation
+    int             getSaturation(void);
+
+    //! Sets Sharpness
+    bool            setSharpness(int sharpness);
+    //! Gets Sharpness
+    int             getSharpness(void);
+
+    // ! Sets Hue
+    bool            setHue(int hue);
+    // ! Gets Hue
+    int             getHue(void);
+
+    //! Sets WDR
+    bool            setWDR(bool toggle);
+    //! Gets WDR
+    bool            getWDR(void);
+
+    //! Sets anti shake
+    bool            setAntiShake(bool toggle);
+    //! Gets anti shake
+    bool            getAntiShake(void);
+
+    //! Sets object tracking
+    bool            setObjectTracking(bool toggle);
+    //! Gets object tracking
+    bool            getObjectTracking(void);
+    //! Start or stop object tracking operation
+    bool            setObjectTrackingStart(bool toggle);
+    //! Gets status of object tracking operation
+    int             getObjectTrackingStatus(void);
+    //! Sets x, y position for object tracking operation
+    bool            setObjectPosition(int x, int y);
+
+    //! Sets smart auto
+    bool            setSmartAuto(bool toggle);
+    //! Gets smart auto
+    bool            getSmartAuto(void);
+    //! Gets the status of smart auto operation
+    int             getSmartAutoStatus(void);
+
+    //! Sets beauty shot
+    bool            setBeautyShot(bool toggle);
+    //! Gets beauty shot
+    bool            getBeautyShot(void);
+
+    //! Start or stop the touch auto focus operation
+    bool            setTouchAFStart(bool toggle);
+
+    //! Sets gamma
+    bool            setGamma(bool toggle);
+    //! Gets gamma
+    bool            getGamma(void);
+
+    //! Sets ODC
+    bool            setODC(bool toggle);
+    //! Gets ODC
+    bool            getODC(void);
+
+    //! Sets Slow AE
+    bool            setSlowAE(bool toggle);
+    //! Gets Slow AE
+    bool            getSlowAE(void);
+
+    //! Sets Shot mode
+    bool            setShotMode(int shotMode);
+    //! Gets Shot mode
+    int             getShotMode(void);
+
+    //! Sets 3DNR
+    bool            set3DNR(bool toggle);
+    //! Gets 3DNR
+    bool            get3DNR(void);
+};
+
+}; // namespace android
+
+#endif // EXYNOS_CAMERA_H__
diff --git a/include/ExynosRect.h b/include/ExynosRect.h
new file mode 100644 (file)
index 0000000..177d96e
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/*!
+ * \file      ExynosRect.h
+ * \brief     header file for ExynosRect
+ * \author    Sangwoo, Park(sw5771.park@samsung.com)
+ * \date      2011/06/02
+ *
+ * <b>Revision History: </b>
+ * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) \n
+ *   Initial version
+ *
+ * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n
+ *   Change file, struct name to ExynosXXX.
+ *
+ */
+
+#ifndef EXYNOS_RECT_H_
+#define EXYNOS_RECT_H_
+
+//! Rectangle information
+/*!
+ * \ingroup Exynos
+ */
+struct ExynosRect
+{
+    int x;           //!< x pos
+    int y;           //!< y pos
+    int w;           //!< width
+    int h;           //!< height
+    int fullW;       //!< full width of image
+    int fullH;       //!< full height of image
+    int colorFormat; //!< V4L2_PIX_FMT_XXX
+
+#ifdef __cplusplus
+    //! Constructor
+    ExynosRect(int _x_ = 0,
+            int _y_ = 0,
+            int _w_ = 0,
+            int _h_ = 0,
+            int _fullW_ = 0,
+            int _fullH_ = 0,
+            int _colorFormat_ = 0)
+    {
+        x = _x_;
+        y = _y_;
+        w = _w_;
+        h = _h_;
+        fullW = _fullW_;
+        fullH = _fullH_;
+        colorFormat = _colorFormat_;
+    }
+
+    //! Constructor
+    ExynosRect(const ExynosRect *other)
+    {
+        x           = other->x;
+        y           = other->y;
+        w           = other->w;
+        h           = other->h;
+        fullW       = other->fullW;
+        fullH       = other->fullH;
+        colorFormat = other->colorFormat;
+    }
+
+    //! Operator(=) override
+    ExynosRect& operator =(const ExynosRect &other)
+    {
+        x           = other.x;
+        y           = other.y;
+        w           = other.w;
+        h           = other.h;
+        fullW       = other.fullW;
+        fullH       = other.fullH;
+        colorFormat = other.colorFormat;
+        return *this;
+    }
+
+    //! Operator(==) override
+    bool operator ==(const ExynosRect &other) const
+    {
+        return (   x           == other.x
+                && y           == other.y
+                && w           == other.w
+                && h           == other.h
+                && fullW       == other.fullW
+                && fullH       == other.fullH
+                && colorFormat == other.colorFormat);
+    }
+
+    //! Operator(!=) override
+    bool operator !=(const ExynosRect &other) const
+    {
+        // use operator(==)
+        return !(*this == other);
+    }
+#endif
+};
+
+//! Clip information
+/*!
+ * \ingroup Exynos
+ */
+struct ExynosRect2
+{
+    int x1; //!< Left   (The x-coordinate value of upper-left corner)
+    int y1; //!< Top    (The y-coordinate value of upper-left corner)
+    int x2; //!< Right  (The x-coordinate value of lower-right corner)
+    int y2; //!< Bottom (The y-coordinate value of lower-right corner)
+
+#ifdef __cplusplus
+    //! Constructor
+    ExynosRect2(int _x1_ = 0, int _y1_ = 0, int _x2_ = 0, int _y2_ = 0)
+    {
+        x1 = _x1_;
+        y1 = _y1_;
+        x2 = _x2_;
+        y2 = _y2_;
+    }
+
+    //! Constructor
+    ExynosRect2(const ExynosRect2 *other)
+    {
+        x1 = other->x1;
+        y1 = other->y1;
+        x2 = other->x2;
+        y2 = other->y2;
+    }
+
+    //! Operator(=) override
+    ExynosRect2& operator =(const ExynosRect2 &other)
+    {
+        x1 = other.x1;
+        y1 = other.y1;
+        x2 = other.x2;
+        y2 = other.y2;
+        return *this;
+    }
+
+    //! Operator(==) override
+    bool operator ==(const ExynosRect2 &other) const
+    {
+        return (   x1 == other.x1
+                && y1 == other.y1
+                && x2 == other.x2
+                && y2 == other.y2);
+    }
+
+    //! Operator(!=) override
+    bool operator !=(const ExynosRect2 &other) const
+    {
+        // use operator(==)
+        return !(*this == other);
+    }
+#endif
+};
+
+#endif //EXYNOS_RECT_H_
diff --git a/include/content_protect.h b/include/content_protect.h
new file mode 100644 (file)
index 0000000..9266123
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co., LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CONTENT_PROTECT_H__
+#define __CONTENT_PROTECT_H__
+
+__BEGIN_DECLS
+
+typedef enum {
+       CP_SUCCESS = 0,
+       CP_ERROR_ENABLE_PATH_PROTECTION_FAILED,
+       CP_ERROR_DISABLE_PATH_PROTECTION_FAILED,
+} cpResult_t;
+
+
+/**
+ * protection IP
+ */
+#define CP_PROTECT_MFC         (1 << 0)
+#define CP_PROTECT_GSC0                (1 << 1)
+#define CP_PROTECT_GSC3                (1 << 2)
+#define CP_PROTECT_FIMD                (1 << 3)
+#define CP_PROTECT_MIXER       (1 << 4)
+
+#define CP_PROTECT_MFC1                (1 << 5)
+#define CP_PROTECT_GSC1                (1 << 6)
+#define CP_PROTECT_GSC2                (1 << 7)
+#define CP_PROTECT_HDMI                (1 << 8)
+
+
+cpResult_t CP_Enable_Path_Protection(uint32_t);
+cpResult_t CP_Disable_Path_Protection(uint32_t);
+
+__END_DECLS
+
+#endif
diff --git a/include/exynos_mem.h b/include/exynos_mem.h
new file mode 100644 (file)
index 0000000..a65f030
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __INCLUDE_EXYNOS_MEM_H
+#define __INCLUDE_EXYNOS_MEM_H __FILE__
+
+/* IOCTL commands */
+#define EXYNOS_MEM_SET_CACHEABLE       _IOW('M', 200, bool)
+#define EXYNOS_MEM_PADDR_CACHE_FLUSH   _IOW('M', 201, struct exynos_mem_flush_range)
+
+struct exynos_mem_flush_range {
+       dma_addr_t      start;
+       size_t          length;
+};
+
+#endif /* __INCLUDE_EXYNOS_MEM_H */
diff --git a/include/s3c_lcd.h b/include/s3c_lcd.h
new file mode 100644 (file)
index 0000000..cd313e9
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _S3CFB_LCD_
+#define _S3CFB_LCD_
+
+/*
+ * S T R U C T U R E S  F O R  C U S T O M  I O C T L S
+ *
+*/
+struct s3cfb_user_window {
+    int x;
+    int y;
+};
+
+struct s3cfb_user_plane_alpha {
+    int             channel;
+    unsigned char   red;
+    unsigned char   green;
+    unsigned char   blue;
+};
+
+struct s3cfb_user_chroma {
+    int             enabled;
+    unsigned char   red;
+    unsigned char   green;
+    unsigned char   blue;
+};
+
+typedef struct {
+    unsigned int phy_start_addr;
+    unsigned int xres;      /* visible resolution*/
+    unsigned int yres;
+    unsigned int xres_virtual;  /* virtual resolution*/
+    unsigned int yres_virtual;
+    unsigned int xoffset;   /* offset from virtual to visible */
+    unsigned int yoffset;   /* resolution   */
+    unsigned int lcd_offset_x;
+    unsigned int lcd_offset_y;
+} s3c_fb_next_info_t;
+
+struct s3c_fb_user_ion_client {
+    int fd;
+    int offset;
+};
+
+/*
+ * C U S T O M  I O C T L S
+ *
+*/
+
+#define S3CFB_WIN_POSITION          _IOW ('F', 203, struct s3cfb_user_window)
+#define S3CFB_WIN_SET_PLANE_ALPHA   _IOW ('F', 204, struct s3cfb_user_plane_alpha)
+#define S3CFB_WIN_SET_CHROMA        _IOW ('F', 205, struct s3cfb_user_chroma)
+#define S3CFB_SET_VSYNC_INT         _IOW ('F', 206, unsigned int)
+#define S3CFB_SET_SUSPEND_FIFO      _IOW ('F', 300, unsigned long)
+#define S3CFB_SET_RESUME_FIFO       _IOW ('F', 301, unsigned long)
+#define S3CFB_GET_LCD_WIDTH         _IOR ('F', 302, int)
+#define S3CFB_GET_LCD_HEIGHT        _IOR ('F', 303, int)
+#define S3CFB_GET_FB_PHY_ADDR       _IOR ('F', 310, unsigned int)
+#define S3C_FB_GET_CURR_FB_INFO     _IOR ('F', 305, s3c_fb_next_info_t)
+#define S3CFB_GET_ION_USER_HANDLE   _IOWR('F', 208, struct s3c_fb_user_ion_client)
+
+/***************** LCD frame buffer *****************/
+#define FB0_NAME    "/dev/fb0"
+#define FB1_NAME    "/dev/fb1"
+#define FB2_NAME    "/dev/fb2"
+#define FB3_NAME    "/dev/fb3"
+#define FB4_NAME    "/dev/fb4"
+
+#endif
diff --git a/include/sec_g2d.h b/include/sec_g2d.h
new file mode 100644 (file)
index 0000000..772cbf8
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _SEC_G2D_DRIVER_H_
+#define _SEC_G2D_DRIVER_H_
+typedef unsigned char  u8;
+typedef unsigned short u16;
+typedef unsigned long  u32;
+
+#define SEC_G2D_DEV_NAME        "/dev/fimg2d"
+
+#define G2D_IOCTL_MAGIC 'G'
+
+#define G2D_BLIT                    _IO(G2D_IOCTL_MAGIC,0)
+#define G2D_GET_VERSION             _IO(G2D_IOCTL_MAGIC,1)
+#define G2D_GET_MEMORY              _IOR(G2D_IOCTL_MAGIC,2, unsigned int)
+#define G2D_GET_MEMORY_SIZE         _IOR(G2D_IOCTL_MAGIC,3, unsigned int)
+#define G2D_DMA_CACHE_CLEAN         _IOWR(G2D_IOCTL_MAGIC,4, struct g2d_dma_info)
+#define G2D_DMA_CACHE_FLUSH         _IOWR(G2D_IOCTL_MAGIC,5, struct g2d_dma_info)
+#define G2D_SYNC                    _IO(G2D_IOCTL_MAGIC,6)
+#define G2D_RESET                   _IO(G2D_IOCTL_MAGIC,7)
+
+#define G2D_MAX_WIDTH   (2048)
+#define G2D_MAX_HEIGHT  (2048)
+
+#define G2D_ALPHA_VALUE_MAX (255)
+
+#define G2D_POLLING (1<<0)
+#define G2D_INTERRUPT (0<<0)
+#define G2D_CACHE_OP (1<<1)
+#define G2D_NONE_INVALIDATE (0<<1)
+#define G2D_HYBRID_MODE (1<<2)
+
+typedef enum {
+    G2D_ROT_0 = 0,
+    G2D_ROT_90,
+    G2D_ROT_180,
+    G2D_ROT_270,
+    G2D_ROT_X_FLIP,
+    G2D_ROT_Y_FLIP
+} G2D_ROT_DEG;
+
+typedef enum {
+    G2D_ALPHA_BLENDING_MIN    = 0,   // wholly transparent
+    G2D_ALPHA_BLENDING_MAX    = 255, // 255
+    G2D_ALPHA_BLENDING_OPAQUE = 256, // opaque
+} G2D_ALPHA_BLENDING_MODE;
+
+typedef enum {
+    G2D_COLORKEY_NONE = 0,
+    G2D_COLORKEY_SRC_ON,
+    G2D_COLORKEY_DST_ON,
+    G2D_COLORKEY_SRC_DST_ON,
+} G2D_COLORKEY_MODE;
+
+typedef enum {
+    G2D_BLUE_SCREEN_NONE = 0,
+    G2D_BLUE_SCREEN_TRANSPARENT,
+    G2D_BLUE_SCREEN_WITH_COLOR,
+} G2D_BLUE_SCREEN_MODE;
+
+typedef enum {
+    G2D_ROP_SRC = 0,
+    G2D_ROP_DST,
+    G2D_ROP_SRC_AND_DST,
+    G2D_ROP_SRC_OR_DST,
+    G2D_ROP_3RD_OPRND,
+    G2D_ROP_SRC_AND_3RD_OPRND,
+    G2D_ROP_SRC_OR_3RD_OPRND,
+    G2D_ROP_SRC_XOR_3RD_OPRND,
+    G2D_ROP_DST_OR_3RD,
+} G2D_ROP_TYPE;
+
+typedef enum {
+    G2D_THIRD_OP_NONE = 0,
+    G2D_THIRD_OP_PATTERN,
+    G2D_THIRD_OP_FG,
+    G2D_THIRD_OP_BG
+} G2D_THIRD_OP_MODE;
+
+typedef enum {
+    G2D_BLACK = 0,
+    G2D_RED,
+    G2D_GREEN,
+    G2D_BLUE,
+    G2D_WHITE,
+    G2D_YELLOW,
+    G2D_CYAN,
+    G2D_MAGENTA
+} G2D_COLOR;
+
+typedef enum {
+    G2D_RGB_565 = ((0<<4)|2),
+
+    G2D_ABGR_8888 = ((2<<4)|1),
+    G2D_BGRA_8888 = ((3<<4)|1),
+    G2D_ARGB_8888 = ((0<<4)|1),
+    G2D_RGBA_8888 = ((1<<4)|1),
+
+    G2D_XBGR_8888 = ((2<<4)|0),
+    G2D_BGRX_8888 = ((3<<4)|0),
+    G2D_XRGB_8888 = ((0<<4)|0),
+    G2D_RGBX_8888 = ((1<<4)|0),
+
+    G2D_ABGR_1555 = ((2<<4)|4),
+    G2D_BGRA_5551 = ((3<<4)|4),
+    G2D_ARGB_1555 = ((0<<4)|4),
+    G2D_RGBA_5551 = ((1<<4)|4),
+
+    G2D_XBGR_1555 = ((2<<4)|3),
+    G2D_BGRX_5551 = ((3<<4)|3),
+    G2D_XRGB_1555 = ((0<<4)|3),
+    G2D_RGBX_5551 = ((1<<4)|3),
+
+    G2D_ABGR_4444 = ((2<<4)|6),
+    G2D_BGRA_4444 = ((3<<4)|6),
+    G2D_ARGB_4444 = ((0<<4)|6),
+    G2D_RGBA_4444 = ((1<<4)|6),
+
+    G2D_XBGR_4444 = ((2<<4)|5),
+    G2D_BGRX_4444 = ((3<<4)|5),
+    G2D_XRGB_4444 = ((0<<4)|5),
+    G2D_RGBX_4444 = ((1<<4)|5),
+
+    G2D_PACKED_BGR_888 = ((2<<4)|7),
+    G2D_PACKED_RGB_888 = ((0<<4)|7),
+
+    G2D_MAX_COLOR_SPACE
+} G2D_COLOR_SPACE;
+
+typedef enum {
+    G2D_Clear_Mode,    //!< [0, 0]
+    G2D_Src_Mode,      //!< [Sa, Sc]
+    G2D_Dst_Mode,      //!< [Da, Dc]
+    G2D_SrcOver_Mode,  //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
+    G2D_DstOver_Mode,  //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
+    G2D_SrcIn_Mode,    //!< [Sa * Da, Sc * Da]
+    G2D_DstIn_Mode,    //!< [Sa * Da, Sa * Dc]
+    G2D_SrcOut_Mode,   //!< [Sa * (1 - Da), Sc * (1 - Da)]
+    G2D_DstOut_Mode,   //!< [Da * (1 - Sa), Dc * (1 - Sa)]
+    G2D_SrcATop_Mode,  //!< [Da, Sc * Da + (1 - Sa) * Dc]
+    G2D_DstATop_Mode,  //!< [Sa, Sa * Dc + Sc * (1 - Da)]
+    G2D_Xor_Mode,      //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
+
+    // these modes are defined in the SVG Compositing standard
+    // http://www.w3.org/TR/2009/WD-SVGCompositing-20090430/
+    G2D_Plus_Mode,
+    G2D_Multiply_Mode,
+    G2D_Screen_Mode,
+    G2D_Overlay_Mode,
+    G2D_Darken_Mode,
+    G2D_Lighten_Mode,
+    G2D_ColorDodge_Mode,
+    G2D_ColorBurn_Mode,
+    G2D_HardLight_Mode,
+    G2D_SoftLight_Mode,
+    G2D_Difference_Mode,
+    G2D_Exclusion_Mode,
+
+    kLastMode = G2D_Exclusion_Mode
+} G2D_PORTTERDUFF_MODE;
+
+typedef enum {
+       G2D_MEMORY_KERNEL,
+       G2D_MEMORY_USER
+} G2D_MEMORY_TYPE;
+
+typedef struct {
+    int    x;
+    int    y;
+    unsigned int    w;
+    unsigned int    h;
+    unsigned int    full_w;
+    unsigned int    full_h;
+    int             color_format;
+    unsigned int    bytes_per_pixel;
+    unsigned char * addr;
+} g2d_rect;
+
+typedef struct {
+    unsigned int    rotate_val;
+    unsigned int    alpha_val;
+
+    unsigned int    blue_screen_mode;     //true : enable, false : disable
+    unsigned int    color_key_val;        //screen color value
+    unsigned int    color_switch_val;     //one color
+
+    unsigned int    src_color;            // when set one color on SRC
+
+    unsigned int    third_op_mode;
+    unsigned int    rop_mode;
+    unsigned int    mask_mode;
+    unsigned int    render_mode;
+    unsigned int    potterduff_mode;
+        unsigned int    memory_type;
+} g2d_flag;
+
+typedef struct {
+    unsigned int    t;
+    unsigned int    b;
+    unsigned int    l;
+    unsigned int    r;
+} g2d_clip;
+
+typedef struct {
+    g2d_rect src_rect;
+    g2d_rect dst_rect;
+    g2d_clip clip;
+    g2d_flag flag;
+} g2d_params;
+
+struct g2d_dma_info {
+    unsigned long addr;
+    unsigned int  size;
+};
+
+typedef struct _sec_g2d_t {
+    int dev_fd;
+    g2d_params  params;
+}sec_g2d_t;
+
+typedef struct __s5p_rect {
+    uint32_t x;
+    uint32_t y;
+    uint32_t w;
+    uint32_t h;
+} __s5p_rect;
+
+typedef struct __s5p_img {
+    uint32_t width;
+    uint32_t height;
+    uint32_t format;
+    uint32_t offset;
+    uint32_t base;
+    int memory_id;
+} __s5p_img;
+
+#endif /*_SEC_G2D_DRIVER_H_*/
diff --git a/include/sec_g2ddrm.h b/include/sec_g2ddrm.h
new file mode 100644 (file)
index 0000000..77da716
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co., LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SEC_G2DDRM_H__
+#define __SEC_G2DDRM_H__
+
+__BEGIN_DECLS
+
+typedef enum {
+       G2DDRM_SUCCESS = 0,
+       G2DDRM_ERROR_INIT_FAILED,
+       G2DDRM_ERROR_EXIT_FAILED,
+       G2DDRM_ERROR_TCI_WSM_FAILED,
+       G2DDRM_ERROR_TCI_MAP_FAILED,
+       G2DDRM_ERROR_BLIT_FAILED,
+} g2ddrmResult_t;
+
+g2ddrmResult_t G2DDRM_Initialize(void);
+g2ddrmResult_t G2DDRM_Blit(struct fimg2d_blit_raw *cmd);
+g2ddrmResult_t G2DDRM_Terminate(void);
+
+__END_DECLS
+
+#endif
diff --git a/include/videodev2_exynos_camera.h b/include/videodev2_exynos_camera.h
new file mode 100644 (file)
index 0000000..9860a93
--- /dev/null
@@ -0,0 +1,1225 @@
+/*
+ * Video for Linux Two header file for samsung
+ *
+ * Copyright (C) 2009, Dongsoo Nathaniel Kim<dongsoo45.kim@samsung.com>
+ *
+ * This header file contains several v4l2 APIs to be proposed to v4l2
+ * community and until bein accepted, will be used restrictly in Samsung's
+ * camera interface driver FIMC.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+/*
+ * Copyright 2008, The Android Open Source Project
+ * Copyright 2010, Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed toggle an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LINUX_VIDEODEV2_EXYNOS_CAMERA_H
+#define __LINUX_VIDEODEV2_EXYNOS_CAMERA_H
+
+/* Values for 'capabilities' field */
+/* Object detection device */
+#define V4L2_CAP_OBJ_RECOGNITION       0x10000000
+/* strobe control */
+#define V4L2_CAP_STROBE                        0x20000000
+
+#define V4L2_CID_FOCUS_MODE            (V4L2_CID_CAMERA_CLASS_BASE+17)
+/* Focus Methods */
+enum v4l2_focus_mode {
+       V4L2_FOCUS_MODE_AUTO            = 0,
+       V4L2_FOCUS_MODE_MACRO           = 1,
+       V4L2_FOCUS_MODE_MANUAL          = 2,
+       V4L2_FOCUS_MODE_LASTP           = 2,
+};
+
+#define V4L2_CID_ZOOM_MODE             (V4L2_CID_CAMERA_CLASS_BASE+18)
+/* Zoom Methods */
+enum v4l2_zoom_mode {
+       V4L2_ZOOM_MODE_CONTINUOUS       = 0,
+       V4L2_ZOOM_MODE_OPTICAL          = 1,
+       V4L2_ZOOM_MODE_DIGITAL          = 2,
+       V4L2_ZOOM_MODE_LASTP            = 2,
+};
+
+/* Exposure Methods */
+#define V4L2_CID_PHOTOMETRY            (V4L2_CID_CAMERA_CLASS_BASE+19)
+enum v4l2_photometry_mode {
+       V4L2_PHOTOMETRY_MULTISEG        = 0, /*Multi Segment*/
+       V4L2_PHOTOMETRY_CWA             = 1, /*Centre Weighted Average*/
+       V4L2_PHOTOMETRY_SPOT            = 2,
+       V4L2_PHOTOMETRY_AFSPOT          = 3, /*Spot metering on focused point*/
+       V4L2_PHOTOMETRY_LASTP           = V4L2_PHOTOMETRY_AFSPOT,
+};
+
+/* Manual exposure control items menu type: iris, shutter, iso */
+#define V4L2_CID_CAM_APERTURE  (V4L2_CID_CAMERA_CLASS_BASE+20)
+#define V4L2_CID_CAM_SHUTTER   (V4L2_CID_CAMERA_CLASS_BASE+21)
+#define V4L2_CID_CAM_ISO       (V4L2_CID_CAMERA_CLASS_BASE+22)
+
+/* Following CIDs are menu type */
+#define V4L2_CID_SCENEMODE     (V4L2_CID_CAMERA_CLASS_BASE+23)
+#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE+24)
+#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE+25)
+
+/* Control dynamic range */
+#define V4L2_CID_CAM_DR                (V4L2_CID_CAMERA_CLASS_BASE+26)
+
+/* White balance preset control */
+#define V4L2_CID_WHITE_BALANCE_PRESET  (V4L2_CID_CAMERA_CLASS_BASE+27)
+#define V4L2_CID_CAM_SENSOR_FW_VER             (V4L2_CID_CAMERA_CLASS_BASE + 28)
+#define V4L2_CID_CAM_PHONE_FW_VER              (V4L2_CID_CAMERA_CLASS_BASE + 29)
+
+/* CID extensions */
+#define V4L2_CID_ROTATION              (V4L2_CID_PRIVATE_BASE + 0)
+#define V4L2_CID_PADDR_Y               (V4L2_CID_PRIVATE_BASE + 1)
+#define V4L2_CID_PADDR_CB              (V4L2_CID_PRIVATE_BASE + 2)
+#define V4L2_CID_PADDR_CR              (V4L2_CID_PRIVATE_BASE + 3)
+#define V4L2_CID_PADDR_CBCR            (V4L2_CID_PRIVATE_BASE + 4)
+#define V4L2_CID_OVERLAY_AUTO          (V4L2_CID_PRIVATE_BASE + 5)
+#define V4L2_CID_OVERLAY_VADDR0                (V4L2_CID_PRIVATE_BASE + 6)
+#define V4L2_CID_OVERLAY_VADDR1                (V4L2_CID_PRIVATE_BASE + 7)
+#define V4L2_CID_OVERLAY_VADDR2                (V4L2_CID_PRIVATE_BASE + 8)
+#define V4L2_CID_OVLY_MODE             (V4L2_CID_PRIVATE_BASE + 9)
+#define V4L2_CID_DST_INFO              (V4L2_CID_PRIVATE_BASE + 10)
+/* UMP secure id control */
+#define V4L2_CID_GET_UMP_SECURE_ID     (V4L2_CID_PRIVATE_BASE + 11)
+#define V4L2_CID_GET_PHY_SRC_YADDR     (V4L2_CID_PRIVATE_BASE + 12)
+#define V4L2_CID_GET_PHY_SRC_CADDR     (V4L2_CID_PRIVATE_BASE + 13)
+#define V4L2_CID_IMAGE_EFFECT_FN       (V4L2_CID_PRIVATE_BASE + 16)
+#define V4L2_CID_IMAGE_EFFECT_APPLY    (V4L2_CID_PRIVATE_BASE + 17)
+#define V4L2_CID_IMAGE_EFFECT_CB       (V4L2_CID_PRIVATE_BASE + 18)
+#define V4L2_CID_IMAGE_EFFECT_CR       (V4L2_CID_PRIVATE_BASE + 19)
+#define V4L2_CID_RESERVED_MEM_BASE_ADDR        (V4L2_CID_PRIVATE_BASE + 20)
+#define V4L2_CID_FIMC_VERSION          (V4L2_CID_PRIVATE_BASE + 21)
+
+#define V4L2_CID_STREAM_PAUSE                  (V4L2_CID_PRIVATE_BASE + 53)
+#define V4L2_CID_CACHE_FLUSH                   (V4L2_CID_PRIVATE_BASE + 61)
+#define V4L2_CID_RESERVED_MEM_SIZE             (V4L2_CID_PRIVATE_BASE + 63)
+
+/* CID Extensions for camera sensor operations */
+#define V4L2_CID_CAM_PREVIEW_ONOFF             (V4L2_CID_PRIVATE_BASE + 64)
+#define V4L2_CID_CAM_CAPTURE                   (V4L2_CID_PRIVATE_BASE + 65)
+/* #define V4L2_CID_CAM_JPEG_MEMSIZE   (V4L2_CID_PRIVATE_BASE + 66) */
+
+#define V4L2_CID_CAM_DATE_INFO_YEAR            (V4L2_CID_PRIVATE_BASE + 14)
+#define V4L2_CID_CAM_DATE_INFO_MONTH                   (V4L2_CID_PRIVATE_BASE + 15)
+#define V4L2_CID_CAM_DATE_INFO_DATE            (V4L2_CID_PRIVATE_BASE + 22)
+#define V4L2_CID_CAM_SENSOR_VER                                (V4L2_CID_PRIVATE_BASE + 23)
+#define V4L2_CID_CAM_FW_MINOR_VER              (V4L2_CID_PRIVATE_BASE + 24)
+#define V4L2_CID_CAM_FW_MAJOR_VER              (V4L2_CID_PRIVATE_BASE + 25)
+#define V4L2_CID_CAM_PRM_MINOR_VER             (V4L2_CID_PRIVATE_BASE + 26)
+#define V4L2_CID_CAM_PRM_MAJOR_VER             (V4L2_CID_PRIVATE_BASE + 27)
+#define V4L2_CID_CAM_FW_VER                    (V4L2_CID_PRIVATE_BASE + 28)
+#define V4L2_CID_CAM_SET_FW_ADDR                (V4L2_CID_PRIVATE_BASE + 29)
+#define V4L2_CID_CAM_SET_FW_SIZE                (V4L2_CID_PRIVATE_BASE + 30)
+#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31)
+enum v4l2_firmware_mode {
+       FW_MODE_UPDATE,
+       FW_MODE_VERSION,
+       FW_MODE_DUMP,
+};
+
+#define V4L2_CID_CAM_JPEG_MAIN_SIZE            (V4L2_CID_PRIVATE_BASE + 32)
+#define V4L2_CID_CAM_JPEG_MAIN_OFFSET          (V4L2_CID_PRIVATE_BASE + 33)
+#define V4L2_CID_CAM_JPEG_THUMB_SIZE           (V4L2_CID_PRIVATE_BASE + 34)
+#define V4L2_CID_CAM_JPEG_THUMB_OFFSET         (V4L2_CID_PRIVATE_BASE + 35)
+#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET      (V4L2_CID_PRIVATE_BASE + 36)
+#define V4L2_CID_CAM_JPEG_QUALITY      (V4L2_CID_PRIVATE_BASE + 37)
+#define V4L2_CID_CAM_SENSOR_MAKER      (V4L2_CID_PRIVATE_BASE + 38)
+#define V4L2_CID_CAM_SENSOR_OPTICAL    (V4L2_CID_PRIVATE_BASE + 39)
+#define V4L2_CID_CAM_AF_VER_LOW                (V4L2_CID_PRIVATE_BASE + 40)
+#define V4L2_CID_CAM_AF_VER_HIGH       (V4L2_CID_PRIVATE_BASE + 41)
+#define V4L2_CID_CAM_GAMMA_RG_LOW      (V4L2_CID_PRIVATE_BASE + 42)
+#define V4L2_CID_CAM_GAMMA_RG_HIGH     (V4L2_CID_PRIVATE_BASE + 43)
+#define V4L2_CID_CAM_GAMMA_BG_LOW      (V4L2_CID_PRIVATE_BASE + 44)
+#define V4L2_CID_CAM_GAMMA_BG_HIGH     (V4L2_CID_PRIVATE_BASE + 45)
+#define V4L2_CID_CAM_DUMP_FW           (V4L2_CID_PRIVATE_BASE + 46)
+#define V4L2_CID_CAM_GET_DUMP_SIZE  (V4L2_CID_PRIVATE_BASE + 47)
+#define V4L2_CID_CAMERA_VT_MODE                        (V4L2_CID_PRIVATE_BASE + 48)
+#define V4L2_CID_CAMERA_VGA_BLUR       (V4L2_CID_PRIVATE_BASE + 49)
+#define V4L2_CID_CAMERA_CAPTURE        (V4L2_CID_PRIVATE_BASE + 50)
+#define V4L2_CID_CAMERA_HDR            (V4L2_CID_PRIVATE_BASE + 51)
+
+#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR                (V4L2_CID_PRIVATE_BASE + 54)
+#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH       (V4L2_CID_PRIVATE_BASE + 55)
+#define V4L2_CID_MAIN_SW_DATE_INFO_DATE                (V4L2_CID_PRIVATE_BASE + 56)
+#define V4L2_CID_MAIN_SW_FW_MINOR_VER          (V4L2_CID_PRIVATE_BASE + 57)
+#define V4L2_CID_MAIN_SW_FW_MAJOR_VER          (V4L2_CID_PRIVATE_BASE + 58)
+#define V4L2_CID_MAIN_SW_PRM_MINOR_VER         (V4L2_CID_PRIVATE_BASE + 59)
+#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER         (V4L2_CID_PRIVATE_BASE + 60)
+
+#define V4L2_CID_FIMC_IS_BASE                  (V4L2_CTRL_CLASS_CAMERA | 0x1000)
+#define V4L2_CID_FIMC_IS_TUNE_BASE             (V4L2_CTRL_CLASS_CAMERA | 0x2000)
+
+#define V4L2_CID_IS_LOAD_FW                    (V4L2_CID_FIMC_IS_BASE + 10)
+#define V4L2_CID_IS_INIT_PARAM                 (V4L2_CID_FIMC_IS_BASE + 11)
+#define V4L2_CID_IS_RESET                      (V4L2_CID_FIMC_IS_BASE + 12)
+#define V4L2_CID_IS_S_POWER                    (V4L2_CID_FIMC_IS_BASE + 13)
+enum is_set_power {
+       IS_POWER_OFF,
+       IS_POWER_ON
+};
+
+#define V4L2_CID_IS_S_STREAM                   (V4L2_CID_FIMC_IS_BASE + 14)
+enum is_set_stream {
+       IS_DISABLE_STREAM,
+       IS_ENABLE_STREAM
+};
+
+#define V4L2_CID_IS_S_SCENARIO_MODE            (V4L2_CID_FIMC_IS_BASE + 15)
+#define V4L2_CID_IS_S_FORMAT_SCENARIO          (V4L2_CID_FIMC_IS_BASE + 16)
+enum scenario_mode {
+       IS_MODE_PREVIEW_STILL,
+       IS_MODE_PREVIEW_VIDEO,
+       IS_MODE_CAPTURE_STILL,
+       IS_MODE_CAPTURE_VIDEO,
+       IS_MODE_MAX
+};
+
+#define V4L2_CID_IS_G_COMPLETES             (V4L2_CID_FIMC_IS_BASE + 18)
+
+/* global */
+#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL    (V4L2_CID_FIMC_IS_BASE + 101)
+/* value : 1 : single shot , >=2 : continuous shot */
+
+#define V4L2_CID_IS_CAMERA_SENSOR_NUM          (V4L2_CID_FIMC_IS_BASE + 201)
+
+#define V4L2_CID_IS_CAMERA_FOCUS_MODE          (V4L2_CID_FIMC_IS_BASE + 401)
+enum is_focus_mode {
+       IS_FOCUS_MODE_AUTO,
+       IS_FOCUS_MODE_MACRO,
+       IS_FOCUS_MODE_INFINITY,
+       IS_FOCUS_MODE_CONTINUOUS,
+       IS_FOCUS_MODE_TOUCH,
+       IS_FOCUS_MODE_FACEDETECT,
+       IS_FOCUS_MODE_IDLE,
+       IS_FOCUS_MODE_MAX,
+};
+
+#define V4L2_CID_IS_CAMERA_FLASH_MODE          (V4L2_CID_FIMC_IS_BASE + 402)
+enum is_flash_mode {
+       IS_FLASH_MODE_OFF,
+       IS_FLASH_MODE_AUTO,
+       IS_FLASH_MODE_AUTO_REDEYE,
+       IS_FLASH_MODE_ON,
+       IS_FLASH_MODE_TORCH,
+       IS_FLASH_MODE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_AWB_MODE            (V4L2_CID_FIMC_IS_BASE + 403)
+enum is_awb_mode {
+       IS_AWB_AUTO,
+       IS_AWB_DAYLIGHT,
+       IS_AWB_CLOUDY,
+       IS_AWB_TUNGSTEN,
+       IS_AWB_FLUORESCENT,
+       IS_AWB_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT                (V4L2_CID_FIMC_IS_BASE + 404)
+enum is_image_effect {
+       IS_IMAGE_EFFECT_DISABLE,
+       IS_IMAGE_EFFECT_MONOCHROME,
+       IS_IMAGE_EFFECT_NEGATIVE_MONO,
+       IS_IMAGE_EFFECT_NEGATIVE_COLOR,
+       IS_IMAGE_EFFECT_SEPIA,
+       IS_IMAGE_EFFECT_SEPIA_CB,
+       IS_IMAGE_EFFECT_SEPIA_CR,
+       IS_IMAGE_EFFECT_NEGATIVE,
+       IS_IMAGE_EFFECT_ARTFREEZE,
+       IS_IMAGE_EFFECT_EMBOSSING,
+       IS_IMAGE_EFFECT_SILHOUETTE,
+       IS_IMAGE_EFFECT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISO                 (V4L2_CID_FIMC_IS_BASE + 405)
+enum is_iso {
+       IS_ISO_AUTO,
+       IS_ISO_50,
+       IS_ISO_100,
+       IS_ISO_200,
+       IS_ISO_400,
+       IS_ISO_800,
+       IS_ISO_1600,
+       IS_ISO_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_CONTRAST            (V4L2_CID_FIMC_IS_BASE + 406)
+enum is_contrast {
+       IS_CONTRAST_AUTO,
+       IS_CONTRAST_MINUS_2,
+       IS_CONTRAST_MINUS_1,
+       IS_CONTRAST_DEFAULT,
+       IS_CONTRAST_PLUS_1,
+       IS_CONTRAST_PLUS_2,
+       IS_CONTRAST_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SATURATION          (V4L2_CID_FIMC_IS_BASE + 407)
+enum is_saturation {
+       IS_SATURATION_MINUS_2,
+       IS_SATURATION_MINUS_1,
+       IS_SATURATION_DEFAULT,
+       IS_SATURATION_PLUS_1,
+       IS_SATURATION_PLUS_2,
+       IS_SATURATION_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SHARPNESS           (V4L2_CID_FIMC_IS_BASE + 408)
+enum is_sharpness {
+       IS_SHARPNESS_MINUS_2,
+       IS_SHARPNESS_MINUS_1,
+       IS_SHARPNESS_DEFAULT,
+       IS_SHARPNESS_PLUS_1,
+       IS_SHARPNESS_PLUS_2,
+       IS_SHARPNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_EXPOSURE            (V4L2_CID_FIMC_IS_BASE + 409)
+enum is_exposure {
+       IS_EXPOSURE_MINUS_4,
+       IS_EXPOSURE_MINUS_3,
+       IS_EXPOSURE_MINUS_2,
+       IS_EXPOSURE_MINUS_1,
+       IS_EXPOSURE_DEFAULT,
+       IS_EXPOSURE_PLUS_1,
+       IS_EXPOSURE_PLUS_2,
+       IS_EXPOSURE_PLUS_3,
+       IS_EXPOSURE_PLUS_4,
+       IS_EXPOSURE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_BRIGHTNESS          (V4L2_CID_FIMC_IS_BASE + 410)
+enum is_brightness {
+       IS_BRIGHTNESS_MINUS_2,
+       IS_BRIGHTNESS_MINUS_1,
+       IS_BRIGHTNESS_DEFAULT,
+       IS_BRIGHTNESS_PLUS_1,
+       IS_BRIGHTNESS_PLUS_2,
+       IS_BRIGHTNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_HUE                 (V4L2_CID_FIMC_IS_BASE + 411)
+enum is_hue {
+       IS_HUE_MINUS_2,
+       IS_HUE_MINUS_1,
+       IS_HUE_DEFAULT,
+       IS_HUE_PLUS_1,
+       IS_HUE_PLUS_2,
+       IS_HUE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_METERING            (V4L2_CID_FIMC_IS_BASE + 412)
+enum is_metering {
+       IS_METERING_AVERAGE,
+       IS_METERING_SPOT,
+       IS_METERING_MATRIX,
+       IS_METERING_CENTER,
+       IS_METERING_MAX
+};
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500)
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X   (V4L2_CID_FIMC_IS_BASE + 502)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y   (V4L2_CID_FIMC_IS_BASE + 503)
+
+#define V4L2_CID_IS_CAMERA_AFC_MODE            (V4L2_CID_FIMC_IS_BASE + 413)
+enum is_afc_mode {
+       IS_AFC_DISABLE,
+       IS_AFC_AUTO,
+       IS_AFC_MANUAL_50HZ,
+       IS_AFC_MANUAL_60HZ,
+       IS_AFC_MAX
+};
+
+#define V4L2_CID_IS_AWB_LOCK_UNLOCK            (V4L2_CID_FIMC_IS_BASE + 496)
+enum is_awb_lock_unlock {
+       IS_AWB_LOCK,
+       IS_AWB_UNLOCK,
+       IS_AWB_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_AE_LOCK_UNLOCK             (V4L2_CID_FIMC_IS_BASE + 497)
+enum is_ae_lock_unlock {
+       IS_AE_LOCK,
+       IS_AE_UNLOCK,
+       IS_AE_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_FD_GET_FACE_COUNT                  (V4L2_CID_FIMC_IS_BASE + 600)
+#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 601)
+#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE             (V4L2_CID_FIMC_IS_BASE + 602)
+#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL            (V4L2_CID_FIMC_IS_BASE + 603)
+#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL            (V4L2_CID_FIMC_IS_BASE + 604)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X              (V4L2_CID_FIMC_IS_BASE + 605)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y              (V4L2_CID_FIMC_IS_BASE + 606)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X          (V4L2_CID_FIMC_IS_BASE + 607)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y          (V4L2_CID_FIMC_IS_BASE + 608)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X          (V4L2_CID_FIMC_IS_BASE + 609)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y          (V4L2_CID_FIMC_IS_BASE + 610)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X      (V4L2_CID_FIMC_IS_BASE + 611)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y      (V4L2_CID_FIMC_IS_BASE + 612)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X         (V4L2_CID_FIMC_IS_BASE + 613)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y         (V4L2_CID_FIMC_IS_BASE + 614)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X     (V4L2_CID_FIMC_IS_BASE + 615)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y     (V4L2_CID_FIMC_IS_BASE + 616)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X             (V4L2_CID_FIMC_IS_BASE + 617)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y             (V4L2_CID_FIMC_IS_BASE + 618)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X         (V4L2_CID_FIMC_IS_BASE + 619)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y         (V4L2_CID_FIMC_IS_BASE + 620)
+#define V4L2_CID_IS_FD_GET_ANGLE                       (V4L2_CID_FIMC_IS_BASE + 621)
+#define V4L2_CID_IS_FD_GET_YAW_ANGLE                   (V4L2_CID_FIMC_IS_BASE + 622)
+#define V4L2_CID_IS_FD_GET_NEXT                                (V4L2_CID_FIMC_IS_BASE + 623)
+#define V4L2_CID_IS_FD_GET_DATA                                (V4L2_CID_FIMC_IS_BASE + 624)
+
+#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER             (V4L2_CID_FIMC_IS_BASE + 650)
+#define V4L2_CID_IS_FD_SET_ROLL_ANGLE                  (V4L2_CID_FIMC_IS_BASE + 651)
+enum is_fd_roll_angle {
+       /* 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_BASIC          = 0,
+       /* 0, 30, 0, -30, 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_PRECISE_BASIC  = 1,
+       /* 0, 90, 0, -90 */
+       IS_FD_ROLL_ANGLE_SIDES          = 2,
+       /* 0, 90, 0, -90 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_PRECISE_SIDES  = 3,
+       /* 0, 90, 0, -90, 0, 180 */
+       IS_FD_ROLL_ANGLE_FULL           = 4,
+       /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */
+       IS_FD_ROLL_ANGLE_PRECISE_FULL   = 5,
+};
+
+#define V4L2_CID_IS_FD_SET_YAW_ANGLE                   (V4L2_CID_FIMC_IS_BASE + 652)
+enum is_fd_yaw_angle {
+       IS_FD_YAW_ANGLE_0       = 0,
+       IS_FD_YAW_ANGLE_45      = 1,
+       IS_FD_YAW_ANGLE_90      = 2,
+       IS_FD_YAW_ANGLE_45_90   = 3,
+};
+
+#define V4L2_CID_IS_FD_SET_SMILE_MODE                  (V4L2_CID_FIMC_IS_BASE + 653)
+enum is_fd_smile_mode {
+       IS_FD_SMILE_MODE_DISABLE        = 0,
+       IS_FD_SMILE_MODE_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_BLINK_MODE                  (V4L2_CID_FIMC_IS_BASE + 654)
+enum is_fd_blink_mode {
+       IS_FD_BLINK_MODE_DISABLE        = 0,
+       IS_FD_BLINK_MODE_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE             (V4L2_CID_FIMC_IS_BASE + 655)
+enum is_fd_eye_detect_mode {
+       IS_FD_EYE_DETECT_DISABLE        = 0,
+       IS_FD_EYE_DETECT_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE           (V4L2_CID_FIMC_IS_BASE + 656)
+enum is_fd_mouth_detect_mode {
+       IS_FD_MOUTH_DETECT_DISABLE      = 0,
+       IS_FD_MOUTH_DETECT_ENABLE       = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE            (V4L2_CID_FIMC_IS_BASE + 657)
+enum is_fd_orientation_mode {
+       IS_FD_ORIENTATION_DISABLE       = 0,
+       IS_FD_ORIENTATION_ENABLE        = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION                 (V4L2_CID_FIMC_IS_BASE + 658)
+#define V4L2_CID_IS_FD_SET_DATA_ADDRESS                        (V4L2_CID_FIMC_IS_BASE + 659)
+
+#define V4L2_CID_IS_SET_ISP                    (V4L2_CID_FIMC_IS_BASE + 440)
+enum is_isp_bypass_mode {
+       IS_ISP_BYPASS_DISABLE,
+       IS_ISP_BYPASS_ENABLE,
+       IS_ISP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DRC                    (V4L2_CID_FIMC_IS_BASE + 441)
+enum is_drc_bypass_mode {
+       IS_DRC_BYPASS_DISABLE,
+       IS_DRC_BYPASS_ENABLE,
+       IS_DRC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_FD                     (V4L2_CID_FIMC_IS_BASE + 442)
+enum is_fd_bypass_mode {
+       IS_FD_BYPASS_DISABLE,
+       IS_FD_BYPASS_ENABLE,
+       IS_FD_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_ODC                    (V4L2_CID_FIMC_IS_BASE + 443)
+enum is_odc_bypass_mode {
+       IS_ODC_BYPASS_DISABLE,
+       IS_ODC_BYPASS_ENABLE,
+       IS_ODC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DIS                    (V4L2_CID_FIMC_IS_BASE + 444)
+enum is_dis_bypass_mode {
+       IS_DIS_BYPASS_DISABLE,
+       IS_DIS_BYPASS_ENABLE,
+       IS_DIS_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_3DNR                   (V4L2_CID_FIMC_IS_BASE + 445)
+enum is_tdnr_bypass_mode {
+       IS_TDNR_BYPASS_DISABLE,
+       IS_TDNR_BYPASS_ENABLE,
+       IS_TDNR_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERC                        (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerc_bypass_mode {
+       IS_SCALERC_BYPASS_DISABLE,
+       IS_SCALERC_BYPASS_ENABLE,
+       IS_SCALERC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERP                        (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerp_bypass_mode {
+       IS_SCALERP_BYPASS_DISABLE,
+       IS_SCALERP_BYPASS_ENABLE,
+       IS_SCALERP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_ROTATION_MODE              (V4L2_CID_FIMC_IS_BASE + 450)
+enum is_rotation_mode {
+       IS_ROTATION_0,
+       IS_ROTATION_90,
+       IS_ROTATION_180,
+       IS_ROTATION_270,
+       IS_ROTATION_MAX
+};
+
+#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE                (V4L2_CID_FIMC_IS_BASE + 451)
+enum is_tdnr_1st_frame_mode {
+       IS_TDNR_1ST_FRAME_NOPROCESSING,
+       IS_TDNR_1ST_FRAME_2DNR,
+       IS_TDNR_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X   (V4L2_CID_FIMC_IS_BASE + 452)
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y   (V4L2_CID_FIMC_IS_BASE + 453)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X       (V4L2_CID_FIMC_IS_BASE + 454)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y       (V4L2_CID_FIMC_IS_BASE + 455)
+
+#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME                (V4L2_CID_FIMC_IS_BASE + 456)
+#define V4L2_CID_IS_CAMERA_EXIF_FLASH          (V4L2_CID_FIMC_IS_BASE + 457)
+#define V4L2_CID_IS_CAMERA_EXIF_ISO            (V4L2_CID_FIMC_IS_BASE + 458)
+#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED   (V4L2_CID_FIMC_IS_BASE + 459)
+#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS     (V4L2_CID_FIMC_IS_BASE + 460)
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT       (V4L2_CID_FIMC_IS_BASE + 461)
+enum is_isp_sel_input {
+       IS_ISP_INPUT_OTF,
+       IS_ISP_INPUT_DMA1,
+       IS_ISP_INPUT_DMA2,
+       IS_ISP_INPUT_DMA12,
+       IS_ISP_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT      (V4L2_CID_FIMC_IS_BASE + 462)
+enum is_isp_sel_output {
+       IS_ISP_OUTPUT_OTF,
+       IS_ISP_OUTPUT_DMA1,
+       IS_ISP_OUTPUT_DMA2,
+       IS_ISP_OUTPUT_DMA12,
+       IS_ISP_OUTPUT_OTF_DMA1,
+       IS_ISP_OUTPUT_OTF_DMA2,
+       IS_ISP_OUTPUT_OTF_DMA12,
+       IS_ISP_OUTPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT       (V4L2_CID_FIMC_IS_BASE + 463)
+enum is_drc_sel_input {
+       IS_DRC_INPUT_OTF,
+       IS_DRC_INPUT_DMA,
+       IS_DRC_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT                (V4L2_CID_FIMC_IS_BASE + 464)
+enum is_fd_sel_input {
+       IS_FD_INPUT_OTF,
+       IS_FD_INPUT_DMA,
+       IS_FD_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_INIT_WIDTH          (V4L2_CID_FIMC_IS_BASE + 465)
+#define V4L2_CID_IS_CAMERA_INIT_HEIGHT         (V4L2_CID_FIMC_IS_BASE + 466)
+
+#define V4L2_CID_IS_CMD_ISP                    (V4L2_CID_FIMC_IS_BASE + 467)
+enum is_isp_cmd_mode {
+       IS_ISP_COMMAND_STOP,
+       IS_ISP_COMMAND_START,
+       IS_ISP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DRC                    (V4L2_CID_FIMC_IS_BASE + 468)
+enum is_drc_cmd_mode {
+       IS_DRC_COMMAND_STOP,
+       IS_DRC_COMMAND_START,
+       IS_DRC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_FD                     (V4L2_CID_FIMC_IS_BASE + 469)
+enum is_fd_cmd_mode {
+       IS_FD_COMMAND_STOP,
+       IS_FD_COMMAND_START,
+       IS_FD_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_ODC                    (V4L2_CID_FIMC_IS_BASE + 470)
+enum is_odc_cmd_mode {
+       IS_ODC_COMMAND_STOP,
+       IS_ODC_COMMAND_START,
+       IS_ODC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DIS                    (V4L2_CID_FIMC_IS_BASE + 471)
+enum is_dis_cmd_mode {
+       IS_DIS_COMMAND_STOP,
+       IS_DIS_COMMAND_START,
+       IS_DIS_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_TDNR                   (V4L2_CID_FIMC_IS_BASE + 472)
+enum is_tdnr_cmd_mode {
+       IS_TDNR_COMMAND_STOP,
+       IS_TDNR_COMMAND_START,
+       IS_TDNR_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERC                        (V4L2_CID_FIMC_IS_BASE + 473)
+enum is_scalerc_cmd_mode {
+       IS_SCALERC_COMMAND_STOP,
+       IS_SCALERC_COMMAND_START,
+       IS_SCALERC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERP                        (V4L2_CID_FIMC_IS_BASE + 474)
+enum is_scalerp_cmd_mode {
+       IS_SCALERP_COMMAND_STOP,
+       IS_SCALERP_COMMAND_START,
+       IS_SCALERP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_X                (V4L2_CID_FIMC_IS_BASE + 480)
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y                (V4L2_CID_FIMC_IS_BASE + 481)
+#define V4L2_CID_IS_GET_SENSOR_WIDTH           (V4L2_CID_FIMC_IS_BASE + 482)
+#define V4L2_CID_IS_GET_SENSOR_HEIGHT          (V4L2_CID_FIMC_IS_BASE + 483)
+
+#define V4L2_CID_IS_GET_FRAME_VALID            (V4L2_CID_FIMC_IS_BASE + 484)
+#define V4L2_CID_IS_SET_FRAME_VALID            (V4L2_CID_FIMC_IS_BASE + 485)
+#define V4L2_CID_IS_GET_FRAME_BADMARK          (V4L2_CID_FIMC_IS_BASE + 486)
+#define V4L2_CID_IS_SET_FRAME_BADMARK          (V4L2_CID_FIMC_IS_BASE + 487)
+#define V4L2_CID_IS_GET_FRAME_CAPTURED         (V4L2_CID_FIMC_IS_BASE + 488)
+#define V4L2_CID_IS_SET_FRAME_CAPTURED         (V4L2_CID_FIMC_IS_BASE + 489)
+#define V4L2_CID_IS_SET_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 490)
+#define V4L2_CID_IS_GET_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 491)
+#define V4L2_CID_IS_CLEAR_FRAME_NUMBER         (V4L2_CID_FIMC_IS_BASE + 492)
+#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER    (V4L2_CID_FIMC_IS_BASE + 493)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM         (V4L2_CID_FIMC_IS_BASE + 494)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS     (V4L2_CID_FIMC_IS_BASE + 495)
+
+#define V4L2_CID_IS_ZOOM_STATE                 (V4L2_CID_FIMC_IS_BASE + 660)
+#define V4L2_CID_IS_ZOOM_MAX_LEVEL             (V4L2_CID_FIMC_IS_BASE + 661)
+#define V4L2_CID_IS_ZOOM                       (V4L2_CID_FIMC_IS_BASE + 662)
+#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR       (V4L2_CID_FIMC_IS_BASE + 663)
+
+#define V4L2_CID_IS_TUNE_SEL_ENTRY             (V4L2_CID_FIMC_IS_TUNE_BASE)
+#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE       (V4L2_CID_FIMC_IS_TUNE_BASE + 1)
+#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN    (V4L2_CID_FIMC_IS_TUNE_BASE + 2)
+#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE     (V4L2_CID_FIMC_IS_TUNE_BASE + 3)
+#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS   (V4L2_CID_FIMC_IS_TUNE_BASE + 4)
+
+enum v4l2_blur {
+       BLUR_LEVEL_0 = 0,
+       BLUR_LEVEL_1,
+       BLUR_LEVEL_2,
+       BLUR_LEVEL_3,
+       BLUR_LEVEL_MAX,
+};
+
+#if 1
+#define V4L2_CID_CAMERA_SCENE_MODE             (V4L2_CID_PRIVATE_BASE+70)
+enum v4l2_camera_scene_mode {
+       SCENE_MODE_BASE,
+       SCENE_MODE_NONE,
+       SCENE_MODE_PORTRAIT,
+       SCENE_MODE_NIGHTSHOT,
+       SCENE_MODE_BACK_LIGHT,
+       SCENE_MODE_LANDSCAPE,
+       SCENE_MODE_SPORTS,
+       SCENE_MODE_PARTY_INDOOR,
+       SCENE_MODE_BEACH_SNOW,
+       SCENE_MODE_SUNSET,
+       SCENE_MODE_DUSK_DAWN,
+       SCENE_MODE_FALL_COLOR,
+       SCENE_MODE_FIREWORKS,
+       SCENE_MODE_TEXT,
+       SCENE_MODE_CANDLE_LIGHT,
+       SCENE_MODE_LOW_LIGHT,
+       SCENE_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_FLASH_MODE             (V4L2_CID_PRIVATE_BASE+71)
+enum v4l2_flash_mode {
+       FLASH_MODE_BASE,
+       FLASH_MODE_OFF,
+       FLASH_MODE_AUTO,
+       FLASH_MODE_ON,
+       FLASH_MODE_TORCH,
+       FLASH_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BRIGHTNESS             (V4L2_CID_PRIVATE_BASE+72)
+enum v4l2_ev_mode {
+       EV_MINUS_4      = -4,
+       EV_MINUS_3      = -3,
+       EV_MINUS_2      = -2,
+       EV_MINUS_1      = -1,
+       EV_DEFAULT      = 0,
+       EV_PLUS_1       = 1,
+       EV_PLUS_2       = 2,
+       EV_PLUS_3       = 3,
+       EV_PLUS_4       = 4,
+       EV_MAX,
+};
+
+#define V4L2_CID_CAMERA_WHITE_BALANCE  (V4L2_CID_PRIVATE_BASE+73)
+enum v4l2_wb_mode {
+       WHITE_BALANCE_BASE = 0,
+       WHITE_BALANCE_AUTO,
+       WHITE_BALANCE_SUNNY,
+       WHITE_BALANCE_CLOUDY,
+       WHITE_BALANCE_TUNGSTEN,
+       WHITE_BALANCE_FLUORESCENT,
+       WHITE_BALANCE_MAX,
+};
+
+#define V4L2_CID_CAMERA_EFFECT                 (V4L2_CID_PRIVATE_BASE+74)
+enum v4l2_effect_mode {
+       IMAGE_EFFECT_BASE = 0,
+       IMAGE_EFFECT_NONE,
+       IMAGE_EFFECT_BNW,
+       IMAGE_EFFECT_SEPIA,
+       IMAGE_EFFECT_AQUA,
+       IMAGE_EFFECT_ANTIQUE,
+       IMAGE_EFFECT_NEGATIVE,
+       IMAGE_EFFECT_SHARPEN,
+       IMAGE_EFFECT_MAX,
+};
+
+#define V4L2_CID_CAMERA_ISO                            (V4L2_CID_PRIVATE_BASE+75)
+enum v4l2_iso_mode {
+       ISO_AUTO = 0,
+       ISO_50,
+       ISO_100,
+       ISO_200,
+       ISO_400,
+       ISO_800,
+       ISO_1600,
+       ISO_SPORTS,
+       ISO_NIGHT,
+       ISO_MOVIE,
+       ISO_MAX,
+};
+
+#define V4L2_CID_CAMERA_METERING                       (V4L2_CID_PRIVATE_BASE+76)
+enum v4l2_metering_mode {
+       METERING_BASE = 0,
+       METERING_MATRIX,
+       METERING_CENTER,
+       METERING_SPOT,
+       METERING_MAX,
+};
+
+#define V4L2_CID_CAMERA_CONTRAST                       (V4L2_CID_PRIVATE_BASE+77)
+enum v4l2_contrast_mode {
+       CONTRAST_MINUS_2 = 0,
+       CONTRAST_MINUS_1,
+       CONTRAST_DEFAULT,
+       CONTRAST_PLUS_1,
+       CONTRAST_PLUS_2,
+       CONTRAST_MAX,
+};
+
+#define V4L2_CID_CAMERA_SATURATION             (V4L2_CID_PRIVATE_BASE+78)
+enum v4l2_saturation_mode {
+       SATURATION_MINUS_2 = 0,
+       SATURATION_MINUS_1,
+       SATURATION_DEFAULT,
+       SATURATION_PLUS_1,
+       SATURATION_PLUS_2,
+       SATURATION_MAX,
+};
+
+#define V4L2_CID_CAMERA_SHARPNESS              (V4L2_CID_PRIVATE_BASE+79)
+enum v4l2_sharpness_mode {
+       SHARPNESS_MINUS_2 = 0,
+       SHARPNESS_MINUS_1,
+       SHARPNESS_DEFAULT,
+       SHARPNESS_PLUS_1,
+       SHARPNESS_PLUS_2,
+       SHARPNESS_MAX,
+};
+
+#define V4L2_CID_CAMERA_WDR                            (V4L2_CID_PRIVATE_BASE+80)
+enum v4l2_wdr_mode {
+       WDR_OFF,
+       WDR_ON,
+       WDR_MAX,
+};
+
+#define V4L2_CID_CAMERA_ANTI_SHAKE             (V4L2_CID_PRIVATE_BASE+81)
+enum v4l2_anti_shake_mode {
+       ANTI_SHAKE_OFF,
+       ANTI_SHAKE_STILL_ON,
+       ANTI_SHAKE_MOVIE_ON,
+       ANTI_SHAKE_MAX,
+};
+
+#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP            (V4L2_CID_PRIVATE_BASE+82)
+enum v4l2_touch_af {
+       TOUCH_AF_STOP = 0,
+       TOUCH_AF_START,
+       TOUCH_AF_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO             (V4L2_CID_PRIVATE_BASE+83)
+enum v4l2_smart_auto {
+       SMART_AUTO_OFF = 0,
+       SMART_AUTO_ON,
+       SMART_AUTO_MAX,
+};
+
+#define V4L2_CID_CAMERA_VINTAGE_MODE           (V4L2_CID_PRIVATE_BASE+84)
+enum v4l2_vintage_mode {
+       VINTAGE_MODE_BASE,
+       VINTAGE_MODE_OFF,
+       VINTAGE_MODE_NORMAL,
+       VINTAGE_MODE_WARM,
+       VINTAGE_MODE_COOL,
+       VINTAGE_MODE_BNW,
+       VINTAGE_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_JPEG_QUALITY           (V4L2_CID_PRIVATE_BASE+85)
+/* (V4L2_CID_PRIVATE_BASE+86) */
+#define V4L2_CID_CAMERA_GPS_LATITUDE           (V4L2_CID_CAMERA_CLASS_BASE+30)
+/* (V4L2_CID_PRIVATE_BASE+87) */
+#define V4L2_CID_CAMERA_GPS_LONGITUDE  (V4L2_CID_CAMERA_CLASS_BASE + 31)
+/* (V4L2_CID_PRIVATE_BASE+88) */
+#define V4L2_CID_CAMERA_GPS_TIMESTAMP  (V4L2_CID_CAMERA_CLASS_BASE + 32)
+/* (V4L2_CID_PRIVATE_BASE+89)*/
+#define V4L2_CID_CAMERA_GPS_ALTITUDE   (V4L2_CID_CAMERA_CLASS_BASE + 33)
+#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34)
+#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD                   (V4L2_CID_CAMERA_CLASS_BASE+35)
+
+#define V4L2_CID_FOCUS_AUTO_MODE                               (V4L2_CID_CAMERA_CLASS_BASE+36)
+enum v4l2_focus_mode_type {
+       V4L2_FOCUS_AUTO_NORMAL = 0,
+       V4L2_FOCUS_AUTO_MACRO,
+       V4L2_FOCUS_AUTO_CONTINUOUS,
+       V4L2_FOCUS_AUTO_FACE_DETECTION,
+       V4L2_FOCUS_AUTO_RECTANGLE,
+       V4L2_FOCUS_AUTO_MAX,
+};
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_LEFT             (V4L2_CID_CAMERA_CLASS_BASE+37)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_TOP              (V4L2_CID_CAMERA_CLASS_BASE+38)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_WIDTH            (V4L2_CID_CAMERA_CLASS_BASE+39)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_HEIGHT           (V4L2_CID_CAMERA_CLASS_BASE+40)
+
+#define V4L2_CID_CAMERA_ZOOM                           (V4L2_CID_PRIVATE_BASE+90)
+enum v4l2_zoom_level {
+       ZOOM_LEVEL_0 = 0,
+       ZOOM_LEVEL_1,
+       ZOOM_LEVEL_2,
+       ZOOM_LEVEL_3,
+       ZOOM_LEVEL_4,
+       ZOOM_LEVEL_5,
+       ZOOM_LEVEL_6,
+       ZOOM_LEVEL_7,
+       ZOOM_LEVEL_8,
+       ZOOM_LEVEL_9,
+       ZOOM_LEVEL_10,
+       ZOOM_LEVEL_11,
+       ZOOM_LEVEL_12,
+       ZOOM_LEVEL_MAX = 31,
+};
+
+#define V4L2_CID_CAMERA_FACE_DETECTION         (V4L2_CID_PRIVATE_BASE+91)
+enum v4l2_face_detection {
+       FACE_DETECTION_OFF = 0,
+       FACE_DETECTION_ON,
+       FACE_DETECTION_NOLINE,
+       FACE_DETECTION_ON_BEAUTY,
+       FACE_DETECTION_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO_STATUS              (V4L2_CID_PRIVATE_BASE+92)
+enum v4l2_smart_auto_status {
+       SMART_AUTO_STATUS_AUTO = 0,
+       SMART_AUTO_STATUS_LANDSCAPE,
+       SMART_AUTO_STATUS_PORTRAIT,
+       SMART_AUTO_STATUS_MACRO,
+       SMART_AUTO_STATUS_NIGHT,
+       SMART_AUTO_STATUS_PORTRAIT_NIGHT,
+       SMART_AUTO_STATUS_BACKLIT,
+       SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
+       SMART_AUTO_STATUS_ANTISHAKE,
+       SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
+       SMART_AUTO_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_AUTO_FOCUS         (V4L2_CID_PRIVATE_BASE+93)
+enum v4l2_auto_focus {
+       AUTO_FOCUS_OFF = 0,
+       AUTO_FOCUS_ON,
+       AUTO_FOCUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_BEAUTY_SHOT            (V4L2_CID_PRIVATE_BASE+94)
+enum v4l2_beauty_shot {
+       BEAUTY_SHOT_OFF = 0,
+       BEAUTY_SHOT_ON,
+       BEAUTY_SHOT_MAX,
+};
+
+#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK              (V4L2_CID_PRIVATE_BASE+95)
+enum v4l2_ae_awb_lockunlock {
+       AE_UNLOCK_AWB_UNLOCK = 0,
+       AE_LOCK_AWB_UNLOCK,
+       AE_UNLOCK_AWB_LOCK,
+       AE_LOCK_AWB_LOCK,
+       AE_AWB_MAX
+};
+
+#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK  (V4L2_CID_PRIVATE_BASE+96)
+enum v4l2_face_lock {
+       FACE_LOCK_OFF = 0,
+       FACE_LOCK_ON,
+       FIRST_FACE_TRACKING,
+       FACE_LOCK_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJECT_POSITION_X      (V4L2_CID_PRIVATE_BASE+97)
+#define V4L2_CID_CAMERA_OBJECT_POSITION_Y      (V4L2_CID_PRIVATE_BASE+98)
+#define V4L2_CID_CAMERA_FOCUS_MODE             (V4L2_CID_PRIVATE_BASE+99)
+enum v4l2_focusmode {
+       FOCUS_MODE_AUTO = 0,
+       FOCUS_MODE_MACRO,
+       FOCUS_MODE_FACEDETECT,
+       FOCUS_MODE_AUTO_DEFAULT,
+       FOCUS_MODE_MACRO_DEFAULT,
+       FOCUS_MODE_FACEDETECT_DEFAULT,
+       FOCUS_MODE_INFINITY,
+       FOCUS_MODE_FIXED,
+       FOCUS_MODE_CONTINUOUS,
+       FOCUS_MODE_CONTINUOUS_PICTURE,
+       FOCUS_MODE_CONTINUOUS_PICTURE_MACRO,
+       FOCUS_MODE_CONTINUOUS_VIDEO,
+       FOCUS_MODE_TOUCH,
+       FOCUS_MODE_MAX,
+       FOCUS_MODE_DEFAULT = (1 << 8),
+};
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS    (V4L2_CID_PRIVATE_BASE+100)
+enum v4l2_obj_tracking_status {
+       OBJECT_TRACKING_STATUS_BASE,
+       OBJECT_TRACKING_STATUS_PROGRESSING,
+       OBJECT_TRACKING_STATUS_SUCCESS,
+       OBJECT_TRACKING_STATUS_FAIL,
+       OBJECT_TRACKING_STATUS_MISSING,
+       OBJECT_TRACKING_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP        (V4L2_CID_PRIVATE_BASE+101)
+enum v4l2_ot_start_stop {
+       OT_STOP = 0,
+       OT_START,
+       OT_MAX,
+};
+
+#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE+102)
+enum v4l2_caf_start_stop {
+       CAF_STOP = 0,
+       CAF_START,
+       CAF_MAX,
+};
+
+#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT              (V4L2_CID_PRIVATE_BASE+103)
+enum v4l2_af_status {
+       CAMERA_AF_STATUS_IN_PROGRESS = 0,
+       CAMERA_AF_STATUS_SUCCESS,
+       CAMERA_AF_STATUS_FAIL,
+       CAMERA_AF_STATUS_1ST_SUCCESS,
+       CAMERA_AF_STATUS_MAX,
+};
+#define V4L2_CID_CAMERA_FRAME_RATE                     (V4L2_CID_PRIVATE_BASE+104)
+enum v4l2_frame_rate {
+       FRAME_RATE_AUTO = 0,
+       FRAME_RATE_7 = 7,
+       FRAME_RATE_15 = 15,
+       FRAME_RATE_20 = 20,
+       FRAME_RATE_30 = 30,
+       FRAME_RATE_60 = 60,
+       FRAME_RATE_120 = 120,
+       FRAME_RATE_MAX
+};
+
+#define V4L2_CID_CAMERA_ANTI_BANDING                                   (V4L2_CID_PRIVATE_BASE+105)
+enum v4l2_anti_banding{
+       ANTI_BANDING_AUTO = 0,
+       ANTI_BANDING_50HZ = 1,
+       ANTI_BANDING_60HZ = 2,
+       ANTI_BANDING_OFF = 3,
+};
+
+#define V4L2_CID_CAMERA_SET_GAMMA      (V4L2_CID_PRIVATE_BASE+106)
+enum v4l2_gamma_mode{
+       GAMMA_OFF = 0,
+       GAMMA_ON = 1,
+       GAMMA_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_SLOW_AE    (V4L2_CID_PRIVATE_BASE+107)
+enum v4l2_slow_ae_mode{
+       SLOW_AE_OFF,
+       SLOW_AE_ON,
+       SLOW_AE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BATCH_REFLECTION                                       (V4L2_CID_PRIVATE_BASE+108)
+#define V4L2_CID_CAMERA_EXIF_ORIENTATION                                       (V4L2_CID_PRIVATE_BASE+109)
+
+/* s1_camera [ Defense process by ESD input ] */
+#define V4L2_CID_CAMERA_RESET                  (V4L2_CID_PRIVATE_BASE+111)
+#define V4L2_CID_CAMERA_CHECK_DATALINE                                         (V4L2_CID_PRIVATE_BASE+112)
+#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP                                    (V4L2_CID_PRIVATE_BASE+113)
+
+#endif
+
+/* Modify NTTS1 */
+#if defined(CONFIG_ARIES_NTT)
+#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK                                    (V4L2_CID_PRIVATE_BASE+114)
+#endif
+#define V4L2_CID_CAMERA_THUMBNAIL_NULL                                  (V4L2_CID_PRIVATE_BASE+115)
+#define V4L2_CID_CAMERA_SENSOR_MODE                                    (V4L2_CID_PRIVATE_BASE+116)
+enum v4l2_sensor_mode {
+       SENSOR_CAMERA,
+       SENSOR_MOVIE,
+};
+
+typedef enum {
+       STREAM_MODE_CAM_OFF,
+       STREAM_MODE_CAM_ON,
+       STREAM_MODE_MOVIE_OFF,
+       STREAM_MODE_MOVIE_ON,
+} stream_mode_t;
+
+#define V4L2_CID_CAMERA_EXIF_EXPTIME                           (V4L2_CID_PRIVATE_BASE+117)
+#define V4L2_CID_CAMERA_EXIF_FLASH                                     (V4L2_CID_PRIVATE_BASE+118)
+#define V4L2_CID_CAMERA_EXIF_ISO                                       (V4L2_CID_PRIVATE_BASE+119)
+#define V4L2_CID_CAMERA_EXIF_TV                                                (V4L2_CID_PRIVATE_BASE+120)
+#define V4L2_CID_CAMERA_EXIF_BV                                                (V4L2_CID_PRIVATE_BASE+121)
+#define V4L2_CID_CAMERA_EXIF_EBV                                       (V4L2_CID_PRIVATE_BASE+122)
+#define V4L2_CID_CAMERA_CHECK_ESD              (V4L2_CID_PRIVATE_BASE+123)
+#define V4L2_CID_CAMERA_APP_CHECK              (V4L2_CID_PRIVATE_BASE+124)
+#define V4L2_CID_CAMERA_BUSFREQ_LOCK           (V4L2_CID_PRIVATE_BASE+125)
+#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK         (V4L2_CID_PRIVATE_BASE+126)
+
+#define V4L2_CID_CAMERA_FACE_ZOOM  (V4L2_CID_PRIVATE_BASE + 132)
+enum v4l2_face_zoom {
+       FACE_ZOOM_STOP = 0,
+       FACE_ZOOM_START
+};
+
+/* control for post processing block in ISP */
+#define V4L2_CID_CAMERA_SET_ODC                                (V4L2_CID_PRIVATE_BASE+127)
+enum set_odc_mode {
+       CAMERA_ODC_ON,
+       CAMERA_ODC_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_DIS                                (V4L2_CID_PRIVATE_BASE+128)
+enum set_dis_mode {
+       CAMERA_DIS_ON,
+       CAMERA_DIS_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_3DNR                               (V4L2_CID_PRIVATE_BASE+129)
+enum set_3dnr_mode {
+       CAMERA_3DNR_ON,
+       CAMERA_3DNR_OFF
+};
+
+#define V4L2_CID_EMBEDDEDDATA_ENABLE                           (V4L2_CID_PRIVATE_BASE+130)
+
+#define V4L2_CID_CAMERA_CHECK_SENSOR_STATUS                    (V4L2_CID_PRIVATE_BASE+150)
+#define V4L2_CID_CAMERA_DEFAULT_FOCUS_POSITION                 (V4L2_CID_PRIVATE_BASE+151)
+
+/*      Pixel format FOURCC depth  Description  */
+enum v4l2_pix_format_mode {
+       V4L2_PIX_FMT_MODE_PREVIEW,
+       V4L2_PIX_FMT_MODE_CAPTURE,
+       V4L2_PIX_FMT_MODE_HDR,
+       V4L2_PIX_FMT_MODE_VT_MIRROR,
+       V4L2_PIX_FMT_MODE_VT_NONMIRROR,
+};
+
+/* 12  Y/CbCr 4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12T    v4l2_fourcc('T', 'V', '1', '2')
+#define V4L2_PIX_FMT_NV21T    v4l2_fourcc('T', 'V', '2', '1')
+#define V4L2_PIX_FMT_INTERLEAVED    v4l2_fourcc('I', 'T', 'L', 'V')
+
+/*
+ *  * V4L2 extention for digital camera
+ *   */
+/* Strobe flash light */
+enum v4l2_strobe_control {
+       /* turn off the flash light */
+       V4L2_STROBE_CONTROL_OFF         = 0,
+       /* turn on the flash light */
+       V4L2_STROBE_CONTROL_ON          = 1,
+       /* act guide light before splash */
+       V4L2_STROBE_CONTROL_AFGUIDE     = 2,
+       /* charge the flash light */
+       V4L2_STROBE_CONTROL_CHARGE      = 3,
+};
+
+enum v4l2_strobe_conf {
+       V4L2_STROBE_OFF                 = 0,    /* Always off */
+       V4L2_STROBE_ON                  = 1,    /* Always splashes */
+       /* Auto control presets */
+       V4L2_STROBE_AUTO                = 2,
+       V4L2_STROBE_REDEYE_REDUCTION    = 3,
+       V4L2_STROBE_SLOW_SYNC           = 4,
+       V4L2_STROBE_FRONT_CURTAIN       = 5,
+       V4L2_STROBE_REAR_CURTAIN        = 6,
+       /* Extra manual control presets */
+       /* keep turned on until turning off */
+       V4L2_STROBE_PERMANENT           = 7,
+       V4L2_STROBE_EXTERNAL            = 8,
+};
+
+enum v4l2_strobe_status {
+       V4L2_STROBE_STATUS_OFF          = 0,
+       /* while processing configurations */
+       V4L2_STROBE_STATUS_BUSY         = 1,
+       V4L2_STROBE_STATUS_ERR          = 2,
+       V4L2_STROBE_STATUS_CHARGING     = 3,
+       V4L2_STROBE_STATUS_CHARGED      = 4,
+};
+
+/* capabilities field */
+/* No strobe supported */
+#define V4L2_STROBE_CAP_NONE           0x0000
+/* Always flash off mode */
+#define V4L2_STROBE_CAP_OFF            0x0001
+/* Always use flash light mode */
+#define V4L2_STROBE_CAP_ON             0x0002
+/* Flashlight works automatic */
+#define V4L2_STROBE_CAP_AUTO           0x0004
+/* Red-eye reduction */
+#define V4L2_STROBE_CAP_REDEYE         0x0008
+/* Slow sync */
+#define V4L2_STROBE_CAP_SLOWSYNC       0x0010
+/* Front curtain */
+#define V4L2_STROBE_CAP_FRONT_CURTAIN  0x0020
+/* Rear curtain */
+#define V4L2_STROBE_CAP_REAR_CURTAIN   0x0040
+/* keep turned on until turning off */
+#define V4L2_STROBE_CAP_PERMANENT      0x0080
+/* use external strobe */
+#define V4L2_STROBE_CAP_EXTERNAL       0x0100
+
+/* Set mode and Get status */
+struct v4l2_strobe {
+       /* off/on/charge:0/1/2 */
+       enum    v4l2_strobe_control control;
+       /* supported strobe capabilities */
+       __u32   capabilities;
+       enum    v4l2_strobe_conf mode;
+       enum    v4l2_strobe_status status;      /* read only */
+       /* default is 0 and range of value varies from each models */
+       __u32   flash_ev;
+       __u32   reserved[4];
+};
+
+#define VIDIOC_S_STROBE     _IOWR('V', 83, struct v4l2_strobe)
+#define VIDIOC_G_STROBE     _IOR('V', 84, struct v4l2_strobe)
+
+/* Object recognition and collateral actions */
+enum v4l2_recog_mode {
+       V4L2_RECOGNITION_MODE_OFF       = 0,
+       V4L2_RECOGNITION_MODE_ON        = 1,
+       V4L2_RECOGNITION_MODE_LOCK      = 2,
+};
+
+enum v4l2_recog_action {
+       V4L2_RECOGNITION_ACTION_NONE    = 0,    /* only recognition */
+       V4L2_RECOGNITION_ACTION_BLINK   = 1,    /* Capture on blinking */
+       V4L2_RECOGNITION_ACTION_SMILE   = 2,    /* Capture on smiling */
+};
+
+enum v4l2_recog_pattern {
+       V4L2_RECOG_PATTERN_FACE         = 0, /* Face */
+       V4L2_RECOG_PATTERN_HUMAN        = 1, /* Human */
+       V4L2_RECOG_PATTERN_CHAR         = 2, /* Character */
+};
+
+struct v4l2_recog_rect {
+       enum    v4l2_recog_pattern  p;  /* detected pattern */
+       struct  v4l2_rect  o;   /* detected area */
+       __u32   reserved[4];
+};
+
+struct v4l2_recog_data {
+       __u8    detect_cnt;             /* detected object counter */
+       struct  v4l2_rect       o;      /* detected area */
+       __u32   reserved[4];
+};
+
+struct v4l2_recognition {
+       enum v4l2_recog_mode    mode;
+
+       /* Which pattern to detect */
+       enum v4l2_recog_pattern  pattern;
+
+       /* How many object to detect */
+       __u8    obj_num;
+
+       /* select detected object */
+       __u32   detect_idx;
+
+       /* read only :Get object coordination */
+       struct v4l2_recog_data  data;
+
+       enum v4l2_recog_action  action;
+       __u32   reserved[4];
+};
+
+#define VIDIOC_S_RECOGNITION   _IOWR('V', 85, struct v4l2_recognition)
+#define VIDIOC_G_RECOGNITION   _IOR('V', 86, struct v4l2_recognition)
+
+#endif /* __LINUX_VIDEODEV2_EXYNOS_CAMERA_H */
diff --git a/include/videodev2_exynos_camera_ext.h b/include/videodev2_exynos_camera_ext.h
new file mode 100644 (file)
index 0000000..3bac352
--- /dev/null
@@ -0,0 +1,2914 @@
+/*
+ * Video for Linux Two header file for samsung
+ *
+ * Copyright (C) 2013, teahyung kim <tkon.kim@samsung.com>
+ *
+ * This header file contains several v4l2 APIs to be proposed to v4l2
+ * community and until bein accepted, will be used restrictly in Samsung's
+ * camera interface driver FIMC.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+/*
+ * Copyright 2008, The Android Open Source Project
+ * Copyright 2010, Samsung Electronics Co. LTD
+ *
+ * Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed toggle an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LINUX_VIDEODEV2_SAMSUNG_H
+#define __LINUX_VIDEODEV2_SAMSUNG_H
+
+/* Values for 'capabilities' field */
+/* Object detection device */
+#define V4L2_CAP_OBJ_RECOGNITION       0x10000000
+/* strobe control */
+#define V4L2_CAP_STROBE                        0x20000000
+
+#define V4L2_CID_FOCUS_MODE            (V4L2_CID_CAMERA_CLASS_BASE + 17)
+/* Focus Methods */
+typedef enum {
+       V4L2_FOCUS_MODE_AUTO            = 0,
+       V4L2_FOCUS_MODE_MACRO           = 1,
+       V4L2_FOCUS_MODE_MANUAL          = 2,
+       V4L2_FOCUS_MODE_LASTP           = 2,
+       V4L2_FOCUS_MODE_FACEDETECT,
+       V4L2_FOCUS_MODE_AUTO_DEFAULT,
+       V4L2_FOCUS_MODE_MACRO_DEFAULT,
+       V4L2_FOCUS_MODE_FACEDETECT_DEFAULT,
+       V4L2_FOCUS_MODE_INFINITY,
+       V4L2_FOCUS_MODE_FIXED,
+       V4L2_FOCUS_MODE_CONTINUOUS,
+       V4L2_FOCUS_MODE_CONTINUOUS_PICTURE,
+       V4L2_FOCUS_MODE_CONTINUOUS_PICTURE_MACRO,
+       V4L2_FOCUS_MODE_CONTINUOUS_VIDEO,
+       V4L2_FOCUS_MODE_TOUCH,
+       V4L2_FOCUS_MODE_MULTI,
+       V4L2_FOCUS_MODE_OBJECT_TRACKING,
+       V4L2_FOCUS_MODE_SINGLE,
+       V4L2_FOCUS_MODE_SELFSHOT,
+       V4L2_FOCUS_MODE_MAX,
+       V4L2_FOCUS_MODE_DEFAULT = (1 << 8),
+} cam_focus_mode;
+
+#define V4L2_CID_ZOOM_MODE             (V4L2_CID_CAMERA_CLASS_BASE + 18)
+/* Zoom Methods */
+enum v4l2_zoom_mode {
+       V4L2_ZOOM_MODE_CONTINUOUS       = 0,
+       V4L2_ZOOM_MODE_OPTICAL          = 1,
+       V4L2_ZOOM_MODE_DIGITAL          = 2,
+       V4L2_ZOOM_MODE_LASTP            = 2,
+};
+
+/* Exposure Methods */
+#define V4L2_CID_PHOTOMETRY            (V4L2_CID_CAMERA_CLASS_BASE + 19)
+enum v4l2_photometry_mode {
+       V4L2_PHOTOMETRY_MULTISEG        = 0, /*Multi Segment*/
+       V4L2_PHOTOMETRY_CWA             = 1, /*Centre Weighted Average*/
+       V4L2_PHOTOMETRY_SPOT            = 2,
+       V4L2_PHOTOMETRY_AFSPOT          = 3, /*Spot metering on focused point*/
+       V4L2_PHOTOMETRY_LASTP           = V4L2_PHOTOMETRY_AFSPOT,
+};
+
+/* Manual exposure control items menu type: iris, shutter, iso */
+#define V4L2_CID_CAM_APERTURE  (V4L2_CID_CAMERA_CLASS_BASE + 20)
+#define V4L2_CID_CAM_SHUTTER   (V4L2_CID_CAMERA_CLASS_BASE + 21)
+#define V4L2_CID_CAM_ISO       (V4L2_CID_CAMERA_CLASS_BASE + 22)
+enum v4l2_iso {
+       V4L2_ISO_AUTO,
+       V4L2_ISO_50,
+       V4L2_ISO_100,
+       V4L2_ISO_125,
+       V4L2_ISO_160,
+       V4L2_ISO_200,
+       V4L2_ISO_250,
+       V4L2_ISO_320,
+       V4L2_ISO_400,
+       V4L2_ISO_500,
+       V4L2_ISO_640,
+       V4L2_ISO_800,
+       V4L2_ISO_1000,
+       V4L2_ISO_1250,
+       V4L2_ISO_1600,
+       V4L2_ISO_2000,
+       V4L2_ISO_2500,
+       V4L2_ISO_3200,
+       V4L2_ISO_4000,
+       V4L2_ISO_5000,
+       V4L2_ISO_6400,
+       V4L2_ISO_8000,
+       V4L2_ISO_10000,
+       V4L2_ISO_12800,
+       V4L2_ISO_16000,
+       V4L2_ISO_20000,
+       V4L2_ISO_25600,
+       V4L2_ISO_SPORTS,
+       V4L2_ISO_NIGHT,
+       V4L2_ISO_MOVIE,
+       V4L2_ISO_MAX
+};
+
+#if 0//##mmkim -- to fix compile error
+/* Following CIDs are menu type */
+#define V4L2_CID_SCENEMODE     (V4L2_CID_CAMERA_CLASS_BASE + 23)
+enum v4l2_camera_scene_mode {
+       V4L2_SCENE_MODE_BASE,
+       V4L2_SCENE_MODE_NONE,
+       V4L2_SCENE_MODE_PORTRAIT,
+       V4L2_SCENE_MODE_NIGHTSHOT,
+       V4L2_SCENE_MODE_BACK_LIGHT,
+       V4L2_SCENE_MODE_LANDSCAPE,
+       V4L2_SCENE_MODE_SPORTS,
+       V4L2_SCENE_MODE_PARTY_INDOOR,
+       V4L2_SCENE_MODE_BEACH_SNOW,
+       V4L2_SCENE_MODE_SUNSET,
+       V4L2_SCENE_MODE_DUSK_DAWN,
+       V4L2_SCENE_MODE_FALL_COLOR,
+       V4L2_SCENE_MODE_FIREWORKS,
+       V4L2_SCENE_MODE_TEXT,
+       V4L2_SCENE_MODE_CANDLE_LIGHT,
+       V4L2_SCENE_MODE_MAX,
+};
+#endif
+#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE + 24)
+#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE + 25)
+
+/* Control dynamic range */
+#define V4L2_CID_CAM_DR                (V4L2_CID_CAMERA_CLASS_BASE + 26)
+
+/* White balance preset control */
+#define V4L2_CID_WHITE_BALANCE_PRESET  (V4L2_CID_CAMERA_CLASS_BASE + 27)
+#if 0 //##mmkim -- to fix compile error
+enum v4l2_wb_preset {
+       V4L2_WHITE_BALANCE_BASE = 0,
+       V4L2_WHITE_BALANCE_AUTO,
+       V4L2_WHITE_BALANCE_SUNNY,
+       V4L2_WHITE_BALANCE_CLOUDY,
+       V4L2_WHITE_BALANCE_TUNGSTEN,
+       V4L2_WHITE_BALANCE_FLUORESCENT,
+       V4L2_WHITE_BALANCE_FLUORESCENT_H,
+       V4L2_WHITE_BALANCE_FLUORESCENT_L,
+       V4L2_WHITE_BALANCE_FLASH,
+       V4L2_WHITE_BALANCE_CUSTOM,
+       V4L2_WHITE_BALANCE_K,
+       V4L2_WHITE_BALANCE_INCANDESCENT,
+       V4L2_WHITE_BALANCE_PROHIBITION,
+       V4L2_WHITE_BALANCE_HORIZON,
+       V4L2_WHITE_BALANCE_LEDLIGHT,
+       V4L2_WHITE_BALANCE_MAX,
+};
+#endif
+#define V4L2_CID_CAM_SENSOR_FW_VER     (V4L2_CID_CAMERA_CLASS_BASE + 28)
+#define V4L2_CID_CAM_PHONE_FW_VER      (V4L2_CID_CAMERA_CLASS_BASE + 29)
+
+/* CID extensions */
+#define V4L2_CID_ROTATION              (V4L2_CID_PRIVATE_BASE + 0)
+#define V4L2_CID_PADDR_Y               (V4L2_CID_PRIVATE_BASE + 1)
+#define V4L2_CID_PADDR_CB              (V4L2_CID_PRIVATE_BASE + 2)
+#define V4L2_CID_PADDR_CR              (V4L2_CID_PRIVATE_BASE + 3)
+#define V4L2_CID_PADDR_CBCR            (V4L2_CID_PRIVATE_BASE + 4)
+#define V4L2_CID_OVERLAY_AUTO          (V4L2_CID_PRIVATE_BASE + 5)
+#define V4L2_CID_OVERLAY_VADDR0                (V4L2_CID_PRIVATE_BASE + 6)
+#define V4L2_CID_OVERLAY_VADDR1                (V4L2_CID_PRIVATE_BASE + 7)
+#define V4L2_CID_OVERLAY_VADDR2                (V4L2_CID_PRIVATE_BASE + 8)
+#define V4L2_CID_OVLY_MODE             (V4L2_CID_PRIVATE_BASE + 9)
+#define V4L2_CID_DST_INFO              (V4L2_CID_PRIVATE_BASE + 10)
+/* UMP secure id control */
+#define V4L2_CID_GET_UMP_SECURE_ID     (V4L2_CID_PRIVATE_BASE + 11)
+#define V4L2_CID_GET_PHY_SRC_YADDR     (V4L2_CID_PRIVATE_BASE + 12)
+#define V4L2_CID_GET_PHY_SRC_CADDR     (V4L2_CID_PRIVATE_BASE + 13)
+#define V4L2_CID_IMAGE_EFFECT_FN       (V4L2_CID_PRIVATE_BASE + 16)
+#define V4L2_CID_IMAGE_EFFECT_APPLY    (V4L2_CID_PRIVATE_BASE + 17)
+#define V4L2_CID_IMAGE_EFFECT_CB       (V4L2_CID_PRIVATE_BASE + 18)
+#define V4L2_CID_IMAGE_EFFECT_CR       (V4L2_CID_PRIVATE_BASE + 19)
+#define V4L2_CID_RESERVED_MEM_BASE_ADDR        (V4L2_CID_PRIVATE_BASE + 20)
+#define V4L2_CID_FIMC_VERSION          (V4L2_CID_PRIVATE_BASE + 21)
+
+#define V4L2_CID_CACHE_FLUSH           (V4L2_CID_PRIVATE_BASE + 61)
+#define V4L2_CID_RESERVED_MEM_SIZE     (V4L2_CID_PRIVATE_BASE + 63)
+#define V4L2_CID_STREAM_PAUSE                  (V4L2_CID_PRIVATE_BASE + 53)
+
+/* CID Extensions for camera sensor operations */
+#define V4L2_CID_CAM_PREVIEW_ONOFF             (V4L2_CID_PRIVATE_BASE + 64)
+#define V4L2_CID_CAM_CAPTURE                   (V4L2_CID_PRIVATE_BASE + 65)
+/* #define V4L2_CID_CAM_JPEG_MEMSIZE   (V4L2_CID_PRIVATE_BASE + 66) */
+
+#define V4L2_CID_CAM_DATE_INFO_YEAR            (V4L2_CID_PRIVATE_BASE + 14)
+#define V4L2_CID_CAM_DATE_INFO_MONTH           (V4L2_CID_PRIVATE_BASE + 15)
+#define V4L2_CID_CAM_DATE_INFO_DATE            (V4L2_CID_PRIVATE_BASE + 22)
+#define V4L2_CID_CAM_SENSOR_VER                        (V4L2_CID_PRIVATE_BASE + 23)
+#define V4L2_CID_CAM_FW_MINOR_VER              (V4L2_CID_PRIVATE_BASE + 24)
+#define V4L2_CID_CAM_FW_MAJOR_VER              (V4L2_CID_PRIVATE_BASE + 25)
+#define V4L2_CID_CAM_PRM_MINOR_VER             (V4L2_CID_PRIVATE_BASE + 26)
+#define V4L2_CID_CAM_PRM_MAJOR_VER             (V4L2_CID_PRIVATE_BASE + 27)
+#define V4L2_CID_CAM_FW_VER                    (V4L2_CID_PRIVATE_BASE + 28)
+#define V4L2_CID_CAM_SET_FW_ADDR               (V4L2_CID_PRIVATE_BASE + 29)
+#define V4L2_CID_CAM_SET_FW_SIZE               (V4L2_CID_PRIVATE_BASE + 30)
+
+
+#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET      (V4L2_CID_PRIVATE_BASE + 36)
+#define V4L2_CID_CAM_JPEG_QUALITY      (V4L2_CID_PRIVATE_BASE + 37)
+#define V4L2_CID_CAM_SENSOR_MAKER      (V4L2_CID_PRIVATE_BASE + 38)
+#define V4L2_CID_CAM_SENSOR_OPTICAL    (V4L2_CID_PRIVATE_BASE + 39)
+#define V4L2_CID_CAM_AF_VER_LOW                (V4L2_CID_PRIVATE_BASE + 40)
+#define V4L2_CID_CAM_AF_VER_HIGH       (V4L2_CID_PRIVATE_BASE + 41)
+#define V4L2_CID_CAM_GAMMA_RG_LOW      (V4L2_CID_PRIVATE_BASE + 42)
+#define V4L2_CID_CAM_GAMMA_RG_HIGH     (V4L2_CID_PRIVATE_BASE + 43)
+#define V4L2_CID_CAM_GAMMA_BG_LOW      (V4L2_CID_PRIVATE_BASE + 44)
+#define V4L2_CID_CAM_GAMMA_BG_HIGH     (V4L2_CID_PRIVATE_BASE + 45)
+#define V4L2_CID_CAM_DUMP_FW           (V4L2_CID_PRIVATE_BASE + 46)
+#define V4L2_CID_CAM_GET_DUMP_SIZE  (V4L2_CID_PRIVATE_BASE + 47)
+#define V4L2_CID_CAMERA_VT_MODE                        (V4L2_CID_PRIVATE_BASE + 48)
+typedef enum {
+       CAM_VT_MODE_NONE ,
+       CAM_VT_MODE_3G ,
+       CAM_VT_MODE_VOIP ,
+} cam_vt_mode;
+
+#define V4L2_CID_CAMERA_VGA_BLUR       (V4L2_CID_PRIVATE_BASE + 49)
+#define V4L2_CID_CAMERA_CAPTURE        (V4L2_CID_PRIVATE_BASE + 50)
+#define V4L2_CID_CAMERA_HDR            (V4L2_CID_PRIVATE_BASE + 51)
+#define V4L2_CID_CAMERA_HYBRID         (V4L2_CID_PRIVATE_BASE + 52)
+
+#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR                (V4L2_CID_PRIVATE_BASE + 54)
+#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH       (V4L2_CID_PRIVATE_BASE + 55)
+#define V4L2_CID_MAIN_SW_DATE_INFO_DATE                (V4L2_CID_PRIVATE_BASE + 56)
+#define V4L2_CID_MAIN_SW_FW_MINOR_VER          (V4L2_CID_PRIVATE_BASE + 57)
+#define V4L2_CID_MAIN_SW_FW_MAJOR_VER          (V4L2_CID_PRIVATE_BASE + 58)
+#define V4L2_CID_MAIN_SW_PRM_MINOR_VER         (V4L2_CID_PRIVATE_BASE + 59)
+#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER         (V4L2_CID_PRIVATE_BASE + 60)
+#define V4L2_CID_CAMERA_HYBRID_CAPTURE         (V4L2_CID_PRIVATE_BASE + 62)
+#define V4L2_CID_CAMERA_FAST_MODE              (V4L2_CID_PRIVATE_BASE + 66)
+enum cam_fast_mode {
+       FAST_MODE_SUBSAMPLING_NONE ,
+       FAST_MODE_SUBSAMPLING_HALF ,
+       FAST_MODE_SUBSAMPLING_QUARTER ,
+};
+#define V4L2_CID_CAMERA_YUV_CAPTURE (V4L2_CID_PRIVATE_BASE + 69)
+
+#define V4L2_CID_FIMC_IS_BASE          (V4L2_CTRL_CLASS_CAMERA | 0x1000)
+#define V4L2_CID_FIMC_IS_TUNE_BASE     (V4L2_CTRL_CLASS_CAMERA | 0x2000)
+#define V4L2_CID_SENSOR_BASE           (V4L2_CTRL_CLASS_CAMERA | 0x3000)
+
+#define V4L2_CID_IS_LOAD_FW                    (V4L2_CID_FIMC_IS_BASE + 10)
+#define V4L2_CID_IS_INIT_PARAM                 (V4L2_CID_FIMC_IS_BASE + 11)
+#define V4L2_CID_IS_RESET                      (V4L2_CID_FIMC_IS_BASE + 12)
+#define V4L2_CID_IS_S_POWER                    (V4L2_CID_FIMC_IS_BASE + 13)
+enum is_set_power {
+       IS_POWER_OFF,
+       IS_POWER_ON
+};
+
+#define V4L2_CID_IS_S_STREAM                   (V4L2_CID_FIMC_IS_BASE + 14)
+enum is_set_stream {
+       IS_DISABLE_STREAM,
+       IS_ENABLE_STREAM
+};
+
+#define V4L2_CID_IS_S_SCENARIO_MODE            (V4L2_CID_FIMC_IS_BASE + 15)
+#define V4L2_CID_IS_S_FORMAT_SCENARIO          (V4L2_CID_FIMC_IS_BASE + 16)
+enum scenario_mode {
+       IS_MODE_PREVIEW_STILL,
+       IS_MODE_PREVIEW_VIDEO,
+       IS_MODE_CAPTURE_STILL,
+       IS_MODE_CAPTURE_VIDEO,
+       IS_MODE_MAX
+};
+
+#define V4L2_CID_IS_G_CAPABILITY               (V4L2_CID_FIMC_IS_BASE + 17)
+#define V4L2_CID_IS_G_COMPLETES                        (V4L2_CID_FIMC_IS_BASE + 18)
+#define V4L2_CID_IS_BDS_WIDTH                  (V4L2_CID_FIMC_IS_BASE + 19)
+#define V4L2_CID_IS_BDS_HEIGHT                 (V4L2_CID_FIMC_IS_BASE + 20)
+#define V4L2_CID_IS_DVFS_LOCK                  (V4L2_CID_FIMC_IS_BASE + 21)
+#define V4L2_CID_IS_DVFS_UNLOCK                        (V4L2_CID_FIMC_IS_BASE + 22)
+#define V4L2_CID_IS_FORCE_DONE                 (V4L2_CID_FIMC_IS_BASE + 50)
+#define V4L2_CID_IS_SET_SETFILE                        (V4L2_CID_FIMC_IS_BASE + 51)
+#define V4L2_CID_IS_S_BNS                      (V4L2_CID_FIMC_IS_BASE + 52)
+#define V4L2_CID_IS_G_BNS_SIZE                 (V4L2_CID_FIMC_IS_BASE + 53)
+#define V4L2_CID_IS_COLOR_RANGE                        (V4L2_CID_FIMC_IS_BASE + 54)
+#define V4L2_CID_IS_MIN_TARGET_FPS             (V4L2_CID_FIMC_IS_BASE + 55)
+#define V4L2_CID_IS_MAX_TARGET_FPS             (V4L2_CID_FIMC_IS_BASE + 56)
+
+/* global */
+#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL    (V4L2_CID_FIMC_IS_BASE + 101)
+/* value : 1 : single shot , >=2 : continuous shot */
+
+#define V4L2_CID_IS_CAMERA_SENSOR_NUM          (V4L2_CID_FIMC_IS_BASE + 201)
+
+#define V4L2_CID_IS_CAMERA_FOCUS_MODE          (V4L2_CID_FIMC_IS_BASE + 401)
+enum is_focus_mode {
+       IS_FOCUS_MODE_AUTO,
+       IS_FOCUS_MODE_MACRO,
+       IS_FOCUS_MODE_INFINITY,
+       IS_FOCUS_MODE_CONTINUOUS,
+       IS_FOCUS_MODE_TOUCH,
+       IS_FOCUS_MODE_FACEDETECT,
+       IS_FOCUS_MODE_IDLE,
+       IS_FOCUS_MODE_MAX,
+};
+
+#define V4L2_CID_IS_CAMERA_FLASH_MODE          (V4L2_CID_FIMC_IS_BASE + 402)
+enum is_flash_mode {
+       IS_FLASH_MODE_OFF,
+       IS_FLASH_MODE_AUTO,
+       IS_FLASH_MODE_AUTO_REDEYE,
+       IS_FLASH_MODE_ON,
+       IS_FLASH_MODE_TORCH,
+       IS_FLASH_MODE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_AWB_MODE            (V4L2_CID_FIMC_IS_BASE + 403)
+enum is_awb_mode {
+       IS_AWB_AUTO,
+       IS_AWB_DAYLIGHT,
+       IS_AWB_CLOUDY,
+       IS_AWB_TUNGSTEN,
+       IS_AWB_FLUORESCENT,
+       IS_AWB_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT                (V4L2_CID_FIMC_IS_BASE + 404)
+enum is_image_effect {
+       IS_IMAGE_EFFECT_DISABLE,
+       IS_IMAGE_EFFECT_MONOCHROME,
+       IS_IMAGE_EFFECT_NEGATIVE_MONO,
+       IS_IMAGE_EFFECT_NEGATIVE_COLOR,
+       IS_IMAGE_EFFECT_SEPIA,
+       IS_IMAGE_EFFECT_SEPIA_CB,
+       IS_IMAGE_EFFECT_SEPIA_CR,
+       IS_IMAGE_EFFECT_NEGATIVE,
+       IS_IMAGE_EFFECT_ARTFREEZE,
+       IS_IMAGE_EFFECT_EMBOSSING,
+       IS_IMAGE_EFFECT_SILHOUETTE,
+       IS_IMAGE_EFFECT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISO                 (V4L2_CID_FIMC_IS_BASE + 405)
+enum is_iso {
+       IS_ISO_AUTO,
+       IS_ISO_50,
+       IS_ISO_100,
+       IS_ISO_200,
+       IS_ISO_400,
+       IS_ISO_800,
+       IS_ISO_1600,
+       IS_ISO_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_CONTRAST            (V4L2_CID_FIMC_IS_BASE + 406)
+enum is_contrast {
+       IS_CONTRAST_AUTO,
+       IS_CONTRAST_MINUS_2,
+       IS_CONTRAST_MINUS_1,
+       IS_CONTRAST_DEFAULT,
+       IS_CONTRAST_PLUS_1,
+       IS_CONTRAST_PLUS_2,
+       IS_CONTRAST_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SATURATION          (V4L2_CID_FIMC_IS_BASE + 407)
+enum is_saturation {
+       IS_SATURATION_MINUS_2,
+       IS_SATURATION_MINUS_1,
+       IS_SATURATION_DEFAULT,
+       IS_SATURATION_PLUS_1,
+       IS_SATURATION_PLUS_2,
+       IS_SATURATION_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SHARPNESS           (V4L2_CID_FIMC_IS_BASE + 408)
+enum is_sharpness {
+       IS_SHARPNESS_MINUS_2,
+       IS_SHARPNESS_MINUS_1,
+       IS_SHARPNESS_DEFAULT,
+       IS_SHARPNESS_PLUS_1,
+       IS_SHARPNESS_PLUS_2,
+       IS_SHARPNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_EXPOSURE            (V4L2_CID_FIMC_IS_BASE + 409)
+enum is_exposure {
+       IS_EXPOSURE_MINUS_4,
+       IS_EXPOSURE_MINUS_3,
+       IS_EXPOSURE_MINUS_2,
+       IS_EXPOSURE_MINUS_1,
+       IS_EXPOSURE_DEFAULT,
+       IS_EXPOSURE_PLUS_1,
+       IS_EXPOSURE_PLUS_2,
+       IS_EXPOSURE_PLUS_3,
+       IS_EXPOSURE_PLUS_4,
+       IS_EXPOSURE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_BRIGHTNESS          (V4L2_CID_FIMC_IS_BASE + 410)
+enum is_brightness {
+       IS_BRIGHTNESS_MINUS_2,
+       IS_BRIGHTNESS_MINUS_1,
+       IS_BRIGHTNESS_DEFAULT,
+       IS_BRIGHTNESS_PLUS_1,
+       IS_BRIGHTNESS_PLUS_2,
+       IS_BRIGHTNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_HUE                 (V4L2_CID_FIMC_IS_BASE + 411)
+enum is_hue {
+       IS_HUE_MINUS_2,
+       IS_HUE_MINUS_1,
+       IS_HUE_DEFAULT,
+       IS_HUE_PLUS_1,
+       IS_HUE_PLUS_2,
+       IS_HUE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_METERING            (V4L2_CID_FIMC_IS_BASE + 412)
+enum is_metering {
+       IS_METERING_AVERAGE,
+       IS_METERING_SPOT,
+       IS_METERING_MATRIX,
+       IS_METERING_CENTER,
+       IS_METERING_MAX
+};
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500)
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X   (V4L2_CID_FIMC_IS_BASE + 502)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y   (V4L2_CID_FIMC_IS_BASE + 503)
+
+#define V4L2_CID_IS_CAMERA_AFC_MODE            (V4L2_CID_FIMC_IS_BASE + 413)
+enum is_afc_mode {
+       IS_AFC_DISABLE,
+       IS_AFC_AUTO,
+       IS_AFC_MANUAL_50HZ,
+       IS_AFC_MANUAL_60HZ,
+       IS_AFC_MAX
+};
+
+#define V4L2_CID_IS_AWB_LOCK_UNLOCK            (V4L2_CID_FIMC_IS_BASE + 496)
+enum is_awb_lock_unlock {
+       IS_AWB_LOCK,
+       IS_AWB_UNLOCK,
+       IS_AWB_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_AE_LOCK_UNLOCK             (V4L2_CID_FIMC_IS_BASE + 497)
+enum is_ae_lock_unlock {
+       IS_AE_LOCK,
+       IS_AE_UNLOCK,
+       IS_AE_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_FD_GET_FACE_COUNT                  (V4L2_CID_FIMC_IS_BASE + 600)
+#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 601)
+#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE             (V4L2_CID_FIMC_IS_BASE + 602)
+#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL            (V4L2_CID_FIMC_IS_BASE + 603)
+#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL            (V4L2_CID_FIMC_IS_BASE + 604)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X              (V4L2_CID_FIMC_IS_BASE + 605)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y              (V4L2_CID_FIMC_IS_BASE + 606)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X          (V4L2_CID_FIMC_IS_BASE + 607)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y          (V4L2_CID_FIMC_IS_BASE + 608)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X          (V4L2_CID_FIMC_IS_BASE + 609)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y          (V4L2_CID_FIMC_IS_BASE + 610)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X      (V4L2_CID_FIMC_IS_BASE + 611)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y      (V4L2_CID_FIMC_IS_BASE + 612)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X         (V4L2_CID_FIMC_IS_BASE + 613)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y         (V4L2_CID_FIMC_IS_BASE + 614)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X     (V4L2_CID_FIMC_IS_BASE + 615)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y     (V4L2_CID_FIMC_IS_BASE + 616)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X             (V4L2_CID_FIMC_IS_BASE + 617)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y             (V4L2_CID_FIMC_IS_BASE + 618)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X         (V4L2_CID_FIMC_IS_BASE + 619)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y         (V4L2_CID_FIMC_IS_BASE + 620)
+#define V4L2_CID_IS_FD_GET_ANGLE                       (V4L2_CID_FIMC_IS_BASE + 621)
+#define V4L2_CID_IS_FD_GET_YAW_ANGLE                   (V4L2_CID_FIMC_IS_BASE + 622)
+#define V4L2_CID_IS_FD_GET_NEXT                                (V4L2_CID_FIMC_IS_BASE + 623)
+#define V4L2_CID_IS_FD_GET_DATA                                (V4L2_CID_FIMC_IS_BASE + 624)
+
+#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER             (V4L2_CID_FIMC_IS_BASE + 650)
+#define V4L2_CID_IS_FD_SET_ROLL_ANGLE                  (V4L2_CID_FIMC_IS_BASE + 651)
+enum is_fd_roll_angle {
+       /* 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_BASIC          = 0,
+       /* 0, 30, 0, -30, 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_PRECISE_BASIC  = 1,
+       /* 0, 90, 0, -90 */
+       IS_FD_ROLL_ANGLE_SIDES          = 2,
+       /* 0, 90, 0, -90 0, 45, 0, -45 */
+       IS_FD_ROLL_ANGLE_PRECISE_SIDES  = 3,
+       /* 0, 90, 0, -90, 0, 180 */
+       IS_FD_ROLL_ANGLE_FULL           = 4,
+       /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */
+       IS_FD_ROLL_ANGLE_PRECISE_FULL   = 5,
+};
+
+#define V4L2_CID_IS_FD_SET_YAW_ANGLE                   (V4L2_CID_FIMC_IS_BASE + 652)
+enum is_fd_yaw_angle {
+       IS_FD_YAW_ANGLE_0       = 0,
+       IS_FD_YAW_ANGLE_45      = 1,
+       IS_FD_YAW_ANGLE_90      = 2,
+       IS_FD_YAW_ANGLE_45_90   = 3,
+};
+
+#define V4L2_CID_IS_FD_SET_SMILE_MODE                  (V4L2_CID_FIMC_IS_BASE + 653)
+enum is_fd_smile_mode {
+       IS_FD_SMILE_MODE_DISABLE        = 0,
+       IS_FD_SMILE_MODE_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_BLINK_MODE                  (V4L2_CID_FIMC_IS_BASE + 654)
+enum is_fd_blink_mode {
+       IS_FD_BLINK_MODE_DISABLE        = 0,
+       IS_FD_BLINK_MODE_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE             (V4L2_CID_FIMC_IS_BASE + 655)
+enum is_fd_eye_detect_mode {
+       IS_FD_EYE_DETECT_DISABLE        = 0,
+       IS_FD_EYE_DETECT_ENABLE         = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE           (V4L2_CID_FIMC_IS_BASE + 656)
+enum is_fd_mouth_detect_mode {
+       IS_FD_MOUTH_DETECT_DISABLE      = 0,
+       IS_FD_MOUTH_DETECT_ENABLE       = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE            (V4L2_CID_FIMC_IS_BASE + 657)
+enum is_fd_orientation_mode {
+       IS_FD_ORIENTATION_DISABLE       = 0,
+       IS_FD_ORIENTATION_ENABLE        = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION                 (V4L2_CID_FIMC_IS_BASE + 658)
+#define V4L2_CID_IS_FD_SET_DATA_ADDRESS                        (V4L2_CID_FIMC_IS_BASE + 659)
+
+#define V4L2_CID_IS_SET_ISP                    (V4L2_CID_FIMC_IS_BASE + 440)
+enum is_isp_bypass_mode {
+       IS_ISP_BYPASS_DISABLE,
+       IS_ISP_BYPASS_ENABLE,
+       IS_ISP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DRC                    (V4L2_CID_FIMC_IS_BASE + 441)
+enum is_drc_bypass_mode {
+       IS_DRC_BYPASS_DISABLE,
+       IS_DRC_BYPASS_ENABLE,
+       IS_DRC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_FD                     (V4L2_CID_FIMC_IS_BASE + 442)
+enum is_fd_bypass_mode {
+       IS_FD_BYPASS_DISABLE,
+       IS_FD_BYPASS_ENABLE,
+       IS_FD_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_ODC                    (V4L2_CID_FIMC_IS_BASE + 443)
+enum is_odc_bypass_mode {
+       IS_ODC_BYPASS_DISABLE,
+       IS_ODC_BYPASS_ENABLE,
+       IS_ODC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DIS                    (V4L2_CID_FIMC_IS_BASE + 444)
+enum is_dis_bypass_mode {
+       IS_DIS_BYPASS_DISABLE,
+       IS_DIS_BYPASS_ENABLE,
+       IS_DIS_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_3DNR                   (V4L2_CID_FIMC_IS_BASE + 445)
+enum is_tdnr_bypass_mode {
+       IS_TDNR_BYPASS_DISABLE,
+       IS_TDNR_BYPASS_ENABLE,
+       IS_TDNR_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERC                        (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerc_bypass_mode {
+       IS_SCALERC_BYPASS_DISABLE,
+       IS_SCALERC_BYPASS_ENABLE,
+       IS_SCALERC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERP                        (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerp_bypass_mode {
+       IS_SCALERP_BYPASS_DISABLE,
+       IS_SCALERP_BYPASS_ENABLE,
+       IS_SCALERP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_ROTATION_MODE              (V4L2_CID_FIMC_IS_BASE + 450)
+enum is_rotation_mode {
+       IS_ROTATION_0,
+       IS_ROTATION_90,
+       IS_ROTATION_180,
+       IS_ROTATION_270,
+       IS_ROTATION_MAX
+};
+
+#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE                (V4L2_CID_FIMC_IS_BASE + 451)
+enum is_tdnr_1st_frame_mode {
+       IS_TDNR_1ST_FRAME_NOPROCESSING,
+       IS_TDNR_1ST_FRAME_2DNR,
+       IS_TDNR_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X   (V4L2_CID_FIMC_IS_BASE + 452)
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y   (V4L2_CID_FIMC_IS_BASE + 453)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X       (V4L2_CID_FIMC_IS_BASE + 454)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y       (V4L2_CID_FIMC_IS_BASE + 455)
+
+#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME                (V4L2_CID_FIMC_IS_BASE + 456)
+#define V4L2_CID_IS_CAMERA_EXIF_FLASH          (V4L2_CID_FIMC_IS_BASE + 457)
+#define V4L2_CID_IS_CAMERA_EXIF_ISO            (V4L2_CID_FIMC_IS_BASE + 458)
+#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED   (V4L2_CID_FIMC_IS_BASE + 459)
+#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS     (V4L2_CID_FIMC_IS_BASE + 460)
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT       (V4L2_CID_FIMC_IS_BASE + 461)
+enum is_isp_sel_input {
+       IS_ISP_INPUT_OTF,
+       IS_ISP_INPUT_DMA1,
+       IS_ISP_INPUT_DMA2,
+       IS_ISP_INPUT_DMA12,
+       IS_ISP_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT      (V4L2_CID_FIMC_IS_BASE + 462)
+enum is_isp_sel_output {
+       IS_ISP_OUTPUT_OTF,
+       IS_ISP_OUTPUT_DMA1,
+       IS_ISP_OUTPUT_DMA2,
+       IS_ISP_OUTPUT_DMA12,
+       IS_ISP_OUTPUT_OTF_DMA1,
+       IS_ISP_OUTPUT_OTF_DMA2,
+       IS_ISP_OUTPUT_OTF_DMA12,
+       IS_ISP_OUTPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT       (V4L2_CID_FIMC_IS_BASE + 463)
+enum is_drc_sel_input {
+       IS_DRC_INPUT_OTF,
+       IS_DRC_INPUT_DMA,
+       IS_DRC_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT                (V4L2_CID_FIMC_IS_BASE + 464)
+enum is_fd_sel_input {
+       IS_FD_INPUT_OTF,
+       IS_FD_INPUT_DMA,
+       IS_FD_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_INIT_WIDTH          (V4L2_CID_FIMC_IS_BASE + 465)
+#define V4L2_CID_IS_CAMERA_INIT_HEIGHT         (V4L2_CID_FIMC_IS_BASE + 466)
+
+#define V4L2_CID_IS_CMD_ISP                    (V4L2_CID_FIMC_IS_BASE + 467)
+enum is_isp_cmd_mode {
+       IS_ISP_COMMAND_STOP,
+       IS_ISP_COMMAND_START,
+       IS_ISP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DRC                    (V4L2_CID_FIMC_IS_BASE + 468)
+enum is_drc_cmd_mode {
+       IS_DRC_COMMAND_STOP,
+       IS_DRC_COMMAND_START,
+       IS_DRC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_FD                     (V4L2_CID_FIMC_IS_BASE + 469)
+enum is_fd_cmd_mode {
+       IS_FD_COMMAND_STOP,
+       IS_FD_COMMAND_START,
+       IS_FD_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_ODC                    (V4L2_CID_FIMC_IS_BASE + 470)
+enum is_odc_cmd_mode {
+       IS_ODC_COMMAND_STOP,
+       IS_ODC_COMMAND_START,
+       IS_ODC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DIS                    (V4L2_CID_FIMC_IS_BASE + 471)
+enum is_dis_cmd_mode {
+       IS_DIS_COMMAND_STOP,
+       IS_DIS_COMMAND_START,
+       IS_DIS_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_TDNR                   (V4L2_CID_FIMC_IS_BASE + 472)
+enum is_tdnr_cmd_mode {
+       IS_TDNR_COMMAND_STOP,
+       IS_TDNR_COMMAND_START,
+       IS_TDNR_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERC                        (V4L2_CID_FIMC_IS_BASE + 473)
+enum is_scalerc_cmd_mode {
+       IS_SCALERC_COMMAND_STOP,
+       IS_SCALERC_COMMAND_START,
+       IS_SCALERC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERP                        (V4L2_CID_FIMC_IS_BASE + 474)
+enum is_scalerp_cmd_mode {
+       IS_SCALERP_COMMAND_STOP,
+       IS_SCALERP_COMMAND_START,
+       IS_SCALERP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_X                (V4L2_CID_FIMC_IS_BASE + 480)
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y                (V4L2_CID_FIMC_IS_BASE + 481)
+#define V4L2_CID_IS_GET_SENSOR_WIDTH           (V4L2_CID_FIMC_IS_BASE + 482)
+#define V4L2_CID_IS_GET_SENSOR_HEIGHT          (V4L2_CID_FIMC_IS_BASE + 483)
+
+#define V4L2_CID_IS_GET_FRAME_VALID            (V4L2_CID_FIMC_IS_BASE + 484)
+#define V4L2_CID_IS_SET_FRAME_VALID            (V4L2_CID_FIMC_IS_BASE + 485)
+#define V4L2_CID_IS_GET_FRAME_BADMARK          (V4L2_CID_FIMC_IS_BASE + 486)
+#define V4L2_CID_IS_SET_FRAME_BADMARK          (V4L2_CID_FIMC_IS_BASE + 487)
+#define V4L2_CID_IS_GET_FRAME_CAPTURED         (V4L2_CID_FIMC_IS_BASE + 488)
+#define V4L2_CID_IS_SET_FRAME_CAPTURED         (V4L2_CID_FIMC_IS_BASE + 489)
+#define V4L2_CID_IS_SET_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 490)
+#define V4L2_CID_IS_GET_FRAME_NUMBER           (V4L2_CID_FIMC_IS_BASE + 491)
+#define V4L2_CID_IS_CLEAR_FRAME_NUMBER         (V4L2_CID_FIMC_IS_BASE + 492)
+#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER    (V4L2_CID_FIMC_IS_BASE + 493)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM         (V4L2_CID_FIMC_IS_BASE + 494)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS     (V4L2_CID_FIMC_IS_BASE + 495)
+
+#define V4L2_CID_IS_ZOOM_STATE                 (V4L2_CID_FIMC_IS_BASE + 660)
+#define V4L2_CID_IS_ZOOM_MAX_LEVEL             (V4L2_CID_FIMC_IS_BASE + 661)
+#define V4L2_CID_IS_ZOOM                       (V4L2_CID_FIMC_IS_BASE + 662)
+#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR       (V4L2_CID_FIMC_IS_BASE + 663)
+
+#define V4L2_CID_IS_TUNE_SEL_ENTRY             (V4L2_CID_FIMC_IS_TUNE_BASE)
+#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE       (V4L2_CID_FIMC_IS_TUNE_BASE + 1)
+#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN    (V4L2_CID_FIMC_IS_TUNE_BASE + 2)
+#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE     (V4L2_CID_FIMC_IS_TUNE_BASE + 3)
+#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS   (V4L2_CID_FIMC_IS_TUNE_BASE + 4)
+
+enum v4l2_blur {
+       BLUR_LEVEL_0 = 0,
+       BLUR_LEVEL_1,
+       BLUR_LEVEL_2,
+       BLUR_LEVEL_3,
+       BLUR_LEVEL_MAX,
+};
+
+#if 1
+#define V4L2_CID_CAMERA_SCENE_MODE             (V4L2_CID_PRIVATE_BASE + 70)
+typedef enum {
+       SCENE_MODE_BASE,
+       SCENE_MODE_NONE,
+       SCENE_MODE_PORTRAIT,
+       SCENE_MODE_NIGHTSHOT,
+       SCENE_MODE_BACK_LIGHT,
+       SCENE_MODE_LANDSCAPE,
+       SCENE_MODE_SPORTS,
+       SCENE_MODE_PARTY_INDOOR,
+       SCENE_MODE_BEACH_SNOW,
+       SCENE_MODE_SUNSET,
+       SCENE_MODE_DUSK_DAWN,
+       SCENE_MODE_FALL_COLOR,
+       SCENE_MODE_FIREWORKS,
+       SCENE_MODE_TEXT,
+       SCENE_MODE_CANDLE_LIGHT,
+       SCENE_MODE_LOW_LIGHT,
+       SCENE_MODE_MAX,
+} cam_scene_mode;
+
+#define V4L2_CID_CAMERA_FLASH_MODE             (V4L2_CID_PRIVATE_BASE+71)
+enum v4l2_flash_mode {
+       FLASH_MODE_BASE,
+       FLASH_MODE_OFF,
+       FLASH_MODE_AUTO,
+       FLASH_MODE_ON,
+       FLASH_MODE_TORCH,
+       FLASH_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BRIGHTNESS             (V4L2_CID_PRIVATE_BASE+72)
+enum v4l2_ev_mode {
+       EV_MINUS_4      = -4,
+       EV_MINUS_3      = -3,
+       EV_MINUS_2      = -2,
+       EV_MINUS_1      = -1,
+       EV_DEFAULT      = 0,
+       EV_PLUS_1       = 1,
+       EV_PLUS_2       = 2,
+       EV_PLUS_3       = 3,
+       EV_PLUS_4       = 4,
+       EV_MAX,
+};
+
+#define V4L2_CID_CAMERA_WHITE_BALANCE  (V4L2_CID_PRIVATE_BASE+73)
+enum v4l2_wb_mode {
+       WHITE_BALANCE_BASE = 0,
+       WHITE_BALANCE_AUTO,
+       WHITE_BALANCE_SUNNY,
+       WHITE_BALANCE_CLOUDY,
+       WHITE_BALANCE_TUNGSTEN,
+       WHITE_BALANCE_FLUORESCENT,
+       WHITE_BALANCE_MAX,
+};
+
+enum v4l2_exposure {
+       EXPOSURE_MINUS_6 = -6,
+       EXPOSURE_MINUS_5 = -5,
+       EXPOSURE_MINUS_4 = -4,
+       EXPOSURE_MINUS_3 = -3,
+       EXPOSURE_MINUS_2 = -2,
+       EXPOSURE_MINUS_1 = -1,
+       EXPOSURE_DEFAULT = 0,
+       EXPOSURE_PLUS_1 = 1,
+       EXPOSURE_PLUS_2 = 2,
+       EXPOSURE_PLUS_3 = 3,
+       EXPOSURE_PLUS_4 = 4,
+       EXPOSURE_PLUS_5 = 5,
+       EXPOSURE_PLUS_6 = 6,
+       EXPOSURE_MAX,
+};
+
+#define V4L2_CID_CAMERA_EFFECT                 (V4L2_CID_PRIVATE_BASE + 74)
+enum v4l2_effect_mode {
+       IMAGE_EFFECT_BASE = 0,
+       IMAGE_EFFECT_NONE,
+       IMAGE_EFFECT_BNW,
+       IMAGE_EFFECT_SEPIA,
+       IMAGE_EFFECT_AQUA,
+       IMAGE_EFFECT_ANTIQUE,
+       IMAGE_EFFECT_NEGATIVE,
+       IMAGE_EFFECT_SHARPEN,
+       IMAGE_EFFECT_SKETCH,
+       IMAGE_EFFECT_WASHED,
+       IMAGE_EFFECT_VINTAGE_WARM,
+       IMAGE_EFFECT_VINTAGE_COLD,
+       IMAGE_EFFECT_SOLARIZE,
+       IMAGE_EFFECT_POSTERIZE,
+       IMAGE_EFFECT_POINT_BLUE,
+       IMAGE_EFFECT_POINT_RED_YELLOW,
+       IMAGE_EFFECT_POINT_COLOR_3,
+       IMAGE_EFFECT_POINT_GREEN,
+       IMAGE_EFFECT_POINT_RED,
+       IMAGE_EFFECT_POINT_YELLOW,
+       IMAGE_EFFECT_CARTOONIZE,
+       IMAGE_EFFECT_MAX,
+};
+
+#define V4L2_CID_CAMERA_ISO                            (V4L2_CID_PRIVATE_BASE + 75)
+enum v4l2_iso_mode {
+       ISO_AUTO = 0,
+       ISO_50,
+       ISO_100,
+       ISO_200,
+       ISO_400,
+       ISO_800,
+       ISO_1600,
+       ISO_SPORTS,
+       ISO_NIGHT,
+       ISO_MOVIE,
+       ISO_MAX,
+};
+
+#define V4L2_CID_CAMERA_METERING                       (V4L2_CID_PRIVATE_BASE + 76)
+enum v4l2_metering_mode {
+       METERING_BASE = 0,
+       METERING_MATRIX,
+       METERING_CENTER,
+       METERING_SPOT,
+       METERING_MAX,
+};
+
+#define V4L2_CID_CAMERA_CONTRAST                       (V4L2_CID_PRIVATE_BASE + 77)
+enum v4l2_contrast_mode {
+       CONTRAST_MINUS_2 = 0,
+       CONTRAST_MINUS_1,
+       CONTRAST_DEFAULT,
+       CONTRAST_PLUS_1,
+       CONTRAST_PLUS_2,
+       CONTRAST_MAX,
+};
+
+#define V4L2_CID_CAMERA_SATURATION             (V4L2_CID_PRIVATE_BASE + 78)
+enum v4l2_saturation_mode {
+       SATURATION_MINUS_2 = 0,
+       SATURATION_MINUS_1,
+       SATURATION_DEFAULT,
+       SATURATION_PLUS_1,
+       SATURATION_PLUS_2,
+       SATURATION_MAX,
+};
+
+#define V4L2_CID_CAMERA_SHARPNESS              (V4L2_CID_PRIVATE_BASE + 79)
+enum v4l2_sharpness_mode {
+       SHARPNESS_MINUS_2 = 0,
+       SHARPNESS_MINUS_1,
+       SHARPNESS_DEFAULT,
+       SHARPNESS_PLUS_1,
+       SHARPNESS_PLUS_2,
+       SHARPNESS_MAX,
+};
+
+#define V4L2_CID_CAMERA_WDR                            (V4L2_CID_PRIVATE_BASE + 80)
+enum v4l2_wdr_mode {
+       WDR_OFF,
+       WDR_ON,
+       WDR_MAX,
+};
+
+#define V4L2_CID_CAMERA_ANTI_SHAKE             (V4L2_CID_PRIVATE_BASE + 81)
+enum v4l2_anti_shake_mode {
+       ANTI_SHAKE_OFF,
+       ANTI_SHAKE_STILL_ON,
+       ANTI_SHAKE_MOVIE_ON,
+       ANTI_SHAKE_MAX,
+};
+
+#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP            (V4L2_CID_PRIVATE_BASE + 82)
+enum v4l2_touch_af {
+       TOUCH_AF_STOP = 0,
+       TOUCH_AF_START,
+       TOUCH_AF_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO             (V4L2_CID_PRIVATE_BASE + 83)
+enum v4l2_smart_auto {
+       SMART_AUTO_OFF = 0,
+       SMART_AUTO_ON,
+       SMART_AUTO_MAX,
+};
+
+#define V4L2_CID_CAMERA_VINTAGE_MODE           (V4L2_CID_PRIVATE_BASE + 84)
+enum v4l2_vintage_mode {
+       VINTAGE_MODE_BASE,
+       VINTAGE_MODE_OFF,
+       VINTAGE_MODE_NORMAL,
+       VINTAGE_MODE_WARM,
+       VINTAGE_MODE_COOL,
+       VINTAGE_MODE_BNW,
+       VINTAGE_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_JPEG_QUALITY           (V4L2_CID_PRIVATE_BASE + 85)
+#define V4L2_CID_CAMERA_CAPTURE_THUMB (V4L2_CID_PRIVATE_BASE + 86)
+#define V4L2_CID_CAMERA_YUV_SNAPSHOT   (V4L2_CID_PRIVATE_BASE + 87)
+#define V4L2_CID_CAMERA_LOW_LIGHT_MODE (V4L2_CID_PRIVATE_BASE + 88)
+#define V4L2_CID_CAMERA_GPS_LATITUDE           (V4L2_CID_CAMERA_CLASS_BASE + 30)
+/* (V4L2_CID_PRIVATE_BASE + 87) */
+#define V4L2_CID_CAMERA_GPS_LONGITUDE          (V4L2_CID_CAMERA_CLASS_BASE + 31)
+/* (V4L2_CID_PRIVATE_BASE + 88) */
+#define V4L2_CID_CAMERA_GPS_TIMESTAMP          (V4L2_CID_CAMERA_CLASS_BASE + 32)
+/* (V4L2_CID_PRIVATE_BASE + 89)*/
+#define V4L2_CID_CAMERA_GPS_ALTITUDE           (V4L2_CID_CAMERA_CLASS_BASE + 33)
+#define V4L2_CID_CAMERA_EXIF_TIME_INFO         (V4L2_CID_CAMERA_CLASS_BASE + 34)
+#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD   (V4L2_CID_CAMERA_CLASS_BASE + 35)
+
+#define V4L2_CID_FOCUS_AUTO_MODE               (V4L2_CID_CAMERA_CLASS_BASE + 36)
+enum  v4l2_focus_mode_type {
+       V4L2_FOCUS_AUTO_NORMAL = 0,
+       V4L2_FOCUS_AUTO_MACRO,
+       V4L2_FOCUS_AUTO_CONTINUOUS,
+       V4L2_FOCUS_AUTO_FACE_DETECTION,
+       V4L2_FOCUS_AUTO_RECTANGLE,
+       V4L2_FOCUS_AUTO_MAX,
+};
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_LEFT     (V4L2_CID_CAMERA_CLASS_BASE + 37)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_TOP      (V4L2_CID_CAMERA_CLASS_BASE + 38)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_WIDTH    (V4L2_CID_CAMERA_CLASS_BASE + 39)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_HEIGHT   (V4L2_CID_CAMERA_CLASS_BASE + 40)
+#define V4L2_CID_IMAGE_EFFECT                  (V4L2_CID_CAMERA_CLASS_BASE + 41)
+enum v4l2_image_effect {
+       V4L2_IMAGE_EFFECT_BASE = 0,
+       V4L2_IMAGE_EFFECT_NONE,
+       V4L2_IMAGE_EFFECT_BNW,
+       V4L2_IMAGE_EFFECT_SEPIA,
+       V4L2_IMAGE_EFFECT_AQUA,
+       V4L2_IMAGE_EFFECT_ANTIQUE,
+       V4L2_IMAGE_EFFECT_NEGATIVE,
+       V4L2_IMAGE_EFFECT_SHARPEN,
+       V4L2_IMAGE_EFFECT_SOLARIZE,
+       V4L2_IMAGE_EFFECT_MAX,
+};
+
+#define V4L2_CID_CAM_CONTRAST                  (V4L2_CID_CAMERA_CLASS_BASE + 42)
+enum v4l2_contrast {
+       V4L2_CONTRAST_AUTO,
+       V4L2_CONTRAST_MINUS_4,
+       V4L2_CONTRAST_MINUS_3,
+       V4L2_CONTRAST_MINUS_2,
+       V4L2_CONTRAST_MINUS_1,
+       V4L2_CONTRAST_DEFAULT,
+       V4L2_CONTRAST_PLUS_1,
+       V4L2_CONTRAST_PLUS_2,
+       V4L2_CONTRAST_PLUS_3,
+       V4L2_CONTRAST_PLUS_4,
+       V4L2_CONTRAST_MAX
+};
+
+#define V4L2_CID_CAM_SATURATION                        (V4L2_CID_CAMERA_CLASS_BASE + 43)
+enum v4l2_saturation {
+       V4L2_SATURATION_MINUS_3,
+       V4L2_SATURATION_MINUS_2,
+       V4L2_SATURATION_MINUS_1,
+       V4L2_SATURATION_DEFAULT,
+       V4L2_SATURATION_PLUS_1,
+       V4L2_SATURATION_PLUS_2,
+       V4L2_SATURATION_PLUS_3,
+       V4L2_SATURATION_MAX
+};
+
+#define V4L2_CID_CAM_SHARPNESS                 (V4L2_CID_CAMERA_CLASS_BASE + 44)
+enum v4l2_sharpness {
+       V4L2_SHARPNESS_MINUS_2,
+       V4L2_SHARPNESS_MINUS_1,
+       V4L2_SHARPNESS_DEFAULT,
+       V4L2_SHARPNESS_PLUS_1,
+       V4L2_SHARPNESS_PLUS_2,
+       V4L2_SHARPNESS_MAX,
+};
+
+#define V4L2_CID_CAM_BRIGHTNESS                        (V4L2_CID_CAMERA_CLASS_BASE + 45)
+enum v4l2_brightness {
+       V4L2_BRIGHTNESS_MINUS_9 = -9,
+       V4L2_BRIGHTNESS_MINUS_8 = -8,
+       V4L2_BRIGHTNESS_MINUS_7 = -7,
+       V4L2_BRIGHTNESS_MINUS_6 = -6,
+       V4L2_BRIGHTNESS_MINUS_5 = -5,
+       V4L2_BRIGHTNESS_MINUS_4 = -4,
+       V4L2_BRIGHTNESS_MINUS_3 = -3,
+       V4L2_BRIGHTNESS_MINUS_2 = -2,
+       V4L2_BRIGHTNESS_MINUS_1 = -1,
+       V4L2_BRIGHTNESS_DEFAULT = 0,
+       V4L2_BRIGHTNESS_PLUS_1 = 1,
+       V4L2_BRIGHTNESS_PLUS_2 = 2,
+       V4L2_BRIGHTNESS_PLUS_3 = 3,
+       V4L2_BRIGHTNESS_PLUS_4 = 4,
+       V4L2_BRIGHTNESS_PLUS_5 = 5,
+       V4L2_BRIGHTNESS_PLUS_6 = 6,
+       V4L2_BRIGHTNESS_PLUS_7 = 7,
+       V4L2_BRIGHTNESS_PLUS_8 = 8,
+       V4L2_BRIGHTNESS_PLUS_9 = 9,
+       V4L2_BRIGHTNESS_MAX,
+};
+
+#define V4L2_CID_CAPTURE                       (V4L2_CID_CAMERA_CLASS_BASE + 46)
+#define V4L2_CID_CAM_METERING                  (V4L2_CID_CAMERA_CLASS_BASE + 47)
+enum v4l2_cam_metering_mode {
+       V4L2_METERING_BASE = 0,
+       V4L2_METERING_MATRIX,
+       V4L2_METERING_CENTER,
+       V4L2_METERING_SPOT,
+       V4L2_METERING_MAX,
+};
+
+#define V4L2_CID_CAM_SET_AUTO_FOCUS            (V4L2_CID_CAMERA_CLASS_BASE + 48)
+enum v4l2_cam_auto_focus {
+       V4L2_AUTO_FOCUS_OFF = 0,
+       V4L2_AUTO_FOCUS_ON,
+       V4L2_AUTO_FOCUS_MAX,
+};
+
+#define V4L2_CID_CAM_FRAME_RATE                        (V4L2_CID_CAMERA_CLASS_BASE + 49)
+typedef enum v4l2_cam_frame_rate {
+       FRAME_RATE_AUTO = 0,
+       FRAME_RATE_7 = 7,
+       FRAME_RATE_15 = 15,
+       FRAME_RATE_20 = 20,
+       FRAME_RATE_25 = 25,
+       FRAME_RATE_30 = 30,
+       FRAME_RATE_60 = 60,
+       FRAME_RATE_120 = 120,
+       FRAME_RATE_MAX,
+}cam_frame_rate;
+
+#define V4L2_CID_CAM_OBJECT_POSITION_X         (V4L2_CID_CAMERA_CLASS_BASE + 50)
+#define V4L2_CID_CAM_OBJECT_POSITION_Y         (V4L2_CID_CAMERA_CLASS_BASE + 51)
+#define V4L2_CID_CAM_FACE_DETECTION            (V4L2_CID_CAMERA_CLASS_BASE + 52)
+enum v4l2_cam_face_detection {
+       V4L2_FACE_DETECTION_OFF = 0,
+       V4L2_FACE_DETECTION_ON,
+       V4L2_FACE_DETECTION_NOLINE,
+       V4L2_FACE_DETECTION_ON_BEAUTY,
+       V4L2_FACE_DETECTION_NORMAL,
+       V4L2_FACE_DETECTION_SMILE_SHOT,
+       V4L2_FACE_DETECTION_BLINK,
+       V4L2_FACE_DETECTION_MAX,
+};
+
+#define V4L2_CID_CAM_WDR                       (V4L2_CID_CAMERA_CLASS_BASE + 53)
+enum v4l2_cam_wdr_mode {
+    V4L2_WDR_OFF = 0,
+    V4L2_WDR_ON,
+    V4L2_WDR_MAX,
+};
+#define V4L2_CID_CAMERA_SENSOR_MODE            (V4L2_CID_CAMERA_CLASS_BASE+54)
+typedef enum v4l2_cam_sensor_mode {
+    V4L2_SENSOR_CAMERA,
+    V4L2_SENSOR_MOVIE,
+    V4L2_SENSOR_MAX,
+}cam_sensor_mode;
+
+#define V4L2_CID_JPEG_QUALITY                  (V4L2_CID_CAMERA_CLASS_BASE + 55)
+#define V4L2_CID_CAM_GET_ISO                   (V4L2_CID_CAMERA_CLASS_BASE + 56)
+#define V4L2_CID_CAM_GET_SHT_TIME              (V4L2_CID_CAMERA_CLASS_BASE + 57)
+#define V4L2_CID_CAM_AEAWB_LOCK_UNLOCK         (V4L2_CID_CAMERA_CLASS_BASE + 58)
+enum v4l2_cam_ae_awb_lockunlock {
+       V4L2_AE_UNLOCK_AWB_UNLOCK = 0,
+       V4L2_AE_LOCK_AWB_UNLOCK,
+       V4L2_AE_UNLOCK_AWB_LOCK,
+       V4L2_AE_LOCK_AWB_LOCK,
+       V4L2_AE_AWB_MAX
+};
+#define V4L2_CID_CAM_ZOOM                      (V4L2_CID_CAMERA_CLASS_BASE + 59)
+enum v4l2_cam_zoom_level {
+       V4L2_ZOOM_LEVEL_0 = 0,
+       V4L2_ZOOM_LEVEL_1,
+       V4L2_ZOOM_LEVEL_2,
+       V4L2_ZOOM_LEVEL_3,
+       V4L2_ZOOM_LEVEL_4,
+       V4L2_ZOOM_LEVEL_5,
+       V4L2_ZOOM_LEVEL_6,
+       V4L2_ZOOM_LEVEL_7,
+       V4L2_ZOOM_LEVEL_8,
+       V4L2_ZOOM_LEVEL_9,
+       V4L2_ZOOM_LEVEL_10,
+       V4L2_ZOOM_LEVEL_11,
+       V4L2_ZOOM_LEVEL_12,
+       V4L2_ZOOM_LEVEL_MAX = 31,
+};
+
+#define V4L2_CID_CAM_GET_FRAME_COUNT           (V4L2_CID_CAMERA_CLASS_BASE + 60)
+#define V4L2_CID_CAM_CAF_START_STOP            (V4L2_CID_CAMERA_CLASS_BASE + 61)
+enum v4l2_cam_caf_start_stop {
+       V4L2_CAF_STOP = 0,
+       V4L2_CAF_START,
+       V4L2_CAF_MAX,
+};
+#define V4L2_CID_CAM_FLASH_MODE                        (V4L2_CID_CAMERA_CLASS_BASE + 62)
+typedef enum v4l2_cam_flash_mode {
+       V4L2_FLASH_MODE_BASE,
+       V4L2_FLASH_MODE_OFF,
+       V4L2_FLASH_MODE_AUTO,
+       V4L2_FLASH_MODE_ON,
+       V4L2_FLASH_MODE_TORCH,
+       V4L2_FLASH_MODE_RED_EYE,
+       V4L2_FLASH_MODE_FILL_IN,
+       V4L2_FLASH_MODE_SLOW_SYNC,
+       V4L2_FLASH_MODE_RED_EYE_FIX,
+       V4L2_FLASH_MODE_FILL_IN_RED_EYE,
+       V4L2_FLASH_MODE_SMART,
+       V4L2_FLASH_MODE_1st_CURTAIN,
+       V4L2_FLASH_MODE_2nd_CURTAIN,
+       V4L2_FLASH_MODE_MAX,
+}cam_flash_mode;
+
+#define V4L2_CID_CAM_SINGLE_AUTO_FOCUS         (V4L2_CID_CAMERA_CLASS_BASE + 63)
+
+#define V4L2_CID_CAMERA_FACTORY_EEP_WRITE_VERSION              (V4L2_CID_CAMERA_CLASS_BASE + 64)
+#define V4L2_CID_CAMERA_FACTORY_EEP_WRITE_SN                   (V4L2_CID_CAMERA_CLASS_BASE + 65)
+
+#define V4L2_CID_CAMERA_FAST_CAPTURE   (V4L2_CID_CAMERA_CLASS_BASE + 66)
+
+#define V4L2_CID_CAMERA_TRANSFER       (V4L2_CID_CAMERA_CLASS_BASE + 67)
+
+#define V4L2_CID_CAMERA_S1_PUSH                (V4L2_CID_CAMERA_CLASS_BASE + 68)
+
+#define V4L2_CID_CAMERA_AUTO_FOCUS_DONE                        (V4L2_CID_CAMERA_CLASS_BASE+69)
+#define V4L2_CID_CAM_AUTO_FOCUS_RESULT         (V4L2_CID_CAMERA_CLASS_BASE + 70)
+enum v4l2_cam_af_status {
+       V4L2_CAMERA_AF_STATUS_IN_PROGRESS = 0,
+       V4L2_CAMERA_AF_STATUS_SUCCESS,
+       V4L2_CAMERA_AF_STATUS_FAIL,
+       V4L2_CAMERA_AF_STATUS_1ST_SUCCESS,
+       V4L2_CAMERA_AF_STATUS_MAX,
+};
+
+#define V4L2_CID_CAM_UPDATE_FW         (V4L2_CID_CAMERA_CLASS_BASE + 71)
+typedef enum {
+       CAM_FW_MODE_NONE,
+       CAM_FW_MODE_VERSION,
+       CAM_FW_MODE_UPDATE,
+       CAM_FW_MODE_DUMP,
+} cam_fw_mode;
+
+#define V4L2_CID_BURSTSHOT_PROC                (V4L2_CID_CAMERA_CLASS_BASE + 72)
+enum v4l2_burst_proc_state {
+       V4L2_INT_STATE_BURST_START = 0,
+       V4L2_INT_STATE_BURST_SYNC,
+       V4L2_INT_STATE_BURST_STOP,
+       V4L2_INT_STATE_BURST_SOUND,
+       V4L2_INT_STATE_BURST_STOP_REQ,
+};
+
+#define V4L2_CID_CAMERA_FOCUS_AREA_MODE        (V4L2_CID_CAMERA_CLASS_BASE + 73)
+typedef enum set_fouce_area {
+       V4L2_FOCUS_AREA_CENTER = 0,
+       V4L2_FOCUS_AREA_MULTI = 1,
+       V4L2_FOCUS_AREA_SMART_TOUCH = 2,
+       V4L2_FOCUS_AREA_FACE_DETECTION = 3,
+       V4L2_FOCUS_AREA_TRACKING = 4,
+       V4L2_FOCUS_AREA_ONE_TOUCH_SHOT = 5,
+} cam_focus_area;
+
+#define V4L2_CID_CAMERA_SHUTTER_SPEED          (V4L2_CID_CAMERA_CLASS_BASE + 74)
+#define V4L2_CID_CAMERA_F_NUMBER               (V4L2_CID_CAMERA_CLASS_BASE + 75)
+
+#define V4L2_CID_ISP_MAIN_FORMAT  (V4L2_CID_CAMERA_CLASS_BASE + 76)
+#define V4L2_CID_CONTINUESHOT_PROC     (V4L2_CID_CAMERA_CLASS_BASE + 77)
+enum v4l2_continuecshot_proc_state {
+       V4L2_INT_STATE_FRAME_SYNC = 0,
+       V4L2_INT_STATE_CAPTURE_SYNC,
+       V4L2_INT_STATE_CONTINUE_CANCEL,
+       V4L2_INT_STATE_CONTINUE_END,
+       V4L2_INT_STATE_START_CAPTURE,
+};
+
+#define V4L2_CID_EXIF_SHUTTER_SPEED_NUM (V4L2_CID_CAMERA_CLASS_BASE + 78)
+#define V4L2_CID_EXIF_SHUTTER_SPEED_DEN (V4L2_CID_CAMERA_CLASS_BASE + 79)
+
+#define V4L2_CID_EXIF_EXPOSURE_TIME_NUM (V4L2_CID_CAMERA_CLASS_BASE + 80)
+#define V4L2_CID_EXIF_EXPOSURE_TIME_DEN (V4L2_CID_CAMERA_CLASS_BASE + 81)
+
+#define V4L2_CID_EXIF_F_NUMBER (V4L2_CID_CAMERA_CLASS_BASE + 82)
+
+#define V4L2_CID_CAMERA_ZOOM                           (V4L2_CID_PRIVATE_BASE + 90)
+enum v4l2_zoom_level {
+       ZOOM_LEVEL_0 = 0,
+       ZOOM_LEVEL_1,
+       ZOOM_LEVEL_2,
+       ZOOM_LEVEL_3,
+       ZOOM_LEVEL_4,
+       ZOOM_LEVEL_5,
+       ZOOM_LEVEL_6,
+       ZOOM_LEVEL_7,
+       ZOOM_LEVEL_8,
+       ZOOM_LEVEL_9,
+       ZOOM_LEVEL_10,
+       ZOOM_LEVEL_11,
+       ZOOM_LEVEL_12,
+       ZOOM_LEVEL_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO_STATUS              (V4L2_CID_PRIVATE_BASE + 92)
+enum v4l2_smart_auto_status {
+       SMART_AUTO_STATUS_AUTO = 0,
+       SMART_AUTO_STATUS_LANDSCAPE,
+       SMART_AUTO_STATUS_PORTRAIT,
+       SMART_AUTO_STATUS_MACRO,
+       SMART_AUTO_STATUS_NIGHT,
+       SMART_AUTO_STATUS_PORTRAIT_NIGHT,
+       SMART_AUTO_STATUS_BACKLIT,
+       SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
+       SMART_AUTO_STATUS_ANTISHAKE,
+       SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
+       SMART_AUTO_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_AUTO_FOCUS         (V4L2_CID_PRIVATE_BASE + 93)
+enum v4l2_auto_focus {
+       AUTO_FOCUS_OFF = 0,
+       AUTO_FOCUS_ON,
+       AUTO_FOCUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_BEAUTY_SHOT            (V4L2_CID_PRIVATE_BASE + 94)
+enum v4l2_beauty_shot {
+       BEAUTY_SHOT_OFF = 0,
+       BEAUTY_SHOT_ON,
+       BEAUTY_SHOT_MAX,
+};
+
+#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK              (V4L2_CID_PRIVATE_BASE + 95)
+enum v4l2_ae_awb_lockunlock {
+       AE_UNLOCK_AWB_UNLOCK = 0,
+       AE_LOCK_AWB_UNLOCK,
+       AE_UNLOCK_AWB_LOCK,
+       AE_LOCK_AWB_LOCK,
+       AE_AWB_MAX
+};
+
+#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK  (V4L2_CID_PRIVATE_BASE + 96)
+enum v4l2_face_lock {
+       FACE_LOCK_OFF = 0,
+       FACE_LOCK_ON,
+       FIRST_FACE_TRACKING,
+       FACE_LOCK_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJECT_POSITION_X      (V4L2_CID_PRIVATE_BASE + 97)
+#define V4L2_CID_CAMERA_OBJECT_POSITION_Y      (V4L2_CID_PRIVATE_BASE + 98)
+#define V4L2_CID_CAMERA_FOCUS_MODE             (V4L2_CID_PRIVATE_BASE + 99)
+typedef enum {
+       FOCUS_MODE_AUTO = 0,
+       FOCUS_MODE_MACRO,
+       FOCUS_MODE_FACEDETECT,
+       FOCUS_MODE_AUTO_DEFAULT,
+       FOCUS_MODE_MACRO_DEFAULT,
+       FOCUS_MODE_FACEDETECT_DEFAULT,
+       FOCUS_MODE_INFINITY,
+       FOCUS_MODE_FIXED,
+       FOCUS_MODE_CONTINOUS,
+       FOCUS_MODE_CONTINOUS_PICTURE,
+       FOCUS_MODE_CONTINOUS_PICTURE_MACRO,
+       FOCUS_MODE_CONTINOUS_VIDEO,
+       FOCUS_MODE_TOUCH,
+       FOCUS_MODE_MAX,
+       FOCUS_MODE_DEFAULT = (1 << 8),
+} focus_mode;
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS    (V4L2_CID_PRIVATE_BASE + 100)
+enum v4l2_obj_tracking_status {
+       OBJECT_TRACKING_STATUS_BASE,
+       OBJECT_TRACKING_STATUS_PROGRESSING,
+       OBJECT_TRACKING_STATUS_SUCCESS,
+       OBJECT_TRACKING_STATUS_FAIL,
+       OBJECT_TRACKING_STATUS_MISSING,
+       OBJECT_TRACKING_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP        (V4L2_CID_PRIVATE_BASE + 101)
+enum v4l2_ot_start_stop {
+       OT_STOP = 0,
+       OT_START,
+       OT_MAX,
+};
+
+#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE + 102)
+enum v4l2_caf_start_stop {
+       CAF_STOP = 0,
+       CAF_START,
+       CAF_MAX,
+};
+
+#define V4L2_CID_CAMERA_ANTI_BANDING                                   (V4L2_CID_PRIVATE_BASE + 105)
+enum v4l2_anti_banding{
+       ANTI_BANDING_AUTO = 0,
+       ANTI_BANDING_50HZ = 1,
+       ANTI_BANDING_60HZ = 2,
+       ANTI_BANDING_OFF = 3,
+};
+
+#define V4L2_CID_CAMERA_SET_GAMMA      (V4L2_CID_PRIVATE_BASE + 106)
+enum v4l2_gamma_mode{
+       GAMMA_OFF = 0,
+       GAMMA_ON = 1,
+       GAMMA_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_SLOW_AE    (V4L2_CID_PRIVATE_BASE + 107)
+enum v4l2_slow_ae_mode{
+       SLOW_AE_OFF,
+       SLOW_AE_ON,
+       SLOW_AE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BATCH_REFLECTION                                       (V4L2_CID_PRIVATE_BASE + 108)
+#define V4L2_CID_CAMERA_EXIF_ORIENTATION                                       (V4L2_CID_PRIVATE_BASE + 109)
+#define V4L2_CID_CAMERA_GET_LUX                (V4L2_CID_PRIVATE_BASE + 110)
+/* s1_camera [ Defense process by ESD input ] */
+#define V4L2_CID_CAMERA_RESET                  (V4L2_CID_PRIVATE_BASE + 111)
+#define V4L2_CID_CAMERA_CHECK_DATALINE                                         (V4L2_CID_PRIVATE_BASE + 112)
+#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP                                    (V4L2_CID_PRIVATE_BASE + 113)
+
+#endif
+
+/* Modify NTTS1 */
+#if defined(CONFIG_ARIES_NTT)
+#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK                                    (V4L2_CID_PRIVATE_BASE + 114)
+#endif
+#define V4L2_CID_CAMERA_THUMBNAIL_NULL                                  (V4L2_CID_PRIVATE_BASE + 115)
+
+typedef enum {
+       STREAM_MODE_CAM_OFF,
+       STREAM_MODE_CAM_ON,
+       STREAM_MODE_MOVIE_OFF,
+       STREAM_MODE_MOVIE_ON,
+       STREAM_MODE_WAIT_OFF
+} stream_mode_t;
+
+#define V4L2_CID_CAMERA_EXIF_EXPTIME           (V4L2_CID_PRIVATE_BASE+117)
+#define V4L2_CID_CAMERA_CHECK_ESD              (V4L2_CID_PRIVATE_BASE+123)
+#define V4L2_CID_CAMERA_APP_CHECK              (V4L2_CID_PRIVATE_BASE+124)
+
+
+#define V4L2_CID_CAMERA_BUSFREQ_LOCK           (V4L2_CID_PRIVATE_BASE+125)
+#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK         (V4L2_CID_PRIVATE_BASE+126)
+
+/* control for post processing block in ISP */
+#define V4L2_CID_CAMERA_SET_ODC                                (V4L2_CID_PRIVATE_BASE + 127)
+enum set_odc_mode {
+       CAMERA_ODC_ON,
+       CAMERA_ODC_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_DIS                                (V4L2_CID_PRIVATE_BASE + 128)
+enum set_dis_mode {
+       CAMERA_DIS_ON,
+       CAMERA_DIS_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_3DNR                               (V4L2_CID_PRIVATE_BASE + 129)
+enum set_3dnr_mode {
+       CAMERA_3DNR_ON,
+       CAMERA_3DNR_OFF
+};
+#define V4L2_CID_EMBEDDEDDATA_ENABLE   (V4L2_CID_PRIVATE_BASE + 130)
+#define V4L2_CID_CAMERA_JPEG_RESOLUTION         (V4L2_CID_PRIVATE_BASE + 131)
+#define V4L2_CID_CAMERA_FACE_ZOOM  (V4L2_CID_PRIVATE_BASE + 132)
+enum v4l2_face_zoom {
+       FACE_ZOOM_STOP = 0,
+       FACE_ZOOM_START
+};
+
+#define V4L2_CID_CAMERA_BRACKET     (V4L2_CID_PRIVATE_BASE+134)
+enum v4l2_face_bracket_mode {
+       BRACKET_MODE_OFF = 0,
+       BRACKET_MODE_AEB,
+       BRACKET_MODE_WBB,
+       BRACKET_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BRACKET_AEB     (V4L2_CID_PRIVATE_BASE+135)
+enum v4l2_face_bracket_aeb_value {
+       BRACKET_AEB_VALUE0 = 0,
+       BRACKET_AEB_VALUE1,
+       BRACKET_AEB_VALUE2,
+       BRACKET_AEB_VALUE3,
+       BRACKET_AEB_VALUE4,
+       BRACKET_AEB_VALUE5,
+       BRACKET_AEB_VALUE6,
+};
+
+#define V4L2_CID_CAMERA_BRACKET_WBB     (V4L2_CID_PRIVATE_BASE+136)
+enum v4l2_face_bracket_wbb_value {
+       BRACKET_WBB_OFF = 0,
+       BRACKET_WBB_VALUE1 = 1,
+       BRACKET_WBB_VALUE2,
+       BRACKET_WBB_VALUE3,
+       BRACKET_WBB_VALUE4,
+       BRACKET_WBB_VALUE5,
+       BRACKET_WBB_VALUE6,
+};
+
+#define V4L2_CID_CAMERA_DRIVE_DIAL    (V4L2_CID_PRIVATE_BASE+137)
+enum v4l2_drive_dial {
+       DRIVEDIAL_SINGLE = 1,
+       DRIVEDIAL_BKT = 2,
+       DRIVEDIAL_CONTI_3 = 3,
+       DRIVEDIAL_CONTI_5 = 5,
+       DRIVEDIAL_CONTI_10 = 10,
+};
+
+enum v4l2_running_cap_mode {
+       RUNNING_MODE_SINGLE = 0,
+       RUNNING_MODE_CONTINUOUS,
+       RUNNING_MODE_CONTINUOUS_9FPS,
+       RUNNING_MODE_CONTINUOUS_5FPS,
+       RUNNING_MODE_BEST,
+       RUNNING_MODE_LOWLIGHT,
+       RUNNING_MODE_AE_BRACKET,
+       RUNNING_MODE_WB_BRACKET,
+       RUNNING_MODE_PW_BRACKET,
+       RUNNING_MODE_HDR,
+       RUNNING_MODE_BLINK,
+       RUNNING_MODE_RAW,
+       RUNNING_MODE_BURST,
+       RUNNING_MODE_BURST_10FPS,
+       RUNNING_MODE_BURST_15FPS,
+       RUNNING_MODE_BURST_30FPS,
+       RUNNING_MODE_SMART,
+       RUNNING_MODE_BULB,
+       RUNNING_MODE_CUSTOM_WB,
+       RUNNING_MODE_DUMP,
+       RUNNING_MODE_MAX
+};
+
+enum v4l2_continuous_mode {
+       CONTINUOUS_MODE_OFF = 0,
+       CONTINUOUS_MODE_ON,
+       CONTINUOUS_MODE_MAX,
+};
+
+enum v4l2_continuous_fps {
+       MULTI_CAPTURE_FPS_1 = 0,
+       MULTI_CAPTURE_FPS_10,
+       MULTI_CAPTURE_FPS_5,
+       MULTI_CAPTURE_FPS_3,
+       MULTI_CAPTURE_FPS_MAX,
+};
+
+enum v4l2_burst_mode {
+       BURST_MODE_OFF = 0,
+       BURST_MODE_ON,
+};
+
+enum v4l2_best_mode {
+       BEST_MODE_OFF = 0,
+       BEST_MODE_ON,
+       BEST_MODE_MAX,};
+
+enum v4l2_lowlight_mode {
+       LOWLIGHT_MODE_OFF = 0,
+       LOWLIGHT_MODE_ON,
+       LOWLIGHT_MODE_MAX,};
+
+enum v4l2_raw_mode {
+       RAW_MODE_OFF = 0,
+       RAW_MODE_ON,
+       RAW_MODE_MAX,};
+
+#define V4L2_CID_CAMERA_FD_EYE_BLINK_RESULT    (V4L2_CID_PRIVATE_BASE+138)
+
+#define V4L2_CID_CAMERA_OPTICAL_ZOOM_STEP      (V4L2_CID_PRIVATE_BASE + 139)
+#define V4L2_CID_CAMERA_OPTICAL_ZOOM_CTRL      (V4L2_CID_PRIVATE_BASE + 140)
+enum v4l2_optical_zoom_ctrl {
+       V4L2_OPTICAL_ZOOM_STOP,
+       V4L2_OPTICAL_ZOOM_TELE_START,
+       V4L2_OPTICAL_ZOOM_WIDE_START,
+       V4L2_OPTICAL_ZOOM_SLOW_TELE_START,
+       V4L2_OPTICAL_ZOOM_SLOW_WIDE_START,
+    V4L2_OPTICAL_ZOOM_PINCH_START,
+    V4L2_OPTICAL_ZOOM_PINCH_STOP,
+    V4L2_OPTICAL_ZOOM_NONE,
+};
+
+#define V4L2_CID_CAMERA_LDC    (V4L2_CID_PRIVATE_BASE+142)
+enum set_LDC_mode {
+       LDC_SET_OFF = 0,
+       LDC_SET_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_LSC    (V4L2_CID_PRIVATE_BASE+143)
+enum set_LSC_mode {
+       LSC_SET_OFF = 0,
+       LSC_SET_ON = 1,
+};
+
+/* If you would like to control AE and AWB lock with signle command,
+ * use V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK above.
+ */
+#define V4L2_CID_CAMERA_AE_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 144)
+enum v4l2_ae_lockunlock {
+       AE_UNLOCK = 0,
+       AE_LOCK,
+       AE_LOCK_MAX
+};
+
+#define V4L2_CID_CAMERA_AWB_LOCK_UNLOCK        (V4L2_CID_PRIVATE_BASE + 145)
+enum v4l2_awb_lockunlock {
+       AWB_UNLOCK = 0,
+       AWB_LOCK,
+       AWB_LOCK_MAX
+};
+
+#define V4L2_CID_CAMERA_SENSOR_OUTPUT_SIZE  (V4L2_CID_PRIVATE_BASE + 146)
+
+#define V4L2_CID_CAMERA_FACTORY_OIS    (V4L2_CID_PRIVATE_BASE+147)
+enum set_Factory_OIS {
+       FACTORY_OIS_RETURN_TO_CENTER = 0,
+       FACTORY_OIS_RUN = 1,
+       FACTORY_OIS_START = 2,
+       FACTORY_OIS_STOP = 3,
+       FACTORY_OIS_MODE_ON = 4,
+       FACTORY_OIS_MODE_OFF = 5,
+       FACTORY_OIS_LOG = 6,
+       FACTORY_OIS_ON = 7,
+       FACTORY_OIS_DECENTER_LOG = 8,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_ZOOM_RANGE_CHECK_DATA_MIN \
+       (V4L2_CID_PRIVATE_BASE+148)
+#define V4L2_CID_CAMERA_FACTORY_ZOOM_RANGE_CHECK_DATA_MAX \
+       (V4L2_CID_PRIVATE_BASE+149)
+
+#define V4L2_CID_CAMERA_CHECK_SENSOR_STATUS            (V4L2_CID_PRIVATE_BASE+150)
+#define V4L2_CID_CAMERA_DEFAULT_FOCUS_POSITION  (V4L2_CID_PRIVATE_BASE+151)
+
+#define V4L2_CID_CAMERA_FACTORY_ZOOM_SLOPE_CHECK_DATA_MIN \
+       (V4L2_CID_PRIVATE_BASE+152)
+#define V4L2_CID_CAMERA_FACTORY_ZOOM_SLOPE_CHECK_DATA_MAX \
+       (V4L2_CID_PRIVATE_BASE+153)
+#define V4L2_CID_CAMERA_FACTORY_ZOOM_STEP  (V4L2_CID_PRIVATE_BASE+154)
+#define V4L2_CID_CAMERA_FACTORY_ZOOM    (V4L2_CID_PRIVATE_BASE+155)
+enum set_Factory_Zoom {
+       FACTORY_ZOOM_MOVE_STEP = 0,
+       FACTORY_ZOOM_RANGE_CHECK_START = 1,
+       FACTORY_ZOOM_RANGE_CHECK_STOP = 2,
+       FACTORY_ZOOM_SLOPE_CHECK_START = 3,
+       FACTORY_ZOOM_SLOPE_CHECK_STOP = 4,
+       FACTORY_ZOOM_SET_RANGE_CHECK_DATA = 5,
+       FACTORY_ZOOM_SET_SLOPE_CHECK_DATA = 6,
+       FACTORY_ZOOM_STEP_TELE = 7,
+       FACTORY_ZOOM_STEP_WIDE = 8,
+       FACTORY_ZOOM_MOVE_END_CHECK = 9,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_MIN \
+       (V4L2_CID_PRIVATE_BASE+156)
+#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_MAX \
+       (V4L2_CID_PRIVATE_BASE+157)
+#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_NUM \
+       (V4L2_CID_PRIVATE_BASE+158)
+#define V4L2_CID_CAMERA_FACTORY_PUNT    (V4L2_CID_PRIVATE_BASE+159)
+enum set_Factory_Punt {
+       FACTORY_PUNT_RANGE_START = 0,
+       FACTORY_PUNT_RANGE_STOP = 1,
+       FACTORY_PUNT_SHORT_SCAN_DATA = 2,
+       FACTORY_PUNT_SHORT_SCAN_START = 3,
+       FACTORY_PUNT_SHORT_SCAN_STOP = 4,
+       FACTORY_PUNT_LONG_SCAN_DATA = 5,
+       FACTORY_PUNT_LONG_SCAN_START = 6,
+       FACTORY_PUNT_LONG_SCAN_STOP = 7,
+       FACTORY_PUNT_LOG = 8,
+       FACTORY_PUNT_SET_RANGE_DATA = 9,
+       FACTORY_PUNT_EEP_WRITE = 10,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_FAIL_STOP    (V4L2_CID_PRIVATE_BASE+160)
+enum set_Factory_Fail_Stop {
+       FACTORY_FAIL_STOP_ON = 0,
+       FACTORY_FAIL_STOP_OFF = 1,
+       FACTORY_FAIL_STOP_RUN = 2,
+       FACTORY_FAIL_STOP_STOP = 3,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_NODEFOCUS    (V4L2_CID_PRIVATE_BASE+161)
+enum set_Factory_NoDeFocus {
+       FACTORY_NODEFOCUSYES_ON = 0,
+       FACTORY_NODEFOCUSYES_OFF = 1,
+       FACTORY_NODEFOCUSYES_RUN = 2,
+       FACTORY_NODEFOCUSYES_STOP = 3,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_INTERPOLATION    (V4L2_CID_PRIVATE_BASE+162)
+enum set_Factory_Interpolation {
+       FACTORY_INTERPOLATION_USE = 0,
+       FACTORY_INTERPOLATION_RELEASE = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_DOWN_RESULT (V4L2_CID_PRIVATE_BASE+163)
+#define V4L2_CID_CAMERA_FACTORY_END_RESULT (V4L2_CID_PRIVATE_BASE+164)
+#define V4L2_CID_CAMERA_FACTORY_COMMON    (V4L2_CID_PRIVATE_BASE+165)
+enum set_Factory_Common {
+       FACTORY_FIRMWARE_DOWNLOAD = 0,
+       FACTORY_DOWNLOAD_CHECK = 1,
+       FACTORY_END_CHECK = 2,
+       FACTORY_COMMON_SET_FOCUS_ZONE_MACRO = 3,
+       FACTORY_FPS30_ON = 4,
+       FACTORY_FPS30_OFF = 5,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_VIB    (V4L2_CID_PRIVATE_BASE+166)
+enum set_Factory_Vib {
+       FACTORY_VIB_START = 0,
+       FACTORY_VIB_STOP = 1,
+       FACTORY_VIB_LOG = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_GYRO    (V4L2_CID_PRIVATE_BASE+167)
+enum set_Factory_Gyro {
+       FACTORY_GYRO_START = 0,
+       FACTORY_GYRO_STOP = 1,
+       FACTORY_GYRO_LOG = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_BACKLASH    (V4L2_CID_PRIVATE_BASE+168)
+enum set_Factory_Backlash {
+       FACTORY_BACKLASH_INPUT = 0,
+       FACTORY_BACKLASH_MAX_THR = 1,
+       FACTORY_BACKLASH_WIDE_RUN = 2,
+       FACTORY_BACKLASH_LOG = 3,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_AF_STEP_SET    (V4L2_CID_PRIVATE_BASE+169)
+#define V4L2_CID_CAMERA_FACTORY_AF_POSITION    (V4L2_CID_PRIVATE_BASE+170)
+#define V4L2_CID_CAMERA_FACTORY_AF_INT_RESULT (V4L2_CID_PRIVATE_BASE+171)
+#define V4L2_CID_CAMERA_FACTORY_AF    (V4L2_CID_PRIVATE_BASE+172)
+enum set_Factory_AF {
+       FACTORY_AF_LOCK_ON_SET = 0,
+       FACTORY_AF_LOCK_OFF_SET = 1,
+       FACTORY_AF_MOVE = 2,
+       FACTORY_AF_STEP_LOG = 3,
+       FACTORY_AF_LOCK_START = 4,
+       FACTORY_AF_LOCK_STOP = 5,
+       FACTORY_AF_FOCUS_LOG = 6,
+       FACTORY_AF_INT_SET = 7,
+       FACTORY_AF_SCAN_LIMIT_START = 8,
+       FACTORY_AF_SCAN_LIMIT_STOP = 10,
+       FACTORY_AF_SCAN_RANGE_START = 11,
+       FACTORY_AF_SCAN_RANGE_STOP = 12,
+       FACTORY_AF_STEP_SAVE = 13,
+       FACTORY_AF_LED_END_CHECK = 14,
+       FACTORY_AF_LED_LOG = 15,
+       FACTORY_AF_MOVE_END_CHECK = 16,
+       FACTORY_AF_SCAN_END_CHECK = 17,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_DEFOCUS_WIDE    (V4L2_CID_PRIVATE_BASE+173)
+#define V4L2_CID_CAMERA_FACTORY_DEFOCUS_TELE (V4L2_CID_PRIVATE_BASE+174)
+#define V4L2_CID_CAMERA_FACTORY_DEFOCUS    (V4L2_CID_PRIVATE_BASE+175)
+enum set_Factory_DeFocus {
+       FACTORY_DEFOCUS_RUN = 0,
+       FACTORY_DEFOCUS_STOP = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_RESOL_CAP    (V4L2_CID_PRIVATE_BASE+176)
+enum set_Factory_Resol_Cap {
+       FACTORY_CAP_COMP_ON = 0,
+       FACTORY_CAP_COMP_OFF = 1,
+       FACTORY_CAP_BARREL_ON = 2,
+       FACTORY_CAP_BARREL_OFF = 3,
+       FACTORY_CAP_BARREL_START = 4,
+       FACTORY_CAP_BARREL_STOP = 5,
+       FACTORY_CAP_COMP_START = 6,
+       FACTORY_CAP_COMP_STOP = 7,
+};
+
+#define V4L2_CID_CAMERA_SET_G_VALUE          (V4L2_CID_PRIVATE_BASE + 177)
+#define V4L2_CID_CAMERA_SET_B_VALUE          (V4L2_CID_PRIVATE_BASE + 178)
+#define V4L2_CID_CAMERA_SET_A_VALUE          (V4L2_CID_PRIVATE_BASE + 179)
+#define V4L2_CID_CAMERA_SET_M_VALUE          (V4L2_CID_PRIVATE_BASE + 180)
+#define V4L2_CID_CAMERA_SET_GBAM          (V4L2_CID_PRIVATE_BASE + 181)
+#define V4L2_CID_CAMERA_SET_K_VALUE          (V4L2_CID_PRIVATE_BASE + 182)
+#define V4L2_CID_CAMERA_SET_FLASH_EVC_STEP   (V4L2_CID_PRIVATE_BASE + 183)
+
+#define V4L2_CID_CAMERA_APERTURE_CMD (V4L2_CID_PRIVATE_BASE+184)
+enum set_Factory_Aperture_Cmd {
+       FACTORY_CMD_PREVIEW = 0,
+       FACTORY_CMD_CAPTURE = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_MIN (V4L2_CID_PRIVATE_BASE+185)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_MAX (V4L2_CID_PRIVATE_BASE+186)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_Y_MIN (V4L2_CID_PRIVATE_BASE+187)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_Y_MAX (V4L2_CID_PRIVATE_BASE+188)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_GAIN \
+       (V4L2_CID_PRIVATE_BASE+189)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_PEAK_X \
+       (V4L2_CID_PRIVATE_BASE+190)
+#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_PEAK_Y \
+       (V4L2_CID_PRIVATE_BASE+191)
+
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_X_MIN (V4L2_CID_PRIVATE_BASE+192)
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_X_MAX (V4L2_CID_PRIVATE_BASE+193)
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_Y_MIN (V4L2_CID_PRIVATE_BASE+194)
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_Y_MAX (V4L2_CID_PRIVATE_BASE+195)
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_PEAK_X \
+       (V4L2_CID_PRIVATE_BASE+196)
+#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_PEAK_Y \
+       (V4L2_CID_PRIVATE_BASE+197)
+
+#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_X_MIN \
+       (V4L2_CID_PRIVATE_BASE+198)
+#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_X_MAX \
+       (V4L2_CID_PRIVATE_BASE+199)
+#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_Y_MIN \
+       (V4L2_CID_PRIVATE_BASE+200)
+#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_Y_MAX \
+       (V4L2_CID_PRIVATE_BASE+202)
+
+#define V4L2_CID_CAMERA_FACTORY_TEST_NUMBER (V4L2_CID_PRIVATE_BASE+203)
+
+#define V4L2_CID_CAMERA_FACTORY_BACKLASH_COUNT (V4L2_CID_PRIVATE_BASE+204)
+#define V4L2_CID_CAMERA_FACTORY_BACKLASH_MAXTHRESHOLD \
+       (V4L2_CID_PRIVATE_BASE+205)
+
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_CTRL (V4L2_CID_PRIVATE_BASE + 206)
+enum set_Factory_Cap_Ctrl {
+       FACTORY_STILL_CAP_NORMAL = 0,
+       FACTORY_STILL_CAP_DUALCAP = 1,
+       FACTORY_DUAL_CAP_ON = 2,
+       FACTORY_DUAL_CAP_OFF = 3,
+};
+
+#define V4L2_CID_CAMERA_DUAL_POSTVIEW          (V4L2_CID_PRIVATE_BASE + 207)
+#define V4L2_CID_CAMERA_DUAL_CAPTURE           (V4L2_CID_PRIVATE_BASE + 208)
+#define V4L2_CID_CAMERA_SET_DUAL_CAPTURE       (V4L2_CID_PRIVATE_BASE + 209)
+#define V4L2_CID_CAMERA_DUAL_CAPTURE_MODE      (V4L2_CID_PRIVATE_BASE + 210)
+
+#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_LIMIT_MIN    (V4L2_CID_PRIVATE_BASE+212)
+#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_LIMIT_MAX    (V4L2_CID_PRIVATE_BASE+213)
+#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_RANGE_MIN    (V4L2_CID_PRIVATE_BASE+214)
+#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_RANGE_MAX    (V4L2_CID_PRIVATE_BASE+215)
+#define V4L2_CID_CAM_APERTURE_PREVIEW  (V4L2_CID_PRIVATE_BASE+216)
+#define V4L2_CID_CAM_APERTURE_CAPTURE  (V4L2_CID_PRIVATE_BASE+217)
+
+#define V4L2_CID_CAMERA_FACTORY_AF_ZONE        (V4L2_CID_PRIVATE_BASE+218)
+enum set_Factory_AFZone_Cmd {
+       FACTORY_AFZONE_NORMAL = 0,
+       FACTORY_AFZONE_MACRO,
+       FACTORY_AFZONE_AUTO,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_OIS_SHIFT      (V4L2_CID_PRIVATE_BASE+219)
+#define V4L2_CID_CAMERA_FACTORY_FLICKER        (V4L2_CID_PRIVATE_BASE+220)
+enum set_Factory_Flicker_Cmd {
+       FACTORY_FLICKER_AUTO = 0,
+       FACTORY_FLICKER_50HZ,
+       FACTORY_FLICKER_60HZ,
+       FACTORY_FLICKER_50_60,
+       FACTORY_FLICKER_OFF,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_AF_LENS        (V4L2_CID_PRIVATE_BASE+221)
+enum set_Factory_AFLENS_Cmd {
+       FACTORY_AFLENS_OPEN = 0,
+       FACTORY_AFLENS_CLOSE,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_LV_TARGET      (V4L2_CID_PRIVATE_BASE+222)
+
+#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS_RANGE_MIN (V4L2_CID_PRIVATE_BASE+223)
+#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS_RANGE_MAX (V4L2_CID_PRIVATE_BASE+224)
+#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS       (V4L2_CID_PRIVATE_BASE+225)
+enum set_Factory_Adj_IRIS_Cmd {
+       FACTORY_ADJ_IRIS_RUN = 0,
+       FACTORY_ADJ_IRIS_STOP,
+       FACTORY_ADJ_IRIS_END_CHECK,
+       FACTORY_ADJ_IRIS_LOG,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW_RANGE_MIN \
+       (V4L2_CID_PRIVATE_BASE+226)
+#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW_RANGE_MAX \
+       (V4L2_CID_PRIVATE_BASE+227)
+#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW (V4L2_CID_PRIVATE_BASE+228)
+enum set_Factory_Adj_Gain_LiveView_Cmd {
+       FACTORY_ADJ_GAIN_LIVEVIEW_RUN = 0,
+       FACTORY_ADJ_GAIN_LIVEVIEW_STOP,
+       FACTORY_ADJ_GAIN_LIVEVIEW_END_CHECK,
+       FACTORY_ADJ_GAIN_LIVEVIEW_LOG,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_IRIS_NUM (V4L2_CID_PRIVATE_BASE+229)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SET_IRIS (V4L2_CID_PRIVATE_BASE+230)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_ISO   (V4L2_CID_PRIVATE_BASE+231)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_RANGE (V4L2_CID_PRIVATE_BASE+232)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SPEEDTIME_X (V4L2_CID_PRIVATE_BASE+233)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SPEEDTIME_Y (V4L2_CID_PRIVATE_BASE+234)
+#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE       (V4L2_CID_PRIVATE_BASE+235)
+enum set_Factory_SH_Close_Cmd {
+       FACTORY_SH_CLOSE_RUN = 0,
+       FACTORY_SH_CLOSE_STOP,
+       FACTORY_SH_CLOSE_END_CHECK,
+       FACTORY_SH_CLOSE_LOG,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_RANGE_MIN \
+       (V4L2_CID_PRIVATE_BASE+236)
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_RANGE_MAX \
+       (V4L2_CID_PRIVATE_BASE+237)
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN   (V4L2_CID_PRIVATE_BASE+238)
+enum set_Factory_Capture_Gain_Cmd {
+       FACTORY_CAPTURE_GAIN_RUN = 0,
+       FACTORY_CAPTURE_GAIN_STOP,
+       FACTORY_CAPTURE_GAIN_END_CHECK,
+       FACTORY_CAPTURE_GAIN_LOG,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_LSC_TABLE      (V4L2_CID_PRIVATE_BASE+239)
+#define V4L2_CID_CAMERA_FACTORY_LSC_REFERENCE (V4L2_CID_PRIVATE_BASE+240)
+
+#define V4L2_CID_CAMERA_FACTORY_PUNT_SHORT_SCAN_DATA (V4L2_CID_PRIVATE_BASE+241)
+#define V4L2_CID_CAMERA_FACTORY_PUNT_LONG_SCAN_DATA (V4L2_CID_PRIVATE_BASE+242)
+
+enum set_camera_mode_Cmd {
+       MODE_SMART_AUTO = 0,
+       MODE_PROGRAM,
+       MODE_A,
+       MODE_S,
+       MODE_M,
+       MODE_VIDEO,
+       MODE_BEST_GROUP_POSE,
+       MODE_BACKGROUND_BLUR,
+       MODE_HIGH_SPEED,
+       MODE_LIGHT_TRAIL_SHOT,
+       MODE_WATERFALL,
+       MODE_SILHOUETTE,
+       MODE_SUNSET,
+       MODE_CLOSE_UP,
+       MODE_FIREWORKS,
+       MODE_CROSS_FILTER,
+       MODE_BACKLIGHT,
+       MODE_BLUE_SKY,
+       MODE_NATURAL_GREEN,
+       MODE_FOOD,
+       MODE_START_FILTER,
+       MODE_MOVING_SHOT,
+       MODE_DAWN,
+       MODE_SNOW,
+       MODE_BEACH,
+       MODE_HOT_FOOD,
+       MODE_COOL_FOOD,
+       MODE_CANDLE,
+       MODE_PARTY_INDOOR,
+       MODE_PANORAMA,
+       MODE_BEAUTY_SHOT,
+       MODE_BEST_SHOT,
+       MODE_CONTINUOUS_SHOT,
+       MODE_BEST_FACE,
+       MODE_PW_BRACKET,
+       MODE_BABY_SHOT,
+       MODE_VIGNTTING,
+       MODE_LANDSCAPE,
+       MODE_ACTION_FREEZE,
+       MODE_RICH_TONE,
+       MODE_ANIMATED_SCENE,
+       MODE_MULTI_EXPOSURE_SHOT,
+       MODE_DRAMA_SHOT,
+       MODE_ERASER,
+       MODE_SOUND_AND_SHOT,
+       MODE_MINIATURE,
+       MODE_CREATIVE_SHOT,
+       MODE_INTERVAL_SHOT,
+       MODE_NIGHT,
+       MODE_GOLF_SHOT,
+       MODE_3D,
+       MODE_SMART_SUGGEST,
+       MODE_SMART_BUDDY,   /*add Smart Buddy Mode*/
+       MODE_MAGIC,
+       MODE_SMART_SELF,
+       MODE_CAMERA_MAX,
+};
+
+#define V4L2_CID_CAMERA_IMAGE_STABILIZER       (V4L2_CID_PRIVATE_BASE + 246)
+enum set_Image_Stabilizer {
+       V4L2_IMAGE_STABILIZER_OFF = 0,
+       V4L2_IMAGE_STABILIZER_OIS = 1,
+       V4L2_IMAGE_STABILIZER_DUALIS = 2,
+};
+
+#define V4L2_CID_CAMERA_IS_OIS_MODE            (V4L2_CID_PRIVATE_BASE + 247)
+enum set_IS_OIS_mode {
+       V4L2_IS_OIS_NONE = 0,
+       V4L2_IS_OIS_MOVIE = 1,
+       V4L2_IS_OIS_STILL = 2,
+       V4L2_IS_OIS_MULTI = 3,
+       V4L2_IS_OIS_VSS = 4,
+};
+
+enum set_OIS_MODE {
+       V4L2_OIS_OFF = 0,
+       V4L2_OIS_MODE_1 = 1,
+       V4L2_OIS_MODE_2 = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_AE_TARGET (V4L2_CID_PRIVATE_BASE + 248)
+
+#define V4L2_CID_CAMERA_AV             (V4L2_CID_PRIVATE_BASE + 249)
+#define V4L2_CID_CAMERA_TV             (V4L2_CID_PRIVATE_BASE + 250)
+#define V4L2_CID_CAMERA_SV             (V4L2_CID_PRIVATE_BASE + 251)
+#define V4L2_CID_CAMERA_EV             (V4L2_CID_PRIVATE_BASE + 252)
+
+#define V4L2_CID_CAMERA_SCENE_SUB_MODE         (V4L2_CID_PRIVATE_BASE + 253)
+
+#define V4L2_CID_CAMERA_WB_CUSTOM_X            (V4L2_CID_PRIVATE_BASE + 254)
+#define V4L2_CID_CAMERA_WB_CUSTOM_Y            (V4L2_CID_PRIVATE_BASE + 255)
+#define V4L2_CID_CAMERA_WB_CUSTOM_VALUE                (V4L2_CID_PRIVATE_BASE + 256)
+
+#define V4L2_CID_CAMERA_RED_EYE_FIX_RESULT     (V4L2_CID_PRIVATE_BASE + 257)
+#define V4L2_CID_CAMERA_FACTORY_FLASH          (V4L2_CID_PRIVATE_BASE + 258)
+enum set_Factory_Flash_Cmd {
+       FACTORY_FLASH_STROBE_CHECK_ON = 0,
+       FACTORY_FLASH_STROBE_CHECK_OFF = 1,
+       FACTORY_FLASH_CHARGE = 2,
+       FACTORY_FLASH_LOG = 3,
+       FACTORY_FLASH_CHARGE_END_CHECK = 4,
+       FACTORY_FLASH_STROBE_CHARGE_END_CHECK = 5,
+       FACTORY_FLASH_WB_LOG = 6,
+       FACTORY_ADJ_FLASH_WB_LOG = 7,
+       FACTORY_ADJ_FLASH_WB_END_CHECK = 8,
+       END_CHECK = 9,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_WB             (V4L2_CID_PRIVATE_BASE + 259)
+enum set_Factory_WB_Cmd {
+       FACTORY_WB_INDOOR_RUN = 0,
+       FACTORY_WB_INDOOR_END_CHECK = 1,
+       FACTORY_WB_OUTDOOR_RUN = 2,
+       FACTORY_WB_OUTDOOR_END_CHECK = 3,
+       FACTORY_WB_LOG = 4,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_FLASH_RANGE_X (V4L2_CID_PRIVATE_BASE + 260)
+#define V4L2_CID_CAMERA_FACTORY_FLASH_RANGE_Y (V4L2_CID_PRIVATE_BASE + 261)
+
+#define V4L2_CID_CAMERA_FACTORY_WB_IN_RG_VALUE (V4L2_CID_PRIVATE_BASE + 262)
+#define V4L2_CID_CAMERA_FACTORY_WB_IN_BG_VALUE (V4L2_CID_PRIVATE_BASE + 263)
+#define V4L2_CID_CAMERA_FACTORY_WB_OUT_RG_VALUE        (V4L2_CID_PRIVATE_BASE + 264)
+#define V4L2_CID_CAMERA_FACTORY_WB_OUT_BG_VALUE        (V4L2_CID_PRIVATE_BASE + 265)
+
+#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_START_X \
+       (V4L2_CID_PRIVATE_BASE + 266)
+#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_END_X \
+       (V4L2_CID_PRIVATE_BASE + 267)
+#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_START_Y \
+       (V4L2_CID_PRIVATE_BASE + 268)
+#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_END_Y \
+       (V4L2_CID_PRIVATE_BASE + 269)
+
+#define V4L2_CID_CAMERA_FACTORY_AF_LED_TIME (V4L2_CID_PRIVATE_BASE + 270)
+
+#define V4L2_CID_CAMERA_FACTORY_AF_DIFF_CHECK_MIN (V4L2_CID_PRIVATE_BASE + 271)
+#define V4L2_CID_CAMERA_FACTORY_AF_DIFF_CHECK_MAX (V4L2_CID_PRIVATE_BASE + 272)
+
+#define V4L2_CID_CAMERA_FACTORY_DEFECTPIXEL    (V4L2_CID_PRIVATE_BASE + 273)
+enum set_Factory_DefectPixel_Cmd {
+       FACTORY_DEFECTPIXEL_SCENARIO_6 = 0,
+       FACTORY_DEFECTPIXEL_RUN,
+       FACTORY_DEFECTPIXEL_END_CHECK,
+       FACTORY_DEFECTPIXEL_LOG,
+       FACTORY_DEFECTPIXEL_CID_1,
+       FACTORY_DEFECTPIXEL_CID_2,
+       FACTORY_DEFECTPIXEL_CID_3,
+       FACTORY_DEFECTPIXEL_WRITE_BLACK,
+       FACTORY_DEFECTPIXEL_WRITE_WHITE,
+       FACTORY_DEFECTPIXEL_CID_WRITE,
+       FACTORY_DEFECTPIXEL_FLASH_MERGE,
+       FACTORY_DEFECTPIXEL_DOT_WRITE_CHECK,
+       FACTORY_DEFECTPIXEL_RAW_DUMP,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_CAP (V4L2_CID_PRIVATE_BASE + 274)
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR0 (V4L2_CID_PRIVATE_BASE + 275)
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR1 (V4L2_CID_PRIVATE_BASE + 276)
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR2 (V4L2_CID_PRIVATE_BASE + 277)
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR_HS (V4L2_CID_PRIVATE_BASE + 278)
+
+#define V4L2_CID_CAMERA_FACTORY_AF_LED_LV_MIN (V4L2_CID_PRIVATE_BASE + 279)
+#define V4L2_CID_CAMERA_FACTORY_AF_LED_LV_MAX (V4L2_CID_PRIVATE_BASE + 280)
+
+#define V4L2_CID_CAMERA_FACTORY_CAM_SYS_MODE (V4L2_CID_PRIVATE_BASE + 281)
+enum set_Factory_Sysmode_Cmd {
+       FACTORY_SYSMODE_CAPTURE = 0,
+       FACTORY_SYSMODE_MONITOR = 1,
+       FACTORY_SYSMODE_PARAM = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_ISP_FW_CHECK (V4L2_CID_PRIVATE_BASE + 282)
+#define V4L2_CID_CAMERA_FACTORY_OIS_VER_CHECK (V4L2_CID_PRIVATE_BASE + 283)
+
+#define V4L2_CID_CAMERA_SMART_SCENE_DETECT    (V4L2_CID_PRIVATE_BASE+284)
+enum set_smartscenedetect_mode {
+       SMART_SCENE_DETECT_OFF = 0,
+       SMART_SCENE_DETECT_ON = 1,
+};
+#define V4L2_CID_CAMERA_SMART_MOVIE_RECORDING    (V4L2_CID_PRIVATE_BASE+285)
+#define V4L2_CID_CAMERA_SMART_AUTO_S1_PUSH    (V4L2_CID_PRIVATE_BASE+286)
+
+#define V4L2_CID_CAMERA_FACTORY_WB_RANGE_FLASH_WRITE \
+       (V4L2_CID_PRIVATE_BASE + 287)
+
+#define V4L2_CID_CAMERA_FACTORY_FLASH_CHR_CHK_TM \
+       (V4L2_CID_PRIVATE_BASE + 288)
+
+#define V4L2_CID_CAMERA_FACE_DETECT_NUMBER (V4L2_CID_PRIVATE_BASE+290)
+#define V4L2_CID_CAMERA_EXIF_FL (V4L2_CID_PRIVATE_BASE + 291)
+
+#define V4L2_CID_CAMERA_SMART_ZOOM             (V4L2_CID_PRIVATE_BASE + 292)
+enum set_Smart_Zoom {
+       V4L2_SMART_ZOOM_OFF = 0,
+       V4L2_SMART_ZOOM_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_CAF             (V4L2_CID_PRIVATE_BASE + 293)
+
+#define V4L2_CID_CAMERA_FACTORY_LIVEVIEW_OFFSET_MARK \
+       (V4L2_CID_PRIVATE_BASE + 294)
+#define V4L2_CID_CAMERA_FACTORY_LIVEVIEW_OFFSET_VAL \
+       (V4L2_CID_PRIVATE_BASE + 295)
+
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_OFFSET_MARK \
+       (V4L2_CID_PRIVATE_BASE + 296)
+#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_OFFSET_VAL \
+       (V4L2_CID_PRIVATE_BASE + 297)
+
+#define V4L2_CID_CAMERA_FACTORY_WB_RANGE (V4L2_CID_PRIVATE_BASE + 298)
+
+#define V4L2_CID_CAMERA_LV             (V4L2_CID_PRIVATE_BASE + 299)
+
+#define V4L2_CID_PHYSICAL_ROTATION             (V4L2_CID_PRIVATE_BASE + 300)
+
+#define V4L2_CID_CAMERA_FOCUS_RANGE    (V4L2_CID_PRIVATE_BASE + 301)
+enum set_fouce_range {
+       V4L2_FOCUS_RANGE_AUTO = 0,
+       V4L2_FOCUS_RANGE_MACRO = 1,
+       V4L2_FOCUS_RANGE_AUTO_MACRO = 2,
+};
+
+#define V4L2_CID_CAMERA_AF_LED                 (V4L2_CID_PRIVATE_BASE + 303)
+enum set_AF_LED {
+       V4L2_AF_LED_OFF = 0,
+       V4L2_AF_LED_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_LENS_TIMER             (V4L2_CID_PRIVATE_BASE + 304)
+
+#define V4L2_CID_CAMERA_FLASH_BATT_INFO        (V4L2_CID_PRIVATE_BASE + 305)
+enum set_FLASH_BATT_INFO {
+       V4L2_FLASH_NORMAL_BATT = 0,
+       V4L2_FLASH_LOW_BATT = 1,
+};
+
+#define V4L2_CID_CAMERA_WIDGET_MODE_LEVEL    (V4L2_CID_PRIVATE_BASE+307)
+enum v4l2_widget_mode_level {
+       V4L2_WIDGET_MODE_LEVEL_1 = 1,
+       V4L2_WIDGET_MODE_LEVEL_2 = 2,
+       V4L2_WIDGET_MODE_LEVEL_3 = 3,
+       V4L2_WIDGET_MODE_LEVEL_4 = 4,
+       V4L2_WIDGET_MODE_LEVEL_5 = 5,
+};
+
+#define V4L2_CID_CAMERA_PREVIEW_WIDTH     (V4L2_CID_PRIVATE_BASE + 310)
+#define V4L2_CID_CAMERA_PREVIEW_HEIGHT     (V4L2_CID_PRIVATE_BASE + 311)
+#define V4L2_CID_CAMERA_PREVIEW_SIZE     (V4L2_CID_PRIVATE_BASE + 312)
+
+#define V4L2_CID_CAMERA_WARNING_CONDITION      (V4L2_CID_PRIVATE_BASE + 313)
+#define V4L2_CID_CAMERA_EXIF_FL_35mm            (V4L2_CID_PRIVATE_BASE + 314)
+
+#define V4L2_CID_CAMERA_LENS_STATUS            (V4L2_CID_PRIVATE_BASE + 315)
+
+#define V4L2_CID_CAMERA_TIMER_LED              (V4L2_CID_PRIVATE_BASE + 317)
+enum set_timer_LED {
+       V4L2_TIMER_LED_OFF = 0,
+       V4L2_TIMER_LED_2_SEC = 2,
+       V4L2_TIMER_LED_5_SEC = 5,
+       V4L2_TIMER_LED_10_SEC = 10,
+};
+#define V4L2_CID_CAMERA_TIMER_MODE             (V4L2_CID_PRIVATE_BASE + 318)
+#define V4L2_CID_CAMERA_SAMSUNG_APP  (V4L2_CID_PRIVATE_BASE + 319)
+#define V4L2_CID_CAMERA_INIT (V4L2_CID_PRIVATE_BASE + 320)
+#define V4L2_CID_CAMERA_POST_INIT (V4L2_CID_PRIVATE_BASE + 321)
+
+#define V4L2_CID_CAMERA_CAPTURE_END         (V4L2_CID_PRIVATE_BASE + 322)
+
+//#define V4L2_CID_CAMERA_FAST_CAPTURE         (V4L2_CID_PRIVATE_BASE + 323)
+
+#define V4L2_CID_CAMERA_FAST_CAPTURE_STOP   (V4L2_CID_PRIVATE_BASE + 324)
+
+#define V4L2_CID_CAMERA_NOTI                           (V4L2_CID_PRIVATE_BASE + 325)
+
+enum set_Factory_Common_Cmd {
+       FACTORY_FLASH_WRITE = 0,
+       FACTORY_LOG_WRITE = 1,
+       FACTORY_SET_OFF = 2,
+       FACTORY_SET_ON = 3,
+       FACTORY_LOG_WRITE_START = 4,
+};
+
+#define V4L2_CID_FACTORY_SHUTTERSPPED          (V4L2_CID_PRIVATE_BASE + 326)
+#define V4L2_CID_FACTORY_CIS_DATA              (V4L2_CID_PRIVATE_BASE + 327)
+
+#define V4L2_CID_CAMERA_MOVIE_RESOLUTION       (V4L2_CID_PRIVATE_BASE + 328)
+
+#define V4L2_CID_CAMERA_COLOR          (V4L2_CID_PRIVATE_BASE + 329)
+#define V4L2_CID_CAMERA_POWER_OFF      (V4L2_CID_PRIVATE_BASE + 330)
+
+#define V4L2_CID_FACTORY_LENS_MOUNT            (V4L2_CID_PRIVATE_BASE + 331)
+#define V4L2_CID_FACTORY_HOT_SHOE              (V4L2_CID_PRIVATE_BASE + 332)
+#define V4L2_CID_FACTORY_FLANGE_BACK   (V4L2_CID_PRIVATE_BASE + 333)
+#define V4L2_CID_CAMERA_AF_PRIORITY    (V4L2_CID_PRIVATE_BASE + 334)
+enum af_priority_value {
+       AF_PRIORITY_OFF = 0,
+       AF_PRIORITY_ON = 1,
+};
+#define V4L2_CID_FACTORY_SEND_PC_DATA  (V4L2_CID_PRIVATE_BASE + 335)
+#define V4L2_CID_FACTORY_DUST_REDUCTION        (V4L2_CID_PRIVATE_BASE + 336)
+#define V4L2_CID_FACTORY_SHUTTER_X             (V4L2_CID_PRIVATE_BASE + 337)
+#define V4L2_CID_FACTORY_LIVEVIEW_ISO_SENS     (V4L2_CID_PRIVATE_BASE + 338)
+#define V4L2_CID_FACTORY_CAPTURE_ISO_SENS      (V4L2_CID_PRIVATE_BASE + 339)
+#define V4L2_CID_FACTORY_AWB           (V4L2_CID_PRIVATE_BASE + 340)
+#define V4L2_CID_FACTORY_VFPN          (V4L2_CID_PRIVATE_BASE + 341)
+
+#define V4L2_CID_CAMERA_FLASH_POPUP            (V4L2_CID_PRIVATE_BASE + 342)
+
+#define V4L2_CID_FACTORY_COLORSHADING (V4L2_CID_PRIVATE_BASE + 343)
+#define V4L2_CID_FACTORY_PAF (V4L2_CID_PRIVATE_BASE + 344)
+
+#define V4L2_CID_SYSTEM_ORIENT (V4L2_CID_PRIVATE_BASE+345)
+enum v4l2_system_orient {
+       SYSTEM_ORIENT_0_DEGREE = 0,
+       SYSTEM_ORIENT_90_DEGREE = 90,
+       SYSTEM_ORIENT_180_DEGREE = 180,
+       SYSTEM_ORIENT_270_DEGREE = 270,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_MEM_COPY               (V4L2_CID_PRIVATE_BASE + 346)
+enum set_Factory_Memcopy_Cmd {
+       FACTORY_MEMCOPY_ISP_RAM = 0,
+       FACTORY_MEMCOPY_ISP_NOR = 1,
+       FACTORY_MEMCOPY_BARREL_EEP = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_MEM_MODE               (V4L2_CID_PRIVATE_BASE + 347)
+enum set_Factory_Memmode_Cmd {
+       FACTORY_MEMMODE_ISP_NOR = 0,
+       FACTORY_MEMMODE_BARREL_EEP = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_EEP_WRITE_MARK         (V4L2_CID_PRIVATE_BASE + 348)
+#define V4L2_CID_CAMERA_FACTORY_EEP_WRITE_OIS_SHIFT    (V4L2_CID_PRIVATE_BASE + 349)
+enum set_Factory_Eepwrite_Cmd {
+       FACTORY_EEPWRITE_STEP0 = 0,
+       FACTORY_EEPWRITE_STEP1 = 1,
+       FACTORY_EEPWRITE_STEP2 = 2,
+       FACTORY_EEPWRITE_STEP3 = 3,
+       FACTORY_EEPWRITE_STEP4 = 4,
+       FACTORY_EEPWRITE_STEP5 = 5,
+       FACTORY_EEPWRITE_STEP6 = 6,
+       FACTORY_EEPWRITE_STEP7 = 7,
+       FACTORY_EEPWRITE_STEP8 = 8,
+       FACTORY_EEPWRITE_STEP9 = 9,
+       FACTORY_EEPWRITE_CHECK = 10,
+       FACTORY_EEPWRITE_REPAIR = 11,
+       FACTORY_EEPWRITE_AP = 12,
+       FACTORY_EEPWRITE_ISP = 13,
+       FACTORY_EEPWRITE_SN = 14,
+       FACTORY_EEPWRITE_OIS_SHIFT = 15,
+};
+
+#define V4L2_CID_FACTORY_FLASHROM (V4L2_CID_PRIVATE_BASE + 350)
+
+#define V4L2_CID_CAMERA_HIGH_ISO_NR            (V4L2_CID_PRIVATE_BASE + 351)
+enum v4l2_high_iso_nr {
+       V4L2_HIGH_ISO_NR_OFF = 0,
+       V4L2_HIGH_ISO_NR_LOW = 1,
+       V4L2_HIGH_ISO_NR_NORMAL = 2,
+       V4L2_HIGH_ISO_NR_HIGH = 3,
+};
+#define V4L2_CID_CAMERA_LONG_TERM_NR           (V4L2_CID_PRIVATE_BASE + 352)
+enum v4l2_long_term_nr {
+       V4L2_LONG_TERM_NR_OFF = 0,
+       V4L2_LONG_TERM_NR_ON = 1,
+};
+#define V4L2_CID_CAMERA_DMF            (V4L2_CID_PRIVATE_BASE + 353)
+enum v4l2_dmf {
+       V4L2_DMF_OFF = 0,
+       V4L2_DMF_ON = 1,
+};
+#define V4L2_CID_CAMERA_COLOR_SPACE            (V4L2_CID_PRIVATE_BASE + 354)
+enum v4l2_color_space {
+       V4L2_COLOR_SPACE_S_RGB = 0,
+       V4L2_COLOR_SPACE_ADOBE_RGB = 1,
+};
+#define V4L2_CID_CAMERA_QUICKVIEW_CANCEL (V4L2_CID_PRIVATE_BASE + 355)
+#define V4L2_CID_CAMERA_MOVIE_FADER_MODE       (V4L2_CID_PRIVATE_BASE + 356)
+#define V4L2_CID_CAMERA_MOVIE_FADEOUT  (V4L2_CID_PRIVATE_BASE + 357)
+#define V4L2_CID_CAMERA_MF_ASSIST              (V4L2_CID_PRIVATE_BASE + 358)
+enum v4l2_mf_assist {
+       V4L2_MF_ASSIST_OFF = 0,
+       V4L2_MF_ASSIST_ON = 1,
+};
+#define V4L2_CID_CAMERA_i_FUNC_ENABLE  (V4L2_CID_PRIVATE_BASE + 359)
+
+#define V4L2_CID_CAMERA_QUICKVIEW (V4L2_CID_PRIVATE_BASE + 360)
+enum review_mode {
+       QUICKVIEW_OFF = 0,
+       QUICKVIEW_ON,
+};
+
+#define V4L2_CID_CAMERA_MF     (V4L2_CID_PRIVATE_BASE + 361)
+
+#define V4L2_CID_CAMERA_FOCUS_PEAKING_LEVEL    (V4L2_CID_PRIVATE_BASE + 362)
+enum v4l2_focus_peaking_level {
+       V4L2_FOCUS_PEAKING_OFF = 0,
+       V4L2_FOCUS_PEAKING_LEVEL_LOW,
+       V4L2_FOCUS_PEAKING_LEVEL_MID,
+       V4L2_FOCUS_PEAKING_LEVEL_HIGH,
+};
+#define V4L2_CID_CAMERA_FOCUS_PEAKING_COLOR    (V4L2_CID_PRIVATE_BASE + 363)
+enum v4l2_focus_peaking_color {
+       V4L2_FOCUS_PEAKING_COLOR_WHITE = 1,
+       V4L2_FOCUS_PEAKING_COLOR_RED,
+       V4L2_FOCUS_PEAKING_COLOR_GREEN,
+};
+
+#define V4L2_CID_CAMERA_COLOR_ADJUST   (V4L2_CID_PRIVATE_BASE + 364)
+
+#define V4L2_CID_CAMERA_LINK_AE_TO_AF_POINT    (V4L2_CID_PRIVATE_BASE + 365)
+enum v4l2_link_ae_to_af_point {
+       V4L2_LINK_AE_TO_AF_POINT_OFF = 0,
+       V4L2_LINK_AE_TO_AF_POINT_ON = 1,
+};
+
+#define V4L2_CID_LENS_UPDATE_FW        (V4L2_CID_PRIVATE_BASE + 366)
+enum v4l2_lens_firmware_mode {
+       CAM_LENS_FW_MODE_NONE,
+       CAM_LENS_FW_MODE_VERSION,
+       CAM_LENS_FW_MODE_UPDATE,
+};
+
+#define V4L2_CID_CAMERA_DYNAMIC_RANGE          (V4L2_CID_PRIVATE_BASE + 367)
+enum v4l2_dynamic_range {
+       V4L2_DYNAMIC_RANGE_OFF = 0,
+       V4L2_DYNAMIC_RANGE_SMART = 1,
+       V4L2_DYNAMIC_RANGE_HDR = 2,
+};
+
+#define V4L2_CID_CAMERA_FRAMING_MODE   (V4L2_CID_PRIVATE_BASE + 368)
+enum v4l2_framing_mode {
+       V4L2_FRAMING_MODE_OFF = 0,
+       V4L2_FRAMING_MODE_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_ISO_STEP       (V4L2_CID_PRIVATE_BASE + 369)
+enum v4l2_iso_step {
+       V4L2_ISO_STEP_1 = 0,
+       V4L2_ISO_STEP_1_3 = 1,
+};
+
+#define V4L2_CID_CAMERA_ISO_AUTO_MAX_LEVEL     (V4L2_CID_PRIVATE_BASE + 370)
+#define V4L2_CID_CAMERA_AF_FRAME_SIZE  (V4L2_CID_PRIVATE_BASE + 371)
+enum af_frame_size_value {
+       AF_FRAME_SIZE_SMALL = 0,
+       AF_FRAME_SIZE_MIDDLE = 1,
+       AF_FRAME_SIZE_LARGE = 2,
+       AF_FRAME_SIZE_HUGE = 3,
+};
+
+#define V4L2_CID_AEAF_LOCK_UNLOCK              (V4L2_CID_PRIVATE_BASE + 372)
+enum v4l2_AEAF_lock_mode {
+       CANCEL_AE_AF_LOCK = 0,
+       CANCEL_AE_LOCK,
+       CANCEL_AF_LOCK,
+       START_AE_AF_LOCK = 0x10,
+       START_AE_LOCK,
+       START_AF_LOCK,
+};
+
+#define V4L2_CID_CAMERA_MF_ENLARGE     (V4L2_CID_PRIVATE_BASE + 373)
+enum v4l2_MF_enlarge {
+       V4L2_MF_ENLARGE_OFF = 0,
+       V4L2_MF_ENLARGE_ON,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_LENS_CAP (V4L2_CID_PRIVATE_BASE + 374)
+enum set_Factory_LensCap_Cmd {
+       FACTORY_LENSCAP_CHECK = 1,
+       FACTORY_LENSCAP_LOG = 2,
+};
+
+#define V4L2_CID_CAMERA_OVER_EXPOSURE_GUIDE    (V4L2_CID_PRIVATE_BASE + 375)
+enum v4l2_over_exp_guide {
+       V4L2_OVER_EXPOSURE_OFF = 0,
+       V4L2_OVER_EXPOSURE_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_NO_LENS_CAPTURE                (V4L2_CID_PRIVATE_BASE + 376)
+enum v4l2_no_lens_capture {
+       V4L2_NO_LENS_CAPTURE_OFF = 0,
+       V4L2_NO_LENS_CAPTURE_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_CHECK_SUM (V4L2_CID_PRIVATE_BASE + 377)
+enum set_Factory_CheckSum_Cmd {
+       FACTORY_CHECK_SUM = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_LOG_WRITE_ALL (V4L2_CID_PRIVATE_BASE + 378)
+enum set_Factory_LogWriteAll_Cmd {
+       FACTORY_LOG_WRITE_ALL_ON = 0,
+       FACTORY_LOG_WRITE_ALL_OFF = 1,
+};
+
+#define V4L2_CID_CAMERA_BURST_BOOT_PARAM (V4L2_CID_PRIVATE_BASE + 379)
+
+#define V4L2_CID_CAMERA_FACTORY_PUNT_INTERPOLATION     (V4L2_CID_PRIVATE_BASE + 380)
+
+#define V4L2_CID_CAMERA_FACTORY_DATA_ERASE   (V4L2_CID_PRIVATE_BASE + 381)
+enum set_Factory_Dataerase_Cmd {
+       FACTORY_DATA_ERASE_PUNT = 0,
+       FACTORY_DATA_ERASE_BACKLASH = 1,
+};
+
+#define V4L2_CID_CAMERA_TURN_AF_LED               (V4L2_CID_PRIVATE_BASE + 382)
+
+#define V4L2_CID_CAMERA_FACTORY_LENS_CAP_LOG  (V4L2_CID_PRIVATE_BASE + 383)
+
+#define V4L2_CID_THUMBNAIL_SIZE               (V4L2_CID_PRIVATE_BASE + 384)
+#define V4L2_CID_ZOOM_SPEED               (V4L2_CID_PRIVATE_BASE + 385)
+
+#define V4L2_CID_CAMERA_FACTORY_NO_LENS_OFF (V4L2_CID_PRIVATE_BASE + 386)
+enum set_Factory_NoLensOff_Cmd {
+       FACTORY_NO_LENS_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_FOCUS_CLOSEOPEN (V4L2_CID_PRIVATE_BASE + 387)
+#define V4L2_CID_CAMERA_FACTORY_FOCUS_CHECK (V4L2_CID_PRIVATE_BASE + 388)
+enum set_Factory_FocusCloseOpenCheck_Cmd {
+       FACTORY_FOCUS_CLOSE = 0,
+       FACTORY_FOCUS_OPEN = 1,
+       FACTORY_FOCUS_CHECK = 2,
+};
+
+#define V4L2_CID_CAMERA_INTERVAL_SHOT_MANUAL_FOCUS (V4L2_CID_PRIVATE_BASE + 389)
+
+#define V4L2_CID_CAMERA_FACTORY_RESOLUTION_LOG (V4L2_CID_PRIVATE_BASE + 390)
+
+#define V4L2_CID_CAMERA_OPTICAL_PREVIEW (V4L2_CID_PRIVATE_BASE + 391)
+enum v4l2_optical_preview {
+       V4L2_OPTICAL_PREVIEW_STOP = 0,
+       V4L2_OPTICAL_PREVIEW_START = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_SHD_LOG (V4L2_CID_PRIVATE_BASE + 392)
+#define V4L2_CID_CAMERA_SYSTEM_RESET_CWB (V4L2_CID_PRIVATE_BASE + 393)
+
+#define V4L2_CID_FACTORY_RAW_SSIF_CAPTURE      (V4L2_CID_PRIVATE_BASE + 394)
+#define V4L2_CID_FACTORY_RAW_PP_CAPTURE        (V4L2_CID_PRIVATE_BASE + 395)
+enum set_Factory_Raw_Capure {
+       DEBUG_SSIF_RAW_CAPTURE,
+       DEBUG_PP_RAW_CAPTURE,
+};
+
+enum set_Factory_Raw_Capture_Sensor_Mode {
+       CT3_MODE_STILL = 1,
+       CT3_MODE_BURST,
+       CT3_MODE_FULL_HD,
+       CT3_MODE_CINEMA,
+       CT3_MODE_HD,
+       CT3_MODE_LIVEVIEW,
+       CT3_MODE_MF,
+       CT3_MODE_FAST_AF,
+       CT3_MODE_PAF_LIVEVIEW,
+};
+
+#define V4L2_CID_CAMERA_VIDEO_OUT_FORMAT       (V4L2_CID_PRIVATE_BASE + 396)
+enum v4l2_video_format {
+       V4L2_VIDEO_FORMAT_NTSC = 0,
+       V4L2_VIDEO_FORMAT_PAL = 1,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_WRITE_SHD_DATA (V4L2_CID_PRIVATE_BASE + 397)
+
+#define V4L2_CID_PROGRAM_SHIFT (V4L2_CID_PRIVATE_BASE + 398)
+enum v4l2_program_shift_cmd {
+       V4L2_PROGRAM_SHIFT_RESET = 0,
+       V4L2_PROGRAM_SHIFT_UP = 1,
+       V4L2_PROGRAM_SHIFT_DOWN = 2,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_CLIP_VALUE     (V4L2_CID_PRIVATE_BASE + 399)
+
+#define V4L2_CID_WEATHER_INFO  (V4L2_CID_PRIVATE_BASE+400)
+
+#define V4L2_CID_FACTORY_GET_ISP_LOG   (V4L2_CID_PRIVATE_BASE+401)
+
+#define V4L2_CID_FACTORY_LOG_WRITE     (V4L2_CID_PRIVATE_BASE+402)
+
+#define V4L2_CID_CAMERA_FACTORY_IR_CHECK_G_AVG (V4L2_CID_PRIVATE_BASE+403)
+
+#define V4L2_CID_CAMERA_FACTORY_TILT_LOCATION (V4L2_CID_PRIVATE_BASE + 404)
+enum set_Factory_Tilt_Location_Cmd {
+       FACTORY_TILT_LOCATION_LEFT_UP = 0,
+       FACTORY_TILT_LOCATION_RIGHT_UP = 1,
+       FACTORY_TILT_LOCATION_LEFT_DOWN = 2,
+       FACTORY_TILT_LOCATION_RIGHT_DOWN = 3,
+};
+
+#define V4L2_CID_FACTORY_AVS_REQUEST   (V4L2_CID_PRIVATE_BASE + 405)
+
+#define V4L2_CID_CAMERA_COLD_BOOT      (V4L2_CID_PRIVATE_BASE+406)
+
+#define V4L2_CID_CAMERA_HIGH_TEMPERATURE (V4L2_CID_PRIVATE_BASE + 407)
+
+/*      Pixel format FOURCC depth  Description  */
+enum v4l2_pix_format_mode {
+       V4L2_PIX_FMT_MODE_PREVIEW,
+       V4L2_PIX_FMT_MODE_CAPTURE,
+       V4L2_PIX_FMT_MODE_HDR,
+       V4L2_PIX_FMT_MODE_VT_MIRROR,
+       V4L2_PIX_FMT_MODE_VT_NONMIRROR,
+};
+
+#define V4L2_CID_SET_CONTINUE_FPS              (V4L2_CID_PRIVATE_BASE + 500)
+
+#define V4L2_CID_CAMERA_GET_MODE       (V4L2_CID_PRIVATE_BASE + 502)
+
+#define V4L2_CID_CAMERA_FACTORY_SEND_SETTING \
+       (V4L2_CID_PRIVATE_BASE + 503)
+#define V4L2_CID_CAMERA_FACTORY_SEND_VALUE \
+       (V4L2_CID_PRIVATE_BASE + 504)
+
+#define V4L2_CID_CAMERA_FACTORY_TILT_SCAN_MIN \
+       (V4L2_CID_PRIVATE_BASE + 505)
+#define V4L2_CID_CAMERA_FACTORY_TILT_SCAN_MAX \
+       (V4L2_CID_PRIVATE_BASE + 506)
+#define V4L2_CID_CAMERA_FACTORY_TILT_FIELD \
+       (V4L2_CID_PRIVATE_BASE + 507)
+#define V4L2_CID_CAMERA_FACTORY_TILT_AF_RANGE_MIN \
+       (V4L2_CID_PRIVATE_BASE + 508)
+#define V4L2_CID_CAMERA_FACTORY_TILT_AF_RANGE_MAX \
+       (V4L2_CID_PRIVATE_BASE + 509)
+#define V4L2_CID_CAMERA_FACTORY_TILT_DIFF_RANGE_MIN \
+       (V4L2_CID_PRIVATE_BASE + 510)
+#define V4L2_CID_CAMERA_FACTORY_TILT_DIFF_RANGE_MAX \
+       (V4L2_CID_PRIVATE_BASE + 511)
+
+#define V4L2_CID_CAMERA_FACTORY_IR_R_GAIN_MIN \
+       (V4L2_CID_PRIVATE_BASE + 512)
+#define V4L2_CID_CAMERA_FACTORY_IR_R_GAIN_MAX \
+       (V4L2_CID_PRIVATE_BASE + 513)
+#define V4L2_CID_CAMERA_FACTORY_IR_B_GAIN_MIN \
+       (V4L2_CID_PRIVATE_BASE + 514)
+#define V4L2_CID_CAMERA_FACTORY_IR_B_GAIN_MAX \
+       (V4L2_CID_PRIVATE_BASE + 515)
+
+#define V4L2_CID_CAMERA_FACTORY_FLASH_MAN_CHARGE \
+       (V4L2_CID_PRIVATE_BASE + 516)
+#define V4L2_CID_CAMERA_FACTORY_FLASH_MAN_EN \
+       (V4L2_CID_PRIVATE_BASE + 517)
+
+#define V4L2_CID_CAMERA_FACTORY_SEND_WORD_VALUE \
+       (V4L2_CID_PRIVATE_BASE + 518)
+#define V4L2_CID_CAMERA_FACTORY_SEND_LONG_VALUE \
+       (V4L2_CID_PRIVATE_BASE + 519)
+
+#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR1_HD \
+       (V4L2_CID_PRIVATE_BASE + 520)
+
+#define V4L2_CID_CAMERA_FACTORY_TILT \
+       (V4L2_CID_PRIVATE_BASE + 522)
+enum set_Factory_Tilt {
+       FACTORY_TILT_ONE_SCRIPT_RUN = 0,
+       FACTORY_TILT_ONE_SCRIPT_DISP1,
+       FACTORY_TILT_ONE_SCRIPT_DISP2,
+       FACTORY_TILT_ONE_SCRIPT_DISP3,
+       FACTORY_TILT_ONE_SCRIPT_DISP4,
+       FACTORY_TILT_ONE_SCRIPT_DISP5,
+};
+
+#define V4L2_CID_CAMERA_FACTORY_IR_CHECK \
+       (V4L2_CID_PRIVATE_BASE + 523)
+enum set_Factory_IR_Check {
+       FACTORY_IR_CHECK_LOG = 0,
+};
+
+#define V4L2_CID_BURSTSHOT_SET_POSTVIEW_SIZE  (V4L2_CID_PRIVATE_BASE + 524)
+
+#define V4L2_CID_BURSTSHOT_SET_SNAPSHOT_SIZE  (V4L2_CID_PRIVATE_BASE + 525)
+
+#define V4L2_CID_CAMERA_FACTORY_FLASH_CHARGE (V4L2_CID_PRIVATE_BASE+527)
+
+#define V4L2_CID_CAMERA_FW_CHECKSUM_VAL (V4L2_CID_PRIVATE_BASE+528)
+
+enum set_Start_Capture_Mode {
+       START_CAPTURE_POSTVIEW = 0,
+       START_CAPTURE_YUV_MAIN,
+       START_CAPTURE_JPEG_MAIN,
+       START_CAPTURE_THUMB,
+       START_CAPTURE_COMBINED,
+};
+
+#define V4L2_CID_CAMERA_CAPTURE_CNT    (V4L2_CID_PRIVATE_BASE + 529)
+#define V4L2_CID_MULTI_EXPOSURE_CNT    (V4L2_CID_PRIVATE_BASE + 530)
+#define V4L2_CID_CAMERA_DZOOM       (V4L2_CID_PRIVATE_BASE + 531)
+#define V4L2_CID_CAMERA_MIC_CONTROL       (V4L2_CID_PRIVATE_BASE + 532)
+
+#define V4L2_CID_BURSTSHOT_STOP        (V4L2_CID_PRIVATE_BASE + 533)
+enum v4l2_burst_stop_state {
+       V4L2_INT_STATE_BURST_NORMAL_STOP = 0,
+       V4L2_INT_STATE_BURST_STOP_BY_POWER_SAVE,
+       V4L2_INT_STATE_BURST_STOP_BY_LENS_DETACH,
+       V4L2_INT_STATE_BURST_STOP_BY_CARD_INOUT,
+};
+
+#define V4L2_CID_ZOOM_ACTION_METHOD (V4L2_CID_PRIVATE_BASE + 534)
+enum V4l2_zoom_action_method {
+       ZOOM_KEY = 0,
+       ZOOM_RING = 1,
+       ZOOM_METHOD_MAX,
+};
+
+#define V4L2_CID_CAMERA_LIVEVIEW_RESOLUTION (V4L2_CID_PRIVATE_BASE + 535)
+
+#define V4L2_CID_CAMERA_FACTORY_OIS_DECENTER (V4L2_CID_PRIVATE_BASE + 550)
+
+/* FOR AF/AE Division Function in Galaxy-Camera */
+#define V4L2_CID_CAMERA_AE_POSITION_X  (V4L2_CID_PRIVATE_BASE+536)
+#define V4L2_CID_CAMERA_AE_POSITION_Y  (V4L2_CID_PRIVATE_BASE+537)
+#define V4L2_CID_CAMERA_AE_WINDOW_SIZE_WIDTH   (V4L2_CID_PRIVATE_BASE+538)
+#define V4L2_CID_CAMERA_AE_WINDOW_SIZE_HEIGHT  (V4L2_CID_PRIVATE_BASE+539)
+#define V4L2_CID_CAMERA_AE_PREVIEW_TOUCH_CTRL  (V4L2_CID_PRIVATE_BASE+540)
+
+
+/* Read the info of FD (SELF SHOT MODE) */
+#define V4L2_CID_CAMERA_SMART_SELF_SHOT_FD_INFO1       (V4L2_CID_PRIVATE_BASE+544)
+#define V4L2_CID_CAMERA_SMART_SELF_SHOT_FD_INFO2       (V4L2_CID_PRIVATE_BASE+545)
+
+/* Set the ROI BOX info (SELF SHOT MODE) */
+#define V4L2_CID_CAMERA_SET_ROI_BOX                                    (V4L2_CID_PRIVATE_BASE+546)
+#define V4L2_CID_CAMERA_SET_ROI_BOX_WIDTH_HEIGHT       (V4L2_CID_PRIVATE_BASE+547)
+#define V4L2_CID_CAMERA_SET_FD_FOCUS_SELECT                    (V4L2_CID_PRIVATE_BASE+548)
+
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_TABLE    (V4L2_CID_PRIVATE_BASE+549)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_MODE    (V4L2_CID_PRIVATE_BASE+550)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_MIN_NUM (V4L2_CID_PRIVATE_BASE+551)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_MAX_NUM (V4L2_CID_PRIVATE_BASE+552)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_ISO_NUM (V4L2_CID_PRIVATE_BASE+553)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_EXP_TIME    (V4L2_CID_PRIVATE_BASE+554)
+#define V4L2_CID_FACTORY_DEFECT_NOISE_LEVEL_REPEAT_NUM  (V4L2_CID_PRIVATE_BASE+555)
+
+/* for NSM Mode */
+#define V4L2_CID_CAMERA_NSM_SYSTEM (V4L2_CID_PRIVATE_BASE + 556)
+#define V4L2_CID_CAMERA_NSM_STATE (V4L2_CID_PRIVATE_BASE + 557)
+
+enum set_camera_nsm_system {
+       NSM_SYSTEM_NONE = 0,
+       NSM_SYSTEM_FILMSUGGEST = 1,
+       NSM_SYSTEM_HOWTOLIBRARY,
+       NSM_SYSTEM_FILMLIBRARY,
+       NSM_SYSTEM_FILMMAKER,
+};
+
+enum set_camera_nsm_state {
+       NSM_STATE_AUTO = 1,
+       NSM_STATE_FILM,
+       NSM_STATE_SHOW,
+};
+
+enum set_camera_nsm_color {
+    NSM_RGB = 0x01,
+    NSM_CONTSHARP,
+    NSM_HUE_ALLREDORANGE,
+    NSM_HUE_YELLOWGREENCYAN,
+    NSM_HUE_BLUEVIOLETPURPLE,
+    NSM_SAT_ALLREDORANGE,
+    NSM_SAT_YELLOWGREENCYAN,
+    NSM_SAT_BLUEVIOLETPURPLE,
+    NSM_RESERVED = 0x09,
+    NSM_R = 0x0A,
+    NSM_G,
+    NSM_B,
+    NSM_GLOBAL_CONTRAST,
+    NSM_GLOBAL_SHARPNESS,
+    NSM_HUE_ALL = 0x0F,
+    NSM_HUE_RED = 0X10,
+    NSM_HUE_ORANGE,
+    NSM_HUE_YELLOW,
+    NSM_HUE_GREEN,
+    NSM_HUE_CYAN,
+    NSM_HUE_BLUE,
+    NSM_HUE_VIOLET,
+    NSM_HUE_PURPLE,
+    NSM_SAT_ALL = 0x18,
+    NSM_SAT_RED,
+    NSM_SAT_ORANGE = 0x1A,
+    NSM_SAT_YELLOW,
+    NSM_SAT_GREEN,
+    NSM_SAT_CYAN,
+    NSM_SAT_BLUE,
+    NSM_SAT_VIOLET = 0x1F,
+    NSM_SAT_PURPLE = 0x20,
+};
+
+#define V4L2_CID_CAMERA_NSM_RGB (V4L2_CID_PRIVATE_BASE + 558)
+#define V4L2_CID_CAMERA_NSM_CONTSHARP (V4L2_CID_PRIVATE_BASE + 559)
+
+#define V4L2_CID_CAMERA_NSM_HUE_ALLREDORANGE (V4L2_CID_PRIVATE_BASE + 560)
+#define V4L2_CID_CAMERA_NSM_HUE_YELLOWGREENCYAN (V4L2_CID_PRIVATE_BASE + 561)
+#define V4L2_CID_CAMERA_NSM_HUE_BLUEVIOLETPURPLE (V4L2_CID_PRIVATE_BASE + 562)
+#define V4L2_CID_CAMERA_NSM_SAT_ALLREDORANGE (V4L2_CID_PRIVATE_BASE + 563)
+#define V4L2_CID_CAMERA_NSM_SAT_YELLOWGREENCYAN (V4L2_CID_PRIVATE_BASE + 564)
+#define V4L2_CID_CAMERA_NSM_SAT_BLUEVIOLETPURPLE (V4L2_CID_PRIVATE_BASE + 565)
+
+#define V4L2_CID_CAMERA_NSM_R (V4L2_CID_PRIVATE_BASE + 566)
+#define V4L2_CID_CAMERA_NSM_G (V4L2_CID_PRIVATE_BASE + 567)
+#define V4L2_CID_CAMERA_NSM_B (V4L2_CID_PRIVATE_BASE + 568)
+#define V4L2_CID_CAMERA_NSM_GLOBAL_CONTRAST (V4L2_CID_PRIVATE_BASE + 569)
+#define V4L2_CID_CAMERA_NSM_GLOBAL_SHARPNESS (V4L2_CID_PRIVATE_BASE + 570)
+
+#define V4L2_CID_CAMERA_NSM_HUE_ALL (V4L2_CID_PRIVATE_BASE + 571)
+#define V4L2_CID_CAMERA_NSM_HUE_RED (V4L2_CID_PRIVATE_BASE + 572)
+#define V4L2_CID_CAMERA_NSM_HUE_ORANGE (V4L2_CID_PRIVATE_BASE + 573)
+#define V4L2_CID_CAMERA_NSM_HUE_YELLOW (V4L2_CID_PRIVATE_BASE + 574)
+#define V4L2_CID_CAMERA_NSM_HUE_GREEN (V4L2_CID_PRIVATE_BASE + 575)
+#define V4L2_CID_CAMERA_NSM_HUE_CYAN (V4L2_CID_PRIVATE_BASE + 576)
+#define V4L2_CID_CAMERA_NSM_HUE_BLUE (V4L2_CID_PRIVATE_BASE + 577)
+#define V4L2_CID_CAMERA_NSM_HUE_VIOLET (V4L2_CID_PRIVATE_BASE + 578)
+#define V4L2_CID_CAMERA_NSM_HUE_PURPLE (V4L2_CID_PRIVATE_BASE + 579)
+
+#define V4L2_CID_CAMERA_NSM_SAT_ALL (V4L2_CID_PRIVATE_BASE + 580)
+#define V4L2_CID_CAMERA_NSM_SAT_RED (V4L2_CID_PRIVATE_BASE + 581)
+#define V4L2_CID_CAMERA_NSM_SAT_ORANGE (V4L2_CID_PRIVATE_BASE + 582)
+#define V4L2_CID_CAMERA_NSM_SAT_YELLOW (V4L2_CID_PRIVATE_BASE + 583)
+#define V4L2_CID_CAMERA_NSM_SAT_GREEN (V4L2_CID_PRIVATE_BASE + 584)
+#define V4L2_CID_CAMERA_NSM_SAT_CYAN (V4L2_CID_PRIVATE_BASE + 585)
+#define V4L2_CID_CAMERA_NSM_SAT_BLUE (V4L2_CID_PRIVATE_BASE + 586)
+#define V4L2_CID_CAMERA_NSM_SAT_VIOLET (V4L2_CID_PRIVATE_BASE + 587)
+#define V4L2_CID_CAMERA_NSM_SAT_PURPLE (V4L2_CID_PRIVATE_BASE + 588)
+
+#define V4L2_CID_CAMERA_NSM_FD_INFO (V4L2_CID_PRIVATE_BASE + 589)
+#define V4L2_CID_CAMERA_NSM_FD_WRITE (V4L2_CID_PRIVATE_BASE + 590)
+/* end NSM Mode */
+
+/* ISP DEBUG CODE  */
+#define V4L2_CID_ISP_DEBUG_READ  (V4L2_CID_SENSOR_BASE + 16)
+#define V4L2_CID_ISP_DEBUG_WRITE (V4L2_CID_SENSOR_BASE + 17)
+#define V4L2_CID_ISP_DEBUG_READ_MEM (V4L2_CID_SENSOR_BASE + 18)
+#define V4L2_CID_ISP_DEBUG_WRITE_MEM (V4L2_CID_SENSOR_BASE + 19)
+#define V4L2_CID_ISP_DEBUG_READ_FILE (V4L2_CID_SENSOR_BASE + 20)
+#define V4L2_CID_ISP_DEBUG_WRITE_FILE (V4L2_CID_SENSOR_BASE + 21)
+#define V4L2_CID_ISP_DEBUG_LOGV (V4L2_CID_SENSOR_BASE + 22)
+
+#define V4L2_CID_FACTORY_FW_CHECK      (V4L2_CID_SENSOR_BASE + 23)
+#define V4L2_CID_FACTORY_D4_CMD                (V4L2_CID_SENSOR_BASE + 24)
+#define V4L2_CID_NOTI_DATA_GET         (V4L2_CID_SENSOR_BASE + 25)
+#define V4L2_CID_EXIF_TIME_MODEL       (V4L2_CID_SENSOR_BASE + 26)
+#define V4L2_CID_CAMERA_DISTANCE_SCALE (V4L2_CID_SENSOR_BASE + 27)
+#define V4L2_CID_EXIF_GPS      (V4L2_CID_SENSOR_BASE + 28)
+
+#define V4L2_CID_CAMERA_SET_SNAPSHOT_SIZE  (V4L2_CID_SENSOR_BASE + 30)
+#define V4L2_CID_CAMERA_CAPTURE_MODE           (V4L2_CID_SENSOR_BASE + 31)
+#define V4L2_CID_CAMERA_SET_POSTVIEW_SIZE      (V4L2_CID_SENSOR_BASE + 32)
+#define V4L2_CID_START_CAPTURE_KIND  (V4L2_CID_SENSOR_BASE + 33)
+#define V4L2_CID_CAMERA_POSTVIEW_TRANSFER      (V4L2_CID_SENSOR_BASE + 34)
+
+#define V4L2_CID_CAM_JPEG_MAIN_SIZE            (V4L2_CID_SENSOR_BASE + 35)
+#define V4L2_CID_CAM_JPEG_MAIN_OFFSET          (V4L2_CID_SENSOR_BASE + 36)
+#define V4L2_CID_CAM_JPEG_THUMB_SIZE           (V4L2_CID_SENSOR_BASE + 37)
+#define V4L2_CID_CAM_JPEG_THUMB_OFFSET      (V4L2_CID_SENSOR_BASE + 38)
+
+#define V4L2_CID_CAMERA_STREAM_PART2        (V4L2_CID_SENSOR_BASE + 39)
+#define V4L2_CID_CAMERA_SMART_READ1         (V4L2_CID_SENSOR_BASE + 40)
+#define V4L2_CID_CAMERA_SMART_READ2         (V4L2_CID_SENSOR_BASE + 41)
+#define V4L2_CID_CAMERA_TIME_INFO           (V4L2_CID_SENSOR_BASE + 42)
+#define V4L2_CID_CAMERA_EXIF_FLASH          (V4L2_CID_SENSOR_BASE + 43)
+#define V4L2_CID_CAMERA_EXIF_ISO            (V4L2_CID_SENSOR_BASE + 44)
+#define V4L2_CID_CAMERA_EXIF_TV             (V4L2_CID_SENSOR_BASE + 45)
+#define V4L2_CID_CAMERA_EXIF_BV             (V4L2_CID_SENSOR_BASE + 46)
+#define V4L2_CID_CAMERA_EXIF_AV             (V4L2_CID_SENSOR_BASE + 47)
+#define V4L2_CID_CAMERA_EXIF_EBV            (V4L2_CID_SENSOR_BASE + 48)
+#define V4L2_CID_CAMERA_PASM_MODE           (V4L2_CID_SENSOR_BASE + 49)
+/* DO NOT ADD MORE CID TO SENSOR_BASE after 49 - Kernel Panic */
+
+/* 12  Y/CbCr 4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12T             v4l2_fourcc('T', 'V', '1', '2')
+#define V4L2_PIX_FMT_NV21T             v4l2_fourcc('T', 'V', '2', '1')
+#define V4L2_PIX_FMT_INTERLEAVED       v4l2_fourcc('I', 'T', 'L', 'V')
+
+/*
+ * V4L2 extention for digital camera
+ */
+/* Strobe flash light */
+enum v4l2_strobe_control {
+       /* turn off the flash light */
+       V4L2_STROBE_CONTROL_OFF         = 0,
+       /* turn on the flash light */
+       V4L2_STROBE_CONTROL_ON          = 1,
+       /* act guide light before splash */
+       V4L2_STROBE_CONTROL_AFGUIDE     = 2,
+       /* charge the flash light */
+       V4L2_STROBE_CONTROL_CHARGE      = 3,
+};
+
+enum v4l2_strobe_conf {
+       V4L2_STROBE_OFF                 = 0,    /* Always off */
+       V4L2_STROBE_ON                  = 1,    /* Always splashes */
+       /* Auto control presets */
+       V4L2_STROBE_AUTO                = 2,
+       V4L2_STROBE_REDEYE_REDUCTION    = 3,
+       V4L2_STROBE_SLOW_SYNC           = 4,
+       V4L2_STROBE_FRONT_CURTAIN       = 5,
+       V4L2_STROBE_REAR_CURTAIN        = 6,
+       /* Extra manual control presets */
+       /* keep turned on until turning off */
+       V4L2_STROBE_PERMANENT           = 7,
+       V4L2_STROBE_EXTERNAL            = 8,
+};
+
+enum v4l2_strobe_status {
+       V4L2_STROBE_STATUS_OFF          = 0,
+       /* while processing configurations */
+       V4L2_STROBE_STATUS_BUSY         = 1,
+       V4L2_STROBE_STATUS_ERR          = 2,
+       V4L2_STROBE_STATUS_CHARGING     = 3,
+       V4L2_STROBE_STATUS_CHARGED      = 4,
+};
+
+/* capabilities field */
+/* No strobe supported */
+#define V4L2_STROBE_CAP_NONE           0x0000
+/* Always flash off mode */
+#define V4L2_STROBE_CAP_OFF            0x0001
+/* Always use flash light mode */
+#define V4L2_STROBE_CAP_ON             0x0002
+/* Flashlight works automatic */
+#define V4L2_STROBE_CAP_AUTO           0x0004
+/* Red-eye reduction */
+#define V4L2_STROBE_CAP_REDEYE         0x0008
+/* Slow sync */
+#define V4L2_STROBE_CAP_SLOWSYNC       0x0010
+/* Front curtain */
+#define V4L2_STROBE_CAP_FRONT_CURTAIN  0x0020
+/* Rear curtain */
+#define V4L2_STROBE_CAP_REAR_CURTAIN   0x0040
+/* keep turned on until turning off */
+#define V4L2_STROBE_CAP_PERMANENT      0x0080
+/* use external strobe */
+#define V4L2_STROBE_CAP_EXTERNAL       0x0100
+
+/* Set mode and Get status */
+struct v4l2_strobe {
+       /* off/on/charge:0/1/2 */
+       enum    v4l2_strobe_control control;
+       /* supported strobe capabilities */
+       __u32   capabilities;
+       enum    v4l2_strobe_conf mode;
+       enum    v4l2_strobe_status status;      /* read only */
+       /* default is 0 and range of value varies from each models */
+       __u32   flash_ev;
+       __u32   reserved[4];
+};
+
+#define VIDIOC_S_STROBE                _IOWR('V', 83, struct v4l2_strobe)
+#define VIDIOC_G_STROBE                _IOR('V', 84, struct v4l2_strobe)
+
+/* Object recognition and collateral actions */
+enum v4l2_recog_mode {
+       V4L2_RECOGNITION_MODE_OFF       = 0,
+       V4L2_RECOGNITION_MODE_ON        = 1,
+       V4L2_RECOGNITION_MODE_LOCK      = 2,
+};
+
+enum v4l2_recog_action {
+       V4L2_RECOGNITION_ACTION_NONE    = 0,    /* only recognition */
+       V4L2_RECOGNITION_ACTION_BLINK   = 1,    /* Capture on blinking */
+       V4L2_RECOGNITION_ACTION_SMILE   = 2,    /* Capture on smiling */
+};
+
+enum v4l2_recog_pattern {
+       V4L2_RECOG_PATTERN_FACE         = 0, /* Face */
+       V4L2_RECOG_PATTERN_HUMAN        = 1, /* Human */
+       V4L2_RECOG_PATTERN_CHAR         = 2, /* Character */
+};
+
+struct v4l2_recog_rect {
+       enum    v4l2_recog_pattern  p;  /* detected pattern */
+       struct  v4l2_rect  o;   /* detected area */
+       __u32   reserved[4];
+};
+
+struct v4l2_recog_data {
+       __u8    detect_cnt;             /* detected object counter */
+       struct  v4l2_rect       o;      /* detected area */
+       __u32   reserved[4];
+};
+
+struct v4l2_recognition {
+       enum    v4l2_recog_mode mode;
+
+       /* Which pattern to detect */
+       enum    v4l2_recog_pattern      pattern;
+
+       /* How many object to detect */
+       __u8    obj_num;
+
+       /* select detected object */
+       __u32   detect_idx;
+
+       /* read only :Get object coordination */
+       struct  v4l2_recog_data data;
+
+       enum    v4l2_recog_action       action;
+       __u32   reserved[4];
+};
+
+#define VIDIOC_S_RECOGNITION   _IOWR('V', 85, struct v4l2_recognition)
+#define VIDIOC_G_RECOGNITION   _IOR('V', 86, struct v4l2_recognition)
+/*
+ * We use this struct as the v4l2_streamparm raw_data for
+ * VIDIOC_G_PARM and VIDIOC_S_PARM
+ */
+struct sec_cam_parm {
+       struct v4l2_captureparm capture;
+       int contrast;
+       int effects;
+       int brightness;
+       int flash_mode;
+       int focus_mode;
+       int iso;
+       int metering;
+       int saturation;
+       int scene_mode;
+       int sharpness;
+       int white_balance;
+       int fps;
+       int aeawb_lockunlock;
+       int zoom_ratio;
+};
+
+#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */
diff --git a/libgscaler/Android.mk b/libgscaler/Android.mk
new file mode 100644 (file)
index 0000000..c1d7f2f
--- /dev/null
@@ -0,0 +1,43 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ifeq ($(filter-out exynos5,$(TARGET_BOARD_PLATFORM)),)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_SHARED_LIBRARIES := liblog libutils libcutils libexynosutils libexynosv4l2 libexynosscaler
+
+# to talk to secure side
+LOCAL_SHARED_LIBRARIES += libMcClient
+LOCAL_STATIC_LIBRARIES := libsecurepath
+
+LOCAL_C_INCLUDES := \
+       $(LOCAL_PATH)/../include \
+       $(TOP)/hardware/samsung_slsi/exynos/include \
+       $(TOP)/hardware/samsung_slsi/exynos/libexynosutils \
+       $(TOP)/hardware/samsung_slsi/exynos/libmpp
+
+LOCAL_SRC_FILES := \
+       libgscaler_obj.cpp \
+       libgscaler.cpp
+
+LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE := libexynosgscaler
+
+include $(TOP)/hardware/samsung_slsi/exynos/BoardConfigCFlags.mk
+include $(BUILD_SHARED_LIBRARY)
+
+endif
diff --git a/libgscaler/libgscaler_obj.cpp b/libgscaler/libgscaler_obj.cpp
new file mode 100644 (file)
index 0000000..df82c74
--- /dev/null
@@ -0,0 +1,1661 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file      libgscaler_obj.cpp
+ * \brief     source file for Gscaler HAL
+ * \author    Sungchun Kang (sungchun.kang@samsung.com)
+ * \date      2013/06/01
+ *
+ * <b>Revision History: </b>
+ * - 2013.06.01 : Sungchun Kang (sungchun.kang@samsung.com) \n
+ *   Create
+ */
+
+#include "libgscaler_obj.h"
+#include "content_protect.h"
+
+int CGscaler::m_gsc_output_create(void *handle, int dev_num, int out_mode)
+{
+    Exynos_gsc_In();
+
+    struct media_device *media0;
+    struct media_entity *gsc_sd_entity;
+    struct media_entity *gsc_vd_entity;
+    struct media_entity *sink_sd_entity;
+    struct media_link *links;
+    char node[32];
+    char devname[32];
+    unsigned int cap;
+    int         i;
+    int         fd = 0;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if ((out_mode != GSC_OUT_FIMD) &&
+        (out_mode != GSC_OUT_TV))
+        return -1;
+
+    gsc->out_mode = out_mode;
+    /* GSCX => FIMD_WINX : arbitrary linking is not allowed */
+    if ((out_mode == GSC_OUT_FIMD) &&
+#ifndef USES_ONLY_GSC0_GSC1
+        (dev_num > 2))
+#else
+        (dev_num > 1))
+#endif
+        return -1;
+
+    /* media0 */
+    snprintf(node, sizeof(node), "%s%d", PFX_NODE_MEDIADEV, 0);
+    media0 = exynos_media_open(node);
+    if (media0 == NULL) {
+        ALOGE("%s::exynos_media_open failed (node=%s)", __func__, node);
+        return false;
+    }
+    gsc->mdev.media0 = media0;
+
+    /* Get the sink subdev entity by name and make the node of sink subdev*/
+    if (out_mode == GSC_OUT_FIMD)
+        snprintf(devname, sizeof(devname), PFX_FIMD_ENTITY, dev_num);
+    else
+        snprintf(devname, sizeof(devname), PFX_MXR_ENTITY, 0);
+
+    sink_sd_entity = exynos_media_get_entity_by_name(media0, devname,
+            strlen(devname));
+    if (!sink_sd_entity) {
+        ALOGE("%s:: failed to get the sink sd entity", __func__);
+        goto gsc_output_err;
+    }
+    gsc->mdev.sink_sd_entity = sink_sd_entity;
+
+    sink_sd_entity->fd = exynos_subdev_open_devname(devname, O_RDWR);
+    if (sink_sd_entity->fd < 0) {
+        ALOGE("%s:: failed to open sink subdev node", __func__);
+        goto gsc_output_err;
+    }
+
+    /* get GSC video dev & sub dev entity by name*/
+#if defined(USES_DT)
+    switch (dev_num) {
+    case 0:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY0);
+        break;
+    case 1:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY1);
+        break;
+    case 2:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY2);
+        break;
+    }
+#else
+    snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY, dev_num);
+#endif
+    gsc_vd_entity = exynos_media_get_entity_by_name(media0, devname,
+            strlen(devname));
+    if (!gsc_vd_entity) {
+        ALOGE("%s:: failed to get the gsc vd entity", __func__);
+        goto gsc_output_err;
+    }
+    gsc->mdev.gsc_vd_entity = gsc_vd_entity;
+
+    snprintf(devname, sizeof(devname), PFX_GSC_SUBDEV_ENTITY, dev_num);
+    gsc_sd_entity = exynos_media_get_entity_by_name(media0, devname,
+            strlen(devname));
+    if (!gsc_sd_entity) {
+        ALOGE("%s:: failed to get the gsc sd entity", __func__);
+        goto gsc_output_err;
+    }
+    gsc->mdev.gsc_sd_entity = gsc_sd_entity;
+
+    /* gsc sub-dev open */
+    snprintf(devname, sizeof(devname), PFX_GSC_SUBDEV_ENTITY, dev_num);
+    gsc_sd_entity->fd = exynos_subdev_open_devname(devname, O_RDWR);
+    if (gsc_sd_entity->fd < 0) {
+        ALOGE("%s: gsc sub-dev open fail", __func__);
+        goto gsc_output_err;
+    }
+
+    /* setup link : GSC : video device --> sub device */
+    for (i = 0; i < (int) gsc_vd_entity->num_links; i++) {
+        links = &gsc_vd_entity->links[i];
+
+        if (links == NULL ||
+            links->source->entity != gsc_vd_entity ||
+            links->sink->entity   != gsc_sd_entity) {
+            continue;
+        } else if (exynos_media_setup_link(media0, links->source,
+                    links->sink, MEDIA_LNK_FL_ENABLED) < 0) {
+            ALOGE("%s::exynos_media_setup_link \
+                    [src.entity=%d->sink.entity=%d] failed",
+                    __func__, links->source->entity->info.id,
+                    links->sink->entity->info.id);
+            return -1;
+        }
+    }
+
+    /* setup link : GSC: sub device --> sink device */
+    for (i = 0; i < (int) gsc_sd_entity->num_links; i++) {
+        links = &gsc_sd_entity->links[i];
+
+        if (links == NULL || links->source->entity != gsc_sd_entity ||
+                             links->sink->entity != sink_sd_entity) {
+            continue;
+        } else if (exynos_media_setup_link(media0, links->source,
+                    links->sink, MEDIA_LNK_FL_ENABLED) < 0) {
+            ALOGE("%s::exynos_media_setup_link \
+                    [src.entity=%d->sink.entity=%d] failed",
+                    __func__, links->source->entity->info.id,
+                    links->sink->entity->info.id);
+            return -1;
+        }
+    }
+
+    /* gsc video-dev open */
+#if defined(USES_DT)
+    switch (dev_num) {
+    case 0:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY0);
+        break;
+    case 1:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY1);
+        break;
+    case 2:
+        snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY2);
+        break;
+    }
+#else
+    snprintf(devname, sizeof(devname), PFX_GSC_VIDEODEV_ENTITY, dev_num);
+#endif
+    gsc_vd_entity->fd = exynos_v4l2_open_devname(devname, O_RDWR);
+    if (gsc_vd_entity->fd < 0) {
+        ALOGE("%s: gsc video-dev open fail", __func__);
+        goto gsc_output_err;
+    }
+
+    cap = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT_MPLANE;
+
+    if (exynos_v4l2_querycap(gsc_vd_entity->fd, cap) == false) {
+        ALOGE("%s::exynos_v4l2_querycap() fail", __func__);
+        goto gsc_output_err;
+    }
+
+    Exynos_gsc_Out();
+
+    return 0;
+
+gsc_output_err:
+    gsc->m_gsc_out_destroy(handle);
+
+    return -1;
+}
+
+int CGscaler::m_gsc_out_stop(void *handle)
+{
+    Exynos_gsc_In();
+
+    struct v4l2_requestbuffers reqbuf;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if (gsc->src_info.stream_on == false) {
+        /* to handle special scenario.*/
+        gsc->src_info.qbuf_cnt = 0;
+        ALOGD("%s::GSC is already stopped", __func__);
+        goto SKIP_STREAMOFF;
+    }
+    gsc->src_info.qbuf_cnt = 0;
+    gsc->src_info.stream_on = false;
+
+    if (exynos_v4l2_streamoff(gsc->mdev.gsc_vd_entity->fd,
+                                V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) < 0) {
+        ALOGE("%s::stream off failed", __func__);
+        return -1;
+    }
+
+SKIP_STREAMOFF:
+    Exynos_gsc_Out();
+
+    return 0;
+}
+
+bool CGscaler::m_gsc_out_destroy(void *handle)
+{
+    Exynos_gsc_In();
+
+    struct media_link * links;
+    int i;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return false;
+    }
+
+    if (gsc->src_info.stream_on == true) {
+        if (gsc->m_gsc_out_stop(gsc) < 0)
+            ALOGE("%s::m_gsc_out_stop() fail", __func__);
+
+            gsc->src_info.stream_on = false;
+    }
+
+    if (gsc->mdev.media0 && gsc->mdev.gsc_sd_entity &&
+        gsc->mdev.gsc_vd_entity && gsc->mdev.sink_sd_entity) {
+
+        /* unlink : gscaler-out --> fimd */
+        for (i = 0; i < (int) gsc->mdev.gsc_sd_entity->num_links; i++) {
+            links = &gsc->mdev.gsc_sd_entity->links[i];
+            if (links == NULL ||
+                links->source->entity != gsc->mdev.gsc_sd_entity ||
+                links->sink->entity != gsc->mdev.sink_sd_entity) {
+                continue;
+            } else if (exynos_media_setup_link(gsc->mdev.media0,
+                links->source, links->sink, 0) < 0) {
+                ALOGE("%s::exynos_media_setup_unlink \
+                        [src.entity=%d->sink.entity=%d] failed",
+                        __func__, links->source->entity->info.id,
+                        links->sink->entity->info.id);
+            }
+        }
+    }
+
+    if (gsc->mdev.gsc_vd_entity && gsc->mdev.gsc_vd_entity->fd > 0) {
+        close(gsc->mdev.gsc_vd_entity->fd);
+        gsc->mdev.gsc_vd_entity->fd = -1;
+    }
+
+    if (gsc->mdev.gsc_sd_entity && gsc->mdev.gsc_sd_entity->fd > 0) {
+        close(gsc->mdev.gsc_sd_entity->fd);
+        gsc->mdev.gsc_sd_entity->fd = -1;
+    }
+
+    if (gsc->mdev.sink_sd_entity && gsc->mdev.sink_sd_entity->fd > 0) {
+        close(gsc->mdev.sink_sd_entity->fd);
+        gsc->mdev.sink_sd_entity->fd = -1;
+    }
+
+    if (gsc->mdev.media0)
+        exynos_media_close(gsc->mdev.media0);
+
+    gsc->mdev.media0 = NULL;
+    gsc->mdev.gsc_sd_entity = NULL;
+    gsc->mdev.gsc_vd_entity = NULL;
+    gsc->mdev.sink_sd_entity = NULL;
+
+    Exynos_gsc_Out();
+    return true;
+}
+
+int CGscaler::m_gsc_m2m_create(int dev)
+{
+    Exynos_gsc_In();
+
+    int          fd = 0;
+    int          video_node_num;
+    unsigned int cap;
+    char         node[32];
+
+    switch(dev) {
+    case 0:
+        video_node_num = NODE_NUM_GSC_0;
+        break;
+    case 1:
+        video_node_num = NODE_NUM_GSC_1;
+        break;
+#ifndef USES_ONLY_GSC0_GSC1
+    case 2:
+        video_node_num = NODE_NUM_GSC_2;
+        break;
+    case 3:
+        video_node_num = NODE_NUM_GSC_3;
+        break;
+#endif
+    default:
+        ALOGE("%s::unexpected dev(%d) fail", __func__, dev);
+        return -1;
+        break;
+    }
+
+    snprintf(node, sizeof(node), "%s%d", PFX_NODE_GSC, video_node_num);
+    fd = exynos_v4l2_open(node, O_RDWR);
+    if (fd < 0) {
+        ALOGE("%s::exynos_v4l2_open(%s) fail", __func__, node);
+        return -1;
+    }
+
+    cap = V4L2_CAP_STREAMING |
+          V4L2_CAP_VIDEO_OUTPUT_MPLANE |
+          V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+
+    if (exynos_v4l2_querycap(fd, cap) == false) {
+        ALOGE("%s::exynos_v4l2_querycap() fail", __func__);
+        close(fd);
+        fd = 0;
+        return -1;
+    }
+
+    Exynos_gsc_Out();
+
+    return fd;
+}
+
+bool CGscaler::m_gsc_find_and_create(void *handle)
+{
+    Exynos_gsc_In();
+
+    int          i                 = 0;
+    bool         flag_find_new_gsc = false;
+    unsigned int total_sleep_time  = 0;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return false;
+    }
+
+    do {
+        for (i = 0; i < NUM_OF_GSC_HW; i++) {
+#ifndef USES_ONLY_GSC0_GSC1
+            if (i == 0 || i == 3)
+#else
+            if (i == 0)
+#endif
+                continue;
+
+            gsc->gsc_id = i;
+            gsc->gsc_fd = gsc->m_gsc_m2m_create(i);
+            if (gsc->gsc_fd < 0) {
+                gsc->gsc_fd = 0;
+                continue;
+            }
+
+            flag_find_new_gsc = true;
+            break;
+        }
+
+        if (flag_find_new_gsc == false) {
+            usleep(GSC_WAITING_TIME_FOR_TRYLOCK);
+            total_sleep_time += GSC_WAITING_TIME_FOR_TRYLOCK;
+            ALOGV("%s::waiting for the gscaler availability", __func__);
+        }
+
+    } while(flag_find_new_gsc == false
+            && total_sleep_time < MAX_GSC_WAITING_TIME_FOR_TRYLOCK);
+
+    if (flag_find_new_gsc == false)
+        ALOGE("%s::we don't have any available gsc.. fail", __func__);
+
+    Exynos_gsc_Out();
+
+    return flag_find_new_gsc;
+}
+
+bool CGscaler::m_gsc_m2m_destroy(void *handle)
+{
+    Exynos_gsc_In();
+
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return false;
+    }
+
+    /*
+     * just in case, we call stop here because we cannot afford to leave
+     * secure side protection on if things failed.
+     */
+    gsc->m_gsc_m2m_stop(handle);
+
+    if (gsc->gsc_id >= HW_SCAL0) {
+        bool ret = exynos_sc_free_and_close(gsc->scaler);
+        Exynos_gsc_Out();
+        return ret;
+    }
+
+    if (0 < gsc->gsc_fd)
+        close(gsc->gsc_fd);
+    gsc->gsc_fd = 0;
+
+    Exynos_gsc_Out();
+
+    return true;
+}
+
+int CGscaler::m_gsc_m2m_stop(void *handle)
+{
+    Exynos_gsc_In();
+
+    struct v4l2_requestbuffers req_buf;
+    int ret = 0;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if (!gsc->src_info.stream_on && !gsc->dst_info.stream_on) {
+        /* wasn't streaming, return success */
+        return 0;
+    } else if (gsc->src_info.stream_on != gsc->dst_info.stream_on) {
+        ALOGE("%s: invalid state, queue stream state doesn't match \
+                (%d != %d)", __func__, gsc->src_info.stream_on,
+                gsc->dst_info.stream_on);
+        ret = -1;
+    }
+
+    /*
+     * we need to plow forward on errors below to make sure that if we had
+     * turned on content protection on secure side, we turn it off.
+     *
+     * also, if we only failed to turn on one of the streams, we'll turn
+     * the other one off correctly.
+     */
+    if (gsc->src_info.stream_on == true) {
+        if (exynos_v4l2_streamoff(gsc->gsc_fd,
+            gsc->src_info.buf.buf_type) < 0) {
+            ALOGE("%s::exynos_v4l2_streamoff(src) fail", __func__);
+            ret = -1;
+        }
+        gsc->src_info.stream_on = false;
+    }
+
+    if (gsc->dst_info.stream_on == true) {
+        if (exynos_v4l2_streamoff(gsc->gsc_fd,
+            gsc->dst_info.buf.buf_type) < 0) {
+            ALOGE("%s::exynos_v4l2_streamoff(dst) fail", __func__);
+            ret = -1;
+        }
+        gsc->dst_info.stream_on = false;
+    }
+
+    /* if drm is enabled */
+    if (gsc->allow_drm && gsc->protection_enabled) {
+        unsigned int protect_id = 0;
+
+        if (gsc->gsc_id == 0)
+            protect_id = CP_PROTECT_GSC0;
+        else if (gsc->gsc_id == 1)
+            protect_id = CP_PROTECT_GSC1;
+        else if (gsc->gsc_id == 2)
+            protect_id = CP_PROTECT_GSC3;
+        else if (gsc->gsc_id == 3)
+            protect_id = CP_PROTECT_GSC3;
+
+        CP_Disable_Path_Protection(protect_id);
+        gsc->protection_enabled = false;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->gsc_fd,
+                           V4L2_CID_CONTENT_PROTECTION, 0) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CONTENT_PROTECTION) fail",
+              __func__);
+        ret = -1;
+    }
+
+    /* src: clear_buf */
+    req_buf.count  = 0;
+    req_buf.type   = gsc->src_info.buf.buf_type;
+    req_buf.memory = gsc->src_info.buf.mem_type;
+    if (exynos_v4l2_reqbufs(gsc->gsc_fd, &req_buf) < 0) {
+        ALOGE("%s::exynos_v4l2_reqbufs():src: fail", __func__);
+        ret = -1;
+    }
+
+    /* dst: clear_buf */
+    req_buf.count  = 0;
+    req_buf.type   = gsc->dst_info.buf.buf_type;
+    req_buf.memory = gsc->dst_info.buf.mem_type;;
+    if (exynos_v4l2_reqbufs(gsc->gsc_fd, &req_buf) < 0) {
+        ALOGE("%s::exynos_v4l2_reqbufs():dst: fail", __func__);
+        ret = -1;
+    }
+
+    Exynos_gsc_Out();
+
+    return ret;
+}
+
+int CGscaler::m_gsc_m2m_run_core(void *handle)
+{
+    Exynos_gsc_In();
+
+    unsigned int rotate, hflip, vflip;
+    bool is_dirty;
+    bool is_drm;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    is_dirty = gsc->src_info.dirty || gsc->dst_info.dirty;
+    is_drm = gsc->src_info.mode_drm;
+
+    if (is_dirty && (gsc->src_info.mode_drm != gsc->dst_info.mode_drm)) {
+        ALOGE("%s: drm mode mismatch between src and dst, \
+                gsc%d (s=%d d=%d)", __func__, gsc->gsc_id,
+                gsc->src_info.mode_drm, gsc->dst_info.mode_drm);
+        return -1;
+    } else if (is_drm && !gsc->allow_drm) {
+        ALOGE("%s: drm mode is not supported on gsc%d", __func__,
+              gsc->gsc_id);
+        return -1;
+    }
+
+    CGscaler::rotateValueHAL2GSC(gsc->dst_img.rot, &rotate, &hflip, &vflip);
+
+    if (CGscaler::m_gsc_check_src_size(&gsc->src_info.width,
+            &gsc->src_info.height, &gsc->src_info.crop_left,
+            &gsc->src_info.crop_top, &gsc->src_info.crop_width,
+            &gsc->src_info.crop_height, gsc->src_info.v4l2_colorformat,
+            (rotate == 90 || rotate == 270)) == false) {
+        ALOGE("%s::m_gsc_check_src_size() fail", __func__);
+        return -1;
+    }
+
+    if (CGscaler::m_gsc_check_dst_size(&gsc->dst_info.width,
+            &gsc->dst_info.height, &gsc->dst_info.crop_left,
+            &gsc->dst_info.crop_top, &gsc->dst_info.crop_width,
+            &gsc->dst_info.crop_height, gsc->dst_info.v4l2_colorformat,
+            gsc->dst_info.rotation) == false) {
+        ALOGE("%s::m_gsc_check_dst_size() fail", __func__);
+        return -1;
+    }
+
+    /* dequeue buffers from previous work if necessary */
+    if (gsc->src_info.stream_on == true) {
+        if (gsc->m_gsc_m2m_wait_frame_done(handle) < 0) {
+            ALOGE("%s::exynos_gsc_m2m_wait_frame_done fail", __func__);
+            return -1;
+        }
+    }
+
+    /*
+     * need to set the content protection flag before doing reqbufs
+     * in set_format
+     */
+    if (is_dirty && gsc->allow_drm && is_drm) {
+        if (exynos_v4l2_s_ctrl(gsc->gsc_fd,
+               V4L2_CID_CONTENT_PROTECTION, is_drm) < 0) {
+            ALOGE("%s::exynos_v4l2_s_ctrl() fail", __func__);
+            return -1;
+        }
+    }
+
+    /*
+     * from this point on, we have to ensure to call stop to clean up
+     * whatever state we have set.
+     */
+
+    if (gsc->src_info.dirty) {
+        if (CGscaler::m_gsc_set_format(gsc->gsc_fd, &gsc->src_info) == false) {
+            ALOGE("%s::m_gsc_set_format(src) fail", __func__);
+            goto done;
+        }
+        gsc->src_info.dirty = false;
+    }
+
+    if (gsc->dst_info.dirty) {
+        if (CGscaler::m_gsc_set_format(gsc->gsc_fd, &gsc->dst_info) == false) {
+            ALOGE("%s::m_gsc_set_format(dst) fail", __func__);
+            goto done;
+        }
+        gsc->dst_info.dirty = false;
+    }
+
+    /*
+     * set up csc equation property
+     */
+    if (is_dirty) {
+        if (exynos_v4l2_s_ctrl(gsc->gsc_fd,
+               V4L2_CID_CSC_EQ_MODE, gsc->eq_auto) < 0) {
+            ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_EQ_MODE) fail", __func__);
+            return -1;
+        }
+
+        if (exynos_v4l2_s_ctrl(gsc->gsc_fd,
+               V4L2_CID_CSC_EQ, gsc->v4l2_colorspace) < 0) {
+            ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_EQ) fail", __func__);
+            return -1;
+        }
+
+        if (exynos_v4l2_s_ctrl(gsc->gsc_fd,
+               V4L2_CID_CSC_RANGE, gsc->range_full) < 0) {
+            ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_RANGE) fail", __func__);
+            return -1;
+        }
+    }
+
+    /* if we are enabling drm, make sure to enable hw protection.
+     * Need to do this before queuing buffers so that the mmu is reserved
+     * and power domain is kept on.
+     */
+    if (is_dirty && gsc->allow_drm && is_drm) {
+        unsigned int protect_id = 0;
+
+        if (gsc->gsc_id == 0) {
+            protect_id = CP_PROTECT_GSC0;
+        } else if (gsc->gsc_id == 1) {
+            protect_id = CP_PROTECT_GSC1;
+        } else if (gsc->gsc_id == 2) {
+            protect_id = CP_PROTECT_GSC2;
+        } else if (gsc->gsc_id == 3) {
+            protect_id = CP_PROTECT_GSC3;
+        } else {
+            ALOGE("%s::invalid gscaler id %d for content protection",
+            __func__, gsc->gsc_id);
+            goto done;
+        }
+
+        if (CP_Enable_Path_Protection(protect_id) != 0) {
+            ALOGE("%s::CP_Enable_Path_Protection failed", __func__);
+            goto done;
+        }
+        gsc->protection_enabled = true;
+    }
+
+    if (gsc->m_gsc_set_addr(gsc->gsc_fd, &gsc->src_info) == false) {
+        ALOGE("%s::m_gsc_set_addr(src) fail", __func__);
+        goto done;
+    }
+
+    if (gsc->m_gsc_set_addr(gsc->gsc_fd, &gsc->dst_info) == false) {
+        ALOGE("%s::m_gsc_set_addr(dst) fail", __func__);
+        goto done;
+    }
+
+    if (gsc->src_info.stream_on == false) {
+        if (exynos_v4l2_streamon(gsc->gsc_fd, gsc->src_info.buf.buf_type) < 0) {
+            ALOGE("%s::exynos_v4l2_streamon(src) fail", __func__);
+            goto done;
+        }
+        gsc->src_info.stream_on = true;
+    }
+
+    if (gsc->dst_info.stream_on == false) {
+        if (exynos_v4l2_streamon(gsc->gsc_fd, gsc->dst_info.buf.buf_type) < 0) {
+            ALOGE("%s::exynos_v4l2_streamon(dst) fail", __func__);
+            goto done;
+        }
+        gsc->dst_info.stream_on = true;
+    }
+
+    Exynos_gsc_Out();
+
+    return 0;
+
+done:
+    gsc->m_gsc_m2m_stop(handle);
+    return -1;
+}
+
+bool CGscaler::m_gsc_check_src_size(
+    unsigned int *w,      unsigned int *h,
+    unsigned int *crop_x, unsigned int *crop_y,
+    unsigned int *crop_w, unsigned int *crop_h,
+    int v4l2_colorformat, bool rotation)
+{
+    unsigned int minWidth, minHeight, shift = 0;
+    if (v4l2_colorformat == V4L2_PIX_FMT_RGB32 || v4l2_colorformat == V4L2_PIX_FMT_RGB565)
+        shift = 1;
+    if (rotation) {
+        minWidth = GSC_MIN_SRC_H_SIZE >> shift;
+        minHeight = GSC_MIN_SRC_W_SIZE >> shift;
+    } else {
+        minWidth = GSC_MIN_SRC_W_SIZE >> shift;
+        minHeight = GSC_MIN_SRC_H_SIZE >> shift;
+    }
+
+    if (*w < minWidth || *h < minHeight) {
+        ALOGE("%s::too small size (w : %d < %d) (h : %d < %d)",
+            __func__, GSC_MIN_SRC_W_SIZE, *w, GSC_MIN_SRC_H_SIZE, *h);
+        return false;
+    }
+
+    if (*crop_w < minWidth || *crop_h < minHeight) {
+        ALOGE("%s::too small size (w : %d < %d) (h : %d < %d)",
+            __func__, GSC_MIN_SRC_W_SIZE,* crop_w, GSC_MIN_SRC_H_SIZE, *crop_h);
+        return false;
+    }
+
+    return true;
+}
+
+bool CGscaler::m_gsc_check_dst_size(
+    unsigned int *w,      unsigned int *h,
+    unsigned int *crop_x, unsigned int *crop_y,
+    unsigned int *crop_w, unsigned int *crop_h,
+    int v4l2_colorformat,
+    int rotation)
+{
+    if (*w < GSC_MIN_DST_W_SIZE || *h < GSC_MIN_DST_H_SIZE) {
+        ALOGE("%s::too small size (w : %d < %d) (h : %d < %d)",
+            __func__, GSC_MIN_DST_W_SIZE, *w, GSC_MIN_DST_H_SIZE, *h);
+        return false;
+    }
+
+    if (*crop_w < GSC_MIN_DST_W_SIZE || *crop_h < GSC_MIN_DST_H_SIZE) {
+        ALOGE("%s::too small size (w : %d < %d) (h : %d < %d)",
+            __func__, GSC_MIN_DST_W_SIZE,* crop_w, GSC_MIN_DST_H_SIZE, *crop_h);
+        return false;
+    }
+
+    return true;
+}
+
+
+int CGscaler::m_gsc_multiple_of_n(int number, int N)
+{
+    int result = number;
+    switch (N) {
+    case 1:
+    case 2:
+    case 4:
+    case 8:
+    case 16:
+    case 32:
+    case 64:
+    case 128:
+    case 256:
+        result = (number - (number & (N-1)));
+        break;
+    default:
+        result = number - (number % N);
+        break;
+    }
+    return result;
+}
+
+int CGscaler::m_gsc_m2m_wait_frame_done(void *handle)
+{
+    Exynos_gsc_In();
+
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if ((gsc->src_info.stream_on == false) ||
+        (gsc->dst_info.stream_on == false)) {
+        ALOGE("%s:: src_strean_on or dst_stream_on are false", __func__);
+        return -1;
+    }
+
+    if (gsc->src_info.buf.buffer_queued) {
+        if (exynos_v4l2_dqbuf(gsc->gsc_fd, &gsc->src_info.buf.buffer) < 0) {
+            ALOGE("%s::exynos_v4l2_dqbuf(src) fail", __func__);
+            return -1;
+        }
+        gsc->src_info.buf.buffer_queued = false;
+    }
+
+    if (gsc->dst_info.buf.buffer_queued) {
+        if (exynos_v4l2_dqbuf(gsc->gsc_fd, &gsc->dst_info.buf.buffer) < 0) {
+            ALOGE("%s::exynos_v4l2_dqbuf(dst) fail", __func__);
+            return -1;
+        }
+        gsc->dst_info.buf.buffer_queued = false;
+    }
+
+    Exynos_gsc_Out();
+
+    return 0;
+}
+
+bool CGscaler::m_gsc_set_format(int fd, GscInfo *info)
+{
+    Exynos_gsc_In();
+
+    struct v4l2_requestbuffers req_buf;
+    int                        plane_count;
+
+    plane_count = m_gsc_get_plane_count(info->v4l2_colorformat);
+    if (plane_count < 0) {
+        ALOGE("%s::not supported v4l2_colorformat", __func__);
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(fd, V4L2_CID_ROTATE, info->rotation) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_ROTATE) fail", __func__);
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(fd, V4L2_CID_VFLIP, info->flip_horizontal) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_VFLIP) fail", __func__);
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(fd, V4L2_CID_HFLIP, info->flip_vertical) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_HFLIP) fail", __func__);
+        return false;
+    }
+
+    info->format.type = info->buf.buf_type;
+    info->format.fmt.pix_mp.width       = info->width;
+    info->format.fmt.pix_mp.height      = info->height;
+    info->format.fmt.pix_mp.pixelformat = info->v4l2_colorformat;
+    info->format.fmt.pix_mp.field       = V4L2_FIELD_ANY;
+    info->format.fmt.pix_mp.num_planes  = plane_count;
+
+    if (exynos_v4l2_s_fmt(fd, &info->format) < 0) {
+        ALOGE("%s::exynos_v4l2_s_fmt() fail", __func__);
+        return false;
+    }
+
+    info->crop.type     = info->buf.buf_type;
+    info->crop.c.left   = info->crop_left;
+    info->crop.c.top    = info->crop_top;
+    info->crop.c.width  = info->crop_width;
+    info->crop.c.height = info->crop_height;
+
+    if (exynos_v4l2_s_crop(fd, &info->crop) < 0) {
+        ALOGE("%s::exynos_v4l2_s_crop() fail", __func__);
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(fd, V4L2_CID_CACHEABLE, info->cacheable) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl() fail", __func__);
+        return false;
+    }
+
+    req_buf.count  = 1;
+    req_buf.type   = info->buf.buf_type;
+    req_buf.memory = info->buf.mem_type;
+    if (exynos_v4l2_reqbufs(fd, &req_buf) < 0) {
+        ALOGE("%s::exynos_v4l2_reqbufs() fail", __func__);
+        return false;
+    }
+
+    Exynos_gsc_Out();
+
+    return true;
+}
+
+unsigned int CGscaler::m_gsc_get_plane_count(int v4l_pixel_format)
+{
+    int plane_count = 0;
+
+    switch (v4l_pixel_format) {
+    case V4L2_PIX_FMT_RGB32:
+    case V4L2_PIX_FMT_BGR32:
+    case V4L2_PIX_FMT_RGB24:
+    case V4L2_PIX_FMT_RGB565:
+    case V4L2_PIX_FMT_RGB555X:
+    case V4L2_PIX_FMT_RGB444:
+    case V4L2_PIX_FMT_YUYV:
+    case V4L2_PIX_FMT_UYVY:
+    case V4L2_PIX_FMT_NV16:
+    case V4L2_PIX_FMT_NV61:
+    case V4L2_PIX_FMT_YVU420:
+    case V4L2_PIX_FMT_YUV420:
+    case V4L2_PIX_FMT_NV12:
+    case V4L2_PIX_FMT_NV21:
+    case V4L2_PIX_FMT_YUV422P:
+        plane_count = 1;
+        break;
+    case V4L2_PIX_FMT_NV12M:
+    case V4L2_PIX_FMT_NV12MT_16X16:
+    case V4L2_PIX_FMT_NV21M:
+        plane_count = 2;
+        break;
+    case V4L2_PIX_FMT_YVU420M:
+    case V4L2_PIX_FMT_YUV420M:
+        plane_count = 3;
+        break;
+    default:
+        ALOGE("%s::unmatched v4l_pixel_format color_space(0x%x)\n",
+             __func__, v4l_pixel_format);
+        plane_count = -1;
+        break;
+    }
+
+    return plane_count;
+}
+
+bool CGscaler::m_gsc_set_addr(int fd, GscInfo *info)
+{
+    unsigned int i;
+    unsigned int plane_size[NUM_OF_GSC_PLANES];
+
+    CGscaler::m_gsc_get_plane_size(plane_size, info->width,
+                         info->height, info->v4l2_colorformat);
+
+    info->buf.buffer.index    = 0;
+    info->buf.buffer.flags    = V4L2_BUF_FLAG_USE_SYNC;
+    info->buf.buffer.type     = info->buf.buf_type;
+    info->buf.buffer.memory   = info->buf.mem_type;
+    info->buf.buffer.m.planes = info->buf.planes;
+    info->buf.buffer.length   = info->format.fmt.pix_mp.num_planes;
+    info->buf.buffer.reserved = info->acquireFenceFd;
+
+    for (i = 0; i < info->format.fmt.pix_mp.num_planes; i++) {
+        if (info->buf.buffer.memory == V4L2_MEMORY_DMABUF)
+            info->buf.buffer.m.planes[i].m.fd = (int)info->buf.addr[i];
+        else
+            info->buf.buffer.m.planes[i].m.userptr =
+                (unsigned long)info->buf.addr[i];
+        info->buf.buffer.m.planes[i].length    = plane_size[i];
+        info->buf.buffer.m.planes[i].bytesused = 0;
+    }
+
+    if (exynos_v4l2_qbuf(fd, &info->buf.buffer) < 0) {
+        ALOGE("%s::exynos_v4l2_qbuf() fail", __func__);
+        return false;
+    }
+    info->buf.buffer_queued = true;
+
+    info->releaseFenceFd = info->buf.buffer.reserved;
+
+    return true;
+}
+
+unsigned int CGscaler::m_gsc_get_plane_size(
+    unsigned int *plane_size,
+    unsigned int  width,
+    unsigned int  height,
+    int           v4l_pixel_format)
+{
+    switch (v4l_pixel_format) {
+    /* 1 plane */
+    case V4L2_PIX_FMT_RGB32:
+    case V4L2_PIX_FMT_BGR32:
+        plane_size[0] = width * height * 4;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_RGB24:
+        plane_size[0] = width * height * 3;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_RGB565:
+    case V4L2_PIX_FMT_RGB555X:
+    case V4L2_PIX_FMT_RGB444:
+    case V4L2_PIX_FMT_YUYV:
+    case V4L2_PIX_FMT_UYVY:
+        plane_size[0] = width * height * 2;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    /* 2 planes */
+    case V4L2_PIX_FMT_NV12M:
+    case V4L2_PIX_FMT_NV21M:
+        plane_size[0] = width * height;
+        plane_size[1] = width * (height / 2);
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_NV12:
+    case V4L2_PIX_FMT_NV21:
+        plane_size[0] = width * height * 3 / 2;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+       break;
+    case V4L2_PIX_FMT_NV16:
+    case V4L2_PIX_FMT_NV61:
+    case V4L2_PIX_FMT_YUV422P:
+        plane_size[0] = width * height * 2;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_NV12MT_16X16:
+        plane_size[0] = ALIGN(width, 16) * ALIGN(height, 16);
+        plane_size[1] = ALIGN(width, 16) * ALIGN(height / 2, 8);
+        plane_size[2] = 0;
+        break;
+    /* 3 planes */
+    case V4L2_PIX_FMT_YUV420M:
+        plane_size[0] = width * height;
+        plane_size[1] = (width / 2) * (height / 2);
+        plane_size[2] = (width / 2) * (height / 2);
+        break;
+    case V4L2_PIX_FMT_YVU420:
+        plane_size[0] = ALIGN(width, 16) * height + ALIGN(width / 2, 16) * height;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_YUV420:
+        plane_size[0] = width * height * 3 / 2;
+        plane_size[1] = 0;
+        plane_size[2] = 0;
+        break;
+    case V4L2_PIX_FMT_YVU420M:
+        plane_size[0] = ALIGN(width, 16) * height;
+        plane_size[1] = ALIGN(width / 2, 16) * (height / 2);
+        plane_size[2] = plane_size[1];
+        break;
+    default:
+        ALOGE("%s::unmatched v4l_pixel_format color_space(0x%x)\n",
+             __func__, v4l_pixel_format);
+        return -1;
+    }
+
+    return 0;
+}
+
+int CGscaler::m_gsc_m2m_config(void *handle,
+    exynos_mpp_img *src_img, exynos_mpp_img *dst_img)
+{
+    Exynos_gsc_In();
+
+    int32_t      src_color_space;
+    int32_t      dst_color_space;
+    int ret;
+    unsigned int rotate;
+    unsigned int hflip;
+    unsigned int vflip;
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if ((src_img->drmMode && !gsc->allow_drm) ||
+        (src_img->drmMode != dst_img->drmMode)) {
+        ALOGE("%s::invalid drm state request for gsc%d (s=%d d=%d)",
+              __func__, gsc->gsc_id, src_img->drmMode, dst_img->drmMode);
+        return -1;
+    }
+
+    src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(src_img->format);
+    dst_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(dst_img->format);
+    CGscaler::rotateValueHAL2GSC(dst_img->rot, &rotate, &hflip, &vflip);
+    exynos_gsc_set_rotation(gsc, rotate, hflip, vflip);
+
+    ret = exynos_gsc_set_src_format(gsc,  src_img->fw, src_img->fh,
+          src_img->x, src_img->y, src_img->w, src_img->h,
+          src_color_space, src_img->cacheable, src_img->drmMode);
+    if (ret < 0) {
+        ALOGE("%s: fail: exynos_gsc_set_src_format \
+            [fw %d fh %d x %d y %d w %d h %d f %x rot %d]",
+            __func__, src_img->fw, src_img->fh, src_img->x, src_img->y,
+            src_img->w, src_img->h, src_color_space, src_img->rot);
+        return -1;
+    }
+
+    ret = exynos_gsc_set_dst_format(gsc, dst_img->fw, dst_img->fh,
+          dst_img->x, dst_img->y, dst_img->w, dst_img->h,
+          dst_color_space, dst_img->cacheable, dst_img->drmMode);
+    if (ret < 0) {
+        ALOGE("%s: fail: exynos_gsc_set_dst_format \
+            [fw %d fh %d x %d y %d w %d h %d f %x rot %d]",
+            __func__, dst_img->fw, dst_img->fh, dst_img->x, dst_img->y,
+            dst_img->w, dst_img->h, src_color_space, dst_img->rot);
+        return -1;
+    }
+
+    Exynos_gsc_Out();
+
+    return 0;
+}
+
+int CGscaler::m_gsc_out_config(void *handle,
+    exynos_mpp_img *src_img, exynos_mpp_img *dst_img)
+{
+    Exynos_gsc_In();
+
+    struct v4l2_format  fmt;
+    struct v4l2_crop    crop;
+    struct v4l2_requestbuffers reqbuf;
+    struct v4l2_subdev_format sd_fmt;
+    struct v4l2_subdev_crop   sd_crop;
+    int i;
+    unsigned int rotate;
+    unsigned int hflip;
+    unsigned int vflip;
+    unsigned int plane_size[NUM_OF_GSC_PLANES];
+    bool rgb;
+
+    struct v4l2_rect dst_rect;
+    int32_t      src_color_space;
+    int32_t      dst_color_space;
+    int32_t      src_planes;
+
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    if (gsc->src_info.stream_on != false) {
+        ALOGE("Error: Src is already streamed on !!!!");
+        return -1;
+    }
+
+    memcpy(&gsc->src_img, src_img, sizeof(exynos_mpp_img));
+    memcpy(&gsc->dst_img, dst_img, sizeof(exynos_mpp_img));
+    src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(src_img->format);
+    dst_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(dst_img->format);
+    src_planes = m_gsc_get_plane_count(src_color_space);
+    src_planes = (src_planes == -1) ? 1 : src_planes;
+    rgb = get_yuv_planes(dst_color_space) == -1;
+    CGscaler::rotateValueHAL2GSC(dst_img->rot, &rotate, &hflip, &vflip);
+
+    if (CGscaler::m_gsc_check_src_size(&gsc->src_img.fw,
+            &gsc->src_img.fh, &gsc->src_img.x, &gsc->src_img.y,
+            &gsc->src_img.w, &gsc->src_img.h, src_color_space,
+            (rotate == 90 || rotate == 270)) == false) {
+            ALOGE("%s::m_gsc_check_src_size() fail", __func__);
+            return -1;
+    }
+
+    /*set: src v4l2_buffer*/
+    gsc->src_info.buf.src_buf_idx = 0;
+    gsc->src_info.qbuf_cnt = 0;
+    /* set format: src pad of GSC sub-dev*/
+    sd_fmt.pad   = GSCALER_SUBDEV_PAD_SOURCE;
+    sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+    if (gsc->out_mode == GSC_OUT_FIMD) {
+        sd_fmt.format.width  = gsc->dst_img.fw;
+        sd_fmt.format.height = gsc->dst_img.fh;
+    } else {
+        sd_fmt.format.width  = gsc->dst_img.w;
+        sd_fmt.format.height = gsc->dst_img.h;
+    }
+    sd_fmt.format.code = rgb ? V4L2_MBUS_FMT_XRGB8888_4X8_LE :
+                               V4L2_MBUS_FMT_YUV8_1X24;
+    if (exynos_subdev_s_fmt(gsc->mdev.gsc_sd_entity->fd, &sd_fmt) < 0) {
+            ALOGE("%s::GSC subdev set format failed", __func__);
+            return -1;
+    }
+
+    /* set crop: src crop of GSC sub-dev*/
+    sd_crop.pad   = GSCALER_SUBDEV_PAD_SOURCE;
+    sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+    if (gsc->out_mode == GSC_OUT_FIMD) {
+        sd_crop.rect.left   = gsc->dst_img.x;
+        sd_crop.rect.top    = gsc->dst_img.y;
+        sd_crop.rect.width  = gsc->dst_img.w;
+        sd_crop.rect.height = gsc->dst_img.h;
+    } else {
+        sd_crop.rect.left   = 0;
+        sd_crop.rect.top    = 0;
+        sd_crop.rect.width  = gsc->dst_img.w;
+        sd_crop.rect.height = gsc->dst_img.h;
+    }
+
+    /* sink pad is connected to GSC out */
+    /*  set format: sink sub-dev */
+    if (gsc->out_mode == GSC_OUT_FIMD) {
+        sd_fmt.pad   = FIMD_SUBDEV_PAD_SINK;
+        sd_fmt.format.width  = gsc->dst_img.w;
+        sd_fmt.format.height = gsc->dst_img.h;
+    } else {
+        sd_fmt.pad   = MIXER_V_SUBDEV_PAD_SINK;
+        sd_fmt.format.width  = gsc->dst_img.w + gsc->dst_img.x*2;
+        sd_fmt.format.height = gsc->dst_img.h + gsc->dst_img.y*2;
+    }
+
+    sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+    sd_fmt.format.code = rgb ? V4L2_MBUS_FMT_XRGB8888_4X8_LE :
+                               V4L2_MBUS_FMT_YUV8_1X24;
+    if (exynos_subdev_s_fmt(gsc->mdev.sink_sd_entity->fd, &sd_fmt) < 0) {
+        ALOGE("%s::sink:set format failed (PAD=%d)", __func__,
+        sd_fmt.pad);
+        return -1;
+    }
+
+    /*  set crop: sink sub-dev */
+    if (gsc->out_mode == GSC_OUT_FIMD)
+        sd_crop.pad   = FIMD_SUBDEV_PAD_SINK;
+    else
+        sd_crop.pad   = MIXER_V_SUBDEV_PAD_SINK;
+
+    sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+    if (gsc->out_mode == GSC_OUT_FIMD) {
+        sd_crop.rect.left   = gsc->dst_img.x;
+        sd_crop.rect.top    = gsc->dst_img.y;
+        sd_crop.rect.width  = gsc->dst_img.w;
+        sd_crop.rect.height = gsc->dst_img.h;
+    } else {
+        sd_crop.rect.left   = 0;
+        sd_crop.rect.top    = 0;
+        sd_crop.rect.width  = gsc->dst_img.w;
+        sd_crop.rect.height = gsc->dst_img.h;
+    }
+
+    if (gsc->out_mode != GSC_OUT_FIMD) {
+        sd_fmt.pad = MIXER_V_SUBDEV_PAD_SOURCE;
+        sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+        sd_fmt.format.width = gsc->dst_img.w + gsc->dst_img.x*2;
+        sd_fmt.format.height = gsc->dst_img.h + gsc->dst_img.y*2;
+        sd_fmt.format.code = V4L2_MBUS_FMT_XRGB8888_4X8_LE;
+        if (exynos_subdev_s_fmt(gsc->mdev.sink_sd_entity->fd, &sd_fmt) < 0) {
+            ALOGE("%s::sink:set format failed (PAD=%d)", __func__,
+            sd_fmt.pad);
+            return -1;
+        }
+
+        sd_fmt.pad   = MIXER_V_SUBDEV_PAD_SOURCE;
+        sd_crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
+        sd_crop.rect.left   = gsc->dst_img.x;
+        sd_crop.rect.top    = gsc->dst_img.y;
+        sd_crop.rect.width  = gsc->dst_img.w;
+        sd_crop.rect.height = gsc->dst_img.h;
+        if (exynos_subdev_s_crop(gsc->mdev.sink_sd_entity->fd, &sd_crop) < 0) {
+            ALOGE("%s::sink: subdev set crop failed(PAD=%d)", __func__,
+            sd_crop.pad);
+            return -1;
+        }
+    }
+
+    /*set GSC ctrls */
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd, V4L2_CID_ROTATE,
+            rotate) < 0) {
+        ALOGE("%s:: exynos_v4l2_s_ctrl (V4L2_CID_ROTATE: %d) failed",
+            __func__,  rotate);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd, V4L2_CID_HFLIP,
+            vflip) < 0) {
+        ALOGE("%s:: exynos_v4l2_s_ctrl (V4L2_CID_HFLIP: %d) failed",
+            __func__,  vflip);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd, V4L2_CID_VFLIP,
+            hflip) < 0) {
+        ALOGE("%s:: exynos_v4l2_s_ctrl (V4L2_CID_VFLIP: %d) failed",
+            __func__,  hflip);
+        return -1;
+    }
+
+     if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd,
+            V4L2_CID_CACHEABLE, 1) < 0) {
+        ALOGE("%s:: exynos_v4l2_s_ctrl (V4L2_CID_CACHEABLE: 1) failed",
+            __func__);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd,
+            V4L2_CID_CONTENT_PROTECTION, gsc->src_img.drmMode) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CONTENT_PROTECTION) fail",
+            __func__);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd,
+           V4L2_CID_CSC_EQ_MODE, gsc->eq_auto) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_EQ_MODE) fail", __func__);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd,
+           V4L2_CID_CSC_EQ, gsc->v4l2_colorspace) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_EQ) fail", __func__);
+        return -1;
+    }
+
+    if (exynos_v4l2_s_ctrl(gsc->mdev.gsc_vd_entity->fd,
+           V4L2_CID_CSC_RANGE, gsc->range_full) < 0) {
+        ALOGE("%s::exynos_v4l2_s_ctrl(V4L2_CID_CSC_RANGE) fail", __func__);
+        return -1;
+    }
+
+      /* set src format  :GSC video dev*/
+    fmt.type  = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    fmt.fmt.pix_mp.width            = gsc->src_img.fw;
+    fmt.fmt.pix_mp.height           = gsc->src_img.fh;
+    fmt.fmt.pix_mp.pixelformat    = src_color_space;
+    fmt.fmt.pix_mp.field              = V4L2_FIELD_NONE;
+    fmt.fmt.pix_mp.num_planes   = src_planes;
+
+    if (exynos_v4l2_s_fmt(gsc->mdev.gsc_vd_entity->fd, &fmt) < 0) {
+        ALOGE("%s::videodev set format failed", __func__);
+        return -1;
+    }
+
+    /* set src crop info :GSC video dev*/
+    crop.type     = fmt.type;
+    crop.c.left    = gsc->src_img.x;
+    crop.c.top     = gsc->src_img.y;
+    crop.c.width  = gsc->src_img.w;
+    crop.c.height = gsc->src_img.h;
+
+    if (exynos_v4l2_s_crop(gsc->mdev.gsc_vd_entity->fd, &crop) < 0) {
+        ALOGE("%s::videodev set crop failed", __func__);
+        return -1;
+    }
+
+    reqbuf.type   = fmt.type;
+    reqbuf.memory = V4L2_MEMORY_DMABUF;
+    reqbuf.count  = MAX_BUFFERS_GSCALER_OUT;
+
+    if (exynos_v4l2_reqbufs(gsc->mdev.gsc_vd_entity->fd, &reqbuf) < 0) {
+        ALOGE("%s::request buffers failed", __func__);
+        return -1;
+    }
+
+    Exynos_gsc_Out();
+
+    return 0;
+}
+
+void CGscaler::rotateValueHAL2GSC(unsigned int transform,
+    unsigned int *rotate, unsigned int *hflip, unsigned int *vflip)
+{
+    int rotate_flag = transform & 0x7;
+    *rotate = 0;
+    *hflip = 0;
+    *vflip = 0;
+
+    switch (rotate_flag) {
+    case HAL_TRANSFORM_ROT_90:
+        *rotate = 90;
+        break;
+    case HAL_TRANSFORM_ROT_180:
+        *rotate = 180;
+        break;
+    case HAL_TRANSFORM_ROT_270:
+        *rotate = 270;
+        break;
+    case HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90:
+        *rotate = 90;
+        *vflip = 1; /* set vflip to compensate the rot & flip order. */
+        break;
+    case HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90:
+        *rotate = 90;
+        *hflip = 1; /* set hflip to compensate the rot & flip order. */
+        break;
+    case HAL_TRANSFORM_FLIP_H:
+        *hflip = 1;
+         break;
+    case HAL_TRANSFORM_FLIP_V:
+        *vflip = 1;
+         break;
+    default:
+        break;
+    }
+}
+
+int CGscaler::m_gsc_m2m_run(void *handle,
+    exynos_mpp_img *src_img, exynos_mpp_img *dst_img)
+{
+    Exynos_gsc_In();
+
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+    void *addr[3] = {NULL, NULL, NULL};
+    int ret = 0;
+
+    addr[0] = (void *)src_img->yaddr;
+    addr[1] = (void *)src_img->uaddr;
+    addr[2] = (void *)src_img->vaddr;
+    ret = exynos_gsc_set_src_addr(handle, addr, src_img->mem_type,
+            src_img->acquireFenceFd);
+    if (ret < 0) {
+        ALOGE("%s::fail: exynos_gsc_set_src_addr[%x %x %x]", __func__,
+            (unsigned int)addr[0], (unsigned int)addr[1],
+            (unsigned int)addr[2]);
+        return -1;
+    }
+
+    addr[0] = (void *)dst_img->yaddr;
+    addr[1] = (void *)dst_img->uaddr;
+    addr[2] = (void *)dst_img->vaddr;
+    ret = exynos_gsc_set_dst_addr(handle, addr, dst_img->mem_type,
+            dst_img->acquireFenceFd);
+    if (ret < 0) {
+        ALOGE("%s::fail: exynos_gsc_set_dst_addr[%x %x %x]", __func__,
+            (unsigned int)addr[0], (unsigned int)addr[1],
+            (unsigned int)addr[2]);
+        return -1;
+    }
+
+    ret = gsc->m_gsc_m2m_run_core(handle);
+     if (ret < 0) {
+        ALOGE("%s::fail: m_gsc_m2m_run_core", __func__);
+        return -1;
+    }
+
+    if (src_img->acquireFenceFd >= 0) {
+        close(src_img->acquireFenceFd);
+        src_img->acquireFenceFd = -1;
+    }
+
+    if (dst_img->acquireFenceFd >= 0) {
+        close(dst_img->acquireFenceFd);
+        dst_img->acquireFenceFd = -1;
+    }
+
+    src_img->releaseFenceFd = gsc->src_info.releaseFenceFd;
+    dst_img->releaseFenceFd = gsc->dst_info.releaseFenceFd;
+
+    Exynos_gsc_Out();
+
+    return 0;
+}
+
+int CGscaler::m_gsc_out_run(void *handle, exynos_mpp_img *src_img)
+{
+    struct v4l2_plane  planes[NUM_OF_GSC_PLANES];
+    struct v4l2_buffer buf;
+    int32_t      src_color_space;
+    int32_t      src_planes;
+    unsigned int i;
+    unsigned int plane_size[NUM_OF_GSC_PLANES];
+    CGscaler* gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    /* All buffers have been queued, dequeue one */
+    if (gsc->src_info.qbuf_cnt == MAX_BUFFERS_GSCALER_OUT) {
+        memset(&buf, 0, sizeof(struct v4l2_buffer));
+        for (i = 0; i < NUM_OF_GSC_PLANES; i++)
+            memset(&planes[i], 0, sizeof(struct v4l2_plane));
+
+        buf.type     = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+        buf.memory   = V4L2_MEMORY_DMABUF;
+        buf.m.planes = planes;
+
+        src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(gsc->src_img.format);
+        src_planes = m_gsc_get_plane_count(src_color_space);
+        src_planes = (src_planes == -1) ? 1 : src_planes;
+        buf.length   = src_planes;
+
+
+        if (exynos_v4l2_dqbuf(gsc->mdev.gsc_vd_entity->fd, &buf) < 0) {
+            ALOGE("%s::dequeue buffer failed (index=%d)(mSrcBufNum=%d)",
+                    __func__, gsc->src_info.buf.src_buf_idx,
+                    MAX_BUFFERS_GSCALER_OUT);
+            return -1;
+        }
+        gsc->src_info.qbuf_cnt--;
+    }
+
+    memset(&buf, 0, sizeof(struct v4l2_buffer));
+    for (i = 0; i < NUM_OF_GSC_PLANES; i++)
+        memset(&planes[i], 0, sizeof(struct v4l2_plane));
+
+    src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(gsc->src_img.format);
+    src_planes = m_gsc_get_plane_count(src_color_space);
+    src_planes = (src_planes == -1) ? 1 : src_planes;
+
+    buf.type     = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    buf.memory   = V4L2_MEMORY_DMABUF;
+    buf.flags    = V4L2_BUF_FLAG_USE_SYNC;
+    buf.length   = src_planes;
+    buf.index    = gsc->src_info.buf.src_buf_idx;
+    buf.m.planes = planes;
+    buf.reserved = src_img->acquireFenceFd;
+
+    gsc->src_info.buf.addr[0] = (void*)src_img->yaddr;
+    gsc->src_info.buf.addr[1] = (void*)src_img->uaddr;
+    gsc->src_info.buf.addr[2] = (void*)src_img->vaddr;
+
+    if (CGscaler::tmp_get_plane_size(src_color_space, plane_size,
+        gsc->src_img.fw,  gsc->src_img.fh, src_planes) != true) {
+        ALOGE("%s:get_plane_size:fail", __func__);
+        return -1;
+    }
+
+    for (i = 0; i < buf.length; i++) {
+        buf.m.planes[i].m.fd = (int)gsc->src_info.buf.addr[i];
+        buf.m.planes[i].length    = plane_size[i];
+        buf.m.planes[i].bytesused = plane_size[i];
+    }
+
+    /* Queue the buf */
+    if (exynos_v4l2_qbuf(gsc->mdev.gsc_vd_entity->fd, &buf) < 0) {
+        ALOGE("%s::queue buffer failed (index=%d)(mSrcBufNum=%d)",
+                __func__, gsc->src_info.buf.src_buf_idx,
+                MAX_BUFFERS_GSCALER_OUT);
+        return -1;
+    }
+    gsc->src_info.buf.src_buf_idx++;
+    gsc->src_info.buf.src_buf_idx =
+        gsc->src_info.buf.src_buf_idx % MAX_BUFFERS_GSCALER_OUT;
+    gsc->src_info.qbuf_cnt++;
+
+    if (gsc->src_info.stream_on == false) {
+        if (exynos_v4l2_streamon(gsc->mdev.gsc_vd_entity->fd,
+            (v4l2_buf_type)buf.type) < 0) {
+            ALOGE("%s::stream on failed", __func__);
+            return -1;
+        }
+        gsc->src_info.stream_on = true;
+    }
+
+    src_img->releaseFenceFd = buf.reserved;
+    return 0;
+}
+
+bool CGscaler::tmp_get_plane_size(int V4L2_PIX,
+    unsigned int * size, unsigned int width, unsigned int height, int src_planes)
+{
+    unsigned int frame_ratio = 1;
+    int src_bpp    = get_yuv_bpp(V4L2_PIX);
+    unsigned int frame_size = width * height;
+
+    src_planes = (src_planes == -1) ? 1 : src_planes;
+    frame_ratio = 8 * (src_planes -1) / (src_bpp - 8);
+
+    switch (src_planes) {
+    case 1:
+        switch (V4L2_PIX) {
+        case V4L2_PIX_FMT_BGR32:
+        case V4L2_PIX_FMT_RGB32:
+            size[0] = frame_size << 2;
+            break;
+       case V4L2_PIX_FMT_RGB565:
+        case V4L2_PIX_FMT_NV16:
+        case V4L2_PIX_FMT_NV61:
+        case V4L2_PIX_FMT_YUYV:
+        case V4L2_PIX_FMT_UYVY:
+        case V4L2_PIX_FMT_VYUY:
+        case V4L2_PIX_FMT_YVYU:
+            size[0] = frame_size << 1;
+            break;
+        case V4L2_PIX_FMT_YUV420:
+        case V4L2_PIX_FMT_NV12:
+        case V4L2_PIX_FMT_NV21:
+        case V4L2_PIX_FMT_NV21M:
+            size[0] = (frame_size * 3) >> 1;
+            break;
+        case V4L2_PIX_FMT_YVU420:
+            size[0] = frame_size + (ALIGN((width >> 1), 16) * ((height >> 1) * 2));
+            break;
+        default:
+            ALOGE("%s::invalid color type (%x)", __func__, V4L2_PIX);
+            return false;
+            break;
+        }
+        size[1] = 0;
+        size[2] = 0;
+        break;
+    case 2:
+        size[0] = frame_size;
+        size[1] = frame_size / frame_ratio;
+        size[2] = 0;
+        break;
+    case 3:
+        size[0] = frame_size;
+        size[1] = frame_size / frame_ratio;
+        size[2] = frame_size / frame_ratio;
+        break;
+    default:
+        ALOGE("%s::invalid color foarmt", __func__);
+        return false;
+        break;
+    }
+
+    return true;
+}
+
+int CGscaler::ConfigMpp(void *handle, exynos_mpp_img *src,
+                                       exynos_mpp_img *dst)
+{
+    return exynos_gsc_config_exclusive(handle, src, dst);
+}
+
+int CGscaler::RunMpp(void *handle, exynos_mpp_img *src,
+                                       exynos_mpp_img *dst)
+{
+    return exynos_gsc_run_exclusive(handle, src, dst);
+}
+
+int CGscaler::StopMpp(void *handle)
+{
+    return exynos_gsc_stop_exclusive(handle);
+}
+
+void CGscaler::DestroyMpp(void *handle)
+{
+    return exynos_gsc_destroy(handle);
+}
+
+int CGscaler::SetCSCProperty(void *handle, unsigned int eqAuto,
+                  unsigned int fullRange, unsigned int colorspace)
+{
+    return exynos_gsc_set_csc_property(handle, eqAuto, fullRange,
+                                           colorspace);
+}
+
+int CGscaler::FreeMpp(void *handle)
+{
+    return exynos_gsc_free_and_close(handle);
+}
+
+int CGscaler::SetInputCrop(void *handle,
+        exynos_mpp_img *src_img, exynos_mpp_img *dst_img)
+{
+    struct v4l2_crop crop;
+    int ret = 0;
+    CGscaler *gsc = GetGscaler(handle);
+    if (gsc == NULL) {
+        ALOGE("%s::handle == NULL() fail", __func__);
+        return -1;
+    }
+
+    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    crop.c.left = src_img->x;
+    crop.c.top = src_img->y;
+    crop.c.width = src_img->w;
+    crop.c.height = src_img->h;
+
+    return exynos_v4l2_s_crop(gsc->mdev.gsc_vd_entity->fd, &crop);
+}
diff --git a/libkeymaster/Android.mk b/libkeymaster/Android.mk
new file mode 100644 (file)
index 0000000..32753a3
--- /dev/null
@@ -0,0 +1,33 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+
+include $(CLEAR_VARS)
+
+MOBICORE_PATH := hardware/samsung_slsi/$(TARGET_SOC)/mobicore
+
+LOCAL_MODULE := keystore.exynos5
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := keymaster_mobicore.cpp tlcTeeKeymaster_if.c
+LOCAL_C_INCLUDES := \
+       $(MOBICORE_PATH)/daemon/ClientLib/public \
+       $(MOBICORE_PATH)/common/MobiCore/inc/
+LOCAL_C_FLAGS = -fvisibility=hidden -Wall -Werror
+LOCAL_SHARED_LIBRARIES := libcrypto liblog libMcClient
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/libkeymaster/NOTICE b/libkeymaster/NOTICE
new file mode 100644 (file)
index 0000000..316b4eb
--- /dev/null
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2014, The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/libkeymaster/keymaster_mobicore.cpp b/libkeymaster/keymaster_mobicore.cpp
new file mode 100644 (file)
index 0000000..0ef92e5
--- /dev/null
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Co., LTD
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <hardware/hardware.h>
+#include <hardware/keymaster0.h>
+
+#include <openssl/evp.h>
+#include <openssl/bio.h>
+#include <openssl/rsa.h>
+#include <openssl/err.h>
+#include <openssl/x509.h>
+
+#include <UniquePtr.h>
+
+#define LOG_TAG "ExynosKeyMaster"
+#include <cutils/log.h>
+
+#include <tlcTeeKeymaster_if.h>
+
+#define RSA_KEY_BUFFER_SIZE   1536
+#define RSA_KEY_MAX_SIZE      (2048 >> 3)
+
+struct BIGNUM_Delete {
+    void operator()(BIGNUM* p) const {
+        BN_free(p);
+    }
+};
+typedef UniquePtr<BIGNUM, BIGNUM_Delete> Unique_BIGNUM;
+
+struct EVP_PKEY_Delete {
+    void operator()(EVP_PKEY* p) const {
+        EVP_PKEY_free(p);
+    }
+};
+typedef UniquePtr<EVP_PKEY, EVP_PKEY_Delete> Unique_EVP_PKEY;
+
+struct PKCS8_PRIV_KEY_INFO_Delete {
+    void operator()(PKCS8_PRIV_KEY_INFO* p) const {
+        PKCS8_PRIV_KEY_INFO_free(p);
+    }
+};
+typedef UniquePtr<PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO_Delete> Unique_PKCS8_PRIV_KEY_INFO;
+
+struct RSA_Delete {
+    void operator()(RSA* p) const {
+        RSA_free(p);
+    }
+};
+typedef UniquePtr<RSA, RSA_Delete> Unique_RSA;
+
+typedef UniquePtr<keymaster0_device_t> Unique_keymaster0_device_t;
+
+/**
+ * Many OpenSSL APIs take ownership of an argument on success but don't free the argument
+ * on failure. This means we need to tell our scoped pointers when we've transferred ownership,
+ * without triggering a warning by not using the result of release().
+ */
+#define OWNERSHIP_TRANSFERRED(obj) \
+    typeof (obj.release()) _dummy __attribute__((unused)) = obj.release()
+
+/*
+ * Checks this thread's error queue and logs if necessary.
+ */
+static void logOpenSSLError(const char* location) {
+    int error = ERR_get_error();
+
+    if (error != 0) {
+        char message[256];
+        ERR_error_string_n(error, message, sizeof(message));
+        ALOGE("OpenSSL error in %s %d: %s", location, error, message);
+    }
+
+    ERR_clear_error();
+    ERR_remove_state(0);
+}
+
+static int exynos_km_generate_keypair(const keymaster0_device_t*,
+        const keymaster_keypair_t key_type, const void* key_params,
+        uint8_t** keyBlob, size_t* keyBlobLength) {
+    teeResult_t ret = TEE_ERR_NONE;
+
+    if (key_type != TYPE_RSA) {
+        ALOGE("Unsupported key type %d", key_type);
+        return -1;
+    } else if (key_params == NULL) {
+        ALOGE("key_params == null");
+        return -1;
+    }
+
+    keymaster_rsa_keygen_params_t* rsa_params = (keymaster_rsa_keygen_params_t*) key_params;
+
+    if ((rsa_params->modulus_size != 512) &&
+        (rsa_params->modulus_size != 1024) &&
+        (rsa_params->modulus_size != 2048)) {
+        ALOGE("key size(%d) is not supported\n", rsa_params->modulus_size);
+        return -1;
+    }
+
+    UniquePtr<uint8_t> keyDataPtr(reinterpret_cast<uint8_t*>(malloc(RSA_KEY_BUFFER_SIZE)));
+    if (keyDataPtr.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    ret = TEE_RSAGenerateKeyPair(TEE_KEYPAIR_RSACRT, keyDataPtr.get(), RSA_KEY_BUFFER_SIZE,
+                               rsa_params->modulus_size, (uint32_t)rsa_params->public_exponent,
+                               (uint32_t *)keyBlobLength);
+    if (ret != TEE_ERR_NONE) {
+        ALOGE("TEE_RSAGenerateKeyPair() is failed: %d", ret);
+        return -1;
+    }
+
+   *keyBlob = keyDataPtr.release();
+
+    return 0;
+}
+
+static int exynos_km_import_keypair(const keymaster0_device_t*,
+        const uint8_t* key, const size_t key_length,
+        uint8_t** key_blob, size_t* key_blob_length) {
+    uint8_t kbuf[RSA_KEY_BUFFER_SIZE];
+    teeRsaKeyMeta_t metadata;
+    uint32_t key_len = 0;
+    BIGNUM *tmp = NULL;
+    BN_CTX *ctx = NULL;
+    teeResult_t ret = TEE_ERR_NONE;
+
+    if (key == NULL) {
+        ALOGE("input key == NULL");
+        return -1;
+    } else if (key_blob == NULL || key_blob_length == NULL) {
+        ALOGE("output key blob or length == NULL");
+        return -1;
+    }
+
+    /* decoding */
+    Unique_PKCS8_PRIV_KEY_INFO pkcs8(d2i_PKCS8_PRIV_KEY_INFO(NULL, &key, key_length));
+    if (pkcs8.get() == NULL) {
+        logOpenSSLError("pkcs4.get");
+        return -1;
+    }
+
+    /* assign to EVP */
+    Unique_EVP_PKEY pkey(EVP_PKCS82PKEY(pkcs8.get()));
+    if (pkey.get() == NULL) {
+        logOpenSSLError("pkey.get");
+        return -1;
+    }
+    OWNERSHIP_TRANSFERRED(pkcs8);
+
+    /* change key format */
+    Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey.get()));
+    if (rsa.get() == NULL) {
+        logOpenSSLError("get rsa key format");
+       return -1;
+    }
+
+    if (BN_cmp(rsa->p, rsa->q) < 0) {
+        /* p <-> q */
+        tmp = rsa->p;
+        rsa->p = rsa->q;
+        rsa->q = tmp;
+        /* dp <-> dq */
+        tmp = rsa->dmp1;
+        rsa->dmp1 = rsa->dmq1;
+        rsa->dmq1 = tmp;
+        /* calulate inverse of q mod p */
+        ctx = BN_CTX_new();
+        if (!BN_mod_inverse(rsa->iqmp, rsa->q, rsa->p, ctx)) {
+            ALOGE("Calculating inverse of q mod p is failed\n");
+            BN_CTX_free(ctx);
+            return -1;
+        }
+        BN_CTX_free(ctx);
+    }
+
+    key_len += sizeof(metadata);
+
+    metadata.lenpubmod = BN_bn2bin(rsa->n, kbuf + key_len);
+    key_len += metadata.lenpubmod;
+    if (metadata.lenpubmod == (512 >> 3))
+        metadata.keysize = TEE_RSA_KEY_SIZE_512;
+    else if (metadata.lenpubmod == (1024 >> 3))
+        metadata.keysize = TEE_RSA_KEY_SIZE_1024;
+    else if (metadata.lenpubmod == (2048 >> 3))
+        metadata.keysize = TEE_RSA_KEY_SIZE_2048;
+    else {
+        ALOGE("key size(%d) is not supported\n", metadata.lenpubmod << 3);
+        return -1;
+    }
+
+    metadata.lenpubexp = BN_bn2bin(rsa->e, kbuf + key_len);
+    key_len += metadata.lenpubexp;
+
+    if ((rsa->p != NULL) && (rsa->q != NULL) && (rsa->dmp1 != NULL) &&
+       (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))
+    {
+           metadata.keytype = TEE_KEYPAIR_RSACRT;
+          metadata.rsacrtpriv.lenp = BN_bn2bin(rsa->p, kbuf + key_len);
+          key_len += metadata.rsacrtpriv.lenp;
+          metadata.rsacrtpriv.lenq = BN_bn2bin(rsa->q, kbuf + key_len);
+          key_len += metadata.rsacrtpriv.lenq;
+          metadata.rsacrtpriv.lendp = BN_bn2bin(rsa->dmp1, kbuf + key_len);
+          key_len += metadata.rsacrtpriv.lendp;
+          metadata.rsacrtpriv.lendq = BN_bn2bin(rsa->dmq1, kbuf + key_len);
+          key_len += metadata.rsacrtpriv.lendq;
+          metadata.rsacrtpriv.lenqinv = BN_bn2bin(rsa->iqmp, kbuf + key_len);
+          key_len += metadata.rsacrtpriv.lenqinv;
+    } else {
+           metadata.keytype = TEE_KEYPAIR_RSA;
+          metadata.rsapriv.lenpriexp = BN_bn2bin(rsa->d, kbuf + key_len);
+          key_len += metadata.rsapriv.lenpriexp;
+    }
+
+    metadata.rfu = 0;
+    metadata.rfulen = 0;
+
+    memcpy(kbuf, &metadata, sizeof(metadata));
+
+    UniquePtr<uint8_t> outPtr(reinterpret_cast<uint8_t*>(malloc(RSA_KEY_BUFFER_SIZE)));
+    if (outPtr.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    *key_blob_length = RSA_KEY_BUFFER_SIZE;
+
+    ret = TEE_KeyImport(kbuf, key_len, outPtr.get(), (uint32_t *)key_blob_length);
+    if (ret != TEE_ERR_NONE) {
+        ALOGE("TEE_KeyImport() is failed: %d", ret);
+        return -1;
+    }
+
+    *key_blob = outPtr.release();
+
+    return 0;
+}
+
+static int exynos_km_get_keypair_public(const struct keymaster0_device*,
+        const uint8_t* key_blob, const size_t key_blob_length,
+        uint8_t** x509_data, size_t* x509_data_length) {
+    uint32_t bin_mod_len;
+    uint32_t bin_exp_len;
+    teeResult_t ret = TEE_ERR_NONE;
+
+    if (x509_data == NULL || x509_data_length == NULL) {
+        ALOGE("output public key buffer == NULL");
+        return -1;
+    }
+
+    UniquePtr<uint8_t> binModPtr(reinterpret_cast<uint8_t*>(malloc(RSA_KEY_MAX_SIZE)));
+    if (binModPtr.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    UniquePtr<uint8_t> binExpPtr(reinterpret_cast<uint8_t*>(malloc(sizeof(uint32_t))));
+    if (binExpPtr.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    bin_mod_len = RSA_KEY_MAX_SIZE;
+    bin_exp_len = sizeof(uint32_t);
+
+    ret = TEE_GetPubKey(key_blob, key_blob_length, binModPtr.get(), &bin_mod_len, binExpPtr.get(),
+                       &bin_exp_len);
+    if (ret != TEE_ERR_NONE) {
+        ALOGE("TEE_GetPubKey() is failed: %d", ret);
+        return -1;
+    }
+
+    Unique_BIGNUM bn_mod(BN_new());
+    if (bn_mod.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    Unique_BIGNUM bn_exp(BN_new());
+    if (bn_exp.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    BN_bin2bn(binModPtr.get(), bin_mod_len, bn_mod.get());
+    BN_bin2bn(binExpPtr.get(), bin_exp_len, bn_exp.get());
+
+    /* assign to RSA */
+    Unique_RSA rsa(RSA_new());
+    if (rsa.get() == NULL) {
+        logOpenSSLError("rsa.get");
+        return -1;
+    }
+
+    RSA* rsa_tmp = rsa.get();
+
+    rsa_tmp->n = bn_mod.release();
+    rsa_tmp->e = bn_exp.release();
+
+    /* assign to EVP */
+    Unique_EVP_PKEY pkey(EVP_PKEY_new());
+    if (pkey.get() == NULL) {
+        logOpenSSLError("allocate EVP_PKEY");
+        return -1;
+    }
+
+    if (EVP_PKEY_assign_RSA(pkey.get(), rsa.get()) == 0) {
+        logOpenSSLError("assing RSA to EVP_PKEY");
+        return -1;
+    }
+    OWNERSHIP_TRANSFERRED(rsa);
+
+    /* change to x.509 format */
+    int len = i2d_PUBKEY(pkey.get(), NULL);
+    if (len <= 0) {
+        logOpenSSLError("i2d_PUBKEY");
+        return -1;
+    }
+
+    UniquePtr<uint8_t> key(static_cast<uint8_t*>(malloc(len)));
+    if (key.get() == NULL) {
+        ALOGE("Could not allocate memory for public key data");
+        return -1;
+    }
+
+    unsigned char* tmp = reinterpret_cast<unsigned char*>(key.get());
+    if (i2d_PUBKEY(pkey.get(), &tmp) != len) {
+        logOpenSSLError("Compare results");
+        return -1;
+    }
+
+    *x509_data_length = len;
+    *x509_data = key.release();
+
+    return 0;
+}
+
+static int exynos_km_sign_data(const keymaster0_device_t*,
+        const void* params,
+        const uint8_t* keyBlob, const size_t keyBlobLength,
+        const uint8_t* data, const size_t dataLength,
+        uint8_t** signedData, size_t* signedDataLength) {
+    teeResult_t ret = TEE_ERR_NONE;
+
+    if (data == NULL) {
+        ALOGE("input data to sign == NULL");
+        return -1;
+    } else if (signedData == NULL || signedDataLength == NULL) {
+        ALOGE("output signature buffer == NULL");
+        return -1;
+    }
+
+    keymaster_rsa_sign_params_t* sign_params = (keymaster_rsa_sign_params_t*) params;
+    if (sign_params->digest_type != DIGEST_NONE) {
+        ALOGE("Cannot handle digest type %d", sign_params->digest_type);
+        return -1;
+    } else if (sign_params->padding_type != PADDING_NONE) {
+        ALOGE("Cannot handle padding type %d", sign_params->padding_type);
+        return -1;
+    }
+
+    UniquePtr<uint8_t> signedDataPtr(reinterpret_cast<uint8_t*>(malloc(RSA_KEY_MAX_SIZE)));
+    if (signedDataPtr.get() == NULL) {
+        ALOGE("memory allocation is failed");
+        return -1;
+    }
+
+    *signedDataLength = RSA_KEY_MAX_SIZE;
+
+    /* binder gives us read-only mappings we can't use with mobicore */
+    void *tmpData = malloc(dataLength);
+    memcpy(tmpData, data, dataLength);
+    ret = TEE_RSASign(keyBlob, keyBlobLength, (const uint8_t *)tmpData, dataLength, signedDataPtr.get(),
+                       (uint32_t *)signedDataLength, TEE_RSA_NODIGEST_NOPADDING);
+    free(tmpData);
+    if (ret != TEE_ERR_NONE) {
+        ALOGE("TEE_RSASign() is failed: %d", ret);
+        return -1;
+    }
+
+    *signedData = signedDataPtr.release();
+
+    return 0;
+}
+
+static int exynos_km_verify_data(const keymaster0_device_t*,
+        const void* params,
+        const uint8_t* keyBlob, const size_t keyBlobLength,
+        const uint8_t* signedData, const size_t signedDataLength,
+        const uint8_t* signature, const size_t signatureLength) {
+    bool result;
+    teeResult_t ret = TEE_ERR_NONE;
+
+    if (signedData == NULL || signature == NULL) {
+        ALOGE("data or signature buffers == NULL");
+        return -1;
+    }
+
+    keymaster_rsa_sign_params_t* sign_params = (keymaster_rsa_sign_params_t*) params;
+    if (sign_params->digest_type != DIGEST_NONE) {
+        ALOGE("Cannot handle digest type %d", sign_params->digest_type);
+        return -1;
+    } else if (sign_params->padding_type != PADDING_NONE) {
+        ALOGE("Cannot handle padding type %d", sign_params->padding_type);
+        return -1;
+    } else if (signatureLength != signedDataLength) {
+        ALOGE("signed data length must be signature length");
+        return -1;
+    }
+
+    void *tmpSignedData = malloc(signedDataLength);
+    memcpy(tmpSignedData, signedData, signedDataLength);
+    void *tmpSig = malloc(signatureLength);
+    memcpy(tmpSig, signature, signatureLength);
+    ret = TEE_RSAVerify(keyBlob, keyBlobLength, (const uint8_t*)tmpSignedData, signedDataLength, (const uint8_t *)tmpSig,
+                       signatureLength, TEE_RSA_NODIGEST_NOPADDING, &result);
+    free(tmpSignedData);
+    free(tmpSig);
+    if (ret != TEE_ERR_NONE) {
+        ALOGE("TEE_RSAVerify() is failed: %d", ret);
+        return -1;
+    }
+
+    return (result == true) ? 0 : -1;
+}
+
+/* Close an opened Exynos KM instance */
+static int exynos_km_close(hw_device_t *dev) {
+    free(dev);
+    return 0;
+}
+
+/*
+ * Generic device handling
+ */
+static int exynos_km_open(const hw_module_t* module, const char* name,
+        hw_device_t** device) {
+    if (strcmp(name, KEYSTORE_KEYMASTER) != 0)
+        return -EINVAL;
+
+    Unique_keymaster0_device_t dev(new keymaster0_device_t);
+    if (dev.get() == NULL)
+        return -ENOMEM;
+
+    dev->common.tag = HARDWARE_DEVICE_TAG;
+    dev->common.version = 1;
+    dev->common.module = (struct hw_module_t*) module;
+    dev->common.close = exynos_km_close;
+
+    dev->flags = 0;
+
+    dev->generate_keypair = exynos_km_generate_keypair;
+    dev->import_keypair = exynos_km_import_keypair;
+    dev->get_keypair_public = exynos_km_get_keypair_public;
+    dev->delete_keypair = NULL;
+    dev->delete_all = NULL;
+    dev->sign_data = exynos_km_sign_data;
+    dev->verify_data = exynos_km_verify_data;
+
+    ERR_load_crypto_strings();
+    ERR_load_BIO_strings();
+
+    *device = reinterpret_cast<hw_device_t*>(dev.release());
+
+    return 0;
+}
+
+static struct hw_module_methods_t keystore_module_methods = {
+    open: exynos_km_open,
+};
+
+struct keystore_module HAL_MODULE_INFO_SYM
+__attribute__ ((visibility ("default"))) = {
+    common: {
+        tag: HARDWARE_MODULE_TAG,
+        version_major: 1,
+        version_minor: 0,
+        id: KEYSTORE_HARDWARE_MODULE_ID,
+        name: "Keymaster Exynos HAL",
+        author: "Samsung S.LSI",
+        methods: &keystore_module_methods,
+        dso: 0,
+        reserved: {},
+    },
+};
diff --git a/libkeymaster/tci.h b/libkeymaster/tci.h
new file mode 100644 (file)
index 0000000..0979df3
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+ * @file   tci.h
+ * @brief  Contains TCI (Trustlet Control
+ * Interface) definitions and data structures
+ *
+ * Copyright Giesecke & Devrient GmbH 2012
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TCI_H__
+#define __TCI_H__
+
+
+typedef uint32_t tciCommandId_t;
+typedef uint32_t tciResponseId_t;
+typedef uint32_t tciReturnCode_t;
+
+
+/**< Responses have bit 31 set */
+#define RSP_ID_MASK (1U << 31)
+#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
+#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
+#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)
+
+
+/**
+ * Return codes
+ */
+#define RET_OK                    0
+#define RET_ERR_UNKNOWN_CMD       1
+#define RET_ERR_NOT_SUPPORTED     2
+#define RET_ERR_INVALID_BUFFER    3
+#define RET_ERR_INVALID_KEY_SIZE  4
+#define RET_ERR_INVALID_KEY_TYPE  5
+#define RET_ERR_INVALID_LENGTH    6
+#define RET_ERR_INVALID_EXPONENT  7
+#define RET_ERR_KEY_GENERATION    8
+#define RET_ERR_SIGN              9
+#define RET_ERR_VERIFY            10
+#define RET_ERR_DIGEST            11
+#define RET_ERR_SECURE_OBJECT     12
+#define RET_ERR_INTERNAL_ERROR    13
+/* ... add more error codes when needed */
+
+
+/**
+ * TCI command header.
+ */
+typedef struct{
+    tciCommandId_t commandId; /**< Command ID */
+} tciCommandHeader_t;
+
+
+/**
+ * TCI response header.
+ */
+typedef struct{
+    tciResponseId_t     responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/
+    tciReturnCode_t     returnCode; /**< Return code of command */
+} tciResponseHeader_t;
+
+#endif // __TCI_H__
diff --git a/libkeymaster/tlTeeKeymaster_Api.h b/libkeymaster/tlTeeKeymaster_Api.h
new file mode 100644 (file)
index 0000000..24adeca
--- /dev/null
@@ -0,0 +1,262 @@
+/**
+ * @file   tlTeeKeymaster_Api.h
+ * @brief  Contains TCI command definitions and data structures
+ *
+ * Copyright Giesecke & Devrient GmbH 2012
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TLTEEKEYMASTERAPI_H__
+#define __TLTEEKEYMASTERAPI_H__
+
+#include "tci.h"
+
+
+
+/**
+ * Command ID's
+ */
+#define CMD_ID_TEE_RSA_GEN_KEY_PAIR   1
+#define CMD_ID_TEE_RSA_SIGN           2
+#define CMD_ID_TEE_RSA_VERIFY         3
+#define CMD_ID_TEE_HMAC_GEN_KEY       4
+#define CMD_ID_TEE_HMAC_SIGN          5
+#define CMD_ID_TEE_HMAC_VERIFY        6
+#define CMD_ID_TEE_KEY_IMPORT         7
+#define CMD_ID_TEE_GET_PUB_KEY        8
+/*... add more command ids when needed */
+
+
+/**
+ * Command message.
+ *
+ * @param len Length of the data to process.
+ * @param data Data to be processed
+ */
+typedef struct {
+    tciCommandHeader_t  header;     /**< Command header */
+    uint32_t            len;        /**< Length of data to process */
+} command_t;
+
+
+/**
+ * Response structure
+ */
+typedef struct {
+    tciResponseHeader_t header;     /**< Response header */
+    uint32_t            len;
+} response_t;
+
+
+/**
+ * Generate key data
+ * Response data contains generated RSA key pair data is
+ * wrapped as below:
+ *
+ * |-- Key metadata --|-- Public key (plaintext) --|-- Private key (encrypted) --|
+ */
+typedef struct {
+    uint32_t type;           /**< Key pair type. RSA or RSACRT */
+    uint32_t keysize;        /**< Key size in bits, e.g. 1024, 2048,.. */
+    uint32_t exponent;       /**< Exponent number */
+    uint32_t keydata;        /**< Key data buffer passed by TLC  */
+    uint32_t keydatalen;     /**< Length of key data buffer */
+    uint32_t solen;          /**< Secure object length  (of key data) (provided by the trustlet)  */
+} rsagenkey_t;
+
+
+/**
+ *  RSA sign data structure
+ */
+typedef struct {
+    uint32_t keydata;           /**< Key data buffer */
+    uint32_t keydatalen;        /**< Length of key data buffer */
+    uint32_t plaindata;         /**< Plaintext data buffer */
+    uint32_t plaindatalen;      /**< Length of plaintext data buffer */
+    uint32_t signaturedata;     /**< Signature data buffer */
+    uint32_t signaturedatalen;  /**< Length of signature data buffer */
+    uint32_t algorithm;         /**< Signing algorithm */
+} rsasign_t;
+
+
+/**
+ *  RSA signature verify data structure
+ */
+typedef struct {
+    uint32_t keydata;           /**< Key data buffer */
+    uint32_t keydatalen;        /**< Length of key data buffer */
+    uint32_t plaindata;         /**< Plaintext data buffer */
+    uint32_t plaindatalen;      /**< Length of plaintext data buffer */
+    uint32_t signaturedata;     /**< Signature data buffer */
+    uint32_t signaturedatalen;  /**< Length of signature data buffer */
+    uint32_t algorithm;         /**< Signing algorithm */
+    bool     validity;          /**< Signature validity */
+} rsaverify_t;
+
+
+/**
+ * Generate HMAC key data
+ * Response data contains generated HMAC key data that is
+ * wrapped as below:
+ *
+ * |-- HMAC key (encrypted) --|
+ */
+typedef struct {
+    uint32_t keydata;        /**< Key data buffer passed by TLC  */
+    uint32_t keydatalen;     /**< Length of key data buffer */
+    uint32_t solen;          /**< Secure object length  (of key data) (provided by the trustlet)  */
+} hmacgenkey_t;
+
+
+/**
+ *  HMAC sign data structure
+ */
+typedef struct {
+    uint32_t keydata;           /**< Key data buffer */
+    uint32_t keydatalen;        /**< Length of key data buffer */
+    uint32_t plaindata;         /**< Plaintext data buffer */
+    uint32_t plaindatalen;      /**< Length of plaintext data buffer */
+    uint32_t signaturedata;     /**< Signature data buffer */
+    uint32_t signaturedatalen;  /**< Length of signature data buffer */
+    uint32_t digest;            /**< Digest algorithm */
+} hmacsign_t;
+
+
+/**
+ *  HMAC signature verify data structure
+ */
+typedef struct {
+    uint32_t keydata;           /**< Key data buffer */
+    uint32_t keydatalen;        /**< Length of key data buffer */
+    uint32_t plaindata;         /**< Plaintext data buffer */
+    uint32_t plaindatalen;      /**< Length of plaintext data buffer */
+    uint32_t signaturedata;     /**< Signature data buffer */
+    uint32_t signaturedatalen;  /**< Length of signature data buffer */
+    uint32_t digest;            /**< Digest algorithm */
+    bool     validity;          /**< Signature validity */
+} hmacverify_t;
+
+/**
+ * RSA private key metadata (Private modulus and exponent lengths)
+ */
+typedef struct {
+    uint32_t     lenprimod;     /**< Private key modulus length */
+    uint32_t     lenpriexp;     /**< Private key exponent length */
+} rsaprivkeymeta_t;
+
+
+/**
+ * RSA CRT private key metadata
+ */
+typedef struct {
+    uint32_t     lenprimod;     /**< Private key modulus length */
+    uint32_t     lenp;          /**< Prime p length */
+    uint32_t     lenq;          /**< Prime q length */
+    uint32_t     lendp;         /**< DP length */
+    uint32_t     lendq;         /**< DQ length */
+    uint32_t     lenqinv;       /**< QP length */
+} rsacrtprivkeymeta_t;
+
+
+/**
+ * Key metadata (key size, modulus/exponent lengths, etc..)
+ */
+typedef struct {
+    uint32_t     keytype;          /**< RSA key pair type. RSA or RSA CRT */
+    uint32_t     keysize;          /**< RSA key size */
+    uint32_t     lenpubmod;        /**< Public key modulus length */
+    uint32_t     lenpubexp;        /**< Public key exponent length */
+    union {
+        rsaprivkeymeta_t    rsapriv;    /**< RSA private key */
+        rsacrtprivkeymeta_t rsacrtpriv; /**< RSA CRT private key */
+    };
+    uint32_t     rfu;          /**< Reserved for future use */
+    uint32_t     rfulen;       /**< Reserved for future use */
+} rsakeymeta_t;
+
+/**
+ *  Key import data structure
+ */
+typedef struct {
+    uint32_t     keydata;           /**< Key data buffer */
+    uint32_t     keydatalen;        /**< Length of key data buffer */
+    uint32_t     sodata;            /**< Wrapped buffer */
+    uint32_t     sodatalen;         /**< Length of wrapped data buffer */
+} keyimport_t;
+
+
+/**
+ *  Get public key data structure
+ */
+typedef struct {
+    uint32_t type;              /**< Key type */
+    uint32_t keydata;           /**< Key data buffer */
+    uint32_t keydatalen;        /**< Length of key data buffer */
+    uint32_t modulus;           /**< Modulus */
+    uint32_t moduluslen;        /**< Modulus length */
+    uint32_t exponent;          /**< Exponent */
+    uint32_t exponentlen;       /**< Exponent length */
+} getpubkey_t;
+
+
+/**
+ * TCI message data.
+ */
+typedef struct {
+    union {
+        command_t     command;
+        response_t    response;
+    };
+
+    union {
+        rsagenkey_t  rsagenkey;
+        rsasign_t    rsasign;
+        rsaverify_t  rsaverify;
+        hmacgenkey_t hmacgenkey;
+        hmacsign_t   hmacsign;
+        hmacverify_t hmacverify;
+        keyimport_t  keyimport;
+        getpubkey_t  getpubkey;
+    };
+
+} tciMessage_t, *tciMessage_ptr;
+
+
+/**
+ * Overall TCI structure.
+ */
+typedef struct {
+    tciMessage_t message;   /**< TCI message */
+} tci_t;
+
+
+/**
+ * Trustlet UUID
+ */
+#define TEE_KEYMASTER_TL_UUID { { 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
+
+
+#endif // __TLTEEKEYMASTERAPI_H__
diff --git a/libkeymaster/tlTeeKeymaster_log.h b/libkeymaster/tlTeeKeymaster_log.h
new file mode 100644 (file)
index 0000000..cc1636b
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * @file   tlTeeKeymaster_log.h
+ * @brief  Contains debug & log macro definitions
+ *
+ * Copyright Giesecke & Devrient GmbH 2012
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TLTEEKEYMASTERLOG_H__
+#define __TLTEEKEYMASTERLOG_H__
+
+#include <android/log.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "TlcTeeKeyMaster"
+#endif // LOG_TAG
+
+/* Macro definitions */
+#define LOG_D(...) __android_log_print(ANDROID_LOG_DEBUG , LOG_TAG, __VA_ARGS__)
+#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO  , LOG_TAG, __VA_ARGS__)
+#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN  , LOG_TAG, __VA_ARGS__)
+#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR , LOG_TAG, __VA_ARGS__)
+
+
+#endif // __TLTEEKEYMASTERLOG_H__
diff --git a/libkeymaster/tlcTeeKeymaster_if.c b/libkeymaster/tlcTeeKeymaster_if.c
new file mode 100644 (file)
index 0000000..384e17d
--- /dev/null
@@ -0,0 +1,1092 @@
+/**
+ * @file   tlcTeeKeymaster_if.c
+ * @brief  Contains trustlet connector interface implementations to
+ * handle key operations with TEE Keymaster trustlet
+ *
+ * Copyright Giesecke & Devrient GmbH 2012
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+#include "MobiCoreDriverApi.h"
+#include "tlTeeKeymaster_Api.h"
+#include "tlTeeKeymaster_log.h"
+#include "tlcTeeKeymaster_if.h"
+
+
+/* Global definitions */
+static const uint32_t gDeviceId = MC_DEVICE_ID_DEFAULT;
+static const mcUuid_t gUuid = TEE_KEYMASTER_TL_UUID;
+
+/**
+ * TEE_Open
+ *
+ * Open session to the TEE Keymaster trustlet
+ *
+ * @param  pSessionHandle  [out] Return pointer to the session handle
+ */
+static tciMessage_ptr TEE_Open(
+    mcSessionHandle_t *pSessionHandle
+){
+    tciMessage_ptr pTci = NULL;
+    mcResult_t     mcRet;
+
+    do
+    {
+
+        /* Validate session handle */
+        if (!pSessionHandle)
+        {
+            LOG_E("TEE_Open(): Invalid session handle\n");
+            break;
+        }
+
+        /* Initialize session handle data */
+        bzero(pSessionHandle, sizeof(mcSessionHandle_t));
+
+        /* Open MobiCore device */
+        mcRet = mcOpenDevice(gDeviceId);
+        if (MC_DRV_OK != mcRet)
+        {
+            LOG_E("TEE_Open(): mcOpenDevice returned: %d\n", mcRet);
+            break;
+        }
+
+        /* Allocating WSM for TCI */
+        mcRet = mcMallocWsm(gDeviceId, 0, sizeof(tciMessage_t), (uint8_t **) &pTci, 0);
+        if (MC_DRV_OK != mcRet)
+        {
+            LOG_E("TEE_Open(): mcMallocWsm returned: %d\n", mcRet);
+            break;
+        }
+
+        /* Open session the TEE Keymaster trustlet */
+        pSessionHandle->deviceId = gDeviceId;
+        mcRet = mcOpenSession(pSessionHandle,
+                              &gUuid,
+                              (uint8_t *) pTci,
+                              (uint32_t) sizeof(tciMessage_t));
+        if (MC_DRV_OK != mcRet)
+        {
+            LOG_E("TEE_Open(): mcOpenSession returned: %d\n", mcRet);
+            break;
+        }
+
+    } while (false);
+
+    LOG_I("TEE_Open(): returning pointer to TCI buffer: 0x%.8x\n", pTci);
+
+    return pTci;
+}
+
+
+/**
+ * TEE_Close
+ *
+ * Close session to the TEE Keymaster trustlet
+ *
+ * @param  sessionHandle  [in] Session handle
+ */
+static void TEE_Close(
+    mcSessionHandle_t *pSessionHandle
+){
+    teeResult_t   ret = TEE_ERR_NONE;
+    mcResult_t    mcRet;
+
+    do {
+
+        /* Validate session handle */
+        if (!pSessionHandle)
+        {
+            LOG_E("TEE_Close(): Invalid session handle\n");
+            break;
+        }
+
+        /* Close session */
+        mcRet = mcCloseSession(pSessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            LOG_E("TEE_Close(): mcCloseSession returned: %d\n", mcRet);
+            ret = TEE_ERR_SESSION;
+            break;
+        }
+
+        /* Close MobiCore device */
+        mcRet = mcCloseDevice(gDeviceId);
+        if (MC_DRV_OK != mcRet)
+        {
+            LOG_E("TEE_Close(): mcCloseDevice returned: %d\n", mcRet);
+            ret = TEE_ERR_MC_DEVICE;
+        }
+
+    } while (false);
+}
+
+
+/**
+ * TEE_RSAGenerateKeyPair
+ *
+ * Generates RSA key pair and returns key pair data as wrapped object
+ *
+ * @param  keyType        [in]  Key pair type. RSA or RSACRT
+ * @param  keyData        [in]  Pointer to the key data buffer
+ * @param  keyDataLength  [in]  Key data buffer length
+ * @param  keySize        [in]  Key size
+ * @param  exponent       [in]  Exponent number
+ * @param  soLen          [out] Key data secure object length
+ */
+teeResult_t TEE_RSAGenerateKeyPair(
+    teeRsaKeyPairType_t keyType,
+    uint8_t*            keyData,
+    uint32_t            keyDataLength,
+    uint32_t            keySize,
+    uint32_t            exponent,
+    uint32_t*           soLen
+){
+    teeResult_t         ret = TEE_ERR_NONE;
+    tciMessage_ptr      pTci = NULL;
+    mcSessionHandle_t   sessionHandle;
+    mcBulkMap_t         mapInfo;
+    mcResult_t          mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, keyData, keyDataLength, &mapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_RSA_GEN_KEY_PAIR;
+        pTci->rsagenkey.type        = keyType;
+        pTci->rsagenkey.keysize     = keySize;
+        pTci->rsagenkey.keydata     = (uint32_t)mapInfo.sVirtualAddr;
+        pTci->rsagenkey.keydatalen  = keyDataLength;
+        pTci->rsagenkey.exponent    = exponent;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, keyData, &mapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_RSAGenerateKeyPair(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        /* Update secure object length */
+        *soLen =  pTci->rsagenkey.solen;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_RSAGenerateKeyPair(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/**
+ * TEE_RSASign
+ *
+ * Signs given plain data and returns signature data
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [out] Pointer to signature data
+ * @param  signatureDataLength  [out] Signature data length
+ * @param  algorithm        [in]  RSA signature algorithm
+ */
+teeResult_t TEE_RSASign(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    uint8_t*        signatureData,
+    uint32_t*       signatureDataLength,
+    teeRsaSigAlg_t  algorithm
+){
+    teeResult_t        ret = TEE_ERR_NONE;
+    tciMessage_ptr     pTci = NULL;
+    mcSessionHandle_t  sessionHandle;
+    mcBulkMap_t        keyMapInfo;
+    mcBulkMap_t        plainMapInfo;
+    mcBulkMap_t        signatureMapInfo;
+    mcResult_t         mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)signatureData, *signatureDataLength, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_RSA_SIGN;
+        pTci->rsasign.keydata = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->rsasign.keydatalen = keyDataLength;
+
+        pTci->rsasign.plaindata = (uint32_t)plainMapInfo.sVirtualAddr;
+        pTci->rsasign.plaindatalen = plainDataLength;
+
+        pTci->rsasign.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr;
+        pTci->rsasign.signaturedatalen = *signatureDataLength;
+
+        pTci->rsasign.algorithm = algorithm;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_RSASign(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        /* Retrieve signature data length */
+        *signatureDataLength = pTci->rsasign.signaturedatalen;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_RSASign(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/**
+ * TEE_RSAVerify
+ *
+ * Verifies given data with RSA public key and return status
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [in]  Pointer to signed data
+ * @param  signatureData    [in]  Plain  data length
+ * @param  algorithm        [in]  RSA signature algorithm
+ * @param  validity         [out] Signature validity
+ */
+teeResult_t TEE_RSAVerify(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    const uint8_t*  signatureData,
+    const uint32_t  signatureDataLength,
+    teeRsaSigAlg_t  algorithm,
+    bool            *validity
+){
+    teeResult_t        ret = TEE_ERR_NONE;
+    tciMessage_ptr     pTci = NULL;
+    mcSessionHandle_t  sessionHandle;
+    mcBulkMap_t        keyMapInfo;
+    mcBulkMap_t        plainMapInfo;
+    mcBulkMap_t        signatureMapInfo;
+    mcResult_t         mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)signatureData, signatureDataLength, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_RSA_VERIFY;
+        pTci->rsaverify.keydata = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->rsaverify.keydatalen = keyDataLength;
+
+        pTci->rsaverify.plaindata = (uint32_t)plainMapInfo.sVirtualAddr;
+        pTci->rsaverify.plaindatalen = plainDataLength;
+
+        pTci->rsaverify.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr;
+        pTci->rsaverify.signaturedatalen = signatureDataLength;
+
+        pTci->rsaverify.algorithm = algorithm;
+        pTci->rsaverify.validity = false;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_RSAVerify(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        *validity =  pTci->rsaverify.validity;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_RSAVerify(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/**
+ * TEE_HMACKeyGenerate
+ *
+ * Generates random key for HMAC calculation and returns key data as wrapped object
+ * (key is encrypted)
+ *
+ * @param  keyData        [out] Pointer to key data
+ * @param  keyDataLength  [in]  Key data buffer length
+ * @param  soLen          [out] Key data secure object length
+ */
+teeResult_t TEE_HMACKeyGenerate(
+    uint8_t*  keyData,
+    uint32_t  keyDataLength,
+    uint32_t* soLen
+){
+    teeResult_t        ret = TEE_ERR_NONE;
+    tciMessage_ptr     pTci = NULL;
+    mcSessionHandle_t  sessionHandle;
+    mcBulkMap_t        keyMapInfo;
+    mcResult_t         mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_HMAC_GEN_KEY;
+        pTci->hmacgenkey.keydata = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->hmacgenkey.keydatalen = keyDataLength;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_RSAVerify(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+        }
+
+        /* Update secure object length */
+        *soLen =  pTci->hmacgenkey.solen;
+
+    }while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_HMACKeyGenerate(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+/**
+ * TEE_HMACSign
+ *
+ * Signs given plain data and returns HMAC signature data
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [out] Pointer to signature data
+ * @param  signatureDataLength  [out] Signature data length
+ * @param  digest           [in]  Digest type
+ */
+teeResult_t TEE_HMACSign(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    uint8_t*        signatureData,
+    uint32_t*       signatureDataLength,
+    teeDigest_t     digest
+){
+    teeResult_t        ret = TEE_ERR_NONE;
+    tciMessage_ptr     pTci = NULL;
+    mcSessionHandle_t  sessionHandle;
+    mcBulkMap_t        keyMapInfo;
+    mcBulkMap_t        plainMapInfo;
+    mcBulkMap_t        signatureMapInfo;
+    mcResult_t         mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)signatureData, *signatureDataLength, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_HMAC_SIGN;
+        pTci->hmacsign.keydata = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->hmacsign.keydatalen = keyDataLength;
+
+        pTci->hmacsign.plaindata = (uint32_t)plainMapInfo.sVirtualAddr;
+        pTci->hmacsign.plaindatalen = plainDataLength;
+
+        pTci->hmacsign.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr;
+        pTci->hmacsign.signaturedatalen = *signatureDataLength;
+
+        pTci->hmacsign.digest = digest;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_HMACSign(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        /* Retrieve signature data length */
+        *signatureDataLength = pTci->hmacsign.signaturedatalen;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_HMACSign(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/**
+ * TEE_HMACVerify
+ *
+ * Verifies given data HMAC key data and return status
+ *
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [in]  Pointer to signed data
+ * @param  signatureData    [in]  Plain  data length
+ * @param  digest           [in]  Digest type
+ * @param  validity         [out] Signature validity
+ */
+teeResult_t TEE_HMACVerify(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    const uint8_t*  signatureData,
+    const uint32_t  signatureDataLength,
+    teeDigest_t     digest,
+    bool            *validity
+){
+    teeResult_t        ret = TEE_ERR_NONE;
+    tciMessage_ptr     pTci = NULL;
+    mcSessionHandle_t  sessionHandle;
+    mcBulkMap_t        keyMapInfo;
+    mcBulkMap_t        plainMapInfo;
+    mcBulkMap_t        signatureMapInfo;
+    mcResult_t         mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)plainData, plainDataLength, &plainMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)signatureData, signatureDataLength, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_HMAC_VERIFY;
+        pTci->hmacverify.keydata = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->hmacverify.keydatalen = keyDataLength;
+
+        pTci->hmacverify.plaindata = (uint32_t)plainMapInfo.sVirtualAddr;
+        pTci->hmacverify.plaindatalen = plainDataLength;
+
+        pTci->hmacverify.signaturedata = (uint32_t)signatureMapInfo.sVirtualAddr;
+        pTci->hmacverify.signaturedatalen = signatureDataLength;
+
+        pTci->hmacverify.digest = digest;
+        pTci->hmacverify.validity = false;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)plainData, &plainMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)signatureData, &signatureMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_HMACVerify(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        *validity =  pTci->hmacverify.validity;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_HMACVerify(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/**
+ * TEE_KeyImport
+ *
+ * Imports key data and returns key data as secure object
+ *
+ * Key data needs to be in the following format
+ *
+ * RSA key data:
+ * |--key metadata--|--public modulus--|--public exponent--|--private exponent--|
+ *
+ * RSA CRT key data:
+ * |--key metadata--|--public modulus--|--public exponent--|--P--|--Q--|--DP--|--DQ--|--Qinv--|
+ *
+ * Where:
+ * P:     secret prime factor
+ * Q:     secret prime factor
+ * DP:    d mod (p-1)
+ * DQ:    d mod (q-1)
+ * Qinv:  q^-1 mod p
+ *
+ * @param  keyData          [in]  Pointer to key data
+ * @param  keyDataLength    [in]  Key data length
+ * @param  soData           [out] Pointer to wrapped key data
+ * @param  soDataLength     [out] Wrapped key data length
+ */
+teeResult_t TEE_KeyImport(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    uint8_t*        soData,
+    uint32_t*       soDataLength
+){
+    teeResult_t         ret = TEE_ERR_NONE;
+    tciMessage_ptr      pTci = NULL;
+    mcSessionHandle_t   sessionHandle;
+    mcBulkMap_t         keyMapInfo;
+    mcBulkMap_t         soMapInfo;
+    mcResult_t          mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)soData, *soDataLength, &soMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_KEY_IMPORT;
+        pTci->keyimport.keydata        = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->keyimport.keydatalen     = keyDataLength;
+        pTci->keyimport.sodata         = (uint32_t)soMapInfo.sVirtualAddr;
+        pTci->keyimport.sodatalen      = *soDataLength;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)soData, &soMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_KeyWrap(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        /* Update secure object length */
+        *soDataLength =  pTci->keyimport.sodatalen;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_KeyWrap(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
+
+
+/** * TEE_GetPubKey
+ *
+ * Retrieves public key daya (modulus and exponent) from wrapped key data
+ *
+ * @param  keyData          [in]  Pointer to key data
+ * @param  keyDataLength    [in]  Key data length
+ * @param  modulus          [out] Pointer to public key modulus data
+ * @param  modulusLength    [out] Modulus data length
+ * @param  exponent         [out] Pointer to public key exponent data
+ * @param  exponentLength   [out] Exponent data length
+ */
+teeResult_t TEE_GetPubKey(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    uint8_t*        modulus,
+    uint32_t*       modulusLength,
+    uint8_t*        exponent,
+    uint32_t*       exponentLength
+){
+    teeResult_t         ret = TEE_ERR_NONE;
+    tciMessage_ptr      pTci = NULL;
+    mcSessionHandle_t   sessionHandle;
+    mcBulkMap_t         keyMapInfo;
+    mcBulkMap_t         modMapInfo;
+    mcBulkMap_t         expMapInfo;
+    mcResult_t          mcRet;
+
+    do {
+
+        /* Open session to the trustlet */
+        pTci = TEE_Open(&sessionHandle);
+        if (!pTci) {
+            ret = TEE_ERR_MEMORY;
+            break;
+        }
+
+        /* Map memory to the secure world */
+        mcRet = mcMap(&sessionHandle, (void*)keyData, keyDataLength, &keyMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)modulus, *modulusLength, &modMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcMap(&sessionHandle, (void*)exponent, *exponentLength, &expMapInfo);
+        if (MC_DRV_OK != mcRet) {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        /* Update TCI buffer */
+        pTci->command.header.commandId = CMD_ID_TEE_GET_PUB_KEY;
+        pTci->getpubkey.keydata        = (uint32_t)keyMapInfo.sVirtualAddr;
+        pTci->getpubkey.keydatalen     = keyDataLength;
+        pTci->getpubkey.modulus        = (uint32_t)modMapInfo.sVirtualAddr;
+        pTci->getpubkey.moduluslen     = *modulusLength;
+        pTci->getpubkey.exponent       = (uint32_t)expMapInfo.sVirtualAddr;
+        pTci->getpubkey.exponentlen    = *exponentLength;
+
+        /* Notify the trustlet */
+        mcRet = mcNotify(&sessionHandle);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Wait for response from the trustlet */
+        if (MC_DRV_OK != mcWaitNotification(&sessionHandle, MC_INFINITE_TIMEOUT))
+        {
+            ret = TEE_ERR_NOTIFICATION;
+            break;
+        }
+
+        /* Unmap memory */
+        mcRet = mcUnmap(&sessionHandle, (void*)keyData, &keyMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)modulus, &modMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        mcRet = mcUnmap(&sessionHandle, (void*)exponent, &expMapInfo);
+        if (MC_DRV_OK != mcRet)
+        {
+            ret = TEE_ERR_MAP;
+            break;
+        }
+
+        if (RET_OK != pTci->response.header.returnCode)
+        {
+            LOG_E("TEE_GetPubKey(): TEE Keymaster trustlet returned: 0x%.8x\n",
+                        pTci->response.header.returnCode);
+            ret = TEE_ERR_FAIL;
+            break;
+        }
+
+        /* Update  modulus and exponent lengths */
+        *modulusLength =   pTci->getpubkey.moduluslen;
+        *exponentLength =   pTci->getpubkey.exponentlen;
+
+    } while (false);
+
+    /* Close session to the trustlet */
+    TEE_Close(&sessionHandle);
+
+    LOG_I("TEE_GetPubKey(): returning: 0x%.8x\n", ret);
+
+    return ret;
+}
diff --git a/libkeymaster/tlcTeeKeymaster_if.h b/libkeymaster/tlcTeeKeymaster_if.h
new file mode 100644 (file)
index 0000000..0c378ca
--- /dev/null
@@ -0,0 +1,324 @@
+/**
+ * @file   tlcTeeKeymaster_if.h
+ * @brief  Contains TEE Keymaster trustlet connector interface definitions
+ *
+ * Copyright Giesecke & Devrient GmbH 2012
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TLCTEEKEYMASTERIF_H__
+#define __TLCTEEKEYMASTERIF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+
+/**
+ * Key sizes
+ */
+#define TEE_RSA_KEY_SIZE_512   512
+#define TEE_RSA_KEY_SIZE_1024  1024
+#define TEE_RSA_KEY_SIZE_2048  2048
+
+
+/* error codes */
+typedef enum
+{
+    TEE_ERR_NONE             = 0,
+    TEE_ERR_FAIL             = 1,
+    TEE_ERR_INVALID_BUFFER   = 2,
+    TEE_ERR_BUFFER_TOO_SMALL = 3,
+    TEE_ERR_NOT_IMPLEMENTED  = 4,
+    TEE_ERR_SESSION          = 5,
+    TEE_ERR_MC_DEVICE        = 6,
+    TEE_ERR_NOTIFICATION     = 7,
+    TEE_ERR_MEMORY           = 8,
+    TEE_ERR_MAP              = 9
+    /* more can be added as required */
+} teeResult_t;
+
+
+/* RSA key pair types */
+typedef enum {
+    TEE_KEYPAIR_RSA       = 1,   /**< RSA public and RSA private key. */
+    TEE_KEYPAIR_RSACRT    = 2    /**< RSA public and RSA CRT private key. */
+} teeRsaKeyPairType_t;
+
+
+/* Supported RSA signature algorithms */
+typedef enum
+{
+    /* RSA */
+    TEE_RSA_SHA_ISO9796           = 1, /**< 20-byte SHA-1 digest, padded according to the ISO 9796-2 scheme as specified in EMV '96 and EMV 2000, encrypted using RSA. */
+    TEE_RSA_SHA_ISO9796_MR        = 2, /**< 20-byte SHA-1 digest, padded according to the ISO9796-2 specification and encrypted using RSA. */
+    TEE_RSA_SHA_PKCS1             = 3, /**< 20-byte SHA-1 digest, padded according to the PKCS#1 (v1.5) scheme, and encrypted using RSA. */
+    TEE_RSA_SHA256_PSS            = 4, /**< SHA-256 digest and PSS padding */
+    TEE_RSA_SHA1_PSS              = 5, /**< SHA-256 digest and PSS padding */
+    TEE_RSA_NODIGEST_NOPADDING    = 6, /**< No digest and padding */
+} teeRsaSigAlg_t;
+
+
+/* Digest types */
+typedef enum
+{
+    TEE_DIGEST_SHA1,
+    TEE_DIGEST_SHA256
+} teeDigest_t;
+
+
+/**
+ * RSA private key metadata (Private modulus and exponent lengths)
+ */
+typedef struct {
+    uint32_t     lenprimod;     /**< Private key modulus length */
+    uint32_t     lenpriexp;     /**< Private key exponent length */
+} teeRsaPrivKeyMeta_t;
+
+
+/**
+ * RSA CRT private key metadata (Private modulus and exponent lengths)
+ */
+typedef struct {
+    uint32_t     lenprimod;     /**< Private key modulus length */
+    uint32_t     lenp;          /**< Prime p length */
+    uint32_t     lenq;          /**< Prime q length */
+    uint32_t     lendp;         /**< DP length */
+    uint32_t     lendq;         /**< DQ length */
+    uint32_t     lenqinv;       /**< QP length */
+} teeRsaCrtPrivKeyMeta_t;
+
+
+/**
+ * Key metadata (public key hash, key size, modulus/exponent lengths, etc..)
+ */
+typedef struct {
+    uint32_t     keytype;       /**< Key type, e.g. RSA */
+    uint32_t     keysize;       /**< Key size, e.g. 1024, 2048 */
+    uint32_t     lenpubmod;     /**< Public key modulus length */
+    uint32_t     lenpubexp;     /**< Public key exponent length */
+    union {
+        teeRsaPrivKeyMeta_t rsapriv;       /**< RSA private key */
+        teeRsaCrtPrivKeyMeta_t rsacrtpriv; /**< RSA CRT private key */
+    };
+    uint32_t     rfu;          /**< Reserved for future use */
+    uint32_t     rfulen;       /**< Reserved for future use */
+} teeRsaKeyMeta_t;
+
+/**
+ * TEE_RSAGenerateKeyPair
+ *
+ * Generates RSA key pair and returns key pair data as wrapped object
+ *
+ * @param  keyType        [in]  Key pair type. RSA or RSACRT
+ * @param  keyData        [in]  Pointer to the key data buffer
+ * @param  keyDataLength  [in]  Key data buffer length
+ * @param  keySize        [in]  Key size
+ * @param  exponent       [in]  Exponent number
+ * @param  soLen          [out] Key data secure object length
+ */
+teeResult_t TEE_RSAGenerateKeyPair(
+    teeRsaKeyPairType_t keyType,
+    uint8_t*            keyData,
+    uint32_t            keyDataLength,
+    uint32_t            keySize,
+    uint32_t            exponent,
+    uint32_t*           soLen);
+
+
+/**
+ * TEE_RSASign
+ *
+ * Signs given plain data and returns signature data
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [out] Pointer to signature data
+ * @param  signatureDataLength  [out] Signature data length
+ * @param  algorithm        [in]  RSA signature algorithm
+ */
+teeResult_t TEE_RSASign(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    uint8_t*        signatureData,
+    uint32_t*       signatureDataLength,
+    teeRsaSigAlg_t  algorithm);
+
+
+/**
+ * TEE_RSAVerify
+ *
+ * Verifies given data with RSA public key and return status
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [in]  Pointer to signed data
+ * @param  signatureData    [in]  Plain  data length
+ * @param  algorithm        [in]  RSA signature algorithm
+ * @param  validity         [out] Signature validity
+ */
+teeResult_t TEE_RSAVerify(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    const uint8_t*  signatureData,
+    const uint32_t  signatureDataLength,
+    teeRsaSigAlg_t  algorithm,
+    bool            *validity);
+
+
+/**
+ * TEE_HMACKeyGenerate
+ *
+ * Generates random key for HMAC calculation and returns key data as wrapped object
+ * (key is encrypted)
+ *
+ * @param  keyData        [out] Pointer to key data
+ * @param  keyDataLength  [in]  Key data buffer length
+ * @param  soLen          [out] Key data secure object length
+ */
+teeResult_t TEE_HMACKeyGenerate(
+    uint8_t*  keyData,
+    uint32_t  keyDataLength,
+    uint32_t* soLen);
+
+
+/**
+ * TEE_HMACSign
+ *
+ * Signs given plain data and returns HMAC signature data
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [out] Pointer to signature data
+ * @param  signatureDataLength  [out] Signature data length
+ * @param  digest           [in]  Digest type
+ */
+teeResult_t TEE_HMACSign(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    uint8_t*        signatureData,
+    uint32_t*       signatureDataLength,
+    teeDigest_t     digest);
+
+
+/**
+ * TEE_HMACVerify
+ *
+ * Verifies given data HMAC key data and return status
+ *
+ * @param  keyData          [in]  Pointer to key data buffer
+ * @param  keyDataLength    [in]  Key data buffer length
+ * @param  plainData        [in]  Pointer to plain data to be signed
+ * @param  plainDataLength  [in]  Plain data length
+ * @param  signatureData    [in]  Pointer to signed data
+ * @param  signatureData    [in]  Plain  data length
+ * @param  digest           [in]  Digest type
+ * @param  validity         [out] Signature validity
+ */
+teeResult_t TEE_HMACVerify(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    const uint8_t*  plainData,
+    const uint32_t  plainDataLength,
+    const uint8_t*  signatureData,
+    const uint32_t  signatureDataLength,
+    teeDigest_t     digest,
+    bool            *validity);
+
+
+/**
+ * TEE_KeyImport
+ *
+ * Imports key data and returns key data as secure object
+ *
+ * Key data needs to be in the following format
+ *
+ * RSA key data:
+ * |--key metadata--|--public modulus--|--public exponent--|--private exponent--|
+ *
+ * RSA CRT key data:
+ * |--key metadata--|--public modulus--|--public exponent--|--P--|--Q--|--DP--|--DQ--|--Qinv--|
+ *
+ * Where:
+ * P:     secret prime factor
+ * Q:     secret prime factor
+ * DP:    d mod (p-1)
+ * DQ:    d mod (q-1)
+ * Qinv:  q^-1 mod p
+ *
+ * @param  keyData          [in]  Pointer to key data
+ * @param  keyDataLength    [in]  Key data length
+ * @param  soData           [out] Pointer to wrapped key data
+ * @param  soDataLength     [out] Wrapped key data length
+ */
+teeResult_t TEE_KeyImport(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    uint8_t*        soData,
+    uint32_t*       soDataLength);
+
+
+/**
+ * TEE_GetPubKey
+ *
+ * Retrieves public key daya (modulus and exponent) from wrapped key data
+ *
+ * @param  keyData          [in]  Pointer to key data
+ * @param  keyDataLength    [in]  Key data length
+ * @param  modulus          [out] Pointer to public key modulus data
+ * @param  modulusLength    [out] Modulus data length
+ * @param  exponent         [out] Pointer to public key exponent data
+ * @param  exponentLength   [out] Exponent data length
+ */
+teeResult_t TEE_GetPubKey(
+    const uint8_t*  keyData,
+    const uint32_t  keyDataLength,
+    uint8_t*        modulus,
+    uint32_t*       modulusLength,
+    uint8_t*        exponent,
+    uint32_t*       exponentLength);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TLCTEEKEYMASTERIF_H__
diff --git a/libscaler/libscaler-m2m1shot.cpp b/libscaler/libscaler-m2m1shot.cpp
new file mode 100644 (file)
index 0000000..74d4b92
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file      libscaler-m2m1shot.cpp
+ * \brief     source file for Scaler HAL
+ * \author    Cho KyongHo <pullip.cho@samsung.com>
+ * \date      2014/05/08
+ *
+ * <b>Revision History: </b>
+ * - 2014.05.08 : Cho KyongHo (pullip.cho@samsung.com) \n
+ *   Create
+ */
+#include <cstring>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <videodev2.h>
+
+#include <exynos_scaler.h>
+
+#include "libscaler-common.h"
+#include "libscaler-m2m1shot.h"
+
+using namespace std;
+
+const char dev_base_name[] = "/dev/m2m1shot_scaler";
+#define DEVBASE_NAME_LEN 20
+
+struct PixFormat {
+    unsigned int pixfmt;
+    char planes;
+    char bit_pp[3];
+};
+
+const static PixFormat g_pixfmt_table[] = {
+    {V4L2_PIX_FMT_RGB32,        1, {32, 0, 0}, },
+    {V4L2_PIX_FMT_BGR32,        1, {32, 0, 0}, },
+    {V4L2_PIX_FMT_RGB565,       1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_RGB555X,      1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_RGB444,       1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_YUYV,         1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_YVYU,         1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_UYVY,         1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_NV16,         1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_NV61,         1, {16, 0, 0}, },
+    {V4L2_PIX_FMT_YUV420,       1, {12, 0, 0}, },
+    {V4L2_PIX_FMT_YVU420,       1, {12, 0, 0}, },
+    {V4L2_PIX_FMT_NV12M,        2, {8, 4, 0}, },
+    {V4L2_PIX_FMT_NV21M,        2, {8, 4, 0}, },
+    {v4l2_fourcc('V', 'M', '1', '2'), 2, {8, 4, 0}, },
+    {V4L2_PIX_FMT_NV12,         1, {12, 0, 0}, },
+    {V4L2_PIX_FMT_NV21,         1, {12, 0, 0}, },
+    {v4l2_fourcc('N', 'M', '2', '1'), 2, {8, 4, 0}, },
+    {V4L2_PIX_FMT_YUV420M,      3, {8, 2, 2}, },
+    {V4L2_PIX_FMT_YVU420M,      3, {8, 2, 2}, },
+    {V4L2_PIX_FMT_NV24,         1, {24, 0, 0}, },
+    {V4L2_PIX_FMT_NV42,         1, {24, 0, 0}, },
+};
+
+
+CScalerM2M1SHOT::CScalerM2M1SHOT(int devid, int drm) : m_iFD(-1)
+{
+    char devname[DEVBASE_NAME_LEN + 2]; // basenamelen + id + null
+
+    if ((devid < 0) || (devid > 4)) { // instance number must be between 0 ~ 3
+        SC_LOGE("Invalid device instance ID %d", devid);
+        return;
+    }
+
+    strncpy(devname, dev_base_name, DEVBASE_NAME_LEN);
+    devname[DEVBASE_NAME_LEN] = devid + '0';
+    devname[DEVBASE_NAME_LEN + 1] = '\0';
+
+    memset(&m_task, 0, sizeof(m_task));
+
+    m_iFD = open(devname, O_RDWR);
+    if (m_iFD < 0) {
+        SC_LOGERR("Failed to open '%s'", devname);
+    } else {
+        // default 3 planes not to miss any buffer address
+        m_task.buf_out.num_planes = 3;
+        m_task.buf_cap.num_planes = 3;
+    }
+}
+
+CScalerM2M1SHOT::~CScalerM2M1SHOT()
+{
+    if (m_iFD >= 0)
+        close(m_iFD);
+}
+
+bool CScalerM2M1SHOT::CScalerM2M1SHOT::Run()
+{
+    int ret;
+
+    ret = ioctl(m_iFD, M2M1SHOT_IOC_PROCESS, &m_task);
+    if (ret < 0) {
+        SC_LOGERR("Failed to process the given M2M1SHOT task");
+        return false;
+    }
+
+    return true;
+}
+
+bool CScalerM2M1SHOT::SetFormat(m2m1shot_pix_format &fmt, m2m1shot_buffer &buf,
+        unsigned int width, unsigned int height, unsigned int v4l2_fmt) {
+    const PixFormat *pixfmt = NULL;
+
+    fmt.width = width;
+    fmt.height = height;
+    fmt.fmt = v4l2_fmt;
+
+    for (size_t i = 0; i < ARRSIZE(g_pixfmt_table); i++) {
+        if (g_pixfmt_table[i].pixfmt == v4l2_fmt) {
+            pixfmt = &g_pixfmt_table[i];
+            break;
+        }
+    }
+
+    if (!pixfmt) {
+        SC_LOGE("Format %#x is not supported", v4l2_fmt);
+        return false;
+    }
+
+    for (int i = 0; i < pixfmt->planes; i++) {
+        if (((pixfmt->bit_pp[i] * width) % 8) != 0) {
+            SC_LOGE("Plane %d of format %#x must have even width", i, v4l2_fmt);
+            return false;
+        }
+        buf.plane[i].len = (pixfmt->bit_pp[i] * width * height) / 8;
+    }
+
+    buf.num_planes = pixfmt->planes;
+
+    return true;
+}
+
+bool CScalerM2M1SHOT::SetCrop(m2m1shot_pix_format &fmt,
+        unsigned int l, unsigned int t, unsigned int w, unsigned int h) {
+    if (fmt.width <= l) {
+        SC_LOGE("crop left %d is larger than image width %d", l, fmt.width);
+        return false;
+    }
+    if (fmt.height <= t) {
+        SC_LOGE("crop top %d is larger than image height %d", t, fmt.height);
+        return false;
+    }
+    if (fmt.width < (l + w)) {
+        SC_LOGE("crop width %d@%d  exceeds image width %d", w, l, fmt.width);
+        return false;
+    }
+    if (fmt.height < (t + h)) {
+        SC_LOGE("crop height %d@%d  exceeds image height %d", h, t, fmt.height);
+        return false;
+    }
+
+    fmt.crop.left = l;
+    fmt.crop.top = t;
+    fmt.crop.width = w;
+    fmt.crop.height = h;
+
+    return true;
+}
+
+bool CScalerM2M1SHOT::SetAddr(
+                m2m1shot_buffer &buf, void *addr[SC_NUM_OF_PLANES], int mem_type) {
+    if (mem_type == V4L2_MEMORY_DMABUF) {
+        buf.type = M2M1SHOT_BUFFER_DMABUF;
+        for (int i = 0; i < buf.num_planes; i++)
+            buf.plane[i].fd = reinterpret_cast<int>(addr[i]);
+    } else if (mem_type == V4L2_MEMORY_USERPTR) {
+        buf.type = M2M1SHOT_BUFFER_USERPTR;
+        for (int i = 0; i < buf.num_planes; i++)
+            buf.plane[i].userptr = reinterpret_cast<unsigned long>(addr[i]);
+    } else {
+        SC_LOGE("Unknown buffer type %d", mem_type);
+        return false;
+    }
+
+    return true;
+}
+
+bool CScalerM2M1SHOT::SetRotate(int rot, int hflip, int vflip) {
+    if ((rot % 90) != 0) {
+        SC_LOGE("Rotation degree %d must be multiple of 90", rot);
+        return false;
+    }
+
+    rot = rot % 360;
+    if (rot < 0)
+        rot = 360 + rot;
+
+    m_task.op.rotate = rot;
+    m_task.op.op &= ~(M2M1SHOT_OP_FLIP_HORI | M2M1SHOT_OP_FLIP_VIRT);
+    if (hflip)
+        m_task.op.op |= M2M1SHOT_OP_FLIP_HORI;
+    if (vflip)
+        m_task.op.op |= M2M1SHOT_OP_FLIP_VIRT;
+
+    return true;
+}
diff --git a/libscaler/libscaler-v4l2.cpp b/libscaler/libscaler-v4l2.cpp
new file mode 100644 (file)
index 0000000..f73e981
--- /dev/null
@@ -0,0 +1,433 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * Copyright@ Samsung Electronics Co. LTD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*!
+ * \file      libscaler-v4l2.cpp
+ * \brief     source file for Scaler HAL
+ * \author    Cho KyongHo <pullip.cho@samsung.com>
+ * \date      2014/05/12
+ *
+ * <b>Revision History: </b>
+ * - 2014.05.12 : Cho KyongHo (pullip.cho@samsung.com) \n
+ *   Create
+ */
+
+#include <cstring>
+#include <cstdlib>
+
+#include "libscaler-v4l2.h"
+
+void CScalerV4L2::Initialize(int instance)
+{
+    snprintf(m_cszNode, SC_MAX_NODENAME, SC_DEV_NODE "%d", SC_NODE(instance));
+
+    m_fdScaler = exynos_v4l2_open(m_cszNode, O_RDWR);
+    if (m_fdScaler < 0) {
+        SC_LOGERR("Failed to open '%s'", m_cszNode);
+        return;
+    }
+
+    unsigned int cap = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT_MPLANE |
+                        V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+    if (!exynos_v4l2_querycap(m_fdScaler, cap)) {
+        SC_LOGERR("Failed to query capture on '%s'", m_cszNode);
+        close(m_fdScaler);
+        m_fdScaler = -1;
+    } else {
+        m_fdValidate = -m_fdScaler;
+    }
+}
+
+CScalerV4L2::CScalerV4L2(int instance, int allow_drm)
+{
+    m_fdScaler = -1;
+    m_iInstance = instance;
+    m_nRotDegree = 0;
+    m_fStatus = 0;
+
+    memset(&m_frmSrc, 0, sizeof(m_frmSrc));
+    memset(&m_frmDst, 0, sizeof(m_frmDst));
+
+    m_frmSrc.fdAcquireFence = -1;
+    m_frmDst.fdAcquireFence = -1;
+
+    m_frmSrc.name = "output";
+    m_frmDst.name = "capture";
+
+    m_frmSrc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
+    m_frmDst.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+
+    Initialize(instance);
+
+    if(Valid()) {
+        if (allow_drm)
+            SetFlag(m_fStatus, SCF_ALLOW_DRM);
+        SC_LOGD("Successfully opened '%s'; returned fd %d; drmmode %s",
+                m_cszNode, m_fdScaler, allow_drm ? "enabled" : "disabled");
+    }
+}
+
+CScalerV4L2::~CScalerV4L2()
+{
+    if (m_fdScaler >= 0)
+        close(m_fdScaler);
+
+    m_fdScaler = -1;
+}
+
+bool CScalerV4L2::Stop()
+{
+    if (!ResetDevice(m_frmSrc)) {
+        SC_LOGE("Failed to stop Scaler for the output frame");
+        return false;
+    }
+
+    if (!ResetDevice(m_frmDst)) {
+        SC_LOGE("Failed to stop Scaler for the cature frame");
+        return false;
+    }
+
+    return true;
+}
+
+bool CScalerV4L2::Run()
+{
+    if (!DevSetCtrl())
+        return false;
+
+    if (!DevSetFormat())
+        return false;
+
+    if (!ReqBufs())
+        return false;
+
+    if (!StreamOn())
+        return false;
+
+    if (!QBuf())
+        return false;
+
+    return DQBuf();
+}
+
+bool CScalerV4L2::DevSetCtrl()
+{
+    if (!TestFlag(m_fStatus, SCF_ROTATION_FRESH)) {
+        SC_LOGD("Skipping rotation and flip setting due to no change");
+        return true;
+    }
+
+    if (!Stop())
+        return false;
+
+    if (exynos_v4l2_s_ctrl(m_fdScaler, V4L2_CID_ROTATE, m_nRotDegree) < 0) {
+        SC_LOGERR("Failed V4L2_CID_ROTATE with degree %d", m_nRotDegree);
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(m_fdScaler, V4L2_CID_VFLIP, TestFlag(m_fStatus, SCF_HFLIP)) < 0) {
+        SC_LOGERR("Failed V4L2_CID_VFLIP - %d", TestFlag(m_fStatus, SCF_VFLIP));
+        return false;
+    }
+
+    if (exynos_v4l2_s_ctrl(m_fdScaler, V4L2_CID_HFLIP, TestFlag(m_fStatus, SCF_VFLIP)) < 0) {
+        SC_LOGERR("Failed V4L2_CID_HFLIP - %d", TestFlag(m_fStatus, SCF_HFLIP));
+        return false;
+    }
+
+    SC_LOGD("Successfully set CID_ROTATE(%d), CID_VFLIP(%d) and CID_HFLIP(%d)",
+            m_nRotDegree, TestFlag(m_fStatus, SCF_VFLIP), TestFlag(m_fStatus, SCF_HFLIP));
+
+    ClearFlag(m_fStatus, SCF_ROTATION_FRESH);
+
+    if (TestFlag(m_fStatus, SCF_CSC_FRESH) && TestFlag(m_fStatus, SCF_CSC_WIDE)) {
+        if (exynos_v4l2_s_ctrl(m_fdScaler, V4L2_CID_CSC_RANGE,
+                            TestFlag(m_fStatus, SCF_CSC_WIDE) ? 1 : 0) < 0) {
+            SC_LOGERR("Failed V4L2_CID_CSC_RANGE to %d", TestFlag(m_fStatus, SCF_CSC_WIDE));
+            return false;
+        }
+
+        ClearFlag(m_fStatus, SCF_CSC_FRESH);
+    }
+
+    return true;
+}
+
+bool CScalerV4L2::ResetDevice(FrameInfo &frm)
+{
+    if (!DQBuf(frm))
+        return false;
+
+    if (TestFlag(frm.flags, SCFF_STREAMING)) {
+        if (exynos_v4l2_streamoff(m_fdScaler, frm.type) < 0 ) {
+            SC_LOGERR("Failed STREAMOFF for the %s", frm.name);
+            return false;
+        }
+        ClearFlag(frm.flags, SCFF_STREAMING);
+    }
+
+    SC_LOGD("VIDIC_STREAMOFF is successful for the %s", frm.name);
+
+    if (TestFlag(frm.flags, SCFF_REQBUFS)) {
+        v4l2_requestbuffers reqbufs;
+        memset(&reqbufs, 0, sizeof(reqbufs));
+        reqbufs.type = frm.type;
+        reqbufs.memory = frm.memory;
+        if (exynos_v4l2_reqbufs(m_fdScaler, &reqbufs) < 0 ) {
+            SC_LOGERR("Failed to REQBUFS(0) for the %s", frm.name);
+            return false;
+        }
+
+        ClearFlag(frm.flags, SCFF_REQBUFS);
+    }
+
+    SC_LOGD("VIDIC_REQBUFS(0) is successful for the %s", frm.name);
+
+    return true;
+}
+
+bool CScalerV4L2::DevSetFormat(FrameInfo &frm)
+{
+
+    if (!TestFlag(frm.flags, SCFF_BUF_FRESH)) {
+        SC_LOGD("Skipping S_FMT for the %s since it is already done", frm.name);
+        return true;
+    }
+
+    if (!ResetDevice(frm)) {
+        SC_LOGE("Failed to VIDIOC_S_FMT for the %s", frm.name);
+        return false;
+    }
+
+    v4l2_format fmt;
+    fmt.type = frm.type;
+    fmt.fmt.pix_mp.pixelformat = frm.color_format;
+    fmt.fmt.pix_mp.width  = frm.width;
+    fmt.fmt.pix_mp.height = frm.height;
+
+    if (exynos_v4l2_s_fmt(m_fdScaler, &fmt) < 0) {
+        SC_LOGERR("Failed S_FMT(fmt: %d, w:%d, h:%d) for the %s",
+                fmt.fmt.pix_mp.pixelformat, fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
+                frm.name);
+        return false;
+    }
+
+    // returned fmt.fmt.pix_mp.num_planes and fmt.fmt.pix_mp.plane_fmt[i].sizeimage
+    frm.out_num_planes = fmt.fmt.pix_mp.num_planes;
+
+    for (int i = 0; i < frm.out_num_planes; i++)
+        frm.out_plane_size[i] = fmt.fmt.pix_mp.plane_fmt[i].sizeimage;
+
+    v4l2_crop crop;
+    crop.type = frm.type;
+    crop.c = frm.crop;
+
+    if (exynos_v4l2_s_crop(m_fdScaler, &crop) < 0) {
+        SC_LOGERR("Failed S_CROP(fmt: %d, l:%d, t:%d, w:%d, h:%d) for the %s",
+                crop.type, crop.c.left, crop.c.top, crop.c.width, crop.c.height,
+                frm.name);
+        return false;
+    }
+
+    if (frm.out_num_planes > SC_MAX_PLANES) {
+        SC_LOGE("Number of planes exceeds %d of %s", frm.out_num_planes, frm.name);
+        return false;
+    }
+
+    ClearFlag(frm.flags, SCFF_BUF_FRESH);
+
+    SC_LOGD("Successfully S_FMT and S_CROP for the %s", frm.name);
+
+    return true;
+}
+
+bool CScalerV4L2::DevSetFormat()
+{
+    if (!DevSetFormat(m_frmSrc))
+        return false;
+
+    return DevSetFormat(m_frmDst);
+}
+
+bool CScalerV4L2::QBuf(FrameInfo &frm, int *pfdReleaseFence)
+{
+    v4l2_buffer buffer;
+    v4l2_plane planes[SC_MAX_PLANES];
+
+    if (!TestFlag(frm.flags, SCFF_REQBUFS)) {
+        SC_LOGE("Trying to QBUF without REQBUFS for %s is not allowed",
+                frm.name);
+        return false;
+    }
+
+    if (!DQBuf(frm))
+        return false;
+
+    memset(&buffer, 0, sizeof(buffer));
+    memset(&planes, 0, sizeof(planes));
+
+    buffer.type   = frm.type;
+    buffer.memory = frm.memory;
+    buffer.index  = 0;
+    buffer.length = frm.out_num_planes;
+
+    if (pfdReleaseFence) {
+        buffer.flags    = V4L2_BUF_FLAG_USE_SYNC;
+        buffer.reserved = frm.fdAcquireFence;
+    }
+
+    buffer.m.planes = planes;
+    for (unsigned long i = 0; i < buffer.length; i++) {
+        planes[i].length = frm.out_plane_size[i];
+        if (V4L2_TYPE_IS_OUTPUT(buffer.type))
+            planes[i].bytesused = planes[i].length;
+        if (buffer.memory == V4L2_MEMORY_DMABUF)
+            planes[i].m.fd = reinterpret_cast<int>(frm.addr[i]);
+        else
+            planes[i].m.userptr = reinterpret_cast<unsigned long>(frm.addr[i]);
+    }
+
+
+    if (exynos_v4l2_qbuf(m_fdScaler, &buffer) < 0) {
+        SC_LOGERR("Failed to QBUF for the %s", frm.name);
+        return false;
+    }
+
+    SetFlag(frm.flags, SCFF_QBUF);
+
+    if (pfdReleaseFence) {
+        if (frm.fdAcquireFence >= 0)
+            close(frm.fdAcquireFence);
+        frm.fdAcquireFence = -1;
+
+        *pfdReleaseFence = static_cast<int>(buffer.reserved);
+    }
+
+    SC_LOGD("Successfully QBUF for the %s", frm.name);
+
+    return true;
+}
+
+bool CScalerV4L2::ReqBufs(FrameInfo &frm)
+{
+    v4l2_requestbuffers reqbufs;
+
+    if (TestFlag(frm.flags, SCFF_REQBUFS)) {
+        SC_LOGD("Skipping REQBUFS for the %s since it is already done", frm.name);
+        return true;
+    }
+
+    memset(&reqbufs, 0, sizeof(reqbufs));
+
+    reqbufs.type    = frm.type;
+    reqbufs.memory  = frm.memory;
+    reqbufs.count   = 1;
+
+    if (exynos_v4l2_reqbufs(m_fdScaler, &reqbufs) < 0) {
+        SC_LOGERR("Failed to REQBUFS for the %s", frm.name);
+        return false;
+    }
+
+    SetFlag(frm.flags, SCFF_REQBUFS);
+
+    SC_LOGD("Successfully REQBUFS for the %s", frm.name);
+
+    return true;
+}
+
+bool CScalerV4L2::SetRotate(int rot, int flip_h, int flip_v)
+{
+    if ((rot % 90) != 0) {
+        SC_LOGE("Rotation of %d degree is not supported", rot);
+        return false;
+    }
+
+    SetRotDegree(rot);
+
+    if (flip_h)
+        SetFlag(m_fStatus, SCF_VFLIP);
+    else
+        ClearFlag(m_fStatus, SCF_VFLIP);
+
+    if (flip_v)
+        SetFlag(m_fStatus, SCF_HFLIP);
+    else
+        ClearFlag(m_fStatus, SCF_HFLIP);
+
+    SetFlag(m_fStatus, SCF_ROTATION_FRESH);
+
+    return true;
+}
+
+bool CScalerV4L2::StreamOn(FrameInfo &frm)
+{
+    if (!TestFlag(frm.flags, SCFF_REQBUFS)) {
+        SC_LOGE("Trying to STREAMON without REQBUFS for %s is not allowed",
+                frm.name);
+        return false;
+    }
+
+    if (!TestFlag(frm.flags, SCFF_STREAMING)) {
+        if (exynos_v4l2_streamon(m_fdScaler, frm.type) < 0 ) {
+            SC_LOGERR("Failed StreamOn for the %s", frm.name);
+            return false;
+        }
+
+        SetFlag(frm.flags, SCFF_STREAMING);
+
+        SC_LOGD("Successfully VIDIOC_STREAMON for the %s", frm.name);
+    }
+
+    return true;
+}
+
+bool CScalerV4L2::DQBuf(FrameInfo &frm)
+{
+    if (!TestFlag(frm.flags, SCFF_QBUF))
+        return true;
+
+    v4l2_buffer buffer;
+    v4l2_plane plane[SC_NUM_OF_PLANES];
+
+    memset(&buffer, 0, sizeof(buffer));
+
+    buffer.type = frm.type;
+    buffer.memory = frm.memory;
+
+    if (V4L2_TYPE_IS_MULTIPLANAR(buffer.type)) {
+        memset(plane, 0, sizeof(plane));
+
+        buffer.length = frm.out_num_planes;
+        buffer.m.planes = plane;
+    }
+
+    ClearFlag(frm.flags, SCFF_QBUF);
+
+    if (exynos_v4l2_dqbuf(m_fdScaler, &buffer) < 0 ) {
+        SC_LOGERR("Failed to DQBuf the %s", frm.name);
+        return false;
+    }
+
+    if (buffer.flags & V4L2_BUF_FLAG_ERROR) {
+        SC_LOGE("Error occurred while processing streaming data");
+        return false;
+    }
+
+    SC_LOGD("Successfully VIDIOC_DQBUF for the %s", frm.name);
+
+    return true;
+}
diff --git a/original-kernel-headers/linux/fimc-is-metadata.h b/original-kernel-headers/linux/fimc-is-metadata.h
new file mode 100644 (file)
index 0000000..769c044
--- /dev/null
@@ -0,0 +1,804 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef FIMC_IS_METADATA_H_
+#define FIMC_IS_METADATA_H_
+struct rational {
+ uint32_t num;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t den;
+};
+#define CAMERA2_MAX_AVAILABLE_MODE 21
+#define CAMERA2_MAX_FACES 16
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAMERA2_FACE_DETECTION_THRESHOLD 35
+enum metadata_mode {
+ METADATA_MODE_NONE,
+ METADATA_MODE_FULL
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_request_ctl {
+ uint32_t id;
+ enum metadata_mode metadataMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint8_t outputStreams[16];
+ uint32_t frameCount;
+};
+struct camera2_request_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t id;
+ enum metadata_mode metadataMode;
+ uint32_t frameCount;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum optical_stabilization_mode {
+ OPTICAL_STABILIZATION_MODE_OFF,
+ OPTICAL_STABILIZATION_MODE_ON
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum lens_facing {
+ LENS_FACING_BACK,
+ LENS_FACING_FRONT
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_lens_ctl {
+ uint32_t focusDistance;
+ float aperture;
+ float focalLength;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ float filterDensity;
+ enum optical_stabilization_mode opticalStabilizationMode;
+};
+struct camera2_lens_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t focusDistance;
+ float aperture;
+ float focalLength;
+ float filterDensity;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum optical_stabilization_mode opticalStabilizationMode;
+ float focusRange[2];
+};
+struct camera2_lens_sm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ float minimumFocusDistance;
+ float hyperfocalDistance;
+ float availableFocalLength[2];
+ float availableApertures;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ float availableFilterDensities;
+ enum optical_stabilization_mode availableOpticalStabilization;
+ uint32_t shadingMapSize;
+ float shadingMap[3][40][30];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t geometricCorrectionMapSize;
+ float geometricCorrectionMap[2][3][40][30];
+ enum lens_facing facing;
+ float position[2];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum sensor_colorfilterarrangement {
+ SENSOR_COLORFILTERARRANGEMENT_RGGB,
+ SENSOR_COLORFILTERARRANGEMENT_GRBG,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SENSOR_COLORFILTERARRANGEMENT_GBRG,
+ SENSOR_COLORFILTERARRANGEMENT_BGGR,
+ SENSOR_COLORFILTERARRANGEMENT_RGB
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum sensor_ref_illuminant {
+ SENSOR_ILLUMINANT_DAYLIGHT = 1,
+ SENSOR_ILLUMINANT_FLUORESCENT = 2,
+ SENSOR_ILLUMINANT_TUNGSTEN = 3,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SENSOR_ILLUMINANT_FLASH = 4,
+ SENSOR_ILLUMINANT_FINE_WEATHER = 9,
+ SENSOR_ILLUMINANT_CLOUDY_WEATHER = 10,
+ SENSOR_ILLUMINANT_SHADE = 11,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SENSOR_ILLUMINANT_DAYLIGHT_FLUORESCENT = 12,
+ SENSOR_ILLUMINANT_DAY_WHITE_FLUORESCENT = 13,
+ SENSOR_ILLUMINANT_COOL_WHITE_FLUORESCENT = 14,
+ SENSOR_ILLUMINANT_WHITE_FLUORESCENT = 15,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SENSOR_ILLUMINANT_STANDARD_A = 17,
+ SENSOR_ILLUMINANT_STANDARD_B = 18,
+ SENSOR_ILLUMINANT_STANDARD_C = 19,
+ SENSOR_ILLUMINANT_D55 = 20,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SENSOR_ILLUMINANT_D65 = 21,
+ SENSOR_ILLUMINANT_D75 = 22,
+ SENSOR_ILLUMINANT_D50 = 23,
+ SENSOR_ILLUMINANT_ISO_STUDIO_TUNGSTEN = 24
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_sensor_ctl {
+ uint64_t exposureTime;
+ uint64_t frameDuration;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t sensitivity;
+};
+struct camera2_sensor_dm {
+ uint64_t exposureTime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint64_t frameDuration;
+ uint32_t sensitivity;
+ uint64_t timeStamp;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_sensor_sm {
+ uint32_t exposureTimeRange[2];
+ uint32_t maxFrameDuration;
+ uint32_t availableSensitivities[10];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum sensor_colorfilterarrangement colorFilterArrangement;
+ float physicalSize[2];
+ uint32_t pixelArraySize[2];
+ uint32_t activeArraySize[4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t whiteLevel;
+ uint32_t blackLevelPattern[4];
+ struct rational colorTransform1[9];
+ struct rational colorTransform2[9];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum sensor_ref_illuminant referenceIlluminant1;
+ enum sensor_ref_illuminant referenceIlluminant2;
+ struct rational forwardMatrix1[9];
+ struct rational forwardMatrix2[9];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct rational calibrationTransform1[9];
+ struct rational calibrationTransform2[9];
+ struct rational baseGainFactor;
+ uint32_t maxAnalogSensitivity;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ float noiseModelCoefficients[2];
+ uint32_t orientation;
+};
+enum flash_mode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CAM2_FLASH_MODE_NOP = 0,
+ CAM2_FLASH_MODE_OFF = 1,
+ CAM2_FLASH_MODE_SINGLE,
+ CAM2_FLASH_MODE_TORCH,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CAM2_FLASH_MODE_BEST
+};
+struct camera2_flash_ctl {
+ enum flash_mode flashMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t firingPower;
+ uint64_t firingTime;
+};
+struct camera2_flash_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum flash_mode flashMode;
+ uint32_t firingPower;
+ uint64_t firingTime;
+ uint32_t firingStable;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t decision;
+};
+struct camera2_flash_sm {
+ uint32_t available;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint64_t chargeDuration;
+};
+enum processing_mode {
+ PROCESSING_MODE_OFF = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ PROCESSING_MODE_FAST,
+ PROCESSING_MODE_HIGH_QUALITY
+};
+struct camera2_hotpixel_ctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum processing_mode mode;
+};
+struct camera2_hotpixel_dm {
+ enum processing_mode mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_demosaic_ctl {
+ enum processing_mode mode;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_demosaic_dm {
+ enum processing_mode mode;
+};
+struct camera2_noisereduction_ctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum processing_mode mode;
+ uint32_t strength;
+};
+struct camera2_noisereduction_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum processing_mode mode;
+ uint32_t strength;
+};
+struct camera2_shading_ctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum processing_mode mode;
+};
+struct camera2_shading_dm {
+ enum processing_mode mode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_geometric_ctl {
+ enum processing_mode mode;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_geometric_dm {
+ enum processing_mode mode;
+};
+enum colorcorrection_mode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ COLORCORRECTION_MODE_FAST = 1,
+ COLORCORRECTION_MODE_HIGH_QUALITY,
+ COLORCORRECTION_MODE_TRANSFORM_MATRIX,
+ COLORCORRECTION_MODE_EFFECT_MONO,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ COLORCORRECTION_MODE_EFFECT_NEGATIVE,
+ COLORCORRECTION_MODE_EFFECT_SOLARIZE,
+ COLORCORRECTION_MODE_EFFECT_SEPIA,
+ COLORCORRECTION_MODE_EFFECT_POSTERIZE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ COLORCORRECTION_MODE_EFFECT_WHITEBOARD,
+ COLORCORRECTION_MODE_EFFECT_BLACKBOARD,
+ COLORCORRECTION_MODE_EFFECT_AQUA
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_colorcorrection_ctl {
+ enum colorcorrection_mode mode;
+ float transform[9];
+ uint32_t hue;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t saturation;
+ uint32_t brightness;
+};
+struct camera2_colorcorrection_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum colorcorrection_mode mode;
+ float transform[9];
+ uint32_t hue;
+ uint32_t saturation;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t brightness;
+};
+struct camera2_colorcorrection_sm {
+ uint8_t availableModes[CAMERA2_MAX_AVAILABLE_MODE];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t hueRange[2];
+ uint32_t saturationRange[2];
+ uint32_t brightnessRange[2];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum tonemap_mode {
+ TONEMAP_MODE_FAST = 1,
+ TONEMAP_MODE_HIGH_QUALITY,
+ TONEMAP_MODE_CONTRAST_CURVE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_tonemap_ctl {
+ enum tonemap_mode mode;
+ float curveRed[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ float curveGreen[64];
+ float curveBlue[64];
+};
+struct camera2_tonemap_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum tonemap_mode mode;
+ float curveRed[64];
+ float curveGreen[64];
+ float curveBlue[64];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_tonemap_sm {
+ uint32_t maxCurvePoints;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_edge_ctl {
+ enum processing_mode mode;
+ uint32_t strength;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_edge_dm {
+ enum processing_mode mode;
+ uint32_t strength;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum scaler_availableformats {
+ SCALER_FORMAT_BAYER_RAW,
+ SCALER_FORMAT_YV12,
+ SCALER_FORMAT_NV21,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ SCALER_FORMAT_JPEG,
+ SCALER_FORMAT_UNKNOWN
+};
+struct camera2_scaler_ctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t cropRegion[3];
+};
+struct camera2_scaler_dm {
+ uint32_t cropRegion[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_scaler_sm {
+ enum scaler_availableformats availableFormats[4];
+ uint32_t availableRawSizes;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint64_t availableRawMinDurations;
+ uint32_t availableProcessedSizes[8];
+ uint64_t availableProcessedMinDurations[8];
+ uint32_t availableJpegSizes[8][2];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint64_t availableJpegMinDurations[8];
+ uint32_t availableMaxDigitalZoom[8];
+};
+struct camera2_jpeg_ctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t quality;
+ uint32_t thumbnailSize[2];
+ uint32_t thumbnailQuality;
+ double gpsCoordinates[3];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t gpsProcessingMethod;
+ uint64_t gpsTimestamp;
+ uint32_t orientation;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_jpeg_dm {
+ uint32_t quality;
+ uint32_t thumbnailSize[2];
+ uint32_t thumbnailQuality;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ double gpsCoordinates[3];
+ uint32_t gpsProcessingMethod;
+ uint64_t gpsTimestamp;
+ uint32_t orientation;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_jpeg_sm {
+ uint32_t availableThumbnailSizes[8][2];
+ uint32_t maxSize;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum facedetect_mode {
+ FACEDETECT_MODE_OFF = 1,
+ FACEDETECT_MODE_SIMPLE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ FACEDETECT_MODE_FULL
+};
+enum stats_mode {
+ STATS_MODE_OFF = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ STATS_MODE_ON
+};
+struct camera2_stats_ctl {
+ enum facedetect_mode faceDetectMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum stats_mode histogramMode;
+ enum stats_mode sharpnessMapMode;
+};
+struct camera2_stats_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum facedetect_mode faceDetectMode;
+ uint32_t faceRectangles[CAMERA2_MAX_FACES][4];
+ uint8_t faceScores[CAMERA2_MAX_FACES];
+ uint32_t faceLandmarks[CAMERA2_MAX_FACES][6];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t faceIds[CAMERA2_MAX_FACES];
+ enum stats_mode histogramMode;
+ uint32_t histogram[3 * 256];
+ enum stats_mode sharpnessMapMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_stats_sm {
+ uint8_t availableFaceDetectModes[CAMERA2_MAX_AVAILABLE_MODE];
+ uint32_t maxFaceCount;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t histogramBucketCount;
+ uint32_t maxHistogramCount;
+ uint32_t sharpnessMapSize[2];
+ uint32_t maxSharpnessMapValue;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum aa_capture_intent {
+ AA_CAPTURE_INTENT_CUSTOM = 0,
+ AA_CAPTURE_INTENT_PREVIEW,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_CAPTURE_INTENT_STILL_CAPTURE,
+ AA_CAPTURE_INTENT_VIDEO_RECORD,
+ AA_CAPTURE_INTENT_VIDEO_SNAPSHOT,
+ AA_CAPTURE_INTENT_ZERO_SHUTTER_LAG
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum aa_mode {
+ AA_CONTROL_NONE = 0,
+ AA_CONTROL_OFF,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_CONTROL_AUTO,
+ AA_CONTROL_USE_SCENE_MODE
+};
+enum aa_scene_mode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_SCENE_MODE_UNSUPPORTED = 1,
+ AA_SCENE_MODE_FACE_PRIORITY,
+ AA_SCENE_MODE_ACTION,
+ AA_SCENE_MODE_PORTRAIT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_SCENE_MODE_LANDSCAPE,
+ AA_SCENE_MODE_NIGHT,
+ AA_SCENE_MODE_NIGHT_PORTRAIT,
+ AA_SCENE_MODE_THEATRE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_SCENE_MODE_BEACH,
+ AA_SCENE_MODE_SNOW,
+ AA_SCENE_MODE_SUNSET,
+ AA_SCENE_MODE_STEADYPHOTO,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_SCENE_MODE_FIREWORKS,
+ AA_SCENE_MODE_SPORTS,
+ AA_SCENE_MODE_PARTY,
+ AA_SCENE_MODE_CANDLELIGHT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_SCENE_MODE_BARCODE,
+ AA_SCENE_MODE_NIGHT_CAPTURE,
+ AA_SCENE_MODE_MAX
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum aa_effect_mode {
+ AA_EFFECT_OFF = 1,
+ AA_EFFECT_MONO,
+ AA_EFFECT_NEGATIVE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_EFFECT_SOLARIZE,
+ AA_EFFECT_SEPIA,
+ AA_EFFECT_POSTERIZE,
+ AA_EFFECT_WHITEBOARD,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_EFFECT_BLACKBOARD,
+ AA_EFFECT_AQUA
+};
+enum aa_aemode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AEMODE_OFF = 1,
+ AA_AEMODE_LOCKED,
+ AA_AEMODE_ON,
+ AA_AEMODE_ON_AUTO_FLASH,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AEMODE_ON_ALWAYS_FLASH,
+ AA_AEMODE_ON_AUTO_FLASH_REDEYE
+};
+enum aa_ae_flashmode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_FLASHMODE_NOP = 0,
+ AA_FLASHMODE_OFF = 1,
+ AA_FLASHMODE_ON,
+ AA_FLASHMODE_AUTO,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_FLASHMODE_CAPTURE,
+ AA_FLASHMODE_ON_ALWAYS
+};
+enum aa_ae_antibanding_mode {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AE_ANTIBANDING_OFF = 1,
+ AA_AE_ANTIBANDING_50HZ,
+ AA_AE_ANTIBANDING_60HZ,
+ AA_AE_ANTIBANDING_AUTO
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum aa_awbmode {
+ AA_AWBMODE_OFF = 1,
+ AA_AWBMODE_LOCKED,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AWBMODE_WB_AUTO,
+ AA_AWBMODE_WB_INCANDESCENT,
+ AA_AWBMODE_WB_FLUORESCENT,
+ AA_AWBMODE_WB_WARM_FLUORESCENT,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AWBMODE_WB_DAYLIGHT,
+ AA_AWBMODE_WB_CLOUDY_DAYLIGHT,
+ AA_AWBMODE_WB_TWILIGHT,
+ AA_AWBMODE_WB_SHADE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum aa_afmode {
+ NO_CHANGE = 0,
+ AA_AFMODE_OFF = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AFMODE_AUTO,
+ AA_AFMODE_MACRO,
+ AA_AFMODE_CONTINUOUS_VIDEO,
+ AA_AFMODE_CONTINUOUS_PICTURE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AFMODE_INFINITY,
+ AA_AFMODE_AUTO_FACE,
+ AA_AFMODE_CONTINUOUS_VIDEO_FACE,
+ AA_AFMODE_CONTINUOUS_PICTURE_FACE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AFMODE_MANUAL,
+ AA_AFMODE_EDOF
+};
+enum aa_afstate {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AFSTATE_INACTIVE = 1,
+ AA_AFSTATE_PASSIVE_SCAN,
+ AA_AFSTATE_ACTIVE_SCAN,
+ AA_AFSTATE_AF_ACQUIRED_FOCUS,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AA_AFSTATE_AF_FAILED_FOCUS
+};
+enum ae_state {
+ AE_STATE_INACTIVE = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AE_STATE_SEARCHING,
+ AE_STATE_CONVERGED,
+ AE_STATE_LOCKED,
+ AE_STATE_FLASH_REQUIRED,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AE_STATE_PRECAPTURE
+};
+enum awb_state {
+ AWB_STATE_INACTIVE = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ AWB_STATE_SEARCHING,
+ AWB_STATE_CONVERGED,
+ AWB_STATE_LOCKED
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum aa_isomode {
+ AA_ISOMODE_AUTO = 1,
+ AA_ISOMODE_MANUAL,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum ae_lockmode {
+ AEMODE_LOCK_OFF = 0,
+ AEMODE_LOCK_ON,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum awb_lockmode {
+ AWBMODE_LOCK_OFF = 0,
+ AWBMODE_LOCK_ON,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_aa_ctl {
+ enum aa_capture_intent captureIntent;
+ enum aa_mode mode;
+ enum aa_scene_mode sceneMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t videoStabilizationMode;
+ enum aa_aemode aeMode;
+ uint32_t aeRegions[5];
+ int32_t aeExpCompensation;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t aeTargetFpsRange[2];
+ enum aa_ae_antibanding_mode aeAntibandingMode;
+ enum aa_ae_flashmode aeflashMode;
+ enum aa_awbmode awbMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t awbRegions[5];
+ enum aa_afmode afMode;
+ uint32_t afRegions[5];
+ uint32_t afTrigger;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum aa_isomode isoMode;
+ uint32_t isoValue;
+};
+struct camera2_aa_dm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum aa_mode mode;
+ enum aa_effect_mode effectMode;
+ enum aa_scene_mode sceneMode;
+ uint32_t videoStabilizationMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum aa_aemode aeMode;
+ uint32_t aeRegions[5];
+ enum ae_state aeState;
+ enum aa_ae_flashmode aeflashMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum aa_awbmode awbMode;
+ uint32_t awbRegions[5];
+ enum awb_state awbState;
+ enum aa_afmode afMode;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t afRegions[5];
+ enum aa_afstate afState;
+ enum aa_isomode isoMode;
+ uint32_t isoValue;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_aa_sm {
+ uint8_t availableSceneModes[CAMERA2_MAX_AVAILABLE_MODE];
+ uint8_t availableEffects[CAMERA2_MAX_AVAILABLE_MODE];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t maxRegions;
+ uint8_t aeAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
+ struct rational aeCompensationStep;
+ int32_t aeCompensationRange[2];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t aeAvailableTargetFpsRanges[CAMERA2_MAX_AVAILABLE_MODE][2];
+ uint8_t aeAvailableAntibandingModes[CAMERA2_MAX_AVAILABLE_MODE];
+ uint8_t awbAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
+ uint8_t afAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint8_t availableVideoStabilizationModes[4];
+ uint32_t isoRange[2];
+};
+struct camera2_lens_usm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t focusDistanceFrameDelay;
+};
+struct camera2_sensor_usm {
+ uint32_t exposureTimeFrameDelay;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t frameDurationFrameDelay;
+ uint32_t sensitivityFrameDelay;
+};
+struct camera2_flash_usm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t flashModeFrameDelay;
+ uint32_t firingPowerFrameDelay;
+ uint64_t firingTimeFrameDelay;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_ctl {
+ struct camera2_request_ctl request;
+ struct camera2_lens_ctl lens;
+ struct camera2_sensor_ctl sensor;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_flash_ctl flash;
+ struct camera2_hotpixel_ctl hotpixel;
+ struct camera2_demosaic_ctl demosaic;
+ struct camera2_noisereduction_ctl noise;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_shading_ctl shading;
+ struct camera2_geometric_ctl geometric;
+ struct camera2_colorcorrection_ctl color;
+ struct camera2_tonemap_ctl tonemap;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_edge_ctl edge;
+ struct camera2_scaler_ctl scaler;
+ struct camera2_jpeg_ctl jpeg;
+ struct camera2_stats_ctl stats;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_aa_ctl aa;
+};
+struct camera2_dm {
+ struct camera2_request_dm request;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_lens_dm lens;
+ struct camera2_sensor_dm sensor;
+ struct camera2_flash_dm flash;
+ struct camera2_hotpixel_dm hotpixel;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_demosaic_dm demosaic;
+ struct camera2_noisereduction_dm noise;
+ struct camera2_shading_dm shading;
+ struct camera2_geometric_dm geometric;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_colorcorrection_dm color;
+ struct camera2_tonemap_dm tonemap;
+ struct camera2_edge_dm edge;
+ struct camera2_scaler_dm scaler;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_jpeg_dm jpeg;
+ struct camera2_stats_dm stats;
+ struct camera2_aa_dm aa;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_sm {
+ struct camera2_lens_sm lens;
+ struct camera2_sensor_sm sensor;
+ struct camera2_flash_sm flash;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_colorcorrection_sm color;
+ struct camera2_tonemap_sm tonemap;
+ struct camera2_scaler_sm scaler;
+ struct camera2_jpeg_sm jpeg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_stats_sm stats;
+ struct camera2_aa_sm aa;
+ struct camera2_lens_usm lensUd;
+ struct camera2_sensor_usm sensorUd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_flash_usm flashUd;
+};
+struct camera2_lens_uctl {
+ struct camera2_lens_ctl ctl;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t maxPos;
+ uint32_t slewRate;
+};
+struct camera2_lens_udm {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t maxPos;
+ uint32_t slewRate;
+};
+struct camera2_sensor_uctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_sensor_ctl ctl;
+ uint64_t dynamicFrameDuration;
+};
+struct camera2_scaler_uctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t sccTargetAddress[4];
+ uint32_t scpTargetAddress[4];
+};
+struct camera2_flash_uctl {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_flash_ctl ctl;
+};
+struct camera2_uctl {
+ uint32_t uUpdateBitMap;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t uFrameNumber;
+ struct camera2_lens_uctl lensUd;
+ struct camera2_sensor_uctl sensorUd;
+ struct camera2_flash_uctl flashUd;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_scaler_uctl scalerUd;
+};
+struct camera2_udm {
+ struct camera2_lens_udm lens;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct camera2_shot {
+ struct camera2_ctl ctl;
+ struct camera2_dm dm;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct camera2_uctl uctl;
+ struct camera2_udm udm;
+ uint32_t magicNumber;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct camera2_shot_ext {
+ uint32_t setfile;
+ uint32_t request_sensor;
+ uint32_t request_scc;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t request_scp;
+ uint32_t drc_bypass;
+ uint32_t dis_bypass;
+ uint32_t dnr_bypass;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t fd_bypass;
+ uint32_t reserved[20];
+ uint32_t timeZone[10][2];
+ struct camera2_shot shot;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint8_t gpsProcessingMethod[32];
+ uint8_t isReprocessing;
+ uint8_t reprocessInput;
+ enum ae_lockmode ae_lock;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ enum awb_lockmode awb_lock;
+ enum aa_awbmode awb_mode_dm;
+};
+struct camera2_stream {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ uint32_t address;
+ uint32_t fcount;
+ uint32_t rcount;
+ uint32_t findex;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define CAM_LENS_CMD (0x1 << 0x0)
+#define CAM_SENSOR_CMD (0x1 << 0x1)
+#define CAM_FLASH_CMD (0x1 << 0x2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/original-kernel-headers/linux/media.h b/original-kernel-headers/linux/media.h
new file mode 100644 (file)
index 0000000..e13771d
--- /dev/null
@@ -0,0 +1,125 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_MEDIA_H
+#define __LINUX_MEDIA_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <linux/version.h>
+#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
+struct media_device_info {
+ char driver[16];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char model[32];
+ char serial[40];
+ char bus_info[32];
+ __u32 media_version;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 hw_revision;
+ __u32 driver_version;
+ __u32 reserved[31];
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
+#define MEDIA_ENT_TYPE_SHIFT 16
+#define MEDIA_ENT_TYPE_MASK 0x00ff0000
+#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
+#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
+#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
+#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
+#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
+#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
+#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
+#define MEDIA_ENT_FL_DEFAULT (1 << 0)
+struct media_entity_desc {
+ __u32 id;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ char name[32];
+ __u32 type;
+ __u32 revision;
+ __u32 flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 group_id;
+ __u16 pads;
+ __u16 links;
+ __u32 reserved[4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ struct {
+ __u32 major;
+ __u32 minor;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } v4l;
+ struct {
+ __u32 major;
+ __u32 minor;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } fb;
+ struct {
+ __u32 card;
+ __u32 device;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 subdevice;
+ } alsa;
+ int dvb;
+ __u8 raw[184];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ };
+};
+#define MEDIA_PAD_FL_SINK (1 << 0)
+#define MEDIA_PAD_FL_SOURCE (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct media_pad_desc {
+ __u32 entity;
+ __u16 index;
+ __u32 flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 reserved[2];
+};
+#define MEDIA_LNK_FL_ENABLED (1 << 0)
+#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
+struct media_link_desc {
+ struct media_pad_desc source;
+ struct media_pad_desc sink;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 flags;
+ __u32 reserved[2];
+};
+struct media_links_enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 entity;
+ struct media_pad_desc __user *pads;
+ struct media_link_desc __user *links;
+ __u32 reserved[4];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
+#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
+#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
+#endif
diff --git a/original-kernel-headers/linux/v4l2-mediabus.h b/original-kernel-headers/linux/v4l2-mediabus.h
new file mode 100644 (file)
index 0000000..2749ee5
--- /dev/null
@@ -0,0 +1,100 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_V4L2_MEDIABUS_H
+#define __LINUX_V4L2_MEDIABUS_H
+#include <linux/types.h>
+#include <linux/videodev2.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum v4l2_mbus_pixelcode {
+ V4L2_MBUS_FMT_FIXED = 0x0001,
+ V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
+ V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
+ V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
+ V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
+ V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
+ V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
+ V4L2_MBUS_FMT_XRGB8888_4X8_LE = 0x1009,
+ V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
+ V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
+ V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
+ V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
+ V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
+ V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
+ V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
+ V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
+ V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
+ V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
+ V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
+ V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
+ V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_YUV8_1X24 = 0x2014,
+ V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
+ V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
+ V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
+ V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
+ V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
+ V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
+ V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
+ V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
+ V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
+ V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
+ V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
+ V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
+ V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
+ V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
+ V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
+ V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
+ V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
+ V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct v4l2_mbus_framefmt {
+ __u32 width;
+ __u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 code;
+ __u32 field;
+ __u32 colorspace;
+ __u32 reserved[7];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#endif
diff --git a/original-kernel-headers/linux/v4l2-subdev.h b/original-kernel-headers/linux/v4l2-subdev.h
new file mode 100644 (file)
index 0000000..5708b8f
--- /dev/null
@@ -0,0 +1,94 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_V4L2_SUBDEV_H
+#define __LINUX_V4L2_SUBDEV_H
+#include <linux/ioctl.h>
+#include <linux/types.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include "v4l2-mediabus.h"
+enum v4l2_subdev_format_whence {
+ V4L2_SUBDEV_FORMAT_TRY = 0,
+ V4L2_SUBDEV_FORMAT_ACTIVE = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct v4l2_subdev_format {
+ __u32 which;
+ __u32 pad;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct v4l2_mbus_framefmt format;
+ __u32 reserved[8];
+};
+struct v4l2_subdev_crop {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 which;
+ __u32 pad;
+ struct v4l2_rect rect;
+ __u32 reserved[8];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct v4l2_subdev_mbus_code_enum {
+ __u32 pad;
+ __u32 index;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 code;
+ __u32 reserved[9];
+};
+struct v4l2_subdev_frame_size_enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 index;
+ __u32 pad;
+ __u32 code;
+ __u32 min_width;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 max_width;
+ __u32 min_height;
+ __u32 max_height;
+ __u32 reserved[9];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct v4l2_subdev_frame_interval {
+ __u32 pad;
+ struct v4l2_fract interval;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 reserved[9];
+};
+struct v4l2_subdev_frame_interval_enum {
+ __u32 index;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 pad;
+ __u32 code;
+ __u32 width;
+ __u32 height;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct v4l2_fract interval;
+ __u32 reserved[9];
+};
+#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
+#define VIDIOC_SUBDEV_G_FRAME_INTERVAL   _IOWR('V', 21, struct v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_S_FRAME_INTERVAL   _IOWR('V', 22, struct v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_ENUM_MBUS_CODE   _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE   _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL   _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
+#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
+#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/original-kernel-headers/linux/videodev2_exynos_media.h b/original-kernel-headers/linux/videodev2_exynos_media.h
new file mode 100644 (file)
index 0000000..4b6fffe
--- /dev/null
@@ -0,0 +1,189 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __LINUX_VIDEODEV2_EXYNOS_MEDIA_H
+#define __LINUX_VIDEODEV2_EXYNOS_MEDIA_H
+#define V4L2_PIX_FMT_YUV444_2P v4l2_fourcc('Y', 'U', '2', 'P')
+#define V4L2_PIX_FMT_YVU444_2P v4l2_fourcc('Y', 'V', '2', 'P')
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_PIX_FMT_YUV444_3P v4l2_fourcc('Y', 'U', '3', 'P')
+#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')
+#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2')
+#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'V', 'U', 'M')
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4')
+#define V4L2_PIX_FMT_FIMV v4l2_fourcc('F', 'I', 'M', 'V')
+#define V4L2_PIX_FMT_FIMV1 v4l2_fourcc('F', 'I', 'M', '1')
+#define V4L2_PIX_FMT_FIMV2 v4l2_fourcc('F', 'I', 'M', '2')
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_PIX_FMT_FIMV3 v4l2_fourcc('F', 'I', 'M', '3')
+#define V4L2_PIX_FMT_FIMV4 v4l2_fourcc('F', 'I', 'M', '4')
+#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0')
+#define V4L2_PIX_FMT_JPEG_444 v4l2_fourcc('J', 'P', 'G', '4')
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_PIX_FMT_JPEG_422 v4l2_fourcc('J', 'P', 'G', '2')
+#define V4L2_PIX_FMT_JPEG_420 v4l2_fourcc('J', 'P', 'G', '0')
+#define V4L2_PIX_FMT_JPEG_GRAY v4l2_fourcc('J', 'P', 'G', 'G')
+#define V4L2_CID_EXYNOS_BASE (V4L2_CTRL_CLASS_USER | 0x2000)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_GLOBAL_ALPHA (V4L2_CID_EXYNOS_BASE + 1)
+#define V4L2_CID_CACHEABLE (V4L2_CID_EXYNOS_BASE + 10)
+#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_EXYNOS_BASE + 20)
+#define V4L2_CID_CAM_JPEG_ENCODEDSIZE (V4L2_CID_EXYNOS_BASE + 21)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_SET_SHAREABLE (V4L2_CID_EXYNOS_BASE + 40)
+#define V4L2_CID_TV_LAYER_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 50)
+#define V4L2_CID_TV_LAYER_BLEND_ALPHA (V4L2_CID_EXYNOS_BASE + 51)
+#define V4L2_CID_TV_PIXEL_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 52)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_TV_CHROMA_ENABLE (V4L2_CID_EXYNOS_BASE + 53)
+#define V4L2_CID_TV_CHROMA_VALUE (V4L2_CID_EXYNOS_BASE + 54)
+#define V4L2_CID_TV_HPD_STATUS (V4L2_CID_EXYNOS_BASE + 55)
+#define V4L2_CID_TV_LAYER_PRIO (V4L2_CID_EXYNOS_BASE + 56)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_TV_SET_DVI_MODE (V4L2_CID_EXYNOS_BASE + 57)
+#define V4L2_CID_TV_GET_DVI_MODE (V4L2_CID_EXYNOS_BASE + 58)
+#define V4L2_CID_TV_SET_ASPECT_RATIO (V4L2_CID_EXYNOS_BASE + 59)
+#define V4L2_CID_TV_MAX_AUDIO_CHANNELS (V4L2_CID_EXYNOS_BASE + 60)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_TV_ENABLE_HDMI_AUDIO (V4L2_CID_EXYNOS_BASE + 61)
+#define V4L2_CID_TV_SET_NUM_CHANNELS (V4L2_CID_EXYNOS_BASE + 62)
+#define V4L2_CID_TV_UPDATE (V4L2_CID_EXYNOS_BASE + 63)
+#define V4L2_CID_TV_SET_COLOR_RANGE (V4L2_CID_EXYNOS_BASE + 64)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_TV_HDCP_ENABLE (V4L2_CID_EXYNOS_BASE + 65)
+#define V4L2_CID_TV_HDMI_STATUS (V4L2_CID_EXYNOS_BASE + 66)
+#define V4L2_CID_CSC_EQ_MODE (V4L2_CID_EXYNOS_BASE + 100)
+#define V4L2_CID_CSC_EQ (V4L2_CID_EXYNOS_BASE + 101)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_CSC_RANGE (V4L2_CID_EXYNOS_BASE + 102)
+#define V4L2_CID_CONTENT_PROTECTION (V4L2_CID_EXYNOS_BASE + 199)
+#define V4L2_CID_USE_SYSMMU (V4L2_CID_EXYNOS_BASE + 200)
+#define V4L2_CID_M2M_CTX_NUM (V4L2_CID_EXYNOS_BASE + 201)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_2D_BLEND_OP (V4L2_CID_EXYNOS_BASE + 103)
+#define V4L2_CID_2D_COLOR_FILL (V4L2_CID_EXYNOS_BASE + 104)
+#define V4L2_CID_2D_DITH (V4L2_CID_EXYNOS_BASE + 105)
+#define V4L2_CID_2D_FMT_PREMULTI (V4L2_CID_EXYNOS_BASE + 106)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC_BASE (V4L2_CTRL_CLASS_MPEG | 0x2000)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_AVAIL   (V4L2_CID_MPEG_MFC_BASE + 1)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRGMENT_ID   (V4L2_CID_MPEG_MFC_BASE + 2)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_INFO   (V4L2_CID_MPEG_MFC_BASE + 3)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_GRID_POS   (V4L2_CID_MPEG_MFC_BASE + 4)
+#define V4L2_CID_MPEG_MFC51_VIDEO_PACKED_PB   (V4L2_CID_MPEG_MFC_BASE + 5)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TAG   (V4L2_CID_MPEG_MFC_BASE + 6)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_ENABLE   (V4L2_CID_MPEG_MFC_BASE + 7)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA   (V4L2_CID_MPEG_MFC_BASE + 8)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA   (V4L2_CID_MPEG_MFC_BASE + 9)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA_BOT   (V4L2_CID_MPEG_MFC_BASE + 10)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA_BOT   (V4L2_CID_MPEG_MFC_BASE + 11)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_GENERATED   (V4L2_CID_MPEG_MFC_BASE + 12)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CHECK_STATE   (V4L2_CID_MPEG_MFC_BASE + 13)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DISPLAY_STATUS   (V4L2_CID_MPEG_MFC_BASE + 14)
+#define V4L2_CID_MPEG_MFC51_VIDEO_LUMA_ADDR   (V4L2_CID_MPEG_MFC_BASE + 15)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_CHROMA_ADDR   (V4L2_CID_MPEG_MFC_BASE + 16)
+#define V4L2_CID_MPEG_MFC51_VIDEO_STREAM_SIZE   (V4L2_CID_MPEG_MFC_BASE + 17)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_COUNT   (V4L2_CID_MPEG_MFC_BASE + 18)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TYPE   (V4L2_CID_MPEG_MFC_BASE + 19)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum v4l2_mpeg_mfc51_video_frame_type {
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_NOT_CODED = 0,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_I_FRAME = 1,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_P_FRAME = 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_B_FRAME = 3,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_SKIPPED = 4,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_OTHERS = 5,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_INTERLACE   (V4L2_CID_MPEG_MFC_BASE + 20)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE   (V4L2_CID_MPEG_MFC_BASE + 21)
+#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_TIME_RES   (V4L2_CID_MPEG_MFC_BASE + 22)
+#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_FRM_DELTA   (V4L2_CID_MPEG_MFC_BASE + 23)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_H263_RC_FRAME_RATE   (V4L2_CID_MPEG_MFC_BASE + 24)
+#define V4L2_CID_MPEG_MFC6X_VIDEO_FRAME_DELTA   (V4L2_CID_MPEG_MFC_BASE + 25)
+#define V4L2_CID_MPEG_MFC51_VIDEO_I_PERIOD_CH V4L2_CID_MPEG_VIDEO_GOP_SIZE
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_RATE_CH   V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_MFC51_VIDEO_BIT_RATE_CH V4L2_CID_MPEG_VIDEO_BITRATE
+#define V4L2_MPEG_VIDEO_MPEG4_LEVEL_6 8
+#define V4L2_MPEG_VIDEO_HEADER_MODE_AT_THE_READY 2
+#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_MFC_BASE + 26)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_S_B   V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING   (V4L2_CID_MPEG_MFC_BASE + 27)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0   (V4L2_CID_MPEG_MFC_BASE + 28)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE   (V4L2_CID_MPEG_MFC_BASE + 29)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_CHEKERBOARD = 0,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_COLUMN = 1,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_ROW = 2,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_SIDE_BY_SIDE = 3,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TOP_BOTTOM = 4,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TEMPORAL = 5,
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_VIDEO_H264_FMO   (V4L2_CID_MPEG_MFC_BASE + 30)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE   (V4L2_CID_MPEG_MFC_BASE + 31)
+enum v4l2_mpeg_video_h264_fmo_map_type {
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP   (V4L2_CID_MPEG_MFC_BASE + 32)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION   (V4L2_CID_MPEG_MFC_BASE + 33)
+enum v4l2_mpeg_video_h264_fmo_change_dir {
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE   (V4L2_CID_MPEG_MFC_BASE + 34)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH   (V4L2_CID_MPEG_MFC_BASE + 35)
+#define V4L2_CID_MPEG_VIDEO_H264_ASO   (V4L2_CID_MPEG_MFC_BASE + 36)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER   (V4L2_CID_MPEG_MFC_BASE + 37)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING   (V4L2_CID_MPEG_MFC_BASE + 38)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE   (V4L2_CID_MPEG_MFC_BASE + 39)
+enum v4l2_mpeg_video_h264_hierarchical_coding_type {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER   (V4L2_CID_MPEG_MFC_BASE + 40)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP   (V4L2_CID_MPEG_MFC_BASE + 41)
+#define V4L2_CID_MPEG_VIDEO_H264_MVC_VIEW_ID   (V4L2_CID_MPEG_MFC_BASE + 42)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_STATUS   (V4L2_CID_MPEG_MFC_BASE + 43)
+#define V4L2_CID_MPEG_MFC51_VIDEO_I_FRAME_DECODING   (V4L2_CID_MPEG_MFC_BASE + 44)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif