summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gernoth <michael@gernoth.net>2015-02-21 21:17:52 +0100
committerMichael Gernoth <michael@gernoth.net>2015-02-21 21:17:52 +0100
commit0fc5d3483c643df3e872c8b000a634df19837c4e (patch)
treeca56e91eef4aa0f6e33e3d5d6327e4d7a53cc7ab
parent39bd0e3ecd910803e81d3be51e3734dd207de87c (diff)
downloadhardware_ti_omap4-0fc5d3483c643df3e872c8b000a634df19837c4e.zip
hardware_ti_omap4-0fc5d3483c643df3e872c8b000a634df19837c4e.tar.gz
hardware_ti_omap4-0fc5d3483c643df3e872c8b000a634df19837c4e.tar.bz2
camera: Add support for camera on motorola devices
This adds flash-support for motorola devices and disables unsupported functionality. Change-Id: Ib1107d78641ca1ded61e8adb88ab7e8951e4ec74
-rwxr-xr-xcamera/Android.mk4
-rw-r--r--camera/CameraHal.cpp255
-rw-r--r--camera/OMXCameraAdapter/OMX3A.cpp8
-rw-r--r--camera/OMXCameraAdapter/OMXAlgo.cpp116
-rwxr-xr-xcamera/OMXCameraAdapter/OMXCameraAdapter.cpp12
-rw-r--r--camera/OMXCameraAdapter/OMXDCC.cpp4
-rw-r--r--camera/TICameraParameters.cpp5
-rw-r--r--camera/inc/CameraHal.h23
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h15
-rw-r--r--camera/inc/OMXCameraAdapter/OMXSceneModeTables.h7
-rw-r--r--camera/inc/TICameraParameters.h5
11 files changed, 453 insertions, 1 deletions
diff --git a/camera/Android.mk b/camera/Android.mk
index 97a6abf..ccbbfbe 100755
--- a/camera/Android.mk
+++ b/camera/Android.mk
@@ -56,6 +56,10 @@ ifdef ARCH_ARM_HAVE_NEON
CAMERAHAL_CFLAGS += -DARCH_ARM_HAVE_NEON
endif
+ifeq ($(BOARD_VENDOR),motorola-omap4)
+ CAMERAHAL_CFLAGS += -DMOTOROLA_CAMERA
+endif
+
CAMERAHAL_CFLAGS += -DLOG_TAG=\"CameraHal\"
TI_CAMERAHAL_COMMON_INCLUDES := \
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index 74e4634..7e7cf9d 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -392,6 +392,9 @@ int CameraHal::setParameters(const android::CameraParameters& params)
bool restartPreviewRequired = false;
bool updateRequired = false;
android::CameraParameters oldParams = mParameters;
+#ifdef MOTOROLA_CAMERA
+ char value[PROPERTY_VALUE_MAX];
+#endif
#ifdef V4L_CAMERA_ADAPTER
if (strcmp (V4L_CAMERA_NAME_USB, mCameraProperties->get(CameraProperties::CAMERA_NAME)) == 0 ) {
@@ -1083,6 +1086,7 @@ int CameraHal::setParameters(const android::CameraParameters& params)
mParameters.remove(TICameraParameters::KEY_GPS_VERSION);
}
+#ifndef MOTOROLA_CAMERA
if( (valstr = params.get(TICameraParameters::KEY_EXIF_MODEL)) != NULL )
{
CAMHAL_LOGDB("EXIF Model set %s", valstr);
@@ -1094,6 +1098,40 @@ int CameraHal::setParameters(const android::CameraParameters& params)
CAMHAL_LOGDB("EXIF Make set %s", valstr);
mParameters.set(TICameraParameters::KEY_EXIF_MAKE, valstr);
}
+#else
+ if( (property_get("ro.product.model",value,0) > 0))
+ {
+ CAMHAL_LOGDB("EXIF Model set %s",value);
+ mParameters.set(TICameraParameters::KEY_EXIF_MODEL, value);
+ }
+
+ if( (property_get("ro.product.manufacturer",value,0) > 0) )
+ {
+ CAMHAL_LOGDB("EXIF Make set %s",value);
+ mParameters.set(TICameraParameters::KEY_EXIF_MAKE, value);
+ }
+
+ // enabled/disabled similar parameters:
+ // KEY_MOT_LEDFLASH // int: 0..100 percent
+ if((params.get(TICameraParameters::KEY_MOT_LEDFLASH) != NULL)
+ && (params.getInt(TICameraParameters::KEY_MOT_LEDFLASH) >=0)
+ && (params.getInt(TICameraParameters::KEY_MOT_LEDFLASH) <=100))
+ {
+ CAMHAL_LOGDB("Led Flash : %s",params.get(TICameraParameters::KEY_MOT_LEDFLASH));
+ mParameters.set(TICameraParameters::KEY_MOT_LEDFLASH,
+ params.get(TICameraParameters::KEY_MOT_LEDFLASH));
+ }
+
+ // KEY_MOT_LEDTORCH // int: 0..100 percent
+ if((params.get(TICameraParameters::KEY_MOT_LEDTORCH) != NULL)
+ && (params.getInt(TICameraParameters::KEY_MOT_LEDTORCH) >=0)
+ && (params.getInt(TICameraParameters::KEY_MOT_LEDTORCH) <=100))
+ {
+ CAMHAL_LOGDB("Led Torch : %s",params.get(TICameraParameters::KEY_MOT_LEDTORCH));
+ mParameters.set(TICameraParameters::KEY_MOT_LEDTORCH,
+ params.get(TICameraParameters::KEY_MOT_LEDTORCH));
+ }
+#endif
#ifdef OMAP_ENHANCEMENT
if( (valstr = params.get(TICameraParameters::KEY_EXP_BRACKETING_RANGE)) != NULL )
@@ -3245,6 +3283,9 @@ status_t CameraHal::__takePicture(const char *params, struct timeval *captureSta
bool isCPCamMode = false;
android::sp<DisplayAdapter> outAdapter = 0;
bool reuseTapout = false;
+#ifdef MOTOROLA_CAMERA
+ unsigned int intensity = DEFAULT_INTENSITY;
+#endif
#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS
@@ -3453,6 +3494,21 @@ status_t CameraHal::__takePicture(const char *params, struct timeval *captureSta
if ( (NO_ERROR == ret) && (NULL != mCameraAdapter) )
{
+#ifdef MOTOROLA_CAMERA
+ intensity = getFlashIntensity();
+
+ if (intensity == 0)
+ {
+ //notification callback can be triggered with this to inform user
+ mParameters.set(android::CameraParameters::KEY_FLASH_MODE, android::CameraParameters::FLASH_MODE_OFF);
+ }
+ else if (intensity <= DEFAULT_INTENSITY)
+ {
+ mParameters.set(TICameraParameters::KEY_MOT_LEDFLASH, (int) intensity);
+ mParameters.set(TICameraParameters::KEY_MOT_LEDTORCH, (int) intensity);
+ }
+#endif
+
if ( NO_ERROR == ret )
ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_QUERY_BUFFER_SIZE_IMAGE_CAPTURE,
( int ) &frame,
@@ -4622,6 +4678,11 @@ void CameraHal::initDefaultParameters()
p.set(TICameraParameters::KEY_ALGO_THREELINCOLORMAP, android::CameraParameters::TRUE);
p.set(TICameraParameters::KEY_ALGO_GIC, android::CameraParameters::TRUE);
+#ifdef MOTOROLA_CAMERA
+ p.set(TICameraParameters::KEY_MOT_LEDFLASH, DEFAULT_INTENSITY);
+ p.set(TICameraParameters::KEY_MOT_LEDTORCH, DEFAULT_INTENSITY);
+#endif
+
LOG_FUNCTION_NAME_EXIT;
}
@@ -4736,6 +4797,200 @@ void CameraHal::resetPreviewRes(android::CameraParameters *params)
LOG_FUNCTION_NAME_EXIT;
}
+#ifdef MOTOROLA_CAMERA
+#include <cutils/properties.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+
+#define EXT_MODULE_VENDOR_STRING "SHARP,OV8820"
+#define INT_MODULE_VENDOR_STRING "SEMCO,OV7739"
+
+#define DCM_CAM_CONFIG_FILE "/data/system/dcm_camera.config"
+#define CAMERA_ENABLED 0x73
+#define CAMERA_DISABLED 0x45
+
+#define MOT_BURST_COUNT "mot-burst-picture-count"
+#define MOT_BURST_COUNT_VALUES "mot-burst-picture-count-values"
+#define MOT_MAX_BURST_SIZE "mot-max-burst-size"
+//Wide screen aspect ratio (16:9)
+#define WIDE_AR 1.7
+
+// TI supports arbitrary burst limits, so we
+// go with what we've used on other platforms
+#define SUPPORTED_BURSTS "0,1,3,6,9"
+
+#define TORCH_DRIVER_DEVICE "/dev/i2c-3"
+#define TORCH_DEVICE_SLAVE_ADDR 0x53
+#define TORCH_DEVICE_CONTROL_REG 0x10
+#define TORCH_BRIGHTNESS_CONTROL_REG 0xA0
+#define TORCH_DEFAULT_BRIGHTNESS 0x02
+#define TORCH_ENABLE 0x0A
+#define TORCH_DISABLE 0x0
+#define MAX_EXPOSURE_COMPENSATION 30
+
+bool CameraHal::i2cRW(int read_size, int write_size, unsigned char *read_data, unsigned char *write_data)
+{
+
+ int i2cfd = -1;
+ int i,j;
+ int ioctl_ret;
+ struct i2c_msg msgs[2];
+ struct i2c_rdwr_ioctl_data i2c_trans;
+ bool retL = 0;
+
+ enum { I2C_WRITE, I2C_READ };
+ enum { ARG_BUS = 1, ARG_ADDR, ARG_READCNT, ARG_DATA };
+
+ msgs[0].addr = TORCH_DEVICE_SLAVE_ADDR;
+ msgs[0].flags = 0;
+ msgs[0].len = write_size;
+ msgs[0].buf = write_data;
+
+ msgs[1].addr = TORCH_DEVICE_SLAVE_ADDR;
+ msgs[1].flags = I2C_M_RD;
+ msgs[1].len = read_size;
+ msgs[1].buf = read_data;
+
+ i2c_trans.msgs = NULL;
+ i2c_trans.nmsgs = 0;
+
+ if ((i2cfd = open(TORCH_DRIVER_DEVICE, O_RDWR)) < 0) {
+ CAMHAL_LOGD("failed to open %s", TORCH_DRIVER_DEVICE);
+ return 1;
+ }
+
+ if ( write_size && read_size ) {
+ i2c_trans.msgs = &msgs[0];
+ i2c_trans.nmsgs = 2;
+ }
+ else if (write_size) {
+ i2c_trans.msgs = &msgs[0];
+ i2c_trans.nmsgs = 1;
+ }
+ else if (read_size) {
+ i2c_trans.msgs = &msgs[1];
+ i2c_trans.nmsgs = 1;
+ }
+ else {
+ goto done;
+ }
+
+ if ( write_size > 0 ) {
+ CAMHAL_LOGD("I2C_WRITE");
+ for( i = 0; i < write_size; i++ )
+ {
+ CAMHAL_LOGD( "%02X ", write_data[i] );
+ }
+ }
+
+ if( (ioctl_ret = ioctl( i2cfd, I2C_RDWR, &(i2c_trans))) < 0 )
+ {
+ CAMHAL_LOGD("* failed driver call: ioctl returned %d", ioctl_ret);
+ retL = 1;
+ goto done;
+ }
+
+
+ if ( read_size > 0 ) {
+ CAMHAL_LOGD("I2C_READ");
+ for( i = 0; i < read_size; i++ )
+ {
+ CAMHAL_LOGD( "%02X ", read_data[i] );
+ }
+ }
+
+done:
+ /* close the hardware */
+ close(i2cfd);
+
+ return retL;
+
+}
+
+unsigned int CameraHal::getFlashIntensity()
+{
+ unsigned int flashIntensity = DEFAULT_INTENSITY;
+ char value[PROPERTY_VALUE_MAX];
+ unsigned long minFlashThreshold;
+
+ if (property_get("ro.media.capture.flashIntensity", value, 0) > 0)
+ {
+ flashIntensity = atoi(value);
+ }
+ if (property_get("ro.media.capture.flashMinV", value, 0) > 0)
+ {
+ minFlashThreshold = atoi(value);
+ }
+ else
+ {
+ minFlashThreshold = FLASH_VOLTAGE_THRESHOLD2;
+ }
+ if ( minFlashThreshold != 0)
+ {
+ int fd = open("/sys/class/power_supply/battery/voltage_now", O_RDONLY);
+ if (fd < 0)
+ {
+ CAMHAL_LOGE("Battery status is unavailable, defaulting Flash intensity to MAX");
+ }
+ else
+ {
+ char buf[8];
+ if ( read(fd, buf, 8) < 0 )
+ {
+ CAMHAL_LOGE("Unable to read battery status, defaulting flash intensity to MAX\n");
+ }
+ else
+ {
+ unsigned long batteryLevel;
+ buf[7] = '\0';
+ batteryLevel = atol(buf);
+ CAMHAL_LOGE("Current battery Level, %d uv", batteryLevel);
+ if (batteryLevel < minFlashThreshold)
+ {
+ CAMHAL_LOGE("Disabling flash due to low Battery");
+ flashIntensity = 0;
+ }
+ else if (batteryLevel < FLASH_VOLTAGE_THRESHOLD1)
+ {
+ flashIntensity = flashIntensity >> 1 ;
+ }
+ }
+ close(fd);
+ }
+ }
+ CAMHAL_LOGE("flashIntensity = %d", flashIntensity);
+ return flashIntensity;
+}
+
+bool CameraHal::SetFlashLedTorch( unsigned intensity )
+{
+ android::CameraParameters params;
+ mCameraAdapter->getParameters(params);
+ CAMHAL_LOGE("CameraHalTI::SetFlashLedTorch %d", intensity);
+ unsigned char write_data[2];
+
+ if (intensity == 0)
+ {
+ write_data[0] = TORCH_DEVICE_CONTROL_REG;
+ write_data[1] = TORCH_DISABLE;
+ i2cRW(0, 2, NULL, write_data);
+ }
+ else
+ {
+ write_data[0] = TORCH_BRIGHTNESS_CONTROL_REG;
+ write_data[1] = TORCH_DEFAULT_BRIGHTNESS;
+ i2cRW(0, 2, NULL, write_data);
+
+ write_data[0] = TORCH_DEVICE_CONTROL_REG;
+ write_data[1] = TORCH_ENABLE;
+ i2cRW(0, 2, NULL, write_data);
+ }
+
+ return true;
+}
+
+#endif
+
void *
camera_buffer_get_omx_ptr (CameraBuffer *buffer)
{
diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp
index 9baad08..8e6437a 100644
--- a/camera/OMXCameraAdapter/OMX3A.cpp
+++ b/camera/OMXCameraAdapter/OMX3A.cpp
@@ -387,6 +387,7 @@ status_t OMXCameraAdapter::setParameters3A(const android::CameraParameters &para
}
}
+#ifndef MOTOROLA_CAMERA
// TI extensions for enable/disable algos
declareParameter3ABool(params, TICameraParameters::KEY_ALGO_EXTERNAL_GAMMA,
mParameters3A.AlgoExternalGamma, SetAlgoExternalGamma, "External Gamma");
@@ -403,12 +404,14 @@ status_t OMXCameraAdapter::setParameters3A(const android::CameraParameters &para
// Gamma table
str = params.get(TICameraParameters::KEY_GAMMA_TABLE);
updateGammaTable(str);
+#endif
LOG_FUNCTION_NAME_EXIT;
return ret;
}
+#ifndef MOTOROLA_CAMERA
void OMXCameraAdapter::updateGammaTable(const char* gamma)
{
unsigned int plane = 0;
@@ -485,6 +488,7 @@ void OMXCameraAdapter::updateGammaTable(const char* gamma)
mPending3Asettings |= SetGammaTable;
}
}
+#endif
void OMXCameraAdapter::declareParameter3ABool(const android::CameraParameters &params, const char *key,
OMX_BOOL &current_setting, E3ASettingsFlags pending,
@@ -1848,6 +1852,7 @@ status_t OMXCameraAdapter::setParameter3ABool(const OMX_INDEXTYPE omx_idx,
return Utils::ErrorUtils::omxToAndroidError(eError);
}
+#ifndef MOTOROLA_CAMERA
status_t OMXCameraAdapter::setAlgoExternalGamma(Gen3A_settings& Gen3A)
{
return setParameter3ABool((OMX_INDEXTYPE) OMX_TI_IndexConfigExternalGamma, Gen3A.AlgoExternalGamma, "External Gamma");
@@ -1957,6 +1962,7 @@ EXIT:
return ret;
}
+#endif
status_t OMXCameraAdapter::apply3Asettings( Gen3A_settings& Gen3A )
{
@@ -2092,6 +2098,7 @@ status_t OMXCameraAdapter::apply3Asettings( Gen3A_settings& Gen3A )
}
break;
+#ifndef MOTOROLA_CAMERA
//TI extensions for enable/disable algos
case SetAlgoExternalGamma:
{
@@ -2134,6 +2141,7 @@ status_t OMXCameraAdapter::apply3Asettings( Gen3A_settings& Gen3A )
ret |= setGammaTable(Gen3A);
}
break;
+#endif
default:
CAMHAL_LOGEB("this setting (0x%x) is still not supported in CameraAdapter ",
diff --git a/camera/OMXCameraAdapter/OMXAlgo.cpp b/camera/OMXCameraAdapter/OMXAlgo.cpp
index 6855d56..72ce1f6 100644
--- a/camera/OMXCameraAdapter/OMXAlgo.cpp
+++ b/camera/OMXCameraAdapter/OMXAlgo.cpp
@@ -1211,6 +1211,7 @@ status_t OMXCameraAdapter::setVFramerate(OMX_U32 minFrameRate, OMX_U32 maxFrameR
status_t OMXCameraAdapter::setMechanicalMisalignmentCorrection(const bool enable)
{
status_t ret = NO_ERROR;
+#ifndef MOTOROLA_CAMERA
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_TI_CONFIG_MM mm;
@@ -1231,9 +1232,124 @@ status_t OMXCameraAdapter::setMechanicalMisalignmentCorrection(const bool enable
}
LOG_FUNCTION_NAME_EXIT;
+#endif
+
+ return ret;
+}
+
+#ifdef MOTOROLA_CAMERA
+// This function is used when setting LedFlash Intensity
+status_t OMXCameraAdapter::setLedFlash(int nLedFlashIntensP)
+{
+ status_t ret = NO_ERROR;
+ OMX_ERRORTYPE eError = OMX_ErrorNone;
+ OMX_CONFIG_LEDINTESITY LedIntensity;
+
+ LOG_FUNCTION_NAME
+
+ if ( OMX_StateInvalid == mComponentState )
+ {
+ CAMHAL_LOGEA("OMX component is in invalid state");
+ ret = -1;
+ }
+
+ if ( NO_ERROR == ret )
+ {
+ OMX_INIT_STRUCT_PTR (&LedIntensity, OMX_CONFIG_LEDINTESITY);
+
+ eError = OMX_GetConfig(mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE) OMX_IndexConfigLedIntensity, &LedIntensity);
+ if ( OMX_ErrorNone != eError )
+ {
+ CAMHAL_LOGEB("OMXGetConfig() returned error 0x%x on index==%08x", eError, OMX_IndexConfigLedIntensity);
+ ret = -1;
+ }
+ if (NO_ERROR == ret)
+ {
+ CAMHAL_LOGEB("old LedIntensity.nLedFlashIntens is: %d ", LedIntensity.nLedFlashIntens);
+
+ LedIntensity.nLedFlashIntens = (OMX_U32)nLedFlashIntensP;
+ CAMHAL_LOGDB("new LedIntensity.nLedFlashIntens is: %d ", LedIntensity.nLedFlashIntens);
+ eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE) OMX_IndexConfigLedIntensity, &LedIntensity);
+
+ if ( OMX_ErrorNone != eError )
+ {
+ CAMHAL_LOGEB("Error while configuring LedFlash Intensity. "
+ "OMXSetConfig() returned error 0x%x", eError);
+ ret = -1;
+ }
+ }
+
+ }
+
+ LOG_FUNCTION_NAME_EXIT
+
+ return ret;
+}
+
+// This function is used when setting LedTorch Intensity
+status_t OMXCameraAdapter::setLedTorch(int nLedTorchIntensP)
+{
+ status_t ret = NO_ERROR;
+ OMX_ERRORTYPE eError = OMX_ErrorNone;
+ OMX_CONFIG_LEDINTESITY LedIntensity;
+ char value[PROPERTY_VALUE_MAX];
+ unsigned int torchIntensity = DEFAULT_INTENSITY;
+
+ LOG_FUNCTION_NAME
+
+ if ( OMX_StateInvalid == mComponentState )
+ {
+ CAMHAL_LOGEA("OMX component is in invalid state");
+ ret = -1;
+ }
+
+ if ( NO_ERROR == ret )
+ {
+ OMX_INIT_STRUCT_PTR (&LedIntensity, OMX_CONFIG_LEDINTESITY);
+
+ eError = OMX_GetConfig(mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE) OMX_IndexConfigLedIntensity, &LedIntensity);
+ if ( OMX_ErrorNone != eError )
+ {
+ CAMHAL_LOGEB("OMXGetConfig() returned error 0x%x", eError);
+ ret = -1;
+ }
+ if (NO_ERROR == ret)
+ {
+ CAMHAL_LOGEB("old LedIntensity.nLedTorchIntens is: %d ", LedIntensity.nLedTorchIntens);
+
+ // read product specific torvh value
+ if (property_get("ro.media.capture.torchIntensity", value, 0) > 0)
+ {
+ torchIntensity = atoi(value);
+ if ((torchIntensity < 0) || (torchIntensity > DEFAULT_INTENSITY))
+ {
+ torchIntensity = DEFAULT_INTENSITY;
+ }
+ }
+ else
+ {
+ torchIntensity = nLedTorchIntensP;
+ }
+
+ LedIntensity.nLedTorchIntens = (OMX_U32)torchIntensity;
+ CAMHAL_LOGEB("new LedIntensity.nLedTorchIntens is: %d ", LedIntensity.nLedTorchIntens);
+ eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp, (OMX_INDEXTYPE) OMX_IndexConfigLedIntensity, &LedIntensity);
+
+ if ( OMX_ErrorNone != eError )
+ {
+ CAMHAL_LOGEB("Error while configuring LedTorch Intensity. "
+ "OMXSetConfig() returned error 0x%x", eError);
+ ret = -1;
+ }
+ }
+
+ }
+
+ LOG_FUNCTION_NAME_EXIT
return ret;
}
+#endif
} // namespace Camera
} // namespace Ti
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index c3ad9fc..9727f80 100755
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -695,6 +695,16 @@ status_t OMXCameraAdapter::setParameters(const android::CameraParameters &params
ret |= setParametersEXIF(params, state);
+#ifdef MOTOROLA_CAMERA
+ CAMHAL_LOGDA("Start setting of Motorola specific parameters");
+ if (NULL != params.get(TICameraParameters::KEY_MOT_LEDFLASH)) {
+ setLedFlash((unsigned int) (params.getInt(TICameraParameters::KEY_MOT_LEDFLASH)));
+ }
+ if (NULL != params.get(TICameraParameters::KEY_MOT_LEDTORCH)) {
+ setLedTorch((unsigned int) (params.getInt(TICameraParameters::KEY_MOT_LEDTORCH)));
+ }
+#endif
+
mParams = params;
mFirstTimeInit = false;
@@ -1006,6 +1016,7 @@ status_t OMXCameraAdapter::setupTunnel(uint32_t SliceHeight, uint32_t EncoderHan
CAMHAL_LOGEB("OMX_SetParameter OMX_IndexParamPortDefinition Error- %x", eError);
}
+#ifndef MOTOROLA_CAMERA
//Slice Configuration
OMX_TI_PARAM_VTCSLICE VTCSlice;
OMX_INIT_STRUCT_PTR(&VTCSlice, OMX_TI_PARAM_VTCSLICE);
@@ -1027,6 +1038,7 @@ status_t OMXCameraAdapter::setupTunnel(uint32_t SliceHeight, uint32_t EncoderHan
CAMHAL_LOGEB("OMX_SetupTunnel returned error: 0x%x", eError);
return BAD_VALUE;
}
+#endif
return NO_ERROR;
}
diff --git a/camera/OMXCameraAdapter/OMXDCC.cpp b/camera/OMXCameraAdapter/OMXDCC.cpp
index 914a53e..cbaf2ab 100644
--- a/camera/OMXCameraAdapter/OMXDCC.cpp
+++ b/camera/OMXCameraAdapter/OMXDCC.cpp
@@ -31,7 +31,11 @@
namespace Ti {
namespace Camera {
+#ifndef MOTOROLA_CAMERA
android::String8 DCCHandler::DCCPath("/data/misc/camera/");
+#else
+android::String8 DCCHandler::DCCPath("/system/etc/omapcam/");
+#endif
bool DCCHandler::mDCCLoaded = false;
status_t DCCHandler::loadDCC(OMX_HANDLETYPE hComponent)
diff --git a/camera/TICameraParameters.cpp b/camera/TICameraParameters.cpp
index fb511f2..c8b8619 100644
--- a/camera/TICameraParameters.cpp
+++ b/camera/TICameraParameters.cpp
@@ -232,5 +232,10 @@ const char TICameraParameters::KEY_GAMMA_TABLE[] = "gamma-table";
const char TICameraParameters::KEY_PREVIEW_FRAME_RATE_RANGE[] = "preview-frame-rate-range";
+#ifdef MOTOROLA_CAMERA
+const char TICameraParameters::KEY_MOT_LEDFLASH[] = "mot-led-flash"; // U32, default 100, percent
+const char TICameraParameters::KEY_MOT_LEDTORCH[] = "mot-led-torch"; // U32, default 100, percent
+#endif
+
} // namespace Camera
} // namespace Ti
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 0e6dfff..b6d19b7 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -86,6 +86,12 @@
#define SHARPNESS_OFFSET 100
#define CONTRAST_OFFSET 100
+#ifdef MOTOROLA_CAMERA
+#define DEFAULT_INTENSITY 100
+#define FLASH_VOLTAGE_THRESHOLD1 3700000 // intensity will be reduced to 50% below threshold1
+#define FLASH_VOLTAGE_THRESHOLD2 3300000 // flash disabled below threshold2
+#endif
+
#define FRAME_RATE_HIGH_HD 60
#define CAMHAL_GRALLOC_USAGE GRALLOC_USAGE_HW_TEXTURE | \
@@ -117,6 +123,11 @@ extern const char * const kYuvImagesOutputDirPath;
#define V4L_CAMERA_NAME_USB "USBCAMERA"
#define OMX_CAMERA_NAME_OV "OV5640"
#define OMX_CAMERA_NAME_SONY "IMX060"
+#ifdef MOTOROLA_CAMERA
+#define OMX_CAMERA_NAME_OV8820 "OV8820"
+#define OMX_CAMERA_NAME_OV7739 "OV7739"
+#define OMX_CAMERA_NAME_MT9M114 "MT9M114"
+#endif
///Forward declarations
@@ -1101,6 +1112,10 @@ public:
//@{
public:
+#ifdef MOTOROLA_CAMERA
+ bool SetFlashLedTorch(unsigned intensity);
+#endif
+
/** Set the notification and data callbacks */
void setCallbacks(camera_notify_callback notify_cb,
camera_data_callback data_cb,
@@ -1399,6 +1414,14 @@ private:
status_t releaseTapinLocked(struct preview_stream_ops *in);
static SocFamily getSocFamily();
+
+#ifdef MOTOROLA_CAMERA
+ // I2C read write utility to support factory test commands
+ bool i2cRW(int read_size, int write_size, unsigned char *read_data, unsigned char *write_data);
+
+ // get best flash intensity level for the current battery level
+ unsigned int getFlashIntensity(void);
+#endif
/*----------Member variables - Public ---------------------*/
public:
int32_t mMsgEnabled;
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index 1fea032..10590df 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -580,6 +580,7 @@ private:
status_t setParameter3ABoolInvert(const OMX_INDEXTYPE omx_idx,
const OMX_BOOL data, const char *msg);
status_t setAlgoExternalGamma(Gen3A_settings& Gen3A);
+#ifndef MOTOROLA_CAMERA
status_t setAlgoNSF1(Gen3A_settings& Gen3A);
status_t setAlgoNSF2(Gen3A_settings& Gen3A);
status_t setAlgoSharpening(Gen3A_settings& Gen3A);
@@ -589,6 +590,7 @@ private:
//Gamma table
void updateGammaTable(const char* gamma);
status_t setGammaTable(Gen3A_settings& Gen3A);
+#endif
status_t getEVCompensation(Gen3A_settings& Gen3A);
status_t getWBMode(Gen3A_settings& Gen3A);
@@ -841,8 +843,17 @@ private:
};
android::sp<CommandHandler> mCommandHandler;
+#ifdef MOTOROLA_CAMERA
+ status_t setLedFlash(int nLedFlashIntensP);
+ status_t setLedTorch(int nLedTorchIntensP);
+#endif
+
public:
+#ifdef MOTOROLA_CAMERA
+ status_t getOTPEeprom(unsigned char * pData, unsigned long nSize);
+#endif
+
class OMXCallbackHandler : public android::Thread {
public:
OMXCallbackHandler(OMXCameraAdapter* ca)
@@ -919,6 +930,10 @@ private:
static const int SENSORID_OV8830;
static const int SENSORID_OV2722;
static const int SENSORID_OV9726;
+#ifdef MOTOROLA_CAMERA
+ static const int SENSORID_OV8820;
+ static const int SENSORID_MT9M114;
+#endif
static const CapU32 mFacing [];
static const userToOMX_LUT mAutoConvergence [];
static const LUTtype mAutoConvergenceLUT;
diff --git a/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h b/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
index d7d7d32..6ac9f2b 100644
--- a/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
+++ b/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
@@ -745,7 +745,12 @@ static const CameraToSensorModesLUTEntry CameraToSensorModesLUT [] = {
{ "OV5650", OV5650_SceneModesLUT, ARRAY_SIZE(OV5650_SceneModesLUT)},
{ "OV8830", OV8830_SceneModesLUT, ARRAY_SIZE(OV8830_SceneModesLUT)},
{ "OV9726", OV2722_SceneModesLUT, ARRAY_SIZE(OV2722_SceneModesLUT)},
- { "OV2722", OV2722_SceneModesLUT, ARRAY_SIZE(OV2722_SceneModesLUT)}
+ { "OV2722", OV2722_SceneModesLUT, ARRAY_SIZE(OV2722_SceneModesLUT)},
+#ifdef MOTOROLA_CAMERA
+ { "OV8820", OV8830_SceneModesLUT, ARRAY_SIZE(OV8830_SceneModesLUT)},
+ { "OV7739", OV2722_SceneModesLUT, ARRAY_SIZE(OV2722_SceneModesLUT)},
+ { "MT9M114", OV2722_SceneModesLUT, ARRAY_SIZE(OV2722_SceneModesLUT)},
+#endif
};
} // namespace Camera
diff --git a/camera/inc/TICameraParameters.h b/camera/inc/TICameraParameters.h
index 951c663..8686456 100644
--- a/camera/inc/TICameraParameters.h
+++ b/camera/inc/TICameraParameters.h
@@ -257,6 +257,11 @@ static const char KEY_GAMMA_TABLE[];
static const char KEY_PREVIEW_FRAME_RATE_RANGE[];
+#ifdef MOTOROLA_CAMERA
+static const char KEY_MOT_LEDFLASH[];
+static const char KEY_MOT_LEDTORCH[];
+#endif
+
};
} // namespace Camera