1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#define LOG_TAG "VrHALImpl" 18 19#include <cutils/log.h> 20#include <cutils/properties.h> 21 22#include <hardware/vr.h> 23#include <hardware/hardware.h> 24 25static void restart_thermal_engine() { 26 if (property_set("ctl.restart", "vendor.thermal-engine")) { 27 ALOGE("%s: couldn't set a system property, " 28 "ctl.restart.", __FUNCTION__); 29 } 30} 31 32static void vr_init(struct vr_module *module) { 33 // NOOP 34} 35 36static void vr_set_vr_mode(struct vr_module *module, bool enabled) { 37 if (enabled) { 38 if (property_set("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine-vr.conf")) { 39 ALOGE("%s: couldn't set a system property, " 40 "sys.qcom.thermalcfg.", __FUNCTION__); 41 } 42 } else { 43 if (property_set("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine.conf")) { 44 ALOGE("%s: couldn't set a system property, " 45 "sys.qcom.thermalcfg.", __FUNCTION__); 46 } 47 } 48 restart_thermal_engine(); 49} 50 51static struct hw_module_methods_t vr_module_methods = { 52 .open = NULL, // There are no devices for this HAL interface. 53}; 54 55 56vr_module_t HAL_MODULE_INFO_SYM = { 57 .common = { 58 .tag = HARDWARE_MODULE_TAG, 59 .module_api_version = VR_MODULE_API_VERSION_1_0, 60 .hal_api_version = HARDWARE_HAL_API_VERSION, 61 .id = VR_HARDWARE_MODULE_ID, 62 .name = "Marlin / Sailfish VR HAL", 63 .author = "The Android Open Source Project", 64 .methods = &vr_module_methods, 65 }, 66 67 .init = vr_init, 68 .set_vr_mode = vr_set_vr_mode, 69}; 70