1# Copyright (c) 2022-2025 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13import("//build/ohos.gni") 14import("../../power.gni") 15 16ohos_shared_library("libpower_interface_service_1.3") { 17 include_dirs = [ "../../utils/include" ] 18 sources = [ 19 "../../utils/power_xcollie.cpp", 20 "src/power_config.cpp", 21 "src/power_interface_impl.cpp", 22 "src/running_lock_counter.cpp", 23 "src/running_lock_impl.cpp", 24 "src/running_lock_timer_handler.cpp", 25 "src/system_operation.cpp", 26 ] 27 28 external_deps = [ 29 "cJSON:cjson", 30 "drivers_interface_power:libpower_stub_1.2", 31 "drivers_interface_power:libpower_stub_1.3", 32 "hdf_core:libhdf_host", 33 "hdf_core:libhdf_utils", 34 "hilog:libhilog", 35 "ipc:ipc_single", 36 "libxml2:libxml2", 37 ] 38 39 defines = [] 40 if (drivers_peripheral_power_c_utils) { 41 external_deps += [ "c_utils:utils" ] 42 } 43 44 # xcollie has a bug, disable it 45 if (drivers_peripheral_power_hicollie) { 46 external_deps += [ "hicollie:libhicollie" ] 47 defines += [ "HICOLLIE_ENABLE" ] 48 } 49 50 if (drivers_peripheral_power_config_policy) { 51 external_deps += [ "config_policy:configpolicy_util" ] 52 } 53 54 if (drivers_peripheral_power_wakeup_cause_path) { 55 defines += [ "DRIVER_PERIPHERAL_POWER_WAKEUP_CAUSE_PATH" ] 56 } 57 58 if (drivers_peripheral_power_suspend_with_tag) { 59 defines += [ "DRIVER_PERIPHERAL_POWER_SUSPEND_WITH_TAG" ] 60 } 61 62 if (drivers_peripheral_power_faster_retry_of_sleep) { 63 defines += [ "FASTER_RETRY_OF_SLEEP" ] 64 } 65 66 if (drivers_peripheral_power_enable_s4) { 67 sources += [ "src/hibernate.cpp" ] 68 defines += [ "DRIVERS_PERIPHERAL_POWER_ENABLE_S4" ] 69 } 70 71 if (drivers_peripheral_power_slower_retry_of_sleep) { 72 defines += [ "SLOWER_RETRY_OF_SLEEP" ] 73 } 74 75 if (drivers_peripheral_power_host_sched_priority) { 76 defines += [ "DRIVERS_PERIPHERAL_POWER_HOST_SCHED_PRIORITY" ] 77 } 78 79 install_images = [ chipset_base_dir ] 80 subsystem_name = "hdf" 81 part_name = "drivers_peripheral_power" 82} 83 84############################################################################################## 85 86ohos_shared_library("libpower_driver") { 87 sources = [ "src/power_interface_driver.cpp" ] 88 89 external_deps = [ 90 "drivers_interface_power:libpower_stub_1.2", 91 "drivers_interface_power:libpower_stub_1.3", 92 "hdf_core:libhdf_host", 93 "hdf_core:libhdf_ipc_adapter", 94 "hdf_core:libhdf_utils", 95 "hdf_core:libhdi", 96 "hilog:libhilog", 97 "ipc:ipc_single", 98 ] 99 if (drivers_peripheral_power_c_utils) { 100 external_deps += [ "c_utils:utils" ] 101 } 102 103 shlib_type = "hdi" 104 install_images = [ chipset_base_dir ] 105 subsystem_name = "hdf" 106 part_name = "drivers_peripheral_power" 107} 108 109group("hdf_power") { 110 deps = [ 111 ":libpower_driver", 112 ":libpower_interface_service_1.3", 113 ] 114 115 if (drivers_peripheral_power_wakeup_cause_path) { 116 deps += [ "profile:power_hdi_service_config" ] 117 } 118} 119