1094332d3Sopenharmony_ci# Copyright (c) 2022-2023 Huawei Device Co., Ltd. 2094332d3Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3094332d3Sopenharmony_ci# you may not use this file except in compliance with the License. 4094332d3Sopenharmony_ci# You may obtain a copy of the License at 5094332d3Sopenharmony_ci# 6094332d3Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7094332d3Sopenharmony_ci# 8094332d3Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9094332d3Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10094332d3Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11094332d3Sopenharmony_ci# See the License for the specific language governing permissions and 12094332d3Sopenharmony_ci# limitations under the License. 13094332d3Sopenharmony_ciimport("//build/ohos.gni") 14094332d3Sopenharmony_ciimport("../../power.gni") 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ciohos_shared_library("libpower_interface_service_1.2") { 17094332d3Sopenharmony_ci include_dirs = [ "../../utils/include" ] 18094332d3Sopenharmony_ci sources = [ 19094332d3Sopenharmony_ci "../../utils/power_xcollie.cpp", 20094332d3Sopenharmony_ci "src/power_interface_impl.cpp", 21094332d3Sopenharmony_ci "src/running_lock_counter.cpp", 22094332d3Sopenharmony_ci "src/running_lock_impl.cpp", 23094332d3Sopenharmony_ci "src/running_lock_timer_handler.cpp", 24094332d3Sopenharmony_ci "src/system_operation.cpp", 25094332d3Sopenharmony_ci ] 26094332d3Sopenharmony_ci 27094332d3Sopenharmony_ci external_deps = [ 28094332d3Sopenharmony_ci "drivers_interface_power:libpower_stub_1.2", 29094332d3Sopenharmony_ci "hdf_core:libhdf_host", 30094332d3Sopenharmony_ci "hdf_core:libhdf_utils", 31094332d3Sopenharmony_ci "hilog:libhilog", 32094332d3Sopenharmony_ci "ipc:ipc_single", 33094332d3Sopenharmony_ci "libxml2:libxml2", 34094332d3Sopenharmony_ci ] 35094332d3Sopenharmony_ci 36094332d3Sopenharmony_ci defines = [] 37094332d3Sopenharmony_ci if (has_power_c_utils_part) { 38094332d3Sopenharmony_ci external_deps += [ "c_utils:utils" ] 39094332d3Sopenharmony_ci } 40094332d3Sopenharmony_ci if (has_power_hisysevent_part) { 41094332d3Sopenharmony_ci external_deps += [ "hisysevent:libhisysevent" ] 42094332d3Sopenharmony_ci } 43094332d3Sopenharmony_ci 44094332d3Sopenharmony_ci # xcollie has a bug, disable it 45094332d3Sopenharmony_ci has_power_xcollie_part = false 46094332d3Sopenharmony_ci if (has_power_xcollie_part) { 47094332d3Sopenharmony_ci external_deps += [ "hicollie:libhicollie" ] 48094332d3Sopenharmony_ci defines += [ "HICOLLIE_ENABLE" ] 49094332d3Sopenharmony_ci } 50094332d3Sopenharmony_ci 51094332d3Sopenharmony_ci if (drivers_peripheral_power_wakeup_cause_path) { 52094332d3Sopenharmony_ci sources += [ "src/power_config.cpp" ] 53094332d3Sopenharmony_ci 54094332d3Sopenharmony_ci external_deps += [ "jsoncpp:jsoncpp" ] 55094332d3Sopenharmony_ci 56094332d3Sopenharmony_ci if (has_power_config_policy_part) { 57094332d3Sopenharmony_ci external_deps += [ "config_policy:configpolicy_util" ] 58094332d3Sopenharmony_ci } 59094332d3Sopenharmony_ci 60094332d3Sopenharmony_ci defines += [ "DRIVER_PERIPHERAL_POWER_WAKEUP_CAUSE_PATH" ] 61094332d3Sopenharmony_ci } 62094332d3Sopenharmony_ci 63094332d3Sopenharmony_ci if (drivers_peripheral_power_suspend_with_tag) { 64094332d3Sopenharmony_ci defines += [ "DRIVER_PERIPHERAL_POWER_SUSPEND_WITH_TAG" ] 65094332d3Sopenharmony_ci } 66094332d3Sopenharmony_ci 67094332d3Sopenharmony_ci if (drivers_peripheral_power_faster_retry_of_sleep) { 68094332d3Sopenharmony_ci defines += [ "FASTER_RETRY_OF_SLEEP" ] 69094332d3Sopenharmony_ci } 70094332d3Sopenharmony_ci 71094332d3Sopenharmony_ci if (drivers_peripheral_power_enable_s4) { 72094332d3Sopenharmony_ci sources += [ "src/hibernate.cpp" ] 73094332d3Sopenharmony_ci defines += [ "DRIVERS_PERIPHERAL_POWER_ENABLE_S4" ] 74094332d3Sopenharmony_ci } 75094332d3Sopenharmony_ci 76094332d3Sopenharmony_ci if (drivers_peripheral_power_slower_retry_of_sleep) { 77094332d3Sopenharmony_ci defines += [ "SLOWER_RETRY_OF_SLEEP" ] 78094332d3Sopenharmony_ci } 79094332d3Sopenharmony_ci 80094332d3Sopenharmony_ci install_images = [ chipset_base_dir ] 81094332d3Sopenharmony_ci subsystem_name = "hdf" 82094332d3Sopenharmony_ci part_name = "drivers_peripheral_power" 83094332d3Sopenharmony_ci} 84094332d3Sopenharmony_ci 85094332d3Sopenharmony_ci############################################################################################## 86094332d3Sopenharmony_ci 87094332d3Sopenharmony_ciohos_shared_library("libpower_driver") { 88094332d3Sopenharmony_ci sources = [ "src/power_interface_driver.cpp" ] 89094332d3Sopenharmony_ci 90094332d3Sopenharmony_ci external_deps = [ 91094332d3Sopenharmony_ci "drivers_interface_power:libpower_stub_1.2", 92094332d3Sopenharmony_ci "hdf_core:libhdf_host", 93094332d3Sopenharmony_ci "hdf_core:libhdf_ipc_adapter", 94094332d3Sopenharmony_ci "hdf_core:libhdf_utils", 95094332d3Sopenharmony_ci "hdf_core:libhdi", 96094332d3Sopenharmony_ci "hilog:libhilog", 97094332d3Sopenharmony_ci "ipc:ipc_single", 98094332d3Sopenharmony_ci ] 99094332d3Sopenharmony_ci if (has_power_c_utils_part) { 100094332d3Sopenharmony_ci external_deps += [ "c_utils:utils" ] 101094332d3Sopenharmony_ci } 102094332d3Sopenharmony_ci 103094332d3Sopenharmony_ci shlib_type = "hdi" 104094332d3Sopenharmony_ci install_images = [ chipset_base_dir ] 105094332d3Sopenharmony_ci subsystem_name = "hdf" 106094332d3Sopenharmony_ci part_name = "drivers_peripheral_power" 107094332d3Sopenharmony_ci} 108094332d3Sopenharmony_ci 109094332d3Sopenharmony_cigroup("hdf_power") { 110094332d3Sopenharmony_ci deps = [ 111094332d3Sopenharmony_ci ":libpower_driver", 112094332d3Sopenharmony_ci ":libpower_interface_service_1.2", 113094332d3Sopenharmony_ci ] 114094332d3Sopenharmony_ci 115094332d3Sopenharmony_ci if (drivers_peripheral_power_wakeup_cause_path) { 116094332d3Sopenharmony_ci deps += [ "profile:power_hdi_service_config" ] 117094332d3Sopenharmony_ci } 118094332d3Sopenharmony_ci} 119