common: vendor: Introduce charging module

* Based upon LA.UM.9.12.r1-15100-SMxx50.QSSI13.0,
  This module contains userspace charging blobs
  typically provided to OEMs as prebuilts.

[TODO: Evaluate enabling this component on ALL]
Change-Id: I380ac70e40bc7dc8317d13ed7bee01e8c1125a68
Signed-off-by: electimon <electimon@gmail.com>
This commit is contained in:
electimon 2023-02-23 08:49:20 +08:00
parent 7f06544cb0
commit 567a41944c
6 changed files with 126 additions and 0 deletions

View File

@ -61,6 +61,10 @@ ifneq (,$(filter bt, $(TARGET_COMMON_QTI_COMPONENTS)))
include $(QCOM_COMMON_PATH)/vendor/bt/qti-bt.mk
endif
ifneq (,$(filter charging, $(TARGET_COMMON_QTI_COMPONENTS)))
include $(QCOM_COMMON_PATH)/vendor/charging/qti-charging.mk
endif
ifneq (,$(filter display, $(TARGET_COMMON_QTI_COMPONENTS)))
include $(QCOM_COMMON_PATH)/system/display/qti-display.mk
include $(QCOM_COMMON_PATH)/vendor/display/qti-display.mk

31
vendor/charging/extract-files.sh vendored Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# Copyright (C) 2018-2019 The LineageOS Project
# Copyright (C) 2020 Paranoid Android
#
# 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.
#
# If we're being sourced by the common script that we called,
# stop right here. No need to go down the rabbit hole.
if [ "${BASH_SOURCE[0]}" != "${0}" ]; then
return
fi
set -e
# Required!
export COMPONENT=charging
export VENDOR=qcom/common/vendor
"../extract-files.sh" "$@"

4
vendor/charging/proprietary-files.txt vendored Normal file
View File

@ -0,0 +1,4 @@
# Charging
vendor/bin/hvdcp_opti
vendor/bin/init.qti.chg_policy.sh
vendor/etc/charger_fstab.qti

19
vendor/charging/qti-charging.mk vendored Normal file
View File

@ -0,0 +1,19 @@
# Copyright (C) 2023 Paranoid Android
#
# 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.
PRODUCT_COPY_FILES += \
device/qcom/common/vendor/charging/vendor.qti.hardware.charger_monitor@1.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.qti.hardware.charger_monitor@1.0-service.rc
# Get non-open-source specific aspects.
$(call inherit-product-if-exists, vendor/qcom/common/vendor/charging/charging-vendor.mk)

25
vendor/charging/setup-makefiles.sh vendored Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
#
# Copyright (C) 2018-2019 The LineageOS Project
# Copyright (C) 2020 Paranoid Android
#
# 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.
#
set -e
# Required!
export COMPONENT=charging
export VENDOR=qcom/common/vendor
"../setup-makefiles.sh" "$@"

View File

@ -0,0 +1,43 @@
# Copyright (c) 2019-2020, Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
#
service vendor.hvdcp_opti /vendor/bin/hvdcp_opti
class main
user root
group system wakelock
capabilities BLOCK_SUSPEND WAKE_ALARM
disabled
service vendor.qti-chg-policy-sh /vendor/bin/init.qti.chg_policy.sh
class core
user root
oneshot
disabled
on boot
enable vendor.qti-chg-policy-sh
start vendor.qti-chg-policy-sh
on charger
chown radio wakelock /sys/power/wake_lock
chmod 0660 /sys/power/wake_lock
chown radio wakelock /sys/power/wake_unlock
chmod 0660 /sys/power/wake_unlock
mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system
mount_all /vendor/etc/charger_fstab.qti --early
enable vendor.qti-chg-policy-sh
start vendor.qti-chg-policy-sh
on property:persist.vendor.hvdcp_opti.start=2
rmdir /mnt/vendor/persist/hvdcp_opti
setprop persist.vendor.hvdcp_opti.start 0
on property:persist.vendor.hvdcp_opti.start=1
mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system
enable vendor.hvdcp_opti
start vendor.hvdcp_opti
setprop persist.vendor.hvdcp_opti.start 0