From 2decc6661eb87a36d64a4aaa9ce7c5a0cda27563 Mon Sep 17 00:00:00 2001 From: Luofan Chen Date: Fri, 5 May 2023 10:54:14 +0800 Subject: [PATCH] soong: Add TARGET_HEALTH_CHARGING_CONTROL related configs To specify the charging control allowed modes: TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_{BYPASS,DEADLINE,TOGGLE}, To specify the charging control paths: TARGET_HEALTH_CHARGING_CONTROL_{CHARGING_PATH,DEADLINE_PATH}, To specify data written to TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH: TARGET_HEALTH_CHARGING_CONTROL_CHARGING_{ENABLE,DISABLE} Change-Id: I88831c84966f82648c8ca60de5abb34416140f6c --- build/soong/Android.bp | 45 ++++++++++++++++++++++++++++++++++++++ config/BoardConfigSoong.mk | 19 ++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/build/soong/Android.bp b/build/soong/Android.bp index e53586f0..72f7b8b6 100644 --- a/build/soong/Android.bp +++ b/build/soong/Android.bp @@ -205,6 +205,51 @@ egl_display_array { }, } +soong_config_module_type { + name: "health_charging_control", + module_type: "cc_defaults", + config_namespace: "lineageGlobalVars", + bool_variables: [ + "target_health_charging_control_supports_toggle", + "target_health_charging_control_supports_bypass", + "target_health_charging_control_supports_deadline", + ], + value_variables: [ + "target_health_charging_control_charging_path", + "target_health_charging_control_charging_enabled", + "target_health_charging_control_charging_disabled", + "target_health_charging_control_deadline_path", + ], + properties: ["cppflags"], +} + +health_charging_control { + name: "health_charging_control_defaults", + soong_config_variables: { + target_health_charging_control_supports_toggle: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE"], + }, + target_health_charging_control_supports_bypass: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS"], + }, + target_health_charging_control_supports_deadline: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE"], + }, + target_health_charging_control_charging_path: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_PATH=\"%s\""], + }, + target_health_charging_control_charging_enabled: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_ENABLED=\"%s\""], + }, + target_health_charging_control_charging_disabled: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_DISABLED=\"%s\""], + }, + target_health_charging_control_deadline_path: { + cppflags: ["-DHEALTH_CHARGING_CONTROL_DEADLINE_PATH=\"%s\""], + }, + }, +} + // NVIDIA specific config modules soong_config_module_type { name: "nvidia_enhancements", diff --git a/config/BoardConfigSoong.mk b/config/BoardConfigSoong.mk index 35da6a1a..c849c979 100644 --- a/config/BoardConfigSoong.mk +++ b/config/BoardConfigSoong.mk @@ -31,6 +31,13 @@ SOONG_CONFIG_lineageGlobalVars += \ additional_gralloc_10_usage_bits \ bootloader_message_offset \ gralloc_handle_has_reserved_size \ + target_health_charging_control_charging_path \ + target_health_charging_control_charging_enabled \ + target_health_charging_control_charging_disabled \ + target_health_charging_control_deadline_path \ + target_health_charging_control_supports_bypass \ + target_health_charging_control_supports_deadline \ + target_health_charging_control_supports_toggle \ target_init_vendor_lib \ target_ld_shim_libs \ target_surfaceflinger_udfps_lib \ @@ -65,6 +72,11 @@ SOONG_CONFIG_lineageQcomVars_uses_pre_uplink_features_netmgrd := $(TARGET_USES_P BOOTLOADER_MESSAGE_OFFSET ?= 0 TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS ?= 0 TARGET_GRALLOC_HANDLE_HAS_RESERVED_SIZE ?= false +TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED ?= 1 +TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED ?= 0 +TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS ?= true +TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE ?= false +TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE ?= true TARGET_INIT_VENDOR_LIB ?= vendor_init TARGET_SURFACEFLINGER_UDFPS_LIB ?= surfaceflinger_udfps_lib TARGET_TRUST_USB_CONTROL_PATH ?= /proc/sys/kernel/deny_new_usb @@ -74,6 +86,13 @@ TARGET_TRUST_USB_CONTROL_DISABLE ?= 0 # Soong value variables SOONG_CONFIG_lineageGlobalVars_additional_gralloc_10_usage_bits := $(TARGET_ADDITIONAL_GRALLOC_10_USAGE_BITS) SOONG_CONFIG_lineageGlobalVars_bootloader_message_offset := $(BOOTLOADER_MESSAGE_OFFSET) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_charging_path := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_charging_enabled := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_charging_disabled := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_deadline_path := $(TARGET_HEALTH_CHARGING_CONTROL_DEADLINE_PATH) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_supports_bypass := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_supports_deadline := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE) +SOONG_CONFIG_lineageGlobalVars_target_health_charging_control_supports_toggle := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE) SOONG_CONFIG_lineageGlobalVars_target_init_vendor_lib := $(TARGET_INIT_VENDOR_LIB) SOONG_CONFIG_lineageGlobalVars_target_ld_shim_libs := $(subst $(space),:,$(TARGET_LD_SHIM_LIBS)) SOONG_CONFIG_lineageGlobalVars_target_surfaceflinger_udfps_lib := $(TARGET_SURFACEFLINGER_UDFPS_LIB)