Migrate to msm8974-common

This commit is contained in:
Daniel Moran (garwynn) 2014-06-04 07:56:04 -05:00
parent 45d906053c
commit 9131456882
7 changed files with 7 additions and 808 deletions

View File

@ -20,14 +20,12 @@
# definition file).
#
# inherit from common msm8960
-include device/samsung/msm8960-common/BoardConfigCommon.mk
# inherit from common msm8974
-include device/samsung/msm8974-common/BoardConfigCommon.mk
TARGET_SPECIFIC_HEADER_PATH := device/samsung/klte/include
# overrides msm8960
TARGET_BOARD_PLATFORM := msm8974
TARGET_BOARD_PLATFORM_GPU := qcom-adreno330
# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := MSM8974
# Kernel Configs
@ -76,27 +74,12 @@ BOARD_NFC_HAL_SUFFIX := msm8974
# Samsung's nonstandard csd-client
BOARD_HAVE_NEW_QCOM_CSDCLIENT := true
# QCOM support
BOARD_USES_QCOM_HARDWARE := true
TARGET_QCOM_MEDIA_VARIANT := caf-new
TARGET_QCOM_DISPLAY_VARIANT := caf-new
BOARD_USES_LEGACY_ALSA_AUDIO :=
TARGET_QCOM_AUDIO_VARIANT := caf
TARGET_USES_QCOM_BSP := true
# Audio settings
BOARD_USES_CUSTOM_AUDIO_PLATFORM_PATH := device/samsung/klte/audio/platform
AUDIO_FEATURE_DISABLED_MULTI_VOICE_SESSIONS := true
AUDIO_FEATURE_DISABLED_FM := true
AUDIO_FEATURE_DISABLED_ANC_HEADSET := true
WIFI_DRIVER_FW_PATH_P2P :=
# Don't use qcom camera HAL
#USE_DEVICE_SPECIFIC_CAMERA := true
TARGET_PROVIDES_CAMERA_HAL_MSM8974 := true
TARGET_PROVIDES_CAMERA_HAL :=
# Build lights
TARGET_PROVIDES_LIBLIGHT := true
@ -128,9 +111,6 @@ TARGET_OTA_ASSERT_DEVICE := kltexx,kltespr,kltetmo,kltecan,klteatt,kltevzw,klte
TARGET_POWERHAL_VARIANT := qcom
TARGET_POWERHAL_SET_INTERACTIVE_EXT := device/samsung/klte/power/power_ext.c
# The "new" GPS is really the old GPS, override it.
BOARD_HAVE_NEW_QC_GPS :=
# We don't use old-ass RPC
TARGET_NO_RPC := true

View File

@ -1,18 +0,0 @@
ifeq ($(TARGET_PROVIDES_CAMERA_HAL_MSM8974),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
CameraWrapper.cpp
LOCAL_SHARED_LIBRARIES := \
libhardware liblog libcamera_client libutils
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE := camera.msm8974
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
endif

View File

@ -1,590 +0,0 @@
/*
* Copyright (C) 2012, The CyanogenMod Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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 CameraWrapper.cpp
*
* This file wraps a vendor camera module.
*
*/
// #define LOG_NDEBUG 0
#define LOG_PARAMETERS
#define LOG_TAG "CameraWrapper"
#include <cutils/log.h>
#include <utils/threads.h>
#include <utils/String8.h>
#include <hardware/hardware.h>
#include <hardware/camera.h>
#include <camera/Camera.h>
#include <camera/CameraParameters.h>
static android::Mutex gCameraWrapperLock;
static camera_module_t *gVendorModule = 0;
static char **fixed_set_params = NULL;
static int camera_device_open(const hw_module_t* module, const char* name,
hw_device_t** device);
static int camera_device_close(hw_device_t* device);
static int camera_get_number_of_cameras(void);
static int camera_get_camera_info(int camera_id, struct camera_info *info);
static int camera_send_command(struct camera_device * device, int32_t cmd,
int32_t arg1, int32_t arg2);
static struct hw_module_methods_t camera_module_methods = {
open: camera_device_open
};
camera_module_t HAL_MODULE_INFO_SYM = {
common: {
tag: HARDWARE_MODULE_TAG,
version_major: 1,
version_minor: 0,
id: CAMERA_HARDWARE_MODULE_ID,
name: "Klte Camera Wrapper",
author: "The CyanogenMod Project",
methods: &camera_module_methods,
dso: NULL, /* remove compilation warnings */
reserved: {0}, /* remove compilation warnings */
},
get_number_of_cameras: camera_get_number_of_cameras,
get_camera_info: camera_get_camera_info,
};
typedef struct wrapper_camera_device {
camera_device_t base;
int id;
camera_device_t *vendor;
} wrapper_camera_device_t;
#define VENDOR_CALL(device, func, ...) ({ \
wrapper_camera_device_t *__wrapper_dev = (wrapper_camera_device_t*) device; \
__wrapper_dev->vendor->ops->func(__wrapper_dev->vendor, ##__VA_ARGS__); \
})
#define CAMERA_ID(device) (((wrapper_camera_device_t *)(device))->id)
static int check_vendor_module()
{
int rv = 0;
ALOGI("%s", __FUNCTION__);
if(gVendorModule)
return 0;
rv = hw_get_module_by_class("camera", "vendor",
(const hw_module_t **)&gVendorModule);
if (rv)
ALOGE("failed to open vendor camera module");
return rv;
}
static char * camera_fixup_getparams(int id, const char * settings)
{
android::CameraParameters params;
params.unflatten(android::String8(settings));
android::String8 strParams = params.flatten();
char *ret = strdup(strParams.string());
ALOGD("%s: get parameters fixed up", __FUNCTION__);
return ret;
}
char * camera_fixup_setparams(struct camera_device * device, const char * settings)
{
int id = CAMERA_ID(device);
android::CameraParameters params;
params.unflatten(android::String8(settings));
const char* recordingHint = params.get(android::CameraParameters::KEY_RECORDING_HINT);
bool isVideo = recordingHint && !strcmp(recordingHint, "true");
if (isVideo) {
params.set("dis", "disable");
params.set(android::CameraParameters::KEY_ZSL, "off");
} else {
params.set(android::CameraParameters::KEY_ZSL, "on");
}
android::String8 strParams = params.flatten();
if (fixed_set_params[id])
free(fixed_set_params[id]);
fixed_set_params[id] = strdup(strParams.string());
char *ret = fixed_set_params[id];
ALOGD("%s: set parameters fixed up", __FUNCTION__);
return ret;
}
/*******************************************************************
* implementation of camera_device_ops functions
*******************************************************************/
int camera_set_preview_window(struct camera_device * device,
struct preview_stream_ops *window)
{
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, set_preview_window, window);
}
void camera_set_callbacks(struct camera_device * device,
camera_notify_callback notify_cb,
camera_data_callback data_cb,
camera_data_timestamp_callback data_cb_timestamp,
camera_request_memory get_memory,
void *user)
{
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
ALOGI("%s", __FUNCTION__);
if(!device)
return;
VENDOR_CALL(device, set_callbacks, notify_cb, data_cb, data_cb_timestamp, get_memory, user);
}
void camera_enable_msg_type(struct camera_device * device, int32_t msg_type)
{
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
ALOGI("%s", __FUNCTION__);
if(!device)
return;
VENDOR_CALL(device, enable_msg_type, msg_type);
}
void camera_disable_msg_type(struct camera_device * device, int32_t msg_type)
{
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
ALOGI("%s", __FUNCTION__);
if(!device)
return;
VENDOR_CALL(device, disable_msg_type, msg_type);
}
int camera_msg_type_enabled(struct camera_device * device, int32_t msg_type)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return 0;
return VENDOR_CALL(device, msg_type_enabled, msg_type);
}
int camera_start_preview(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, start_preview);
}
void camera_stop_preview(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return;
VENDOR_CALL(device, stop_preview);
}
int camera_preview_enabled(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, preview_enabled);
}
int camera_store_meta_data_in_buffers(struct camera_device * device, int enable)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, store_meta_data_in_buffers, enable);
}
int camera_start_recording(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return EINVAL;
return VENDOR_CALL(device, start_recording);
}
void camera_stop_recording(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return;
VENDOR_CALL(device, stop_recording);
}
int camera_recording_enabled(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, recording_enabled);
}
void camera_release_recording_frame(struct camera_device * device,
const void *opaque)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return;
VENDOR_CALL(device, release_recording_frame, opaque);
}
int camera_auto_focus(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, auto_focus);
}
int camera_cancel_auto_focus(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, cancel_auto_focus);
}
int camera_take_picture(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, take_picture);
}
int camera_cancel_picture(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, cancel_picture);
}
int camera_set_parameters(struct camera_device * device, const char *params)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
char *tmp = NULL;
tmp = camera_fixup_setparams(device, params);
#ifdef LOG_PARAMETERS
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, tmp);
#endif
int ret = VENDOR_CALL(device, set_parameters, tmp);
return ret;
}
char* camera_get_parameters(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return NULL;
char* params = VENDOR_CALL(device, get_parameters);
#ifdef LOG_PARAMETERS
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
#endif
char * tmp = camera_fixup_getparams(CAMERA_ID(device), params);
VENDOR_CALL(device, put_parameters, params);
params = tmp;
#ifdef LOG_PARAMETERS
__android_log_write(ANDROID_LOG_VERBOSE, LOG_TAG, params);
#endif
return params;
}
static void camera_put_parameters(struct camera_device *device, char *params)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(params)
free(params);
}
int camera_send_command(struct camera_device * device,
int32_t cmd, int32_t arg1, int32_t arg2)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return -EINVAL;
return VENDOR_CALL(device, send_command, cmd, arg1, arg2);
}
void camera_release(struct camera_device * device)
{
ALOGI("%s", __FUNCTION__);
ALOGI("%s->%08X->%08X", __FUNCTION__, (uintptr_t)device, (uintptr_t)(((wrapper_camera_device_t*)device)->vendor));
if(!device)
return;
VENDOR_CALL(device, release);
}
int camera_dump(struct camera_device * device, int fd)
{
if(!device)
return -EINVAL;
return VENDOR_CALL(device, dump, fd);
}
extern "C" void heaptracker_free_leaked_memory(void);
int camera_device_close(hw_device_t* device)
{
int ret = 0;
wrapper_camera_device_t *wrapper_dev = NULL;
ALOGI("%s", __FUNCTION__);
android::Mutex::Autolock lock(gCameraWrapperLock);
if (!device) {
ret = -EINVAL;
goto done;
}
for (int i = 0; i < camera_get_number_of_cameras(); i++) {
if (fixed_set_params[i])
free(fixed_set_params[i]);
}
wrapper_dev = (wrapper_camera_device_t*) device;
wrapper_dev->vendor->common.close((hw_device_t*)wrapper_dev->vendor);
if (wrapper_dev->base.ops)
free(wrapper_dev->base.ops);
free(wrapper_dev);
done:
#ifdef HEAPTRACKER
heaptracker_free_leaked_memory();
#endif
return ret;
}
/*******************************************************************
* implementation of camera_module functions
*******************************************************************/
/* open device handle to one of the cameras
*
* assume camera service will keep singleton of each camera
* so this function will always only be called once per camera instance
*/
int camera_device_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
int rv = 0;
int num_cameras = 0;
int cameraid;
wrapper_camera_device_t* camera_device = NULL;
camera_device_ops_t* camera_ops = NULL;
android::Mutex::Autolock lock(gCameraWrapperLock);
ALOGI("camera_device open");
if (name != NULL) {
if (check_vendor_module())
return -EINVAL;
cameraid = atoi(name);
num_cameras = gVendorModule->get_number_of_cameras();
fixed_set_params = (char **) malloc(sizeof(char *) * num_cameras);
if (!fixed_set_params) {
ALOGE("parameter memory allocation fail");
rv = -ENOMEM;
goto fail;
}
memset(fixed_set_params, 0, sizeof(char *) * num_cameras);
if(cameraid > num_cameras)
{
ALOGE("camera service provided cameraid out of bounds, "
"cameraid = %d, num supported = %d",
cameraid, num_cameras);
rv = -EINVAL;
goto fail;
}
camera_device = (wrapper_camera_device_t*)malloc(sizeof(*camera_device));
if(!camera_device)
{
ALOGE("camera_device allocation fail");
rv = -ENOMEM;
goto fail;
}
memset(camera_device, 0, sizeof(*camera_device));
camera_device->id = cameraid;
if(rv = gVendorModule->common.methods->open((const hw_module_t*)gVendorModule, name, (hw_device_t**)&(camera_device->vendor)))
{
ALOGE("vendor camera open fail");
goto fail;
}
ALOGI("%s: got vendor camera device 0x%08X", __FUNCTION__, (uintptr_t)(camera_device->vendor));
camera_ops = (camera_device_ops_t*)malloc(sizeof(*camera_ops));
if(!camera_ops)
{
ALOGE("camera_ops allocation fail");
rv = -ENOMEM;
goto fail;
}
memset(camera_ops, 0, sizeof(*camera_ops));
camera_device->base.common.tag = HARDWARE_DEVICE_TAG;
camera_device->base.common.version = 0;
camera_device->base.common.module = (hw_module_t *)(module);
camera_device->base.common.close = camera_device_close;
camera_device->base.ops = camera_ops;
camera_ops->set_preview_window = camera_set_preview_window;
camera_ops->set_callbacks = camera_set_callbacks;
camera_ops->enable_msg_type = camera_enable_msg_type;
camera_ops->disable_msg_type = camera_disable_msg_type;
camera_ops->msg_type_enabled = camera_msg_type_enabled;
camera_ops->start_preview = camera_start_preview;
camera_ops->stop_preview = camera_stop_preview;
camera_ops->preview_enabled = camera_preview_enabled;
camera_ops->store_meta_data_in_buffers = camera_store_meta_data_in_buffers;
camera_ops->start_recording = camera_start_recording;
camera_ops->stop_recording = camera_stop_recording;
camera_ops->recording_enabled = camera_recording_enabled;
camera_ops->release_recording_frame = camera_release_recording_frame;
camera_ops->auto_focus = camera_auto_focus;
camera_ops->cancel_auto_focus = camera_cancel_auto_focus;
camera_ops->take_picture = camera_take_picture;
camera_ops->cancel_picture = camera_cancel_picture;
camera_ops->set_parameters = camera_set_parameters;
camera_ops->get_parameters = camera_get_parameters;
camera_ops->put_parameters = camera_put_parameters;
camera_ops->send_command = camera_send_command;
camera_ops->release = camera_release;
camera_ops->dump = camera_dump;
*device = &camera_device->base.common;
}
return rv;
fail:
if(camera_device) {
free(camera_device);
camera_device = NULL;
}
if(camera_ops) {
free(camera_ops);
camera_ops = NULL;
}
*device = NULL;
return rv;
}
int camera_get_number_of_cameras(void)
{
ALOGI("%s", __FUNCTION__);
if (check_vendor_module())
return 0;
return gVendorModule->get_number_of_cameras();
}
int camera_get_camera_info(int camera_id, struct camera_info *info)
{
ALOGI("%s", __FUNCTION__);
if (check_vendor_module())
return 0;
return gVendorModule->get_camera_info(camera_id, info);
}

View File

@ -8,8 +8,8 @@
"target_path": "device/samsung/qcom-common"
},
{
"repository": "android_device_samsung_msm8960-common",
"target_path": "device/samsung/msm8960-common"
"repository": "android_device_samsung_msm8974-common",
"target_path": "device/samsung/msm8974-common"
},
{
"repository": "android_device_samsung_klte",

View File

@ -1,28 +0,0 @@
# Copyright (C) 2013 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.
# HAL module implementation stored in
# hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := consumerir.msm8974
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SRC_FILES := consumerir.c
LOCAL_SHARED_LIBRARIES := liblog libcutils
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)

View File

@ -1,130 +0,0 @@
/*
* Copyright (C) 2013 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.
*/
#define LOG_TAG "ConsumerIrHal"
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <cutils/log.h>
#include <hardware/hardware.h>
#include <hardware/consumerir.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
static const consumerir_freq_range_t consumerir_freqs[] = {
{.min = 30000, .max = 30000},
{.min = 33000, .max = 33000},
{.min = 36000, .max = 36000},
{.min = 38000, .max = 38000},
{.min = 40000, .max = 40000},
{.min = 56000, .max = 56000},
};
int fd = 0;
static int consumerir_transmit(struct consumerir_device *dev,
int carrier_freq, int pattern[], int pattern_len)
{
int strlen;
int i;
char buffer[1024];
memset(buffer, 0, 1024);
/* write the header */
strlen = sprintf(buffer, "%d,", carrier_freq);
/* write out the timing pattern */
for (i = 0; i < pattern_len; i++)
{
strlen += sprintf(buffer + strlen, "%d,", pattern[i]);
}
buffer[strlen - 1] = 0;
write(fd, buffer, strlen - 1);
return 0;
}
static int consumerir_get_num_carrier_freqs(struct consumerir_device *dev)
{
return ARRAY_SIZE(consumerir_freqs);
}
static int consumerir_get_carrier_freqs(struct consumerir_device *dev,
size_t len, consumerir_freq_range_t *ranges)
{
size_t to_copy = ARRAY_SIZE(consumerir_freqs);
to_copy = len < to_copy ? len : to_copy;
memcpy(ranges, consumerir_freqs, to_copy * sizeof(consumerir_freq_range_t));
return to_copy;
}
static int consumerir_close(hw_device_t *dev)
{
free(dev);
close(fd);
return 0;
}
/*
* Generic device handling
*/
static int consumerir_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
if (strcmp(name, CONSUMERIR_TRANSMITTER) != 0) {
return -EINVAL;
}
if (device == NULL) {
ALOGE("NULL device on open");
return -EINVAL;
}
consumerir_device_t *dev = malloc(sizeof(consumerir_device_t));
memset(dev, 0, sizeof(consumerir_device_t));
dev->common.tag = HARDWARE_DEVICE_TAG;
dev->common.version = 0;
dev->common.module = (struct hw_module_t*) module;
dev->common.close = consumerir_close;
dev->transmit = consumerir_transmit;
dev->get_num_carrier_freqs = consumerir_get_num_carrier_freqs;
dev->get_carrier_freqs = consumerir_get_carrier_freqs;
*device = (hw_device_t*) dev;
fd = open("/sys/class/sec/sec_ir/ir_send", O_RDWR);
return 0;
}
static struct hw_module_methods_t consumerir_module_methods = {
.open = consumerir_open,
};
consumerir_module_t HAL_MODULE_INFO_SYM = {
.common = {
.tag = HARDWARE_MODULE_TAG,
.module_api_version = CONSUMERIR_MODULE_API_VERSION_1_0,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = CONSUMERIR_HARDWARE_MODULE_ID,
.name = "Consumer IR Module",
.author = "The CyanogenMod Project",
.methods = &consumerir_module_methods,
},
};

View File

@ -97,24 +97,9 @@ PRODUCT_PACKAGES += \
init.crda.sh \
init.sec.boot.sh
# HAL
PRODUCT_PACKAGES += \
copybit.msm8974 \
gralloc.msm8974 \
hwcomposer.msm8974 \
memtrack.msm8974 \
power.msm8974 \
camera.msm8974
# Audio
PRODUCT_PACKAGES += \
audiod \
audio.a2dp.default \
audio_policy.msm8974 \
audio.primary.msm8974 \
audio.r_submix.default \
audio.usb.default \
libaudio-resampler \
libqcomvisualizer \
libqcomvoiceprocessing \
tinymix
@ -221,8 +206,8 @@ PRODUCT_COPY_FILES += \
device/samsung/klte/wpa_supplicant_overlay.conf:system/etc/wifi/wpa_supplicant_overlay.conf \
device/samsung/klte/p2p_supplicant_overlay.conf:system/etc/wifi/p2p_supplicant_overlay.conf
# call common msm8960
$(call inherit-product, device/samsung/msm8960-common/msm8960.mk)
# call common msm8974
$(call inherit-product, device/samsung/msm8974-common/msm8974.mk)
# call dalvik heap config
$(call inherit-product, frameworks/native/build/phone-xxhdpi-2048-dalvik-heap.mk)