msm8974-common: Fixup CameraWrapper for L

-Also clean up code and get rid of warnings.
   Clean up from Arne Coucheron works on other samsung wrappers.

  -Requires device tree to include a CameraParametersExtra.h
   for the specific device.

Change-Id: Icab1b9ec17710861f735a05dcdd87dac932c63c2
This commit is contained in:
Tony Layher 2014-11-16 03:27:31 -05:00 committed by Christopher R. Palmer
parent 0232f8c3ca
commit 39da7d7fa2
3 changed files with 31 additions and 21 deletions

View File

@ -32,7 +32,6 @@ BOARD_HAVE_BLUETOOTH := true
# Camera # Camera
TARGET_PROVIDES_CAMERA_HAL := true TARGET_PROVIDES_CAMERA_HAL := true
USE_DEVICE_SPECIFIC_CAMERA := true USE_DEVICE_SPECIFIC_CAMERA := true
COMMON_GLOBAL_CFLAGS += -DSAMSUNG_CAMERA_HARDWARE
# Charger # Charger
BOARD_BATTERY_DEVICE_NAME := "battery" BOARD_BATTERY_DEVICE_NAME := "battery"

View File

@ -9,8 +9,11 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \
libhardware liblog libcamera_client libutils libhardware liblog libcamera_client libutils
LOCAL_C_INCLUDES := \
system/media/camera/include
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE := camera.msm8974 LOCAL_MODULE := camera.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@ -48,23 +48,27 @@ static int camera_send_command(struct camera_device * device, int32_t cmd,
int32_t arg1, int32_t arg2); int32_t arg1, int32_t arg2);
static struct hw_module_methods_t camera_module_methods = { static struct hw_module_methods_t camera_module_methods = {
open: camera_device_open .open = camera_device_open
}; };
camera_module_t HAL_MODULE_INFO_SYM = { camera_module_t HAL_MODULE_INFO_SYM = {
common: { .common = {
tag: HARDWARE_MODULE_TAG, tag: HARDWARE_MODULE_TAG,
version_major: 1, .module_api_version = CAMERA_MODULE_API_VERSION_1_0,
version_minor: 0, .hal_api_version = HARDWARE_HAL_API_VERSION,
id: CAMERA_HARDWARE_MODULE_ID, .id = CAMERA_HARDWARE_MODULE_ID,
name: "MSM8974 Camera Wrapper", .name = "MSM8974 Camera Wrapper",
author: "The CyanogenMod Project", .author = "The CyanogenMod Project",
methods: &camera_module_methods, .methods = &camera_module_methods,
dso: NULL, /* remove compilation warnings */ .dso = NULL, /* remove compilation warnings */
reserved: {0}, /* remove compilation warnings */ .reserved = {0}, /* remove compilation warnings */
}, },
get_number_of_cameras: camera_get_number_of_cameras, .get_number_of_cameras = camera_get_number_of_cameras,
get_camera_info: camera_get_camera_info, .get_camera_info = camera_get_camera_info,
.set_callbacks = NULL, /* remove compilation warnings */
.get_vendor_tag_ops = NULL, /* remove compilation warnings */
.open_legacy = NULL, /* remove compilation warnings */
.reserved = {0}, /* remove compilation warnings */
}; };
typedef struct wrapper_camera_device { typedef struct wrapper_camera_device {
@ -98,7 +102,8 @@ static int check_vendor_module()
#define KEY_VIDEO_HFR_VALUES "video-hfr-values" #define KEY_VIDEO_HFR_VALUES "video-hfr-values"
static char * camera_fixup_getparams(int id, const char * settings) static char *camera_fixup_getparams(int __attribute__((unused)) id,
const char *settings)
{ {
android::CameraParameters params; android::CameraParameters params;
params.unflatten(android::String8(settings)); params.unflatten(android::String8(settings));
@ -145,10 +150,10 @@ char * camera_fixup_setparams(struct camera_device * device, const char * settin
bool isVideo = recordingHint && !strcmp(recordingHint, "true"); bool isVideo = recordingHint && !strcmp(recordingHint, "true");
if (isVideo) { if (isVideo) {
params.set("dis", "disable"); params.set(android::CameraParameters::KEY_DIS, android::CameraParameters::DIS_DISABLE);
params.set(android::CameraParameters::KEY_ZSL, "off"); params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_OFF);
} else { } else {
params.set(android::CameraParameters::KEY_ZSL, "on"); params.set(android::CameraParameters::KEY_ZSL, android::CameraParameters::ZSL_ON);
} }
android::String8 strParams = params.flatten(); android::String8 strParams = params.flatten();
@ -528,12 +533,15 @@ int camera_device_open(const hw_module_t* module, const char* name,
memset(camera_device, 0, sizeof(*camera_device)); memset(camera_device, 0, sizeof(*camera_device));
camera_device->id = cameraid; camera_device->id = cameraid;
rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)); rv = gVendorModule->common.methods->open(
(const hw_module_t*)gVendorModule, name,
(hw_device_t**)&(camera_device->vendor));
if (rv) { if (rv) {
ALOGE("vendor camera open fail"); ALOGE("vendor camera open fail");
goto fail; goto fail;
} }
ALOGI("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor)); ALOGI("%s: got vendor camera device 0x%08X",
__FUNCTION__, (uintptr_t)(camera_device->vendor));
camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops)); camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops));
if(!camera_ops) if(!camera_ops)
@ -546,7 +554,7 @@ int camera_device_open(const hw_module_t* module, const char* name,
memset(camera_ops, 0, sizeof(*camera_ops)); memset(camera_ops, 0, sizeof(*camera_ops));
camera_device->base.common.tag = HARDWARE_DEVICE_TAG; camera_device->base.common.tag = HARDWARE_DEVICE_TAG;
camera_device->base.common.version = 0; camera_device->base.common.version = CAMERA_DEVICE_API_VERSION_1_0;
camera_device->base.common.module = (hw_module_t *)(module); camera_device->base.common.module = (hw_module_t *)(module);
camera_device->base.common.close = camera_device_close; camera_device->base.common.close = camera_device_close;
camera_device->base.ops = camera_ops; camera_device->base.ops = camera_ops;