sanders: Pixel Experience CAF Bringup
Signed-off-by: Jorge Lucas <jorgelucas.sd@gmail.com>
This commit is contained in:
@@ -214,15 +214,12 @@ TARGET_RELEASETOOLS_EXTENSIONS := $(DEVICE_PATH)/releasetools
|
|||||||
TARGET_PROVIDES_QTI_TELEPHONY_JAR := true
|
TARGET_PROVIDES_QTI_TELEPHONY_JAR := true
|
||||||
|
|
||||||
# SELinux
|
# SELinux
|
||||||
include device/qcom/sepolicy/sepolicy.mk
|
include device/qcom/sepolicy/Android.mk
|
||||||
BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
|
BOARD_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
|
||||||
|
|
||||||
SELINUX_IGNORE_NEVERALLOWS := true
|
SELINUX_IGNORE_NEVERALLOWS := true
|
||||||
TARGET_ENABLE_MEDIADRM_64 := true
|
TARGET_ENABLE_MEDIADRM_64 := true
|
||||||
|
|
||||||
# Thermal
|
|
||||||
USE_DEVICE_SPECIFIC_THERMAL := true
|
|
||||||
|
|
||||||
# Treble
|
# Treble
|
||||||
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
|
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
|
||||||
BOARD_VENDORIMAGE_PARTITION_SIZE := 805306368
|
BOARD_VENDORIMAGE_PARTITION_SIZE := 805306368
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
|
|||||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_n_mr1.mk)
|
$(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_n_mr1.mk)
|
||||||
|
|
||||||
$(call inherit-product, device/motorola/sanders/device.mk)
|
$(call inherit-product, device/motorola/sanders/device.mk)
|
||||||
$(call inherit-product, vendor/aosp/config/common_full_phone.mk)
|
$(call inherit-product, vendor/aosp/config/common.mk)
|
||||||
|
|
||||||
# Pixel Stuffs
|
# Pixel Stuffs
|
||||||
TARGET_GAPPS_ARCH := arm64
|
TARGET_GAPPS_ARCH := arm64
|
||||||
|
|||||||
@@ -205,16 +205,6 @@
|
|||||||
<instance>slot2</instance>
|
<instance>slot2</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="hidl">
|
|
||||||
<name>android.hardware.radio.deprecated</name>
|
|
||||||
<transport>hwbinder</transport>
|
|
||||||
<version>1.0</version>
|
|
||||||
<interface>
|
|
||||||
<name>IOemHook</name>
|
|
||||||
<instance>slot1</instance>
|
|
||||||
<instance>slot2</instance>
|
|
||||||
</interface>
|
|
||||||
</hal>
|
|
||||||
<hal format="hidl">
|
<hal format="hidl">
|
||||||
<name>android.hardware.renderscript</name>
|
<name>android.hardware.renderscript</name>
|
||||||
<transport arch="32+64">passthrough</transport>
|
<transport arch="32+64">passthrough</transport>
|
||||||
|
|||||||
@@ -216,11 +216,7 @@ PRODUCT_COPY_FILES += \
|
|||||||
|
|
||||||
# IMS
|
# IMS
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
ims-ext-common \
|
ims-ext-common
|
||||||
telephony-ext
|
|
||||||
|
|
||||||
PRODUCT_BOOT_JARS += \
|
|
||||||
telephony-ext
|
|
||||||
|
|
||||||
# IMS
|
# IMS
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
@@ -448,3 +444,6 @@ PRODUCT_BOOT_JARS += \
|
|||||||
|
|
||||||
# for specific
|
# for specific
|
||||||
$(call inherit-product, vendor/motorola/sanders/sanders-vendor.mk)
|
$(call inherit-product, vendor/motorola/sanders/sanders-vendor.mk)
|
||||||
|
|
||||||
|
# Performance
|
||||||
|
include vendor/qcom/common/qti-vendor.mk
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2017 The LineageOS 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 $(CLEAR_VARS)
|
|
||||||
LOCAL_SHARED_LIBRARIES := libhidltransport
|
|
||||||
LOCAL_MODULE := android.hidl.base@1.0
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
||||||
LOCAL_VENDOR_MODULE := true
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_SHARED_LIBRARIES := libhidltransport
|
|
||||||
LOCAL_MODULE := android.hidl.manager@1.0
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
||||||
LOCAL_VENDOR_MODULE := true
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
@@ -17,7 +17,7 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_SRC_FILES := libqsap_shim.c
|
LOCAL_SRC_FILES := libqsap_shim.c
|
||||||
LOCAL_SHARED_LIBRARIES := libqsap_sdk liblog libcutils libutils
|
LOCAL_SHARED_LIBRARIES := libqsap_sdk liblog libcutils libutils
|
||||||
LOCAL_C_INCLUDES := $(TOP)/system/qcom/softap/sdk
|
LOCAL_C_INCLUDES := $(TOP)/vendor/qcom/opensource/softap/softap/sdk
|
||||||
LOCAL_C_FLAGS := -Wno-error
|
LOCAL_C_FLAGS := -Wno-error
|
||||||
LOCAL_HEADER_LIBRARIES := libutils_headers
|
LOCAL_HEADER_LIBRARIES := libutils_headers
|
||||||
LOCAL_MODULE := libqsap_shim
|
LOCAL_MODULE := libqsap_shim
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
LOCAL_PATH:= $(call my-dir)
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
LOCAL_MODULE:=thermal-engine
|
|
||||||
|
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS:=$(LOCAL_PATH)
|
|
||||||
|
|
||||||
include $(BUILD_HEADER_LIBRARY)
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are
|
|
||||||
* met:
|
|
||||||
* * * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * 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.
|
|
||||||
* * Neither the name of The Linux Foundation nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
|
||||||
* 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 <cutils/properties.h>
|
|
||||||
#ifndef __THERMAL_CLIENT_H__
|
|
||||||
#define __THERMAL_CLIENT_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_ACTIONS (32)
|
|
||||||
|
|
||||||
/* Enum for supported fields */
|
|
||||||
enum supported_fields {
|
|
||||||
UNKNOWN_FIELD = 0x0,
|
|
||||||
DISABLE_FIELD = 0x1,
|
|
||||||
SAMPLING_FIELD = 0x2,
|
|
||||||
THRESHOLDS_FIELD = 0x4,
|
|
||||||
SET_POINT_FIELD = THRESHOLDS_FIELD,
|
|
||||||
THRESHOLDS_CLR_FIELD = 0x8,
|
|
||||||
SET_POINT_CLR_FIELD = THRESHOLDS_CLR_FIELD,
|
|
||||||
ACTION_INFO_FIELD = 0x10,
|
|
||||||
SUPPORTED_FIELD_MAX = 0x20,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum field_data_type {
|
|
||||||
FIELD_INT = 0,
|
|
||||||
FIELD_STR,
|
|
||||||
FIELD_INT_ARR,
|
|
||||||
FIELD_ARR_STR,
|
|
||||||
FIELD_ARR_INT_ARR,
|
|
||||||
FIELD_MAX
|
|
||||||
};
|
|
||||||
|
|
||||||
struct action_info_data {
|
|
||||||
int info[MAX_ACTIONS];
|
|
||||||
uint32_t num_actions;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct field_data {
|
|
||||||
char *field_name;
|
|
||||||
enum field_data_type data_type;
|
|
||||||
uint32_t num_data;
|
|
||||||
void *data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct config_instance {
|
|
||||||
char *cfg_desc;
|
|
||||||
char *algo_type;
|
|
||||||
unsigned int fields_mask; /* mask set by client to request to adjust supported fields */
|
|
||||||
uint32_t num_fields;
|
|
||||||
struct field_data *fields;
|
|
||||||
};
|
|
||||||
|
|
||||||
int thermal_client_config_query(char *algo_type, struct config_instance **configs);
|
|
||||||
void thermal_client_config_cleanup(struct config_instance *configs, unsigned int config_size);
|
|
||||||
int thermal_client_config_set(struct config_instance *configs, unsigned int config_size);
|
|
||||||
|
|
||||||
int thermal_client_register_callback(char *client_name, int (*callback)(int , void *, void *), void *data);
|
|
||||||
int thermal_client_request(char *client_name, int req_data);
|
|
||||||
void thermal_client_unregister_callback(int client_cb_handle);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __THERMAL_CLIENT_H__ */
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# Copyright (C) 2015 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)
|
|
||||||
|
|
||||||
LOCAL_MODULE := thermal.$(TARGET_BOARD_PLATFORM)
|
|
||||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
|
||||||
LOCAL_PROPRIETARY_MODULE := true
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := thermal.c
|
|
||||||
LOCAL_SRC_FILES += thermal-8953.c
|
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := liblog libcutils
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_CFLAGS := -Wno-unused-parameter
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
|
||||||
* Not a contribution
|
|
||||||
* Copyright (C) 2016 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 <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define LOG_TAG "ThermalHAL-8998"
|
|
||||||
#include <utils/Log.h>
|
|
||||||
|
|
||||||
#include <hardware/hardware.h>
|
|
||||||
#include <hardware/thermal.h>
|
|
||||||
|
|
||||||
#define MAX_LENGTH 50
|
|
||||||
|
|
||||||
#define TEMPERATURE_FILE_FORMAT "/sys/class/thermal/thermal_zone%d/temp"
|
|
||||||
|
|
||||||
#define BATTERY_SENSOR_NUM 0
|
|
||||||
#define GPU_SENSOR_NUM 17
|
|
||||||
#define SKIN_SENSOR_NUM 5
|
|
||||||
|
|
||||||
const int CPU_SENSORS[] = {8, 9, 10, 11, 12, 13, 14,15};
|
|
||||||
|
|
||||||
#define CPU_NUM (sizeof(CPU_SENSORS) / sizeof(int))
|
|
||||||
// Sum of CPU_NUM + 3 for GPU, BATTERY, and SKIN.
|
|
||||||
#define TEMPERATURE_NUM (CPU_NUM + 3)
|
|
||||||
|
|
||||||
//therm-reset-temp
|
|
||||||
#define CPU_SHUTDOWN_THRESHOLD 115
|
|
||||||
//limit-temp
|
|
||||||
#define CPU_THROTTLING_THRESHOLD 60
|
|
||||||
#define BATTERY_SHUTDOWN_THRESHOLD 60
|
|
||||||
//must match thermal-engine.conf
|
|
||||||
#define SKIN_THROTTLING_THRESHOLD 44
|
|
||||||
#define SKIN_SHUTDOWN_THRESHOLD 70
|
|
||||||
#define VR_THROTTLED_BELOW_MIN 58
|
|
||||||
|
|
||||||
#define GPU_LABEL "GPU"
|
|
||||||
#define BATTERY_LABEL "battery"
|
|
||||||
#define SKIN_LABEL "skin"
|
|
||||||
|
|
||||||
const char *CPU_LABEL[] = {"CPU0", "CPU1", "CPU2", "CPU3", "CPU4", "CPU5", "CPU6", "CPU7"};
|
|
||||||
|
|
||||||
const char *get_cpu_label(unsigned int cpu_num) {
|
|
||||||
|
|
||||||
if(cpu_num >= CPU_NUM)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return CPU_LABEL[cpu_num];
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t get_num_cpus() {
|
|
||||||
return CPU_NUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads device temperature.
|
|
||||||
*
|
|
||||||
* @param sensor_num Number of sensor file with temperature.
|
|
||||||
* @param type Device temperature type.
|
|
||||||
* @param name Device temperature name.
|
|
||||||
* @param mult Multiplier used to translate temperature to Celsius.
|
|
||||||
* @param throttling_threshold Throttling threshold for the temperature.
|
|
||||||
* @param shutdown_threshold Shutdown threshold for the temperature.
|
|
||||||
* @param out Pointer to temperature_t structure that will be filled with current
|
|
||||||
* values.
|
|
||||||
*
|
|
||||||
* @return 0 on success or negative value -errno on error.
|
|
||||||
*/
|
|
||||||
static ssize_t read_temperature(int sensor_num, int type, const char *name, float mult,
|
|
||||||
float throttling_threshold, float shutdown_threshold, float vr_throttling_threshold,
|
|
||||||
temperature_t *out)
|
|
||||||
{
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
FILE *file;
|
|
||||||
char file_name[MAX_LENGTH];
|
|
||||||
float temp;
|
|
||||||
|
|
||||||
snprintf(file_name, sizeof(file_name), TEMPERATURE_FILE_FORMAT, sensor_num);
|
|
||||||
file = fopen(file_name, "r");
|
|
||||||
if (file == NULL) {
|
|
||||||
ALOGE("%s: failed to open: %s", __func__, strerror(errno));
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
if (1 != fscanf(file, "%f", &temp)) {
|
|
||||||
fclose(file);
|
|
||||||
ALOGE("%s: failed to read a float: %s", __func__, strerror(errno));
|
|
||||||
return errno ? -errno : -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
(*out) = (temperature_t) {
|
|
||||||
.type = type,
|
|
||||||
.name = name,
|
|
||||||
.current_value = temp * mult,
|
|
||||||
.throttling_threshold = throttling_threshold,
|
|
||||||
.shutdown_threshold = shutdown_threshold,
|
|
||||||
.vr_throttling_threshold = vr_throttling_threshold
|
|
||||||
};
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t get_cpu_temperatures(temperature_t *list, size_t size)
|
|
||||||
{
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
size_t cpu;
|
|
||||||
for (cpu = 0; cpu < CPU_NUM; cpu++) {
|
|
||||||
if (cpu >= size) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// tsens_tz_sensor[4,6,9,11]: temperature in decidegrees Celsius.
|
|
||||||
ssize_t result = read_temperature(CPU_SENSORS[cpu], DEVICE_TEMPERATURE_CPU, CPU_LABEL[cpu],
|
|
||||||
0.1, CPU_THROTTLING_THRESHOLD, CPU_SHUTDOWN_THRESHOLD, UNKNOWN_TEMPERATURE,
|
|
||||||
&list[cpu]);
|
|
||||||
if (result != 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cpu;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t get_temperatures(thermal_module_t *module, temperature_t *list, size_t size) {
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
ssize_t result = 0;
|
|
||||||
size_t current_index = 0;
|
|
||||||
|
|
||||||
if (list == NULL) {
|
|
||||||
return TEMPERATURE_NUM;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = get_cpu_temperatures(list, size);
|
|
||||||
if (result < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
current_index += result;
|
|
||||||
|
|
||||||
// GPU temperature.
|
|
||||||
if (current_index < size) {
|
|
||||||
// tsens_tz_sensor14: temperature in decidegrees Celsius.
|
|
||||||
result = read_temperature(GPU_SENSOR_NUM, DEVICE_TEMPERATURE_GPU, GPU_LABEL, 0.1,
|
|
||||||
UNKNOWN_TEMPERATURE, UNKNOWN_TEMPERATURE, UNKNOWN_TEMPERATURE,
|
|
||||||
&list[current_index]);
|
|
||||||
if (result < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
current_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Battery temperature.
|
|
||||||
if (current_index < size) {
|
|
||||||
// tsens_tz_sensor29: battery: temperature in millidegrees Celsius.
|
|
||||||
result = read_temperature(BATTERY_SENSOR_NUM, DEVICE_TEMPERATURE_BATTERY, BATTERY_LABEL,
|
|
||||||
0.001, UNKNOWN_TEMPERATURE, BATTERY_SHUTDOWN_THRESHOLD, UNKNOWN_TEMPERATURE,
|
|
||||||
&list[current_index]);
|
|
||||||
if (result < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
current_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skin temperature.
|
|
||||||
if (current_index < size) {
|
|
||||||
// tsens_tz_sensor24: temperature in Celsius.
|
|
||||||
result = read_temperature(SKIN_SENSOR_NUM, DEVICE_TEMPERATURE_SKIN, SKIN_LABEL, 1.,
|
|
||||||
SKIN_THROTTLING_THRESHOLD, SKIN_SHUTDOWN_THRESHOLD, VR_THROTTLED_BELOW_MIN,
|
|
||||||
&list[current_index]);
|
|
||||||
if (result < 0) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
current_index++;
|
|
||||||
}
|
|
||||||
return TEMPERATURE_NUM;
|
|
||||||
}
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
|
||||||
* Not a contribution
|
|
||||||
* Copyright (C) 2016 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 <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define LOG_TAG "ThermalHAL"
|
|
||||||
#include <utils/Log.h>
|
|
||||||
|
|
||||||
#include <hardware/hardware.h>
|
|
||||||
#include <hardware/thermal.h>
|
|
||||||
|
|
||||||
#define MAX_LENGTH 50
|
|
||||||
|
|
||||||
#define CPU_USAGE_FILE "/proc/stat"
|
|
||||||
#define CPU_ONLINE_FILE_FORMAT "/sys/devices/system/cpu/cpu%d/online"
|
|
||||||
#define CPU_PRESENT_FILE "/sys/devices/system/cpu/present"
|
|
||||||
|
|
||||||
const char * __attribute__ ((weak)) get_cpu_label(unsigned int cpu_num) {
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
static const char * cpu_label = "cpu";
|
|
||||||
return cpu_label;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t __attribute__ ((weak)) get_num_cpus() {
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
FILE *file;
|
|
||||||
char *line = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
static size_t cpus = 0;
|
|
||||||
ssize_t read;
|
|
||||||
|
|
||||||
if(cpus) return cpus;
|
|
||||||
|
|
||||||
file = fopen(CPU_PRESENT_FILE, "r");
|
|
||||||
if (file == NULL) {
|
|
||||||
ALOGE("%s: failed to open: %s", __func__, strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((read = getline(&line, &len, file)) != -1) {
|
|
||||||
if (strnlen(line, read) < 3 || strncmp(line, "0-", 2) != 0 || !isdigit(line[2]))
|
|
||||||
ALOGE("%s: Incorrect cpu present file format", __func__);
|
|
||||||
else
|
|
||||||
cpus = atoi(&line[2]) + 1;
|
|
||||||
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ALOGE("%s: failed to read cpu present file: %s", __func__, strerror(errno));
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
return cpus;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t __attribute__ ((weak)) get_temperatures(thermal_module_t *module, temperature_t *list, size_t size) {
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t get_cpu_usages(thermal_module_t *module, cpu_usage_t *list) {
|
|
||||||
ALOGD("Entering %s",__func__);
|
|
||||||
int vals, cpu_num, online;
|
|
||||||
ssize_t read;
|
|
||||||
uint64_t user, nice, system, idle, active, total;
|
|
||||||
char *line = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
size_t size = 0;
|
|
||||||
size_t cpus = 0;
|
|
||||||
char file_name[MAX_LENGTH];
|
|
||||||
FILE *file;
|
|
||||||
FILE *cpu_file;
|
|
||||||
|
|
||||||
cpus = get_num_cpus();
|
|
||||||
if (!cpus)
|
|
||||||
return errno ? -errno : -EIO;
|
|
||||||
|
|
||||||
if (list == NULL)
|
|
||||||
return cpus;
|
|
||||||
|
|
||||||
file = fopen(CPU_USAGE_FILE, "r");
|
|
||||||
if (file == NULL) {
|
|
||||||
ALOGE("%s: failed to open: %s", __func__, strerror(errno));
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((read = getline(&line, &len, file)) != -1) {
|
|
||||||
if (strnlen(line, read) < 4 || strncmp(line, "cpu", 3) != 0 || !isdigit(line[3])) {
|
|
||||||
free(line);
|
|
||||||
line = NULL;
|
|
||||||
len = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
vals = sscanf(line, "cpu%d %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64, &cpu_num, &user,
|
|
||||||
&nice, &system, &idle);
|
|
||||||
|
|
||||||
free(line);
|
|
||||||
line = NULL;
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
if (vals != 5 || size == cpus) {
|
|
||||||
if (vals != 5) {
|
|
||||||
ALOGE("%s: failed to read CPU information from file: %s", __func__,
|
|
||||||
strerror(errno));
|
|
||||||
} else {
|
|
||||||
ALOGE("/proc/stat file has incorrect format.");
|
|
||||||
}
|
|
||||||
fclose(file);
|
|
||||||
return errno ? -errno : -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
active = user + nice + system;
|
|
||||||
total = active + idle;
|
|
||||||
|
|
||||||
// Read online CPU information.
|
|
||||||
snprintf(file_name, MAX_LENGTH, CPU_ONLINE_FILE_FORMAT, cpu_num);
|
|
||||||
cpu_file = fopen(file_name, "r");
|
|
||||||
online = 0;
|
|
||||||
if (cpu_file == NULL) {
|
|
||||||
ALOGE("%s: failed to open file: %s (%s)", __func__, file_name, strerror(errno));
|
|
||||||
fclose(file);
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
if (1 != fscanf(cpu_file, "%d", &online)) {
|
|
||||||
ALOGE("%s: failed to read CPU online information from file: %s (%s)", __func__,
|
|
||||||
file_name, strerror(errno));
|
|
||||||
fclose(file);
|
|
||||||
fclose(cpu_file);
|
|
||||||
return errno ? -errno : -EIO;
|
|
||||||
}
|
|
||||||
fclose(cpu_file);
|
|
||||||
|
|
||||||
list[size] = (cpu_usage_t) {
|
|
||||||
.name = get_cpu_label(size),
|
|
||||||
.active = active,
|
|
||||||
.total = total,
|
|
||||||
.is_online = online
|
|
||||||
};
|
|
||||||
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
if (size != cpus) {
|
|
||||||
ALOGE("/proc/stat file has incorrect format.");
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cpus;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct hw_module_methods_t thermal_module_methods = {
|
|
||||||
.open = NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
thermal_module_t HAL_MODULE_INFO_SYM = {
|
|
||||||
.common = {
|
|
||||||
.tag = HARDWARE_MODULE_TAG,
|
|
||||||
.module_api_version = THERMAL_HARDWARE_MODULE_API_VERSION_0_1,
|
|
||||||
.hal_api_version = HARDWARE_HAL_API_VERSION,
|
|
||||||
.id = THERMAL_HARDWARE_MODULE_ID,
|
|
||||||
.name = "Thermal HAL",
|
|
||||||
.author = "The Android Open Source Project",
|
|
||||||
.methods = &thermal_module_methods,
|
|
||||||
},
|
|
||||||
.getTemperatures = get_temperatures,
|
|
||||||
.getCpuUsages = get_cpu_usages,
|
|
||||||
};
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
ifeq ($(BOARD_VNDK_VERSION),)
|
|
||||||
$(warning ************* BOARD VNDK is not enabled - compiling vndk-sp ***************************)
|
|
||||||
LOCAL_PATH := $(call my-dir)
|
|
||||||
|
|
||||||
include $(LOCAL_PATH)/vndk-sp-libs.mk
|
|
||||||
|
|
||||||
vndk_sp_dir := vndk-sp-$(PLATFORM_VNDK_VERSION)
|
|
||||||
|
|
||||||
define define-vndk-lib
|
|
||||||
include $$(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := $1.$2
|
|
||||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
||||||
LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so
|
|
||||||
LOCAL_STRIP_MODULE := false
|
|
||||||
LOCAL_MULTILIB := first
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_INSTALLED_MODULE_STEM := $1.so
|
|
||||||
LOCAL_MODULE_SUFFIX := .so
|
|
||||||
LOCAL_MODULE_RELATIVE_PATH := $3
|
|
||||||
LOCAL_VENDOR_MODULE := $4
|
|
||||||
include $$(BUILD_PREBUILT)
|
|
||||||
|
|
||||||
ifneq ($$(TARGET_2ND_ARCH),)
|
|
||||||
ifneq ($$(TARGET_TRANSLATE_2ND_ARCH),true)
|
|
||||||
include $$(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := $1.$2
|
|
||||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
|
||||||
LOCAL_PREBUILT_MODULE_FILE := $$($$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so
|
|
||||||
LOCAL_STRIP_MODULE := false
|
|
||||||
LOCAL_MULTILIB := 32
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_INSTALLED_MODULE_STEM := $1.so
|
|
||||||
LOCAL_MODULE_SUFFIX := .so
|
|
||||||
LOCAL_MODULE_RELATIVE_PATH := $3
|
|
||||||
LOCAL_VENDOR_MODULE := $4
|
|
||||||
include $$(BUILD_PREBUILT)
|
|
||||||
endif # TARGET_TRANSLATE_2ND_ARCH is not true
|
|
||||||
endif # TARGET_2ND_ARCH is not empty
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(foreach lib,$(VNDK_SP_LIBRARIES),\
|
|
||||||
$(eval $(call define-vndk-lib,$(lib),vndk-sp-gen,$(vndk_sp_dir),)))
|
|
||||||
$(foreach lib,$(EXTRA_VENDOR_LIBRARIES),\
|
|
||||||
$(eval $(call define-vndk-lib,$(lib),vndk-ext-gen,,true)))
|
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := vndk-sp
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
LOCAL_REQUIRED_MODULES := \
|
|
||||||
$(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) \
|
|
||||||
$(addsuffix .vndk-ext-gen,$(EXTRA_VENDOR_LIBRARIES))
|
|
||||||
include $(BUILD_PHONY_PACKAGE)
|
|
||||||
|
|
||||||
vndk_sp_dir :=
|
|
||||||
endif
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
VNDK_SP_LIBRARIES := \
|
|
||||||
android.hardware.graphics.allocator@2.0 \
|
|
||||||
android.hardware.graphics.mapper@2.0 \
|
|
||||||
android.hardware.graphics.mapper@2.1 \
|
|
||||||
android.hardware.graphics.common@1.0 \
|
|
||||||
android.hardware.graphics.common@1.1 \
|
|
||||||
android.hardware.renderscript@1.0 \
|
|
||||||
android.hidl.base@1.0 \
|
|
||||||
android.hidl.memory@1.0 \
|
|
||||||
libRSCpuRef \
|
|
||||||
libRSDriver \
|
|
||||||
libRS_internal \
|
|
||||||
libbacktrace \
|
|
||||||
libbase \
|
|
||||||
libbcinfo \
|
|
||||||
libblas \
|
|
||||||
libc++ \
|
|
||||||
libcompiler_rt \
|
|
||||||
libcutils \
|
|
||||||
libft2 \
|
|
||||||
libhardware \
|
|
||||||
libhidlbase \
|
|
||||||
libhidlmemory \
|
|
||||||
libhidltransport \
|
|
||||||
libhwbinder \
|
|
||||||
libion \
|
|
||||||
liblzma \
|
|
||||||
libpng \
|
|
||||||
libunwind \
|
|
||||||
libunwindstack\
|
|
||||||
libutils \
|
|
||||||
libutilscallstack \
|
|
||||||
libdexfile \
|
|
||||||
|
|
||||||
EXTRA_VENDOR_LIBRARIES := \
|
|
||||||
vendor.display.config@1.0 \
|
|
||||||
vendor.display.config@1.1 \
|
|
||||||
vendor.display.config@1.2 \
|
|
||||||
vendor.nxp.nxpnfc@1.0 \
|
|
||||||
vendor.qti.hardware.camera.device@1.0
|
|
||||||
Reference in New Issue
Block a user