sm6375-common: Import vendor files for the Linux 6.1 port

Extracted from malmo_g W1UOS36H.35-39-8 and device-specific compatibility overrides. Device extraction scripts preserve the build compatibility fixups.
This commit is contained in:
TheImposter65 committed 2026-11-07 20:16:21 +00:00
commit 5d0291f99e
936 files changed
+60890

No files matched your search

Vendored Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Vendored Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+118
View File
@@ -0,0 +1,118 @@
#! /vendor/bin/sh
# Copyright (c) 2013-2014, 2019 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# start ril-daemon only for targets on which radio is present
#
baseband=`getprop ro.baseband`
sgltecsfb=`getprop persist.vendor.radio.sglte_csfb`
datamode=`getprop persist.vendor.data.mode`
low_ram=`getprop ro.config.low_ram`
case "$baseband" in
"apq" | "sda" | "qcs" )
setprop ro.vendor.radio.noril yes
stop vendor.ril-daemon
stop vendor.qcrild
stop vendor.qcrild2
stop vendor.qcrild3
esac
case "$baseband" in
"msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3" | "sdm" | "sdx" | "sm6")
# start qcrild only for targets on which modem is present
# modemvalue 0x0 indicates Modem online
# modemvalue 0x1 indicates Modem IP is not functional or disabled
# modemvalue 0x2 indicates Modem offline
modemvalue="0x0"
if [ -f /sys/devices/soc0/modem ]; then
modemvalue=`cat /sys/devices/soc0/modem`
fi
if [ $modemvalue != "0x1" ] && [ $modemvalue != "0x2" ]; then
start vendor.qcrild
case "$baseband" in
"svlte2a" | "csfb")
start qmiproxy
;;
"sglte" | "sglte2" )
if [ "x$sgltecsfb" != "xtrue" ]; then
start qmiproxy
else
setprop persist.vendor.radio.voice.modem.index 0
fi
;;
esac
multisim=`getprop persist.radio.multisim.config`
if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then
start vendor.qcrild2
elif [ "$multisim" = "tsts" ]; then
start vendor.qcrild2
start vendor.qcrild3
fi
case "$datamode" in
"tethered")
start vendor.dataqti
if [ "$low_ram" != "true" ]; then
start vendor.dataadpl
fi
;;
"concurrent")
start vendor.dataqti
if [ "$low_ram" != "true" ]; then
start vendor.dataadpl
fi
;;
*)
;;
esac
else
setprop ro.vendor.radio.noril yes
stop vendor.qcrild
stop vendor.qcrild2
stop vendor.qcrild3
fi
esac
#
# Allow persistent faking of bms
# User needs to set fake bms charge in persist.vendor.bms.fake_batt_capacity
#
fake_batt_capacity=`getprop persist.vendor.bms.fake_batt_capacity`
case "$fake_batt_capacity" in
"") ;; #Do nothing here
* )
echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity
;;
esac
+35
View File
@@ -0,0 +1,35 @@
#! /vendor/bin/sh
# Copyright (c) 2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
country=`getprop wlan.crda.country`
# crda takes input in COUNTRY environment variable
if [ $country != "" ]
then
COUNTRY="$country" /system/bin/crda
fi
+30
View File
@@ -0,0 +1,30 @@
#!/vendor/bin/sh
debug=$(getprop ro.boot.gbdebug 2> /dev/null)
bootmode=$(getprop ro.bootmode 2> /dev/null)
# If androidboot.gbdebug is set on command line, skip inserting
# the pre-installed modules.
if [ "$debug" == "1" ]; then
return 0
fi
insmod /vendor/lib/modules/greybus.ko
# Only support PTP and BATTERY in charge-only mode
if [ "$bootmode" == "charger" ]; then
insmod /vendor/lib/modules/gb-mods.ko
insmod /vendor/lib/modules/gb-battery.ko
insmod /vendor/lib/modules/gb-ptp.ko
return 0
fi
gbmods="/vendor/lib/modules/gb-*"
for mod in $gbmods
do
insmod $mod
done
insmod /vendor/lib/modules/v4l2-hal.ko
start vendor.mods_camd
+162
View File
@@ -0,0 +1,162 @@
#=============================================================================
# Copyright (c) 2020-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
rev=`cat /sys/devices/soc0/revision`
if [ -d /proc/sys/walt ]; then
echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable
echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
echo 0 > /proc/sys/walt/sched_sbt_delay_windows
echo 0 > /proc/sys/walt/sched_sbt_pause_cpus
echo 65 > /proc/sys/walt/sched_downmigrate
echo 71 > /proc/sys/walt/sched_upmigrate
echo 85 > /proc/sys/walt/sched_group_downmigrate
echo 100 > /proc/sys/walt/sched_group_upmigrate
echo 1 > /proc/sys/walt/sched_walt_rotate_big_tasks
echo 400000000 > /proc/sys/walt/sched_coloc_downmigrate_ns
echo 16000000 16000000 16000000 16000000 16000000 16000000 16000000 16000000 > /proc/sys/walt/sched_coloc_busy_hyst_cpu_ns
echo 0 > /proc/sys/walt/sched_coloc_busy_hysteresis_enable_cpus
echo 10 10 10 10 10 10 10 10 > /proc/sys/walt/sched_coloc_busy_hyst_cpu_busy_pct
echo 8500000 8500000 8500000 8500000 5000000 5000000 5000000 5000000 > /proc/sys/walt/sched_util_busy_hyst_cpu_ns
echo 255 > /proc/sys/walt/sched_util_busy_hysteresis_enable_cpus
echo 1 1 1 1 15 15 15 15 > /proc/sys/walt/sched_util_busy_hyst_cpu_util
echo 40 > /proc/sys/walt/sched_cluster_util_thres_pct
echo 30 > /proc/sys/walt/sched_idle_enough
echo 10 > /proc/sys/walt/sched_ed_boost
# set the threshold for low latency task boost feature which prioritize
# binder activity tasks
echo 325 > /proc/sys/walt/walt_low_latency_task_threshold
# Turn off scheduler boost at the end
echo 0 > /proc/sys/walt/sched_boost
# configure input boost settings
echo 1113600 0 0 0 0 0 0 0 > /proc/sys/walt/input_boost/input_boost_freq
echo 120 > /proc/sys/walt/input_boost/input_boost_ms
echo "walt" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo "walt" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/up_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/up_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/pl
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/pl
echo 680000 > /sys/devices/system/cpu/cpufreq/policy0/walt/rtg_boost_freq
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/rtg_boost_freq
echo 1113600 > /sys/devices/system/cpu/cpufreq/policy0/walt/hispeed_freq
echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/walt/hispeed_freq
else
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 1 > /proc/sys/kernel/sched_pelt_multiplier
fi
echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 691200 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
# Reset the RT boost, which is 1024 (max) by default.
echo 0 > /proc/sys/kernel/sched_util_clamp_min_rt_default
# cpuset parameters
# IKSWU-96565 init.mmi.product.rc was overwritten
# echo 0-5 > /dev/cpuset/background/cpus
# echo 0-5 > /dev/cpuset/system-background/cpus
# configure bus-dcvs
bus_dcvs="/sys/devices/system/cpu/bus_dcvs"
for device in $bus_dcvs/*
do
if [ -e $device/boost_freq ]; then
cat $device/hw_min_freq > $device/boost_freq
fi
done
for ddrbw in $bus_dcvs/DDR/*bwmon-ddr
do
echo "1720 2086 2597 2929 3879 5161 5931 6881 7980" > $ddrbw/mbps_zones
echo 4 > $ddrbw/sample_ms
echo 68 > $ddrbw/io_percent
echo 20 > $ddrbw/hist_memory
echo 0 > $ddrbw/hyst_length
echo 1 > $ddrbw/idle_length
echo 80 > $ddrbw/down_thres
echo 0 > $ddrbw/guard_band_mbps
echo 250 > $ddrbw/up_scale
echo 1600 > $ddrbw/idle_mbps
echo 1804000 > $ddrbw/max_freq
echo 40 > $ddrbw/window_ms
done
for l3gold in $bus_dcvs/L3/*gold
do
echo 4000 > $l3gold/ipm_ceil
done
echo s2idle > /sys/power/mem_sleep
if [ -e /sys/devices/system/cpu/qcom_lpm/parameters/sleep_disabled ]; then
echo N > /sys/devices/system/cpu/qcom_lpm/parameters/sleep_disabled
fi
# Change console log level as per console config property
console_config=`getprop persist.vendor.console.silent.config`
case "$console_config" in
"1")
echo "Enable console config to $console_config"
echo 0 > /proc/sys/kernel/printk
;;
*)
echo "Enable console config to $console_config"
;;
esac
# set rq_affinity to 2 on ufs devices
for sd in /sys/block/sd*/queue/rq_affinity
do
echo 2 > $sd
done
setprop vendor.post_boot.parsed 1
+158
View File
@@ -0,0 +1,158 @@
#=============================================================================
# Copyright (c) 2020-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
rev=`cat /sys/devices/soc0/revision`
if [ -d /proc/sys/walt ]; then
echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
echo 40 > /sys/devices/system/cpu/cpu0/core_ctl/busy_down_thres
echo 100 > /sys/devices/system/cpu/cpu0/core_ctl/offline_delay_ms
echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
echo 1 > /sys/devices/system/cpu/cpu0/core_ctl/enable
echo 0 > /sys/devices/system/cpu/cpu6/core_ctl/enable
echo 0 > /proc/sys/walt/sched_sbt_delay_windows
echo 0 > /proc/sys/walt/sched_sbt_pause_cpus
echo 65 > /proc/sys/walt/sched_downmigrate
echo 71 > /proc/sys/walt/sched_upmigrate
echo 85 > /proc/sys/walt/sched_group_downmigrate
echo 100 > /proc/sys/walt/sched_group_upmigrate
echo 1 > /proc/sys/walt/sched_walt_rotate_big_tasks
echo 400000000 > /proc/sys/walt/sched_coloc_downmigrate_ns
echo 16000000 16000000 16000000 16000000 16000000 16000000 16000000 16000000 > /proc/sys/walt/sched_coloc_busy_hyst_cpu_ns
echo 0 > /proc/sys/walt/sched_coloc_busy_hysteresis_enable_cpus
echo 10 10 10 10 10 10 10 10 > /proc/sys/walt/sched_coloc_busy_hyst_cpu_busy_pct
echo 8500000 8500000 8500000 8500000 5000000 5000000 5000000 5000000 > /proc/sys/walt/sched_util_busy_hyst_cpu_ns
echo 255 > /proc/sys/walt/sched_util_busy_hysteresis_enable_cpus
echo 1 1 1 1 15 15 15 15 > /proc/sys/walt/sched_util_busy_hyst_cpu_util
echo 40 > /proc/sys/walt/sched_cluster_util_thres_pct
echo 30 > /proc/sys/walt/sched_idle_enough
echo 10 > /proc/sys/walt/sched_ed_boost
# set the threshold for low latency task boost feature which prioritize
# binder activity tasks
echo 325 > /proc/sys/walt/walt_low_latency_task_threshold
# Turn off scheduler boost at the end
echo 0 > /proc/sys/walt/sched_boost
# configure input boost settings
echo 1113600 0 0 0 0 0 0 0 > /proc/sys/walt/input_boost/input_boost_freq
echo 120 > /proc/sys/walt/input_boost/input_boost_ms
echo "walt" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo "walt" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/up_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/down_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/up_rate_limit_us
echo 0 > /sys/devices/system/cpu/cpufreq/policy0/walt/pl
echo 0 > /sys/devices/system/cpu/cpufreq/policy6/walt/pl
echo 1113600 > /sys/devices/system/cpu/cpufreq/policy0/walt/hispeed_freq
echo 1228800 > /sys/devices/system/cpu/cpufreq/policy6/walt/hispeed_freq
else
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo "schedutil" > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
echo 1 > /proc/sys/kernel/sched_pelt_multiplier
fi
echo 576000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
echo 691200 > /sys/devices/system/cpu/cpufreq/policy6/scaling_min_freq
# Reset the RT boost, which is 1024 (max) by default.
echo 0 > /proc/sys/kernel/sched_util_clamp_min_rt_default
# cpuset parameters
echo 0-5 > /dev/cpuset/background/cpus
echo 0-5 > /dev/cpuset/system-background/cpus
# configure bus-dcvs
bus_dcvs="/sys/devices/system/cpu/bus_dcvs"
for device in $bus_dcvs/*
do
if [ -e $device/boost_freq ]; then
cat $device/hw_min_freq > $device/boost_freq
fi
done
for ddrbw in $bus_dcvs/DDR/*bwmon-ddr
do
echo "1720 2086 2597 2929 3879 5161 5931 6881 7980" > $ddrbw/mbps_zones
echo 4 > $ddrbw/sample_ms
echo 68 > $ddrbw/io_percent
echo 20 > $ddrbw/hist_memory
echo 0 > $ddrbw/hyst_length
echo 1 > $ddrbw/idle_length
echo 80 > $ddrbw/down_thres
echo 0 > $ddrbw/guard_band_mbps
echo 250 > $ddrbw/up_scale
echo 1600 > $ddrbw/idle_mbps
echo 1804000 > $ddrbw/max_freq
echo 40 > $ddrbw/window_ms
done
for l3gold in $bus_dcvs/L3/*gold
do
echo 4000 > $l3gold/ipm_ceil
done
echo s2idle > /sys/power/mem_sleep
if [ -e /sys/devices/system/cpu/qcom_lpm/parameters/sleep_disabled ]; then
echo N > /sys/devices/system/cpu/qcom_lpm/parameters/sleep_disabled
fi
# Change console log level as per console config property
console_config=`getprop persist.vendor.console.silent.config`
case "$console_config" in
"1")
echo "Enable console config to $console_config"
echo 0 > /proc/sys/kernel/printk
;;
*)
echo "Enable console config to $console_config"
;;
esac
# set rq_affinity to 2 on ufs devices
for sd in /sys/block/sd*/queue/rq_affinity
do
echo 2 > $sd
done
setprop vendor.post_boot.parsed 1
+204
View File
@@ -0,0 +1,204 @@
#=============================================================================
# Copyright (c) 2020-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
function configure_zram_parameters() {
# Moto liujg6: Skip this if we are using zram from fstab.
using_zram_from_fstab=`getprop ro.boot.using_zram_from_fstab`
if [ "$using_zram_from_fstab" == "true" ]; then
return
fi
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
low_ram=`getprop ro.config.low_ram`
# Zram disk - 75% for Go and < 2GB devices .
# For >2GB Non-Go devices, size = 50% of RAM size. Limit the size to 4GB.
# And enable lz4 zram compression for Go targets.
let RamSizeGB="( $MemTotal / 1048576 ) + 1"
diskSizeUnit=M
if [ $RamSizeGB -le 2 ]; then
let zRamSizeMB="( $RamSizeGB * 1024 ) * 3 / 4"
else
let zRamSizeMB="( $RamSizeGB * 1024 ) / 2"
fi
# use MB avoid 32 bit overflow
if [ $zRamSizeMB -gt 4096 ]; then
let zRamSizeMB=4096
fi
if [ "$low_ram" == "true" ]; then
echo lz4 > /sys/block/zram0/comp_algorithm
fi
if [ -f /sys/block/zram0/disksize ]; then
if [ -f /sys/block/zram0/use_dedup ]; then
echo 1 > /sys/block/zram0/use_dedup
fi
echo "$zRamSizeMB""$diskSizeUnit" > /sys/block/zram0/disksize
# ZRAM may use more memory than it saves if SLAB_STORE_USER
# debug option is enabled.
if [ -e /sys/kernel/slab/zs_handle ]; then
echo 0 > /sys/kernel/slab/zs_handle/store_user
fi
if [ -e /sys/kernel/slab/zspage ]; then
echo 0 > /sys/kernel/slab/zspage/store_user
fi
mkswap /dev/block/zram0
swapon /dev/block/zram0 -p 32758
fi
}
verify_pasr_support()
{
ddr_type=`od -An -tx /proc/device-tree/memory/ddr_device_type`
ddr_type5="08"
if [ -d /sys/kernel/mem-offline ]; then
#only LPDDR5 supports PAAR
if [ ${ddr_type:4:2} != $ddr_type5 ]; then
setprop vendor.pasr.activemode.enabled false
fi
setprop vendor.pasr.enabled true
fi
}
function configure_read_ahead_kb_values() {
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
dmpts=$(ls /sys/block/*/queue/read_ahead_kb | grep -e dm -e mmc -e sd)
# dmpts holds below read_ahead_kb nodes if exists:
# /sys/block/dm-0/queue/read_ahead_kb to /sys/block/dm-10/queue/read_ahead_kb
# /sys/block/sda/queue/read_ahead_kb to
# /sys/block/sdh/queue/read_ahead_kb
# Set 128 for <= 4GB &
# set 512 for > 4GB targets.
if [ $MemTotal -le 4194304 ]; then
ra_kb=128
else
ra_kb=512
fi
if [ -f /sys/block/mmcblk0/bdi/read_ahead_kb ]; then
echo $ra_kb > /sys/block/mmcblk0/bdi/read_ahead_kb
fi
if [ -f /sys/block/mmcblk0rpmb/bdi/read_ahead_kb ]; then
echo $ra_kb > /sys/block/mmcblk0rpmb/bdi/read_ahead_kb
fi
for dm in $dmpts; do
if [ `cat $(dirname $dm)/../removable` -eq 0 ]; then
echo $ra_kb > $dm
fi
done
}
function configure_memory_parameters() {
# Set Memory parameters.
#
# Set per_process_reclaim tuning parameters
# All targets will use vmpressure range 50-70,
# All targets will use 512 pages swap size.
#
# Set Low memory killer minfree parameters
# 32 bit Non-Go, all memory configurations will use 15K series
# 32 bit Go, all memory configurations will use uLMK + Memcg
# 64 bit will use Google default LMK series.
#
# Set ALMK parameters (usually above the highest minfree values)
# vmpressure_file_min threshold is always set slightly higher
# than LMK minfree's last bin value for all targets. It is calculated
# as vmpressure_file_min = (last bin - second last bin ) + last bin
#
# Set allocstall_threshold to 0 for all targets.
#
configure_zram_parameters
configure_read_ahead_kb_values
echo 100 > /proc/sys/vm/swappiness
# Disable periodic kcompactd wakeups. We do not use THP, so having many
# huge pages is not as necessary.
echo 0 > /proc/sys/vm/compaction_proactiveness
# With THP enabled, the kernel greatly increases min_free_kbytes over
# its default value. Disable THP to prevent resetting of min_free_kbytes
# value during online/offline pages.
if [ -f /sys/kernel/mm/transparent_hugepage/enabled ]; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
MemTotalStr=`cat /proc/meminfo | grep MemTotal`
MemTotal=${MemTotalStr:16:8}
let RamSizeGB="( $MemTotal / 1048576 ) + 1"
# Set the min_free_kbytes to standard kernel value
if [ $RamSizeGB -ge 8 ]; then
echo 11584 > /proc/sys/vm/min_free_kbytes
elif [ $RamSizeGB -ge 4 ]; then
echo 8192 > /proc/sys/vm/min_free_kbytes
elif [ $RamSizeGB -ge 2 ]; then
echo 5792 > /proc/sys/vm/min_free_kbytes
else
echo 4096 > /proc/sys/vm/min_free_kbytes
fi
#echo 40 > /proc/sys/vm/watermark_scale_factor
verify_pasr_support
#Disable MGLRU - MOTO enables MGLRU on kernel 5.15 or later
#echo N > /sys/kernel/mm/lru_gen/enabled
}
configure_memory_parameters
if [ -f /sys/devices/soc0/soc_id ]; then
platformid=`cat /sys/devices/soc0/soc_id`
fi
case "$platformid" in
"507"|"578")
/vendor/bin/sh /vendor/bin/init.kernel.post_boot-blair.sh
;;
"454"|"472")
/vendor/bin/sh /vendor/bin/init.kernel.post_boot-holi.sh
;;
*)
echo "***WARNING***: Invalid SoC ID\n\t No postboot settings applied!!\n"
;;
esac
+42
View File
@@ -0,0 +1,42 @@
#!/vendor/bin/sh
block_by_name=/dev/block/bootdevice/by-name
utags=${block_by_name}/utags
utags_backup=${block_by_name}/utagsBackup
CHMOD_L_FLAG=-L
# Set correct permissions for UTAGS
/vendor/bin/chown -L root:system $utags
/vendor/bin/chown -L root:system $utags_backup
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $utags
if [ $? -ne 0 ]; then
CHMOD_L_FLAG=" "
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $utags
fi
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $utags_backup
# HOB/DHOB
hob=${block_by_name}/hob
dhob=${block_by_name}/dhob
/vendor/bin/chown -L radio:radio $hob
/vendor/bin/chown -L radio:radio $dhob
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $hob
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $dhob
# CLOGO
clogo=${block_by_name}/clogo
/vendor/bin/chown -L root:vendor_tcmd $clogo
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $clogo
#CID
cid=${block_by_name}/cid
/vendor/bin/chown -L root:vendor_tcmd $cid
/vendor/bin/chmod ${CHMOD_L_FLAG} 0660 $cid
#BL logs
logs=${block_by_name}/logs
if [ -f $logs ]; then
/vendor/bin/chown -L root:system $logs
/vendor/bin/chmod ${CHMOD_L_FLAG} 0640 $logs
fi
+206
View File
@@ -0,0 +1,206 @@
#!/vendor/bin/sh
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
export PATH
scriptname=${0##*/}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
# We take this from cpuinfo because hex "letters" are lowercase there
set -A cinfo `cat /proc/cpuinfo | sed -n "/Revision/p"`
hw=${cinfo[2]#?}
# Now "cook" the value so it can be matched against devtree names
m2=${hw%?}
minor2=${hw#$m2}
m1=${m2%?}
minor1=${m2#$m1}
if [ "$minor2" == "0" ]; then
minor2=""
if [ "$minor1" == "0" ]; then
minor1=""
fi
fi
setprop ro.vendor.hw.revision p${hw%??}$minor1$minor2
unset hw cinfo m1 m2 minor1 minor2
# reload UTAGS
utag_status=$(cat /proc/config/reload)
if [ "$utag_status" == "2" ]; then
notice "Utags are not ready, reloading"
echo 1 > /proc/config/reload
utag_status=$(cat /proc/config/reload)
[ "$utag_status" != "0" ] && notice "Utags failed to reload"
fi
# Export these for factory validation purposes
iccid=$(cat /proc/config/iccid/ascii 2>/dev/null)
if [ ! -z "$iccid" ]; then
setprop ro.vendor.mot.iccid $iccid
fi
unset iccid
cust_md5=$(cat /proc/config/cust_md5/ascii 2>/dev/null)
if [ ! -z "$cust_md5" ]; then
setprop ro.vendor.mot.cust_md5 $cust_md5
fi
unset cust_md5
# Get FTI data and catch old units with incorrect/missing UTAG_FTI
pds_fti=/mnt/vendor/persist/factory/fti
if [ -r $pds_fti ]; then
set -A fti $(od -A n -t x1 $pds_fti 2>/dev/null | tr '[A-F]' '[a-f]')
else
notice "Can not read FTI data in persist"
fi
# If UTAG_FTI is readable, compare checksums
# and if they mismatch, assume PDS is valid and overwrite UTAG
utag_fti=/proc/config/fti
if [ -r $utag_fti/ascii ]; then
set -A fti_utag $(cat ${utag_fti}/raw | sed 's/../& /g' | tr '[A-F]' '[a-f]')
# Byte 128 is total cksum, if nothing there, PDS data is invalid/missing
if [ ! -z "${fti[127]}" ]; then
# Make sure fti in UTAG is the same as in persist. Checksum comparison
if [ "${fti[126]}" != "${fti_utag[126]}" -o "${fti[127]}" != "${fti_utag[127]}" ]; then
notice "Copying FTI data from persist"
cat $pds_fti > ${utag_fti}/raw
fi
else
# If PDS data is invalid, take UTAG and hope it is correct
notice "Will use FTI from UTAG"
set -A fti $(od -A n -t x1 ${utag_fti}/ascii 2>/dev/null)
fi
else
notice "Missing FTI UTAG; copying from persist"
echo fti > /proc/config/all/new
cat $pds_fti > ${utag_fti}/raw
fi
# Read HW version from FTI data
hw_v1="\x${fti[35]}"
hw_v2="\x${fti[36]}"
hw_v3="\x${fti[37]}"
if [ "$hw_v3" == "\x30" ]; then
hw_v3=""
fi
hw_v4="\x${fti[38]}"
if [ "$hw_v4" == "\x30" ]; then
hw_v4=""
fi
setprop ro.vendor.hw.boardversion $(printf "$hw_v1$hw_v2$hw_v3$hw_v4")
# Now we have set fti var either from PDS or UTAG
# Get Last Test Station stamp from FTI
# and convert to user-friendly date, US format
# Real offsets for year/month/day are 63/64/65
# If the month/date look reasonable, data is probably OK.
mdate="Unknown"
y=0x${fti[63]}
m=0x${fti[64]}
d=0x${fti[65]}
let year=$y month=$m day=$d
# Invalid data will often have bogus month/date values
if [ $month -le 12 -a $day -le 31 -a $year -ge 12 ]; then
mdate=$month/$day/20$year
else
notice "Corrupt FTI data"
fi
setprop ro.vendor.manufacturedate $mdate
unset fti y m d year month day utag_fti pds_fti fti_utag mdate
t=$(getprop ro.build.tags)
if [[ "$t" != *release* ]]; then
for p in $(cat /proc/cmdline); do
if [ ${p%%:*} = "@" ]; then
v=${p#@:}; a=${v%=*}; b=${v#*=}
${a%%:*} ${a##*:} $b
fi
done
fi
unset p v a b t
# Cleanup stale/incorrect programmed model value
# Real values will never contain substrings matching "internal" device name
product=$(getprop ro.vendor.hw.device)
model=$(cat /proc/config/model/ascii 2>/dev/null)
if [ $? -eq 0 ]; then
if [ "${model#*_}" == "$product" -o "${model%_*}" == "$product" ]; then
notice "Clearing stale model value"
echo "" > /proc/config/model/raw
fi
fi
unset model product
# set ro.vendor.bootreason, which be used to indicate kpanic/wdt boot status.
# When ro.boot.last_powerup_reason is set, it denotes this is a 2nd reboot
# after kpanic/wdt, we set ro.bootreason as coldboot to copy logs.
# Otherwise, we would set ro.bootreason the same as ro.boot.bootreason.
# ro.boot.bootreason is restricted as of android p, so get it another way:
bootreason_kvp=$(cat /proc/bootinfo | grep "Last boot reason")
last_power_up=$(getprop ro.boot.last_powerup_reason)
if [ ! -z "$last_power_up" ]
then
setprop ro.vendor.bootreason "coldboot"
else
setprop ro.vendor.bootreason ${bootreason_kvp##* }
fi
get_history_value()
{
local __result=$1
local history_count=0
local value=""
local IFS=','
shift 1
for arg in ${@}; do
value=$value",$arg"
history_count=$(($history_count + 1))
if [ $history_count -eq 3 ]; then
break
fi
done
eval $__result="$value"
debug "value:$value history_count:$history_count"
}
set_boot_bootseq_history()
{
#get current boot sequence
if [ ! -f /proc/bootinfo ]; then
notice "Error:/proc/bootinfo is not ready"
return
fi
boot_seq_line=`grep BOOT_SEQ /proc/bootinfo | sed 's/ //g'`
boot_seq=${boot_seq_line##*:}
notice "BOOT_SEQ is $boot_seq"
setprop ro.vendor.boot_seq $boot_seq
boot_time=`date +%s`
#get previous value of bootseq history
bootseq_history=`getprop persist.vendor.boot.bootseq.history`
notice "booseq_history is $bootseq_history"
get_history_value valid_history_value $bootseq_history
setprop persist.vendor.boot.bootseq.history "$boot_seq.$boot_time$valid_history_value"
new_bootseq_history=`getprop persist.vendor.boot.bootseq.history`
notice "set persist.vendor.boot.bootseq.history $new_bootseq_history"
}
set_boot_bootseq_history
rkp_complete_file="/mnt/vendor/persist/rkp_complete"
rkp_csr_state="not uploaded"
if [ -f "$rkp_complete_file" ]; then
setprop ro.vendor.mot.hw.rkp_csr_uploaded 1
rkp_csr_state="already uploaded"
else
setprop ro.vendor.mot.hw.rkp_csr_uploaded 0
fi
notice "RKP CSR file on device is: $rkp_csr_state"
unset $rkp_complete_file
unset $rkp_csr_state
+53
View File
@@ -0,0 +1,53 @@
#!/vendor/bin/sh
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
export PATH
scriptname=${0##*/}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
# Globals
cap_path=
setup_permissions()
{
chmod 0660 $cap_path/fac_enable
chmod 0660 $cap_path/fac_cal
notice "set permission "
[ -e $cap_path/fac_detect ] && chown system:system $cap_path/fac_detect
[ -e $cap_path/fac_enable ] && chown system:system $cap_path/fac_enable
[ -e $cap_path/fac_cal ] && chown system:system $cap_path/fac_cal
[ -e $cap_path/fac_irq_state ] && chown system:system $cap_path/fac_irq_state
[ -e $cap_path/fac_compensation ] && chown system:system $cap_path/fac_compensation
[ -e $cap_path/fac_raw ] && chown system:system $cap_path/fac_raw
[ -e $cap_path/reset ] && chown system:system $cap_path/reset
}
# main
notice "cap sh start"
count=0
max=10
while [ ! -e /sys/class/capsense/capsense0 ]; do
sleep 1
count=$(($count+1))
if [ $count -gt $max ]; then
break
fi
done
if [ -e /sys/class/capsense/capsense0 ]; then
cap_path=/sys/class/capsense/capsense0
setup_permissions
fi
if [ -e /sys/class/capsense/capsense1 ]; then
cap_path=/sys/class/capsense/capsense1
setup_permissions
fi
+28
View File
@@ -0,0 +1,28 @@
#!/vendor/bin/sh
scriptname=${0##*/}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
set_ro_hw_properties_dislayport()
{
local dp_path=/sys/class/drm/card0-DP-1
local wait_cnt=0
while [ "$wait_cnt" -lt 5 ]; do
if [ -e $dp_path ]; then
setprop ro.vendor.hw.displayport true
notice "setprop ro.vendor.hw.displayport as true"
break;
fi
notice "waiting for dp, wait_cnt is $wait_cnt"
sleep 1;
wait_cnt=$((wait_cnt+1))
done
}
# Main starts here
set_ro_hw_properties_dislayport
+49
View File
@@ -0,0 +1,49 @@
#!/vendor/bin/sh
getlogs_opts="/data/vendor/bug2go/getlogs.opts"
edof_trigger="/data/vendor/bug2go/edof_identfier"
mdlog_user_opts="/data/vendor/diag_mdlog/user3.opts"
qdb_file="/firmware/image/qdsp6m.qdb"
qdb_file_alt="/vendor/firmware_mnt/image/qdsp6m.qdb"
arg_output="/data/vendor/bug2go/modem"
arg_output_files="/data/vendor/bug2go/modem/*"
log_file=$arg_output/"getlogs.log"
mkdir $arg_output
chmod g+rwX $arg_output
# The output arg is fixed,
# use the cutomized opts from file if it exists
if [ -f $getlogs_opts ]; then
args=`cat $getlogs_opts`
# allow opts_file to be used only once
mv -f $getlogs_opts $arg_output/
else
size=$(getprop persist.vendor.sys.diag_mdlog.getlogs_size)
args="-b $size"
fi
diag_mdlog-getlogs -o $arg_output $args &> $log_file
if [ -f $mdlog_user_opts ]; then
cp $mdlog_user_opts $arg_output/
fi
# copy qdsp6m.qdb
if [ -f $qdb_file ]; then
cp $qdb_file $arg_output/
else
# copy qdsp6m.qdb from alternate folder
if [ -f $qdb_file_alt ]; then
cp $qdb_file_alt $arg_output/
fi
fi
chmod -R g+rw $arg_output
chmod -R g+rw $arg_output_files
chmod g+X $arg_output/mdm
chmod g+X $arg_output/mdm2
if [ -f $edof_trigger ]; then
rm -rf /data/vendor/diag_mdlog/logs/*
rm -f $edof_trigger
fi
+57
View File
@@ -0,0 +1,57 @@
#!/vendor/bin/sh
echo "Retrieve Modem RFS logs"
__copy_logs()
{
file1="${1}"
file2="${2}"
if [ ! -f "${file1}" ]; then
echo -e "${file1} invalid"
return
fi
/vendor/bin/chmod 666 "${file1}"
/vendor/bin/cp "${file1}" "${file2}"
/vendor/bin/chmod 640 "${file2}"
}
mdm_rfs_folder=/mnt/vendor/persist/rfs/msm/mpss
mdm_rfs_log0=modem_efs_log_0.txt
mdm_rfs_log1=modem_efs_log_1.txt
mdm_rfs_buf_log=mot_efs_buffered_log.txt
mdm_log_target_folder=/data/vendor/dontpanic
if [ -z "$1" ]
then
loop=0
else
loop=1
fi
while true
do
/vendor/bin/echo "1" > /data/vendor/radio/read_modem_efs
/vendor/bin/sleep 1
/vendor/bin/echo "0" > /data/vendor/radio/read_modem_efs
__copy_logs $mdm_rfs_folder/$mdm_rfs_log0 $mdm_log_target_folder/$mdm_rfs_log0
__copy_logs $mdm_rfs_folder/$mdm_rfs_log1 $mdm_log_target_folder/$mdm_rfs_log1
__copy_logs $mdm_rfs_folder/$mdm_rfs_buf_log $mdm_log_target_folder/$mdm_rfs_buf_log
if [ $loop -eq 1 ]
then
/vendor/bin/sleep 600
else
break
fi
done
exit 0
+10
View File
@@ -0,0 +1,10 @@
#!/vendor/bin/sh
# All modules that depend on conditions or need extra parameters
# should go here.
# Handle factory bootmode
bootmode=$(getprop ro.bootmode)
if [ $bootmode = "mot-factory" ]; then
insmod /vendor/lib/modules/moto_f_usbnet.ko
fi
+75
View File
@@ -0,0 +1,75 @@
#!/vendor/bin/sh
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
export PATH
scriptname=${0##*/}
debug()
{
echo "$*"
}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
get_history_value()
{
local __result=$1
local history_count=0
local value=""
local IFS=$2
shift 2
for arg in ${@}; do
value=$value"$IFS$arg"
history_count=$(($history_count + 1))
if [ $history_count -eq 3 ]; then
break
fi
done
eval $__result="$value"
debug "value:$value history_count:$history_count"
}
set_reboot_bootseq_history()
{
BOOTSEQ_HISTORY_PROP=persist.vendor.reboot.bootseq.history
#get current boot sequence
if [ ! -f /proc/bootinfo ]; then
notice "Error:/proc/bootinfo is not ready"
return
fi
boot_seq_line=`grep BOOT_SEQ /proc/bootinfo | sed 's/ //g'`
boot_seq=${boot_seq_line##*:}
notice "BOOT_SEQ is $boot_seq"
shutdown_time=`date +%s`
#get previous value of bootseq history
bootseq_history=`getprop $BOOTSEQ_HISTORY_PROP`
debug "booseq_history is $bootseq_history"
get_history_value valid_history_value , $bootseq_history
setprop $BOOTSEQ_HISTORY_PROP "$boot_seq.$shutdown_time$valid_history_value"
new_bootseq_history=`getprop $BOOTSEQ_HISTORY_PROP`
notice "set $BOOTSEQ_HISTORY_PROP $new_bootseq_history"
#update reboot command history
REBOOTCMD_HISTORY_PROP=persist.vendor.reboot.command.history
reboot_cmds=`getprop log.powerctrl.reboot.command`
notice "reboot_cmds is [$reboot_cmds]"
#get previous value of command history
rebootcmd_history=`getprop $REBOOTCMD_HISTORY_PROP`
debug "reboot command history is $rebootcmd_history"
get_history_value valid_cmd_history_value - $rebootcmd_history
setprop $REBOOTCMD_HISTORY_PROP "$boot_seq.$reboot_cmds${valid_cmd_history_value}"
new_bootseq_history=`getprop $REBOOTCMD_HISTORY_PROP`
notice "set $REBOOTCMD_HISTORY_PROP $new_bootseq_history"
}
set_reboot_bootseq_history
+685
View File
@@ -0,0 +1,685 @@
#!/vendor/bin/sh
PATH=/sbin:/vendor/sbin:/vendor/bin:/vendor/xbin
export PATH
while getopts cds op;
do
case $op in
c) cal_on=1;;
d) dbg_on=1;;
s) dump_statistics=1;;
esac
done
shift $(($OPTIND-1))
# Globals
scriptname=${0##*/}
touch_class_path=/sys/class/touchscreen
touch_status_prop=
touch_update_prop=
touch_calibration_done_version=persist.vendor.touch.calibration
touch_vendor=
touch_path=
panel_path=/sys/devices/virtual/graphics/fb0
oem_panel_script=/vendor/bin/init.oem.panel.sh
dlkm_path=/vendor/lib/modules
device_property=ro.vendor.hw.device
hwrev_property=ro.vendor.hw.revision
firmware_path=/vendor/firmware
param_path=/data/vendor/param/touch
factory_property=ro.vendor.build.motfactory
bootmode_property=ro.bootmode
touch_firmware_property=ro.vendor.touch.fw_version
touch_vendor_property=ro.vendor.touch.supplier_vendor
let dec_cfg_id_boot=0
let dec_cfg_id_latest=0
# Whether to search for TP firmware in the parameter path
let search_in_param=0
# Whether the matching TP firmware is found in the parameter path
let find_in_param=0
typeset -l product_id
panel_ver=
supplier=
property=
config_id=
build_id=
hwrev_id=
str_cfg_id_new=
str_cfg_id_boot=
str_cfg_id_latest=
build_id_new=
debug()
{
[ $dbg_on ] && echo "Debug: $*"
}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
sanity_check()
{
read_touch_property flashprog || return 1
[[ ( -z "$property" ) || ( "$property" == "1" ) ]] && return 2
read_touch_property productinfo || return 1
[[ ( -z "$property" ) || ( "$property" == "0" ) ]] && return 2
read_touch_property buildid || return 1
config_id=${property#*-}
[[ ( -z "$config_id" ) || ( "$config_id" == "0" ) ]] && return 2
build_id=${property%-*}
[[ ( -z "$build_id" ) || ( "$build_id" == "0" ) ]] && return 2
return 0
}
error_msg()
{
local err_msg
local err_code=$1
case $err_code in
1) err_msg="Error: No response from touch IC";;
2) err_msg="Error: Cannot read property $2";;
3) err_msg="Error: No matching firmware file found";;
4) err_msg="Error: Touch IC is in bootloader mode";;
5) err_msg="Error: Touch provides no reflash interface";;
6) err_msg="Error: Touch driver is not running";;
7) err_msg="Warning: Touch firmware is not the latest";;
8) err_msg="Info: Touch class does not exist";;
9) err_msg="Error: Touch IC is not ready to flash";;
esac
notice "$err_msg"
}
error_and_leave()
{
local err_code=$1
local touch_status="unknown"
error_msg $err_code
case $err_code in
1|4) touch_status="dead";;
5|6|8) touch_status="absent";;
esac
# perform sanity check and declare touch ready if error is not fatal
if [ "$touch_status" == "unknown" ]; then
sanity_check
case "$?" in
0) touch_status="ready";;
2) touch_status="dead";;
1) touch_status="absent";;
esac
fi
# perform recovery if touch is declared dead
if [ "$touch_status" == "dead" ]; then
notice "Touch needs to go through recovery!!!"
reboot_cnt=$(getprop $touch_status_prop 2>/dev/null)
[ -z "$reboot_cnt" ] && reboot_cnt=0
debug "current reboot counter [$reboot_cnt]"
fi
setprop $touch_status_prop $touch_status
notice "property [$touch_status_prop] set to [`getprop $touch_status_prop`]"
if [ "$touch_status" == "dead" ]; then
notice "Touch is not responding; no further action!!!"
#if [ $((reboot_cnt)) -lt 2 ]; then
# notice "Touch is not working; rebooting..."
# debug "sleep 3s to allow touch-dead-sh service to run"
# sleep 3
# [ -z "$dbg_on" ] && setprop sys.powerctl reboot
#else
# notice "Although touch is not working, no more reboots"
#fi
fi
exit $err_code
}
prepend()
{
local list=""
local prefix=$1
shift
for name in $*; do
list="$list$prefix/$name "
done
echo $list
}
dump_statistics()
{
debug "dumping touch statistics"
cat $touch_path/ic_ver
[ -f $touch_path/stats ] && cat $touch_path/stats
return 0
}
wait_for_poweron()
{
local wait_nomore
local readiness
local count
debug "wait until driver reports <ready to flash>..."
wait_nomore=60
count=0
while true; do
readiness=$(cat $touch_path/poweron)
if [ "$readiness" == "1" ]; then
debug "ready to flash!!!"
break;
fi
count=$((count+1))
[ $count -eq $wait_nomore ] && break
sleep 1
debug "not ready; keep waiting..."
done
if [ $count -eq $wait_nomore ]; then
error_msg 9
return 1
fi
return 0
}
setup_permissions()
{
local bootmode=$(getprop $bootmode_property 2> /dev/null)
local selinux=$(getprop ro.boot.selinux 2> /dev/null)
local key_path
local key_files
local entry
if [[ ("$selinux" == "permissive") || ("$bootmode" == "mot-factory") ]]; then
debug "loosen permissions to $touch_vendor files"
case $touch_vendor in
samsung) key_path="/sys/devices/virtual/sec/sec_ts/"
key_files=$(ls $key_path 2>/dev/null)
# Set optional permissions to LSI touch tests
[ -f $touch_path/size ] && chown root:vendor_tcmd $touch_path/size
[ -f $touch_path/address ] && chown root:vendor_tcmd $touch_path/address
[ -f $touch_path/write ] && chown root:vendor_tcmd $touch_path/write
;;
pixart) key_path="/sys/bus/i2c/devices/1-0033"
key_files="selftest selftest_bin"
;;
synaptics) key_path=$touch_path
key_files=$(prepend f54 `ls $touch_path/f54/ 2>/dev/null`)
key_files=$key_files"reporting query stats";;
focaltech) key_path="/proc/"
key_files="ftxxxx-debug";;
ilitek) key_path="/proc/ilitek"
key_files="ioctl";;
goodix) key_path="/proc/"
key_files="gmnode"
if [[ "$touch_instance" == "GTx5" ]] || [[ "$touch_instance" == "GTx8" ]]; then
key_path="/dev/"
key_files="gtp_tools"
fi
;;
stmicro) key_path="/proc/fts/"
key_files="driver_test"
# Set optional permissions to LSI touch tests
[ -f $touch_path/calibrate ] && chown root:vendor_tcmd $touch_path/calibrate
;;
esac
for entry in $key_files; do
chmod 0666 $key_path/$entry
debug "change permissions of $key_path/$entry"
done
fi
# Set permissions to enable factory touch tests
chown root:vendor_tcmd $touch_path/drv_irq
chown root:vendor_tcmd $touch_path/hw_irqstat
chown root:vendor_tcmd $touch_path/reset
# Set permissions to allow Bug2Go access to touch statistics
chown root:log $touch_path/stats
# Erase is optional
[ -f $touch_path/erase_all ] && chown root:vendor_tcmd $touch_path/erase_all
}
read_touch_property()
{
property=""
debug "retrieving property: [$touch_path/$1]"
property=$(cat $touch_path/$1 2> /dev/null)
debug "touch property [$1] is: [$property]"
[ -z "$property" ] && return 1
return 0
}
read_panel_property()
{
property=""
debug "retrieving panel property: [$panel_path/$1]"
property=$(cat $panel_path/$1 2> /dev/null)
debug "panel property [$1] is: [$property]"
[ -z "$property" ] && return 1
return 0
}
find_latest_config_id()
{
local fw_mask=$1
local skip_fields=$2
local dec max z str_hex i
str_cfg_id_latest=""
debug "scanning dir for files matching [$fw_mask]"
let dec=0; max=0;
for file in $(ls $fw_mask 2>/dev/null); do
z=$file
i=0
while [ ! $i -eq $skip_fields ]; do
z=${z#*-}
i=$((i+1))
done
str_hex=${z%%-*};
let dec=0x$str_hex
if [ $dec -gt $max ]; then
let max=$dec; dec_cfg_id_latest=$dec;
str_cfg_id_latest=$str_hex
fi
done
[ -z "$str_cfg_id_latest" ] && return 1
return 0
}
find_best_match()
{
local hw_mask=$1
local panel_supplier=$2
local skip_fields fw_mask
local match_best_cfg
local match_best_cfg_dec param_cfg_dec
let match_best_cfg_dec=0
let param_cfg_dec=0
while [ ! -z "$hw_mask" ]; do
if [ "$hw_mask" == "-" ]; then
hw_mask=""
fi
if [ ! -z "$panel_supplier" ]; then
skip_fields=3
fw_mask="$touch_vendor-$panel_supplier-$touch_product_id-*-$product_id$hw_mask.*"
else
skip_fields=2
fw_mask="$touch_vendor-$touch_product_id-*-$product_id$hw_mask.*"
fi
find_latest_config_id "$fw_mask" "$skip_fields"
if [ "$?" == "0" ]; then
let match_best_cfg_dec=$dec_cfg_id_latest
match_best_cfg=$str_cfg_id_latest
fi
if [ "$search_in_param" == "1" ]; then
cd $param_path
find_latest_config_id "$fw_mask" "$skip_fields"
if [ "$?" == "0" ]; then
if [ $match_best_cfg_dec -lt $dec_cfg_id_latest ]; then
let match_best_cfg_dec=$dec_cfg_id_latest
match_best_cfg=$str_cfg_id_latest
let find_in_param=1
else
cd $firmware_path
fi
else
cd $firmware_path
fi
fi
[ $match_best_cfg_dec != 0 ] && break
hw_mask=${hw_mask%?}
done
str_cfg_id_latest=$match_best_cfg
dec_cfg_id_latest=$match_best_cfg_dec
[ -z "$match_best_cfg" ] && return 1
if [ -z "$panel_supplier" ]; then
firmware_file=$(ls $touch_vendor-$touch_product_id-$str_cfg_id_latest-*-$product_id$hw_mask.*)
else
firmware_file=$(ls $touch_vendor-$panel_supplier-$touch_product_id-$str_cfg_id_latest-*-$product_id$hw_mask.*)
fi
notice "Firmware file for upgrade $firmware_file"
return 0
}
query_touch_info()
{
read_touch_property flashprog
bl_mode=$property
debug "bl mode: $bl_mode"
while true; do
read_touch_property productinfo
touch_product_id=$property
if [ "$touch_product_id" ]; then
# driver might not be ready yet, wait
debug "touch product id: $touch_product_id"
break
fi
sleep 1
done
if [ "$touch_product_id" == "0" ]; then
debug "touch ic reports invalid product id"
error_msg 1
return 1
fi
read_touch_property buildid
str_cfg_id_boot=${property#*-}
let dec_cfg_id_boot=0x$str_cfg_id_boot
debug "touch config id: $str_cfg_id_boot"
build_id_boot=${property%-*}
debug "touch build id: $build_id_boot"
return 0
}
query_panel_info()
{
supplier=""
read_touch_property "panel_supplier"
[ -z "$property" ] && read_panel_property "panel_supplier"
supplier=$property
if [ "$supplier" ]; then
read_panel_property "controller_drv_ver"
panel_ver=${property#${property%?}}
debug "panel supplier: $supplier, ver $panel_ver"
setprop $touch_vendor_property "$supplier-$touch_vendor"
notice "touch_vendor_property = $touch_vendor_property, $supplier-$touch_vendor"
else
debug "driver does not report panel supplier"
fi
}
load_driver_modules()
{
if [ "$supplier" ]; then
if [ -f $oem_panel_script ]; then
debug "load_driver_modules()"
$oem_panel_script -s $supplier
fi
fi
}
search_firmware_file()
{
local match_not_found
match_not_found=1
if [ "$supplier" ]; then
for pattern in "$supplier$panel_ver" "$supplier"; do
debug "search for best hw revision match with supplier"
find_best_match "-$hwrev_id" "$pattern"
match_not_found=$?
[ "$match_not_found" == "0" ] && break
done
fi
if [ "$match_not_found" != "0" ]; then
debug "search for best hw revision match without supplier"
find_best_match "-$hwrev_id"
if [ "$?" != "0" ]; then
error_msg 3
return 1
fi
fi
return 0
}
reload_modules()
{
local rc
local module
for module in $*; do
[ -f $dlkm_path/$module.ko ] || continue
notice "Reloading [$module.ko]..."
rmmod $module
rc=$?
[ $rc != 0 ] && notice "Unloading [$module] failed: $rc"
insmod $dlkm_path/$module.ko
rc=$?
[ $rc != 0 ] && notice "Loading [$module] failed: $rc"
done
}
run_firmware_upgrade()
{
local recovery
recovery=0
if [ "$bl_mode" == "1" ] || [ "$build_id_boot" == "0" ]; then
recovery=1
notice "Initiating touch firmware recovery"
notice " bl mode = $bl_mode"
notice " build id = $build_id_boot"
fi
if [ $dec_cfg_id_boot -ne $dec_cfg_id_latest ] || [ "$recovery" == "1" ]; then
wait_for_poweron
# wait for poweron time is limited, thus in ceratin cases
# it can time out. forfeiting firmware update in this case
# would be cleaner option, since script cannot indefinitely
# delay sysfs permissions setup and cause more troubles
if [ "$?" != "0" ]; then
notice "Touch firmware update forfeited!!!"
return 1
fi
debug "forcing firmware upgrade"
echo 1 > $touch_path/forcereflash
debug "sending reflash command"
if [ "$find_in_param" == "1" ]; then
notice "Start touchUpg service, upgrade tp firmware parameters"
echo 1 > $touch_path/flash_mode
start vendor.touchUpg
else
echo 0 > $touch_path/flash_mode
fi
echo $firmware_file > $touch_path/doreflash
read_touch_property flashprog
if [ "$?" != "0" ]; then
error_msg 1
return 1
fi
bl_mode=$property
if [ "$bl_mode" == "1" ]; then
error_msg 4
return 1
fi
read_touch_property buildid
if [ "$?" != "0" ]; then
error_msg 1
return 1
fi
str_cfg_id_new=${property#*-}
build_id_new=${property%-*}
notice "Touch firmware config id at boot time $str_cfg_id_boot"
notice "Touch firmware config id in the file $str_cfg_id_latest"
notice "Touch firmware config id currently programmed $str_cfg_id_new"
[ "$str_cfg_id_latest" != "$str_cfg_id_new" ] && error_msg 7 && return 1
# indicate that update has been completed
setprop $touch_update_prop "completed"
notice "property [$touch_update_prop] set to [`getprop $touch_update_prop`]"
if [ "$touch_vendor" == "synaptics" ]; then
notice "forcing F54 registers update"
echo 1 > $touch_path/f54/force_update
notice "need to reload F54"
reload_modules "synaptics_dsx_test_reporting"
fi
fi
return 0
}
do_sec_calibration()
{
local __result=$1
local info
local rc
sleep 3
echo run_force_calibration > /sys/devices/virtual/sec/tsp/cmd
rc=$(cat /sys/devices/virtual/sec/tsp/cmd_result)
[ "$rc" != "run_force_calibration:OK" ] && return 1
info=$(cat $touch_class_path/$touch_instance/buildid)
if [ -f $touch_class_path/$touch_instance/mutual_range ]; then
info=$info";$(cat $touch_class_path/$touch_instance/mutual_range)"
else
notice "mutual range unavailable"
fi
info=$info";forced"
eval "$__result='$info'"
return 0
}
do_calibration()
{
local rc
local cal_info
local factory_build
local cal_version
factory_build=$(getprop $factory_property 2> /dev/null)
cal_info=$(getprop $touch_calibration_done_version 2> /dev/null)
# new calibration info comes with mutual range and probably was enforced
if [[ ("$cal_info" && "${cal_info%%;*}" != "$cal_info") || ("$cal_info" == "enable-autocalibration") ]]; then
cal_version=${cal_info%%;*}
cal_version=${cal_version#*-}
debug "cal_version is '$cal_version'"
fi
if [[ ("$factory_build" != 1 || "$cal_version" != "autocalibration") ]]; then
debug "factory='$factory_build', cal_version='$cal_version', latest='$str_cfg_id_latest'"
return
fi
notice "Force touch calibration"
case $touch_vendor in
samsung) do_sec_calibration cal_info
rc=$?
debug "cal_info='$cal_info'"
;;
esac
notice "Touch calibration result $rc"
[ $rc == 0 ] && setprop $touch_calibration_done_version $cal_info
}
process_touch_instance()
{
touch_vendor=$(cat $touch_class_path/$touch_instance/vendor)
debug "touch vendor [$touch_vendor]"
touch_path=/sys$(cat $touch_class_path/$touch_instance/path)
debug "sysfs touch path: $touch_path"
touch_status_prop=vendor.hw.touch.$touch_instance.status
touch_update_prop=vendor.hw.touch.$touch_instance.update
if [ ! -f $touch_path/doreflash ] ||
[ ! -f $touch_path/poweron ] ||
[ ! -f $touch_path/flashprog ] ||
[ ! -f $touch_path/productinfo ] ||
[ ! -f $touch_path/buildid ]; then
error_msg 5
return
fi
if [ $dump_statistics ]; then
dump_statistics
fi
if [ -f $touch_path/flash_mode ]; then
notice "Support parameter APK for FW upgrade"
let search_in_param=1
fi
notice "Checking touch ID [$touch_instance] FW upgrade"
touch_vendor=$(cat $touch_class_path/$touch_instance/vendor)
debug "touch vendor [$touch_vendor]"
touch_path=/sys$(cat $touch_class_path/$touch_instance/path)
debug "sysfs touch path: $touch_path"
query_touch_info
query_panel_info
search_firmware_file
[ "$?" == "0" ] && run_firmware_upgrade
if [ "$?" == "0" ]; then
do_calibration
notice "Touch firmware is up to date"
setprop $touch_status_prop "ready"
notice "property [$touch_status_prop] set to [`getprop $touch_status_prop`]"
notice "Handling touch ID [$touch_instance] permissions"
fi
read_touch_property buildid
setprop $touch_firmware_property ${property}
notice "Touch firmware property is $touch_firmware_property"
setup_permissions
}
set_ro_hw_properties_exponent_panel()
{
local panelname_path=/sys/class/drm/card0-DSI-1/panelName
local panelname_cli_path=/sys/class/drm/card0-DSI-2/panelName
local bl_exponent_path=/sys/class/drm/card0-DSI-1/panelBLExponent
local bl_exponent_prop=ro.vendor.hw.curve
local prim_declare_path=/sys/class/drm/card0-DSI-1/panelDeclare
local cli_declare_path=/sys/class/drm/card0-DSI-2/panelDeclare
local prim_declare_prop=ro.vendor.hw.primary_declare
local cli_declare_prop=ro.vendor.hw.cli_declare
local panelname
local wait_cnt=0
lid_property=ro.vendor.mot.hw.lid
lid=1
has_lid=$(getprop $lid_property 2> /dev/null)
while [ "$wait_cnt" -lt 15 ]; do
if [ -e $panelname_path ]; then
panelname=$(cat $panelname_path)
panelBLExponent=$(cat $bl_exponent_path)
setprop $bl_exponent_prop "$panelBLExponent"
notice "setprop $bl_exponent_prop as $panelBLExponent for panel [$panelname]"
if [ -e $prim_declare_path ]; then
prim_declare_str=$(cat $prim_declare_path)
setprop $prim_declare_prop "$prim_declare_str"
notice "setprop $prim_declare_prop as $prim_declare_str for panel [$panelname]"
fi
if [ $has_lid -eq $lid ]
then
if [ -e $panelname_cli_path -a -e $cli_declare_path ] ; then
panelname=$(cat $panelname_cli_path)
cli_declare_str=$(cat $cli_declare_path)
setprop $cli_declare_prop "$cli_declare_str"
notice "setprop $cli_declare_prop as $cli_declare_str for panel [$panelname]"
break;
fi
else
break;
fi
fi
notice "waiting for panelname, wait_cnt is $wait_cnt, has_lid is $has_lid"
sleep 1;
wait_cnt=$((wait_cnt+1))
done
}
# Main starts here
query_panel_info
load_driver_modules
[ -d $touch_class_path ] || error_and_leave 8
debug "sysfs panel path: $panel_path"
product_id=$(getprop $device_property 2> /dev/null)
[ -z "$product_id" ] && error_and_leave 2 $device_property
product_id=${product_id%-*}
product_id=${product_id%_*}
debug "product id: $product_id"
hwrev_id=$(getprop $hwrev_property 2> /dev/null)
[ -z "$hwrev_id" ] && notice "hw revision undefined"
debug "hw revision: $hwrev_id"
cd $firmware_path
# Run asynchronously for each instance
for touch_instance in $(ls $touch_class_path); do
process_touch_instance &
done
if [ -f /sys/bus/i2c/devices/1-0033/vendor ]; then
touch_vendor=$(cat /sys/bus/i2c/devices/1-0033/vendor)
setup_permissions
fi
# check if need to reload modules
# set exponent backlight property
set_ro_hw_properties_exponent_panel
wait
debug "all background processes completed"
return 0
+548
View File
@@ -0,0 +1,548 @@
#!/vendor/bin/sh
# Copyright (c) 2012, Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of Code Aurora Forum, Inc. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Allow unique persistent serial numbers for devices connected via usb
# User needs to set unique usb serial number to persist.usb.serialno and
# if persistent serial number is not set then Update USB serial number if
# passed from command line
#
dbg_on=0
log_dbg()
{
echo "${0##*/}: $*"
[ $dbg_on ] && echo "${0##*/}: $*" > /dev/kmsg
}
log_info()
{
echo "${0##*/}: $*"
echo "${0##*/}: $*" > /dev/kmsg
}
target=`getprop ro.board.platform`
usb_action=`getprop vendor.usb.mmi-usb-sh.action`
log_dbg "mmi-usb-sh: action = \"$usb_action\""
sys_usb_config=`getprop vendor.usb.config`
factory_usb_config="usbnet"
factory_usb_config_adb="usbnet,adb"
wait_usb_udc_device ()
{
if [ "$#" == "1" ]
then
timeout_ms=$1
else
timeout_ms=20000
fi
relative_time=0
usb_controller=`getprop ro.boot.usbcontroller`
usb_udc="/sys/class/udc/$usb_controller"
while [ $relative_time -lt $timeout_ms ]; do
if [ -d $usb_udc ]
then
log_info "mmi-usb-sh: udc is detected within $relative_time ms"
return 0
fi
relative_time=$((relative_time+100))
sleep 0.1
done
log_info "mmi-usb-sh: cannot detect udc within $timeout_ms ms"
return 1
}
set_usb_secure_mode ()
{
if [ "$#" == "1" ]
then
if [ -f /sys/class/android_usb/android0/secure ]
then
echo "$1" > /sys/class/android_usb/android0/secure
else
setprop vendor.usb.secure_mode $1
fi
log_info "mmi-usb-sh: secure mode = $1"
fi
}
tcmd_ctrl_adb ()
{
ctrl_adb=`getprop vendor.tcmd.ctrl_adb`
log_info "mmi-usb-sh: vendor.tcmd.ctrl_adb = $ctrl_adb"
case "$ctrl_adb" in
"0")
if [[ "$sys_usb_config" == *adb* ]]
then
# *** ALWAYS expecting adb at the end ***
new_usb_config=${sys_usb_config/,adb/}
log_info "mmi-usb-sh: disabling adb ($new_usb_config)"
setprop persist.vendor.usb.config $new_usb_config
setprop vendor.usb.config $new_usb_config
setprop persist.vendor.factory.allow_adb 0
fi
;;
"1")
if [[ "$sys_usb_config" != *adb* ]]
then
# *** ALWAYS expecting adb at the end ***
new_usb_config="$sys_usb_config,adb"
log_info "mmi-usb-sh: enabling adb ($new_usb_config)"
setprop persist.vendor.usb.config $new_usb_config
setprop vendor.usb.config $new_usb_config
setprop persist.vendor.factory.allow_adb 1
fi
;;
esac
exit 0
}
case "$usb_action" in
"")
;;
"vendor.tcmd.ctrl_adb")
tcmd_ctrl_adb
;;
esac
# soc_ids for 8937
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
case "$target" in
"msm8937")
setprop vendor.usb.rps_mask 0
setprop vendor.rmnet_vnd.rps_mask 0
setprop vendor.usb.diag.func.name "diag"
case "$soc_id" in
"294" | "295")
setprop vendor.usb.rps_mask 40
;;
esac
case "$soc_id" in
"313" | "320")
qcom_usb_config="diag,serial_smd,rmnet_ipa"
qcom_adb_usb_config="diag,serial_smd,rmnet_ipa,adb"
bpt_usb_config="diag,serial_smd,rmnet_bam_ipa"
bpt_adb_usb_config="diag,serial_smd,rmnet_bam_ipa,adb"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.inst.name "rmnet"
setprop vendor.usb.dpl.inst.name "dpl"
;;
*)
qcom_usb_config="diag,serial_smd,rmnet_qti_bam"
qcom_adb_usb_config="diag,serial_smd,rmnet_qti_bam,adb"
bpt_usb_config="diag,serial_smd,rmnet"
bpt_adb_usb_config="diag,serial_smd,rmnet,adb"
;;
esac
;;
"msm8953")
#Set RPS Mask for Tethering to CPU4
setprop vendor.usb.rps_mask 10
setprop vendor.rmnet_vnd.rps_mask 0
if [ -d /config/usb_gadget/g1 ]; then
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.func.name "rmnet_bam"
else
qcom_usb_config="diag,serial_smd,serial_tty,rmnet_bam,mass_storage"
qcom_adb_usb_config="diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb"
bpt_usb_config="diag,serial_smd,serial_tty,rmnet"
bpt_adb_usb_config="diag,serial_smd,serial_tty,rmnet,adb"
fi
setprop vendor.usb.controller "7000000.dwc3"
setprop vendor.usb.diag.func.name "diag"
;;
"msm8996")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 2
setprop vendor.rmnet_vnd.rps_mask 0f
qcom_usb_config="diag,serial_cdev,serial_tty,rmnet_bam,mass_storage"
qcom_adb_usb_config="diag,serial_cdev,serial_tty,rmnet_bam,mass_storage,adb"
bpt_usb_config="diag,serial_cdev,serial_tty,rmnet"
bpt_adb_usb_config="diag,serial_cdev,serial_tty,rmnet,adb"
setprop vendor.usb.controller "6a00000.dwc3"
setprop vendor.usb.diag.func.name "diag"
;;
"msm8998")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 70
setprop vendor.rmnet_vnd.rps_mask 0d
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a800000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.hcd_mask 80
setprop vendor.usb.diag.func.name "diag"
;;
"sdm660")
#Set RPS Mask for Tethering to CPU2
setprop vendor.usb.rps_mask 30
setprop vendor.rmnet_vnd.rps_mask 4
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a800000.dwc3"
setprop vendor.usb.rndis.func.name "rndis_bam"
setprop vendor.usb.rmnet.func.name "rmnet_bam"
setprop vendor.usb.diag.func.name "diag"
;;
"sdm845")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "diag"
;;
"sdm710")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "diag"
;;
"sm6150")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.hcd_mask 80
setprop vendor.usb.rps_mask 40
setprop vendor.usb.diag.func.name "diag"
;;
"trinket")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "4e00000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "diag"
;;
"kona")
qcom_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet"
qcom_adb_usb_config="diag,diag_mdm,qdss,qdss_mdm,serial_cdev,serial_cdev_mdm,dpl,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "diag"
;;
"lito")
qcom_usb_config="diag,serial_cdev,rmnet"
qcom_adb_usb_config="diag,serial_cdev,rmnet,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "diag"
;;
"bengal")
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
factory_usb_config="diag,usbnet"
factory_usb_config_adb="diag,usbnet,adb"
setprop vendor.usb.controller "4e00000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "ffs"
;;
"lahaina")
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "ffs"
factory_usb_config="diag,usbnet"
factory_usb_config_adb="diag,usbnet,adb"
;;
"holi" | "blair")
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
factory_usb_config="diag,usbnet"
factory_usb_config_adb="diag,usbnet,adb"
setprop vendor.usb.controller "4e00000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "ffs"
;;
"taro" | "kalama" | "parrot" | "crow" | "pineapple")
qcom_usb_config="diag,serial_cdev,rmnet,dpl,qdss"
qcom_adb_usb_config="diag,serial_cdev,rmnet,dpl,qdss,adb"
bpt_usb_config="diag,serial,rmnet"
bpt_adb_usb_config="diag,serial,rmnet,adb"
setprop vendor.usb.controller "a600000.dwc3"
setprop vendor.usb.rndis.func.name "gsi"
setprop vendor.usb.rmnet.func.name "gsi"
setprop vendor.usb.diag.func.name "ffs"
factory_usb_config="diag,usbnet"
factory_usb_config_adb="diag,usbnet,adb"
wait_usb_udc_device 20000
;;
esac
## This is needed to switch to the qcom rndis driver.
diag_extra=`getprop persist.vendor.usb.config.extra`
if [ "$diag_extra" == "" ]; then
setprop persist.vendor.usb.config.extra none
fi
#
# Allow USB enumeration with default PID/VID
#
usb_config=`getprop persist.vendor.usb.config`
mot_usb_config=`getprop persist.vendor.mot.usb.config`
bootmode=`getprop ro.bootmode`
buildtype=`getprop ro.build.type`
securehw=`getprop ro.boot.secure_hardware`
cid=`getprop ro.vendor.boot.cid`
diagmode=`getprop persist.vendor.radio.usbdiag`
debuggable=`getprop ro.debuggable`
log_info "mmi-usb-sh: persist usb configs = \"$usb_config\", \"$mot_usb_config\", \"$diagmode\""
phonelock_type=`getprop persist.sys.phonelock.mode`
usb_restricted=`getprop persist.sys.usb.policylocked`
log_info "mmi-usb-sh: phonelock.mode=$phonelock_type, usb.policylocked=$usb_restricted, securehw=$securehw, buildtype=$buildtype, cid=$cid"
if [ "$securehw" == "1" ] && [ "$buildtype" == "user" ] && [ "$(($cid))" != 0 ]
then
if [ "$usb_restricted" == "1" ]
then
set_usb_secure_mode 1
else
case "$phonelock_type" in
"1" )
set_usb_secure_mode 1
;;
* )
set_usb_secure_mode 0
;;
esac
fi
fi
# ##DIAG# mode option
case "$diagmode" in
"1" )
case "$usb_config" in
"$bpt_usb_config" | "$bpt_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $bpt_usb_config
;;
*)
setprop persist.vendor.usb.config $bpt_adb_usb_config
;;
esac
;;
esac
exit 0
;;
* )
# Do nothing. USB enumeration will be set by bootmode
;;
esac
case "$bootmode" in
"bp-tools" )
case "$usb_config" in
"$bpt_usb_config" | "$bpt_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $bpt_usb_config
setprop persist.vendor.usb.bp-tools.config $bpt_usb_config
setprop persist.vendor.usb.bp-tools.func $bpt_usb_config
;;
*)
setprop persist.vendor.usb.config $bpt_adb_usb_config
setprop persist.vendor.usb.bp-tools.config $bpt_adb_usb_config
setprop persist.vendor.usb.bp-tools.func $bpt_adb_usb_config
;;
esac
;;
esac
;;
"mot-factory" )
allow_adb=`getprop persist.vendor.factory.allow_adb`
case "$allow_adb" in
"1")
if [ "$usb_config" != $factory_usb_config_adb ]
then
setprop persist.vendor.usb.config $factory_usb_config_adb
setprop persist.vendor.usb.mot-factory.config $factory_usb_config_adb
setprop persist.vendor.usb.mot-factory.func $factory_usb_config_adb
fi
;;
*)
if [ "$usb_config" != $factory_usb_config ]
then
setprop persist.vendor.usb.config $factory_usb_config
setprop persist.vendor.usb.mot-factory.config $factory_usb_config
setprop persist.vendor.usb.mot-factory.func $factory_usb_config
fi
;;
esac
# Disable Host Mode LPM for Factory mode
echo 1 > /sys/module/dwc3_msm/parameters/disable_host_mode_pm
;;
"qcom" )
case "$usb_config" in
"$qcom_usb_config" | "$qcom_adb_usb_config" )
;;
* )
case "$securehw" in
"1" )
setprop persist.vendor.usb.config $qcom_usb_config
setprop persist.vendor.usb.qcom.config $qcom_usb_config
setprop persist.vendor.usb.qcom.func $qcom_usb_config
;;
*)
setprop persist.vendor.usb.config $qcom_adb_usb_config
setprop persist.vendor.usb.qcom.config $qcom_adb_usb_config
setprop persist.vendor.usb.qcom.func $qcom_adb_usb_config
;;
esac
;;
esac
;;
* )
if [ "$buildtype" == "user" ] && [ "$phonelock_type" != "1" ] && [ "$usb_restricted" != "1" ] && [ "$debuggable" != "1"]
then
set_usb_secure_mode 1
log_info "Disabling enumeration until bootup!"
fi
case "$usb_config" in
"mtp,adb" | "mtp" | "adb")
;;
*)
case "$mot_usb_config" in
"mtp,adb" | "mtp" | "adb")
setprop persist.vendor.usb.config $mot_usb_config
;;
*)
case "$securehw" in
"1" )
setprop persist.vendor.usb.config mtp
;;
*)
setprop persist.vendor.usb.config adb
;;
esac
;;
esac
;;
esac
ffs_mtp=`getprop vendor.usb.use_ffs_mtp`
new_persist_usb_config=`getprop persist.vendor.usb.config`
if [ "$ffs_mtp" == "1" ] && [ "$new_persist_usb_config" == "mtp" ]
then
setprop persist.vendor.usb.config none
fi
adb_early=`getprop ro.boot.adb_early`
if [ "$adb_early" == "1" ]; then
set_usb_secure_mode 0
log_info "Enabling enumeration after bootup, count = $count !"
new_persist_usb_config=`getprop persist.vendor.usb.config`
if [[ "$new_persist_usb_config" != *adb* ]]; then
setprop persist.vendor.usb.config "adb"
setprop vendor.usb.config "adb"
else
setprop vendor.usb.config $new_persist_usb_config
fi
exit 0
fi
if [ "$buildtype" == "user" ] && [ "$phonelock_type" != "1" ] && [ "$usb_restricted" != "1" ] && [ "$debuggable" != "1"]
then
count=0
bootcomplete=`getprop vendor.boot_completed`
log_info "mmi-usb-sh - bootcomplete = $bootcomplete"
while [ "$bootcomplete" != "1" ]; do
log_dbg "Sleeping till bootup!"
sleep 1
count=$((count+1))
if [ $count -gt 90 ]
then
log_info "mmi-usb-sh - Timed out waiting for bootup"
break
fi
bootcomplete=`getprop vendor.boot_completed`
done
set_usb_secure_mode 0
log_info "Enabling enumeration after bootup, count = $count !"
exit 0
fi
;;
esac
new_persist_usb_config=`getprop persist.vendor.usb.config`
if [ "$sys_usb_config" != "$new_persist_usb_config" ]; then
setprop vendor.usb.config $new_persist_usb_config
fi
+38
View File
@@ -0,0 +1,38 @@
#!/vendor/bin/sh
wlan_log_path="/data/vendor/wifi/wlan_logs/"
wlan_log_dest_path="/data/vendor/bug2go/wlan_logs"
diag_log_path="/data/vendor/diag_mdlog/logs"
mdm2_log_path="/data/vendor/diag_mdlog/logs/mdm2"
wlan_dump_path="/data/vendor/tombstones/rfs/modem"
wlan_dump_path_8450="/data/vendor/ss-ram-dumps/bp-dumps"
cp -r $wlan_log_path $wlan_log_dest_path
chmod g+rwX $wlan_log_dest_path
if [ -d $wlan_dump_path ]
then echo "Get PD dump file"
for file in $(ls -1r $wlan_dump_path );
do cp $wlan_dump_path/$file $wlan_log_dest_path/$file
done
fi
if [ -d $wlan_dump_path_8450 ]
then echo "Get 8450 dump file"
for file in $(ls -1r $wlan_dump_path_8450 );
do cp -r $wlan_dump_path_8450/$file $wlan_log_dest_path/$file
done
fi
if [ -d $mdm2_log_path ]
then echo "Get diag logs"
for f in $diag_log_path/*.qmdl{,2}
do
cp $f $wlan_log_dest_path
done
cp -r $mdm2_log_path $wlan_log_dest_path
chmod g+X $wlan_log_dest_path/mdm2
fi
chmod -R g+rw $wlan_log_dest_path
chown -R log:log $wlan_log_dest_path
+742
View File
@@ -0,0 +1,742 @@
#!/vendor/bin/sh
BASEDIR=vendor
PATH=/sbin:/$BASEDIR/sbin:/$BASEDIR/bin:/$BASEDIR/xbin
export PATH
while getopts dpfrM op;
do
case $op in
d) dbg_on=1;;
p) populate_only=1;;
f) dead_touch=1;;
r) reset_touch=1;;
M) mount_2nd_stage=1;;
esac
done
shift $(($OPTIND-1))
scriptname=${0##*/}
hw_mp=/proc/hw
config_mp=/proc/config
reboot_utag=$config_mp/.reboot
touch_status_prop=vendor.hw.touch.status
hw_cfg_file=hw_config.xml
vhw_file=/$BASEDIR/etc/vhw.xml
bp_file=/system/build.prop
oem_file=/oem/oem.prop
load_error=3
need_to_reload=2
reload_in_progress=1
reload_done=0
ver_utag=".version"
version_fs="unknown"
xml_version="unknown"
device_params=""
xml_file=""
utag_update_fail="false"
modem_ver_prop=ro.vendor.hw.modem_version
policy_prop=ro.vendor.super_image_policy
super_image_detection()
{
local subsys
local file2mount
local basefile
local version
local extention
local image_dir
local is_super_image
local super_image_prop
local file_mount_prop
local modem_version=$(getprop $modem_ver_prop)
local policy=$(getprop $policy_prop)
debug "'$policy_prop' is '$policy'"
for subsys in modem fsg; do
debug "Processing [${subsys}]..."
is_super_image=""
case ${subsys} in
modem) image_dir=/vendor/firmware_mnt;;
fsg) image_dir=/vendor/fsg;;
esac
[ -f $image_dir/super_modem ] && is_super_image="true"
debug "super image '$is_super_image'"
if [ "$is_super_image" == "true" ]; then
file2mount=""
case ${subsys} in
modem) super_image_prop="ro.vendor.hw.modem_super_image"
file_mount_prop="ro.vendor.hw.modem_mount_file"
basefile="NON-HLOS.bin"
extention=".bin"
[ "$modem_version" ] && file2mount=$(printf "NON-HLOS%sbin" $modem_version)
;;
fsg) super_image_prop="ro.vendor.hw.fsg_super_image"
file_mount_prop="ro.vendor.hw.fsg_mount_file"
basefile="fsg.mbn"
extention=".mbn"
[ "$modem_version" ] && file2mount=$(printf "fsg%smbn" $modem_version)
;;
esac
if [ -z "$file2mount" ]; then
notice "'$modem_ver_prop' not set, but [$subsys] is super image!"
else
# modem_version matches existing file in super image
if [ -f $image_dir/$file2mount ]; then
notice "[$subsys] is super image. '$file2mount' will be mounted"
setprop $file_mount_prop $file2mount
setprop $super_image_prop yes
continue
fi
notice "[$subsys] is super image. '$file2mount' not found"
fi
else
notice "[$subsys] non-super image"
fi
# check super image policy
if [ "$policy" == "enforce" ]; then
notice "[$subsys] strict super image policy! Rebooting to recovery..."
debug "'ro.vendor.hw.super_image_failure' -> 'yes'"
setprop ro.vendor.hw.super_image_failure yes
return
fi
notice "[$subsys] super image policy not enforced"
# proceed with non-super image if policy allows
if [ -z "$is_super_image" ]; then
notice "[$subsys] proceed with non-super image!"
continue
fi
# retrieve default version if available
version=$(cat $image_dir/super_modem)
if [ "$version" ]; then
basefile=$version
notice "default file override '$basefile'"
else
notice "use default file: '$basefile' instead of '$file2mount'"
fi
notice "Searching for '$basefile' in $image_dir..."
debug "checking file '$image_dir/$basefile'"
if [ -f $image_dir/$basefile ]; then
notice "[$subsys] is super image! '$basefile' will be mounted"
debug "'$file_mount_prop' -> '$basefile'"
setprop $file_mount_prop $basefile
debug "'$super_image_prop' -> 'yes'"
setprop $super_image_prop yes
continue
fi
# set to fail
notice "Unable to mount '$basefile'! Rebooting to recovery..."
debug "'ro.vendor.hw.super_image_failure' -> 'yes'"
setprop ro.vendor.hw.super_image_failure yes
return
done
}
set_reboot_counter()
{
local value=$1
local reboot_cnt=0
local reboot_mp=${reboot_utag%.*}
local tag_name=${reboot_utag##*/}
if [ $((value)) -gt 0 ]; then
notice "increase reboot counter"
[ -d $reboot_utag ] && reboot_cnt=$(cat $reboot_utag/ascii)
value=$(($reboot_cnt + 1))
fi
if [ ! -d $reboot_utag ]; then
echo ${reboot_utag##*/} > $reboot_mp/all/new
[ $? != 0 ] && notice "error creating UTAG $tag_name"
fi
echo "$value" > $reboot_utag/ascii
[ $? != 0 ] && notice "error updating UTAG $tag_name"
notice "UTAG $tag_name is [`cat $reboot_utag/ascii`]"
}
set_reboot_counter_property()
{
local reboot_cnt=0
local tag_name=${reboot_utag##*/}
if [ -d $reboot_utag ]; then
reboot_cnt=$(cat $reboot_utag/ascii)
notice "UTAG $tag_name has value [$reboot_cnt]"
else
notice "UTAG $tag_name does not exist"
fi
setprop $touch_status_prop $reboot_cnt
notice "property [$touch_status_prop] is set to [`getprop $touch_status_prop`]"
}
debug()
{
[ $dbg_on ] && echo "Debug: $*"
}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
add_device_params()
{
device_params=$device_params" $@"
debug "add_device_params='$device_params'"
}
drop_device_parameter()
{
device_params=${device_params% *}
debug "drop_device_parameter='$device_params'"
}
set_xml_file()
{
xml_file=$@
debug "working with XML file='$xml_file'"
}
exec_parser()
{
eval motobox expat -u -f $xml_file $device_params "$@" 2>/dev/null
}
reload_utags()
{
local mp=$1
local value
echo "1" > $mp/reload
value=$(cat $mp/reload)
while [ "$value" == "$reload_in_progress" ]; do
notice "waiting for loading to complete"
sleep 1;
value=$(cat $mp/reload)
notice "'$mp' current status [$value]"
done
}
procfs_wait_for_device()
{
local __result=$1
local status
local mpi
local IFS=' '
local device_timeout_count=0
while [ ! -f $hw_mp/reload ] || [ ! -f $config_mp/reload ]; do
notice "waiting for devices"
sleep 1;
if [ "$device_timeout_count" -eq "10" ];then
notice "waiting for devices timeout"
eval $__result=""
return
fi
device_timeout_count=$(($device_timeout_count + 1))
done
for mpi in $hw_mp $config_mp; do
status=$(cat $mpi/reload)
notice "mount point '$mpi' status [$status]"
if [ "$status" == "$need_to_reload" ]; then
notice "force $mpi reloading"
reload_utags $mpi
fi
done
for mpi in $hw_mp $config_mp; do
status=$(cat $mpi/reload)
notice "$mpi reload is [$status]"
device_timeout_count=0
while [ "$status" != "$reload_done" ]; do
notice "waiting for loading $mpi to complete"
sleep 1;
status=$(cat $mpi/reload)
if [ "$device_timeout_count" -eq "10" ]; then
notice "error: waiting for loading $mpi timeout"
break
fi
device_timeout_count=$(($device_timeout_count + 1))
done
done
eval $__result=$status
}
get_attr_data_by_name()
{
local __result=$1
local attr=$2
shift 2
local IFS=' '
eval $__result=""
for arg in ${@}; do
[ "${arg%=*}" == "$attr" ] || continue
debug "attr_data='${arg#*=}'"
eval $__result="${arg#*=}"
break
done
}
get_tag_data()
{
local __name=$1
local __value=$2
shift 2
local dataval
local IFS=' '
eval $__name=""
eval $__value=""
for arg in ${@}; do
case $arg in
string-array | string)
debug "---/ skip keyword: '$arg'"
continue;;
esac
debug "---> arg='$arg'"
if [ "${arg%=*}" == "name" ]; then
eval $__name=${arg#*=}
continue
fi
# eval treats ';' as a separator, thus make it '\;'
dataval=$(echo ${arg#?} | sed 's/;/\\;/g')
debug "<--- dataval='$dataval'"
eval $__value=$dataval
done
}
update_utag()
{
local utag=$1
local payload=$2
local verify
local rc
if [ ! -d $hw_mp/$utag ]; then
notice "creating utag '$utag'"
echo $utag > $hw_mp/all/new
rc=$?
[ "$rc" != "0" ] && notice "'$utag' create dir failed rc=$rc"
fi
debug "writing '$payload' to '$hw_mp/$utag/ascii'"
echo "$payload" > $hw_mp/$utag/ascii
rc=$?
if [ "$rc" != "0" ]; then
utag_update_fail="true"
notice "'$utag' write file failed rc=$rc"
fi
verify=$(cat $hw_mp/$utag/ascii)
debug "read '$verify' from '$hw_mp/$utag/ascii'"
[ "$verify" != "$payload" ] && notice "'$utag' payload validation failed"
}
populate_utags()
{
local selection="$@"
local pline
local ptag
local pvalue
for pline in $(exec_parser $selection); do
get_tag_data ptag pvalue $pline
url_style_off pvalue $pvalue
debug "tag='$ptag' value='$pvalue'"
update_utag $ptag $pvalue
done
}
set_ro_hw_properties_upgrade()
{
local utag_path
local utag_name
local prop_prefix
local utag_value
local verify
for hwtag in $(find $hw_mp -name '.system'); do
debug "path $hwtag has '.system' in its name"
prop_prefix="ro.vendor.hw."
utag_path=${hwtag%/*}
utag_name=${utag_path##*/}
utag_value=$(cat $utag_path/ascii)
setprop $prop_prefix$utag_name "$utag_value"
notice "ro.vendor.hw.$utag_name='$utag_value'"
done
}
set_ro_hw_property()
{
local hwtag=$1
local utag_path
local utag_name
local prop_prefix
local utag_value
local verify
debug "path $hwtag has '.system' in its name"
prop_prefix=$(cat $hwtag/ascii)
verify=${prop_prefix%.}
# esure property ends with '.'
if [ "$prop_prefix" == "$verify" ]; then
prop_prefix="$prop_prefix."
debug "added '.' at the end of [$prop_prefix]"
fi
utag_path=${hwtag%/*}
utag_name=${utag_path##*/}
utag_value=$(cat $utag_path/ascii)
setprop $prop_prefix$utag_name "$utag_value"
notice "$prop_prefix$utag_name='$utag_value'"
}
set_ro_hw_properties()
{
for hwtag in $(find $hw_mp -name '.system'); do
set_ro_hw_property $hwtag &
done
}
smart_value()
{
local mtag=$1
local __result=$2
local value
eval $__result=""
local tmp=${mtag#?}
# absolute path to the file starts with '/'
if [ "${mtag%$tmp}" == "/" ]; then
value=$(cat $mtag)
# property likely to have '.'
elif [ "$mtag" != "${mtag%.*}" ]; then
value=$(getprop $mtag)
else # tag otherwise
value=$(cat $hw_mp/$mtag/ascii)
fi
eval $__result='$value'
}
url_style_off()
{
local __arg=$1
local value=$2
if [[ $value == *%* ]]; then
value=$(echo ${value//%20/ })
value=$(echo ${value//%28/\(})
value=$(echo ${value//%29/\)})
fi
eval $__arg='$value'
}
match()
{
local mapping
local mline
local mtag
local fs_value
local mvalue
local matched
url_style_off mapping $1
debug "match mapping='$mapping'"
# put '\"' around $mapping to ensure XML
# parser takes it as a single argument
for mline in $(exec_parser \"$mapping\"); do
get_tag_data mtag mvalue $mline
url_style_off mvalue $mvalue
# obtain value based on data source: utag, property or file
smart_value $mtag fs_value
if [ "$fs_value" == "$mvalue" ]; then
matched="true";
else
matched="false";
fi
debug "cmp utag='$mtag' values '$mvalue' & '$fs_value' is \"$matched\""
[ "$matched" == "false" ] && break
done
[ "$matched" == "true" ] && return 0
return 1
}
find_match()
{
local __retval=$1
local tag_name
local fline
local line
local subsection
local matched="false"
eval $__retval=""
for fline in $(exec_parser); do
subsection=${fline%% *}
add_device_params $subsection
for line in $(exec_parser); do
get_attr_data_by_name tag_name "name" $line
debug "tag_name='$tag_name'"
match $tag_name
[ "$?" != "0" ] && continue
eval $__retval=$tag_name
matched="true"
break
done
drop_device_parameter
[ "$matched" == "true" ] && break
done
}
prefetch_from_file()
{
local pname=$1
local __result=$2
local value
local override
eval $__result=""
value=$(cat $bp_file 2>/dev/null | sed '/^$/d' | sed '/^#/d' | sed '/^import/d' | sed -n "/$pname=/p" | sed 's/.*=//')
debug "'$pname' from '$bp_file': '$value'"
if [ -f $oem_file ]; then
override=$(cat $oem_file 2>/dev/null | sed '/^$/d' | sed '/^#/d' | sed '/^import/d' | sed -n "/$pname=/p" | sed 's/.*=//')
[ "$override" ] && value=$override && debug "'$pname' from '$oem_file': '$value'"
fi
eval $__result=$value
}
append_match()
{
local prop_list=$1
local suffix="$2"
local dest_prop
local fetched_prop
local prop_value
local IFS=','
# properties list to put the result of appending hw suffix to
# example: appended="ro.vendor.product.name,ro.vendor.product.device"
for dest_prop in $prop_list; do
fetch_prop=${dest_prop}
# only alter property name that has "vendor" in it
if [ "${fetch_prop//.vendor}" != "$dest_prop" ]; then
fetch_prop=${fetch_prop//.vendor}
prop_value=$(getprop $fetch_prop)
[ -z "$prop_value" ] && prefetch_from_file $fetch_prop prop_value
# finally set destination property to appended value
setprop $dest_prop "$prop_value$suffix"
notice "$dest_prop='$prop_value$suffix'"
fi
done
}
export_match()
{
local prop_list=$1
local prop_value="$2"
local dest_prop
local IFS=','
# example: export="ro.vendor.product.display,ro.vendor.product.display.plain_text"
for dest_prop in $prop_list; do
fetch_prop=${dest_prop}
setprop $fetch_prop "$prop_value"
debug "export $fetch_prop='$prop_value'"
done
}
process_mappings()
{
local pname=""
local pexport=""
local pdefault=""
local pappend=""
local putag=""
local subsection
local pline
local matched_val
local whitespace_val
local export_val
local utag_val
for pline in $(exec_parser); do
subsection=${pline%% *}
debug "subsection is '$subsection'"
get_attr_data_by_name pname "name" $pline
get_attr_data_by_name pexport "export" $pline
get_attr_data_by_name pdefault "default" $pline
get_attr_data_by_name pappend "append" $pline
get_attr_data_by_name putag "writeback" $pline
[ "$pname" ] && url_style_off pname $pname && debug "name='$pname'"
[ "$pexport" ] && url_style_off pexport $pexport && debug "export='$pexport'"
[ "$pdefault" ] && url_style_off pdefault $pdefault && debug "default='$pdefault'"
[ "$pappend" ] && url_style_off pappend $pappend && debug "append='$pappend'"
# add 'subsection' to permanent parameters
add_device_params $subsection
# call itself here to handle nonamed subsection, like quirks
[ -z "$pname" ] && [ -z "$pexport" ] && [ -z "$pdefault" ] && [ -z "$pappend" ] && [ -z "$putag" ] && process_mappings && continue
find_match matched_val
[ "$matched_val" ] && url_style_off matched_val $matched_val
# append_match handles OEM overrides, thus has to be called even with empty value
[ "$pappend" ] && append_match $pappend "$matched_val"
if [ "$matched_val" ]; then
if [ "$pexport" ]; then
export_match $pexport "$matched_val"
notice "exporting '$matched_val' into property $pexport"
fi
elif [ "$pexport" -a "$pdefault" ]; then
# if match is not found, proceed with default
export_match $pexport "$pdefault"
notice "defaulting '$pdefault' into property $pexport"
fi
if [ "$putag" ] && [ -d $hw_mp/$putag ]; then
export_val=$(getprop $pexport)
utag_val=$(cat $hw_mp/$putag/ascii)
debug "writeback compare $utag_val,$export_val"
# if property is empty value, clear the utag.
# if property and writeback utag are empty value, don't update utag
if [ "$export_val" -o "$utag_val" != "(null)" ] && [ "$utag_val" != "$export_val" ]; then
update_utag $putag $export_val
notice "writeback '$export_val' into utag $putag"
fi
fi
# remove the last added parameter
drop_device_parameter
done
}
# Main starts here
IFS=$'\n'
if [ ! -z "$mount_2nd_stage" ]; then
notice "Super image detection"
super_image_detection
return 0
fi
if [ ! -z "$reset_touch" ]; then
notice "reset reboot counter"
set_reboot_counter 0
return 0
fi
if [ ! -z "$dead_touch" ]; then
notice "property [$touch_status_prop] set to [dead]"
set_reboot_counter 1
return 0
fi
if [ -f /vendor/lib/modules/utags.ko ]; then
notice "loading utag driver"
insmod /vendor/lib/modules/utags.ko
if [ $? -ne 0 ]; then
gki_modules_full_path=`find /vendor/lib/modules -name "*-gki"`
if [ -n "$gki_modules_full_path" ]; then
gki_modules_path=`basename $gki_modules_full_path`
notice "loading gki utag driver in /vendor/lib/modules/$gki_modules_path"
insmod /vendor/lib/modules/$gki_modules_path/utags.ko
if [ $? -ne 0 ]; then
notice "fail to load /vendor/lib/modules/$gki_modules_path/utags.ko"
setprop ro.vendor.mot.gki.path "."
else
notice "successfully load /vendor/lib/modules/$gki_modules_path/utags.ko"
setprop ro.vendor.mot.gki.path $gki_modules_path
fi
else
notice "fail to load utag driver"
setprop ro.vendor.mot.gki.path "."
fi
else
setprop ro.vendor.mot.gki.path "."
fi
fi
notice "checking integrity"
# check necessary components exist and just proceed
# with RO properties setup otherwise
if [ ! -f /$BASEDIR/bin/expat ] || [ ! -f $vhw_file ]; then
notice "warning: missing expat or xml"
set_ro_hw_properties
return 0
fi
if [ ! -z "$populate_only" ]; then
# special handling for factory UTAGs provisioning
for path in /data/local/tmp /pds/factory; do
[ -f $path/$hw_cfg_file ] && break
done
notice "populating hw config from '$path/$hw_cfg_file'"
set_xml_file $path/$hw_cfg_file
populate_utags hardware
return 0
fi
notice "initializing procfs"
procfs_wait_for_device readiness
if [ "$readiness" != "0" ]; then
notice "no access to hw utags procfs"
return 1
fi
# populate touch status property with reboot counter
set_reboot_counter_property &
# XML parsing starts here
set_xml_file $vhw_file
get_attr_data_by_name boot_device_prop "match" $(exec_parser)
debug "attr='get' value='$boot_device_prop'"
if [ -z $boot_device_prop ]; then
notice "fatal: undefined boot device property"
return 1
fi
# ensure lower case
typeset -l boot_device=$(getprop $boot_device_prop)
# drop suffixes
boot_device=${boot_device%[_-]*}
notice "matching to boot device '$boot_device'"
# add 'validation' to permanent parameters
add_device_params validation
for line in $(exec_parser); do
get_attr_data_by_name product "name" $line
debug "attr='name' value='$product'"
if [ "$product" == "$boot_device" ]; then
get_attr_data_by_name xml_version "version" $line
[ "$xml_version" != "unknown" ] && notice "device '$boot_device' xml version='$xml_version'"
break
fi
done
[ "$xml_version" == "unknown" ] && notice "no match found for device '$boot_device'"
# delete obsolete 'version' utag if exists
[ -d $hw_mp/${ver_utag#?} ] && $(echo ${ver_utag#?} > $hw_mp/all/delete)
# read procfs version
[ -d $hw_mp/$ver_utag ] && version_fs=$(cat $hw_mp/$ver_utag/ascii)
notice "procfs version='$version_fs'"
# add 'device' and '$boot_device' to permanent parameters
add_device_params device $boot_device
[ "$xml_version" == "$version_fs" ] && notice "hw descriptor is up to date"
for section in $(exec_parser); do
debug "section='$section'"
case $section in
mappings)
# add 'mappings' to permanent parameters
add_device_params $section
process_mappings &
;;
*)
[ "$xml_version" == "$version_fs" ] && continue
populate_utags $section;;
esac
done
if [ "$xml_version" != "$version_fs" ]; then
# create version utag if it's missing
[ ! -d $hw_mp/$ver_utag ] && $(echo "$ver_utag" > $hw_mp/all/new)
# update procfs version
[ -d $hw_mp/$ver_utag ] && $(echo "$xml_version" > $hw_mp/$ver_utag/ascii)
fi
set_ro_hw_properties
if [ "$utag_update_fail" == "true" ]; then
set_ro_hw_properties_upgrade
fi
wait
notice "script init.oem.hw.sh finish "
return 0
+216
View File
@@ -0,0 +1,216 @@
#!/vendor/bin/sh
# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Set platform variables
target=`getprop ro.board.platform`
if [ -f /sys/devices/soc0/hw_platform ]; then
soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
else
soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
fi
if [ -f /sys/devices/soc0/soc_id ]; then
soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
else
soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
fi
if [ -f /sys/devices/soc0/platform_version ]; then
soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
else
soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
fi
# Dynamic Memory Managment (DMM) provides a sys file system to the userspace
# that can be used to plug in/out memory that has been configured as unstable.
# This unstable memory can be in Active or In-Active State.
# Each of which the userspace can request by writing to a sys file.
#
# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
# property is set in the Android system properties file.
#
# If ro.dev.dmm.dpd.start_address is set here then the target has a memory
# configuration that supports DynamicMemoryManagement.
init_DMM()
{
block=-1
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
;;
*)
return
;;
esac
mem="/sys/devices/system/memory"
op=`cat $mem/movable_start_bytes`
case "$op" in
"0")
log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
;;
"$mem/movable_start_bytes: No such file or directory ")
log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
;;
*)
log -p i -t DMM DMM available. movable_start_bytes at $op
movable_start_bytes=0x`cat $mem/movable_start_bytes`
block_size_bytes=0x`cat $mem/block_size_bytes`
block=$((#${movable_start_bytes}/${block_size_bytes}))
chown -h system.system $mem/memory$block/state
chown -h system.system $mem/probe
chown -h system.system $mem/active
chown -h system.system $mem/remove
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
echo $movable_start_bytes > $mem/probe
case "$?" in
"0")
log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
;;
*)
log -p e -t DMM $movable_start_bytes to physical hotplug failed.
return
;;
esac
echo online > $mem/memory$block/state
case "$?" in
"0")
log -p i -t DMM \'echo online\' to logical hotplug succeeded.
;;
*)
log -p e -t DMM \'echo online\' to logical hotplug failed.
return
;;
esac
;;
esac
setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
setprop ro.dev.dmm.dpd.block $block
;;
esac
case "$target" in
"msm8960")
return
;;
esac
# For 7X30 targets:
# ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
# configuration. This is also used to indicate that the target is capable of
# setting EBI-1 to Deep Power Down or Self Refresh.
op=`cat $mem/low_power_memory_start_bytes`
case "$op" in
"0")
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
;;
"$mem/low_power_memory_start_bytes No such file or directory ")
log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
;;
*)
log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
;;
esac
}
#
# For controlling console and shell on console on 8960 - perist.serial.enable 8960
# On other target use default ro.debuggable property.
#
serial=`getprop persist.serial.enable`
dserial=`getprop ro.debuggable`
case "$target" in
"msm8960")
case "$serial" in
"0")
echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
;;
"1")
echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
start console
;;
*)
case "$dserial" in
"1")
start console
;;
esac
;;
esac
;;
"msm8610" | "msm8974" | "msm8226")
case "$serial" in
"0")
echo 0 > /sys/devices/f991f000.serial/console
;;
"1")
echo 1 > /sys/devices/f991f000.serial/console
start console
;;
*)
case "$dserial" in
"1")
start console
;;
esac
;;
esac
;;
*)
case "$dserial" in
"1")
start console
;;
esac
;;
esac
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
insmod /system/lib/modules/ss_mfcinit.ko
insmod /system/lib/modules/ss_vencoder.ko
insmod /system/lib/modules/ss_vdecoder.ko
chmod -h 0666 /dev/ss_mfc_reg
chmod -h 0666 /dev/ss_vdec
chmod -h 0666 /dev/ss_venc
init_DMM
;;
"msm8960")
init_DMM
;;
esac
+115
View File
@@ -0,0 +1,115 @@
#! /vendor/bin/sh
# Copyright (c) 2009-2010, 2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
LOG_TAG="qcom-bt-wlan-coex"
LOG_NAME="${0}:"
coex_pid=""
ath_wlan_supported=`getprop wlan.driver.ath`
loge ()
{
/system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
}
logi ()
{
/system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
}
failed ()
{
loge "$1: exit code $2"
exit $2
}
start_coex ()
{
case "$ath_wlan_supported" in
"2")
echo "ATH WLAN Chip ID AR6004 is enabled"
/system/bin/abtfilt -d -z -n -m -a -w wlan0 &
;;
"1")
echo "ATH WLAN Chip ID is enabled"
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
;;
"0")
echo "WCN WLAN Chip ID is enabled"
# Must have -o turned on to avoid daemon (otherwise we cannot get pid)
/system/bin/btwlancoex -o $opt_flags &
;;
*)
echo "NO WLAN Chip ID is enabled, so enabling ATH as default"
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
;;
esac
coex_pid=$!
logi "start_coex: pid = $coex_pid"
}
kill_coex ()
{
logi "kill_coex: pid = $coex_pid"
kill -TERM $coex_pid
# this shell doesn't exit now -- wait returns for normal exit
}
# mimic coex options parsing -- maybe a waste of effort
USAGE="${0} [-o] [-c] [-r] [-i] [-h]"
while getopts "ocrih" f
do
case $f in
o | c | r | i | h) opt_flags="$opt_flags -$f" ;;
\?) echo $USAGE; exit 1;;
esac
done
# init does SIGTERM on ctl.stop for service
trap "kill_coex" TERM INT
#Selectively start coex module
target=`getprop ro.board.platform`
if [ "$target" == "msm8960" ] && [ "$ath_wlan_supported" != "2" ]; then
logi "btwlancoex/abtfilt is not needed"
else
# Build settings may not produce the coex executable
if ls /system/bin/btwlancoex || ls /system/bin/abtfilt
then
start_coex
wait $coex_pid
logi "Coex stopped"
else
logi "btwlancoex/abtfilt not available"
fi
fi
exit 0
+505
View File
@@ -0,0 +1,505 @@
#! /vendor/bin/sh
# Copyright (c) 2012-2013,2016,2018-2020 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
export PATH=/vendor/bin
# Set platform variables
if [ -f /sys/devices/soc0/hw_platform ]; then
soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
else
soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
fi
if [ -f /sys/devices/soc0/soc_id ]; then
soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
else
soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
fi
if [ -f /sys/devices/soc0/platform_version ]; then
soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
else
soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
fi
if [ -f /sys/class/drm/card0-DSI-1/modes ]; then
echo "detect" > /sys/class/drm/card0-DSI-1/status
mode_file=/sys/class/drm/card0-DSI-1/modes
while read line; do
fb_width=${line%%x*};
break;
done < $mode_file
elif [ -f /sys/class/graphics/fb0/virtual_size ]; then
res=`cat /sys/class/graphics/fb0/virtual_size` 2> /dev/null
fb_width=${res%,*}
fi
log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'"
#For drm based display driver
vbfile=/sys/module/drm/parameters/vblankoffdelay
if [ -w $vbfile ]; then
echo -1 > $vbfile
else
log -t DRM_BOOT -p w "file: '$vbfile' or perms doesn't exist"
fi
function set_density_by_fb() {
#put default density based on width
if [ -z $fb_width ]; then
setprop vendor.display.lcd_density 320
else
if [ $fb_width -ge 1600 ]; then
setprop vendor.display.lcd_density 640
elif [ $fb_width -ge 1440 ]; then
setprop vendor.display.lcd_density 560
elif [ $fb_width -ge 1080 ]; then
setprop vendor.display.lcd_density 480
elif [ $fb_width -ge 720 ]; then
setprop vendor.display.lcd_density 320 #for 720X1280 resolution
elif [ $fb_width -ge 480 ]; then
setprop vendor.display.lcd_density 240 #for 480X854 QRD resolution
else
setprop vendor.display.lcd_density 160
fi
fi
}
target=`getprop ro.board.platform`
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
case "$soc_hwplatform" in
"FFA" | "SVLTE_FFA")
# linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
# the UI keyboard works fine.
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
"Fluid")
setprop vendor.display.lcd_density 240
setprop qcom.bt.dev_power_class 2
;;
*)
ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
;;
esac
;;
"sm6150")
case "$soc_hwplatform" in
"ADP")
setprop vendor.display.lcd_density 160
;;
esac
case "$soc_hwid" in
365|366)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
setprop vendor.media.target.version 1
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 2
fi
;;
355|369|377|384)
setprop vendor.chre.enabled 0
;;
*)
esac
;;
"msm8660")
case "$soc_hwplatform" in
"Fluid")
setprop vendor.display.lcd_density 240
;;
"Dragon")
setprop ro.sound.alsa "WM8903"
;;
esac
;;
"msm8960")
# lcd density is write-once. Hence the separate switch case
case "$soc_hwplatform" in
"Liquid")
if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
setprop ro.sf.hwrotation 90
fi
setprop vendor.display.lcd_density 160
;;
"MTP")
setprop vendor.display.lcd_density 240
;;
*)
case "$soc_hwid" in
"109")
setprop vendor.display.lcd_density 160
;;
*)
setprop vendor.display.lcd_density 240
;;
esac
;;
esac
#Set up composition type based on the target
case "$soc_hwid" in
87)
#8960
setprop debug.composition.type dyn
;;
153|154|155|156|157|138)
#8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB
setprop debug.composition.type c2d
;;
*)
esac
;;
"msm8974")
case "$soc_hwplatform" in
"Liquid")
setprop vendor.display.lcd_density 160
# Liquid do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop ro.hw.nav_keys 0
;;
"Dragon")
setprop vendor.display.lcd_density 240
;;
*)
setprop vendor.display.lcd_density 320
;;
esac
;;
"msm8226")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 320
;;
esac
;;
"msm8610" | "apq8084" | "mpq8092")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 240
;;
esac
;;
"apq8084")
case "$soc_hwplatform" in
"Liquid")
setprop vendor.display.lcd_density 320
# Liquid do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop ro.hw.nav_keys 0
;;
"SBC")
setprop vendor.display.lcd_density 200
# SBC do not have hardware navigation keys, so enable
# Android sw navigation bar
setprop qemu.hw.mainkeys 0
;;
*)
setprop vendor.display.lcd_density 480
;;
esac
;;
"msm8996")
case "$soc_hwplatform" in
"Dragon")
setprop vendor.display.lcd_density 240
setprop qemu.hw.mainkeys 0
;;
"ADP")
setprop vendor.display.lcd_density 160
setprop qemu.hw.mainkeys 0
;;
"SBC")
setprop vendor.display.lcd_density 240
setprop qemu.hw.mainkeys 0
;;
*)
setprop vendor.display.lcd_density 560
;;
esac
;;
"msm8937" | "msm8940")
# Set vendor.opengles.version based on chip id.
# MSM8937 and MSM8940 variants supports OpenGLES 3.1
# 196608 is decimal for 0x30000 to report version 3.0
# 196609 is decimal for 0x30001 to report version 3.1
# 196610 is decimal for 0x30002 to report version 3.2
case "$soc_hwid" in
294|295|296|297|298|313|353|354|363|364)
setprop vendor.opengles.version 196610
if [ $soc_hwid = 354 ]
then
setprop vendor.media.target.version 1
log -t BOOT -p i "SDM429 early_boot prop set for: HwID '$soc_hwid'"
fi
;;
303|307|308|309|320)
# Vulkan is not supported for 8917 variants
setprop vendor.opengles.version 196608
setprop persist.graphics.vulkan.disable true
;;
*)
setprop vendor.opengles.version 196608
;;
esac
;;
"msm8909")
case "$soc_hwplatform" in
*)
setprop persist.graphics.vulkan.disable true
;;
esac
;;
"msm8998" | "apq8098_latv")
case "$soc_hwplatform" in
*)
setprop vendor.display.lcd_density 560
;;
esac
;;
"sdm845")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"msmnile")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"kona")
case "$soc_hwplatform" in
*)
setprop vendor.media.target_variant "_kona"
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
;;
esac
;;
"lito")
case "$soc_hwid" in
400|440)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
434|459)
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
setprop vendor.media.target.version 2
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 3
fi
;;
esac
;;
"bengal")
case "$soc_hwid" in
441)
setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
setprop vendor.gralloc.disable_ubwc 1
# 196609 is decimal for 0x30001 to report version 3.1
setprop vendor.opengles.version 196609
;;
471)
#scuba APQ
setprop vendor.gralloc.disable_ubwc 1
;;
esac
;;
"sdm710" | "msmpeafowl")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc1/sku_version` 2> /dev/null
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
esac
;;
"msm8953")
cap_ver = 1
if [ -e "/sys/devices/platform/soc/1d00000.qcom,vidc/capability_version" ]; then
cap_ver=`cat /sys/devices/platform/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null
else
cap_ver=`cat /sys/devices/soc/1d00000.qcom,vidc/capability_version` 2> /dev/null
fi
if [ $cap_ver -eq 1 ]; then
setprop vendor.media.target.version 1
fi
;;
#Set property to differentiate SDM660 & SDM455
#SOC ID for SDM455 is 385
"sdm660")
case "$soc_hwplatform" in
*)
if [ $fb_width -le 1600 ]; then
setprop vendor.display.lcd_density 560
else
setprop vendor.display.lcd_density 640
fi
if [ $soc_hwid -eq 385 ]; then
setprop vendor.media.target.version 1
fi
;;
esac
;;
"holi")
setprop vendor.media.target_variant "_holi"
;;
esac
baseband=`getprop ro.baseband`
#enable atfwd daemon all targets except sda, apq, qcs
case "$baseband" in
"apq" | "sda" | "qcs" )
setprop persist.vendor.radio.atfwd.start false;;
*)
setprop persist.vendor.radio.atfwd.start true;;
esac
#set default lcd density
#Since lcd density has read only
#property, it will not overwrite previous set
#property if any target is setting forcefully.
set_density_by_fb
# set Lilliput LCD density for ADP
product=`getprop ro.board.platform`
case "$product" in
"msmnile_au")
setprop vendor.display.lcd_density 160
echo 902400000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/min_freq
echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu0-cpu-l3-lat/max_freq
echo 902400000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/min_freq
echo 1612800000 > /sys/class/devfreq/soc:qcom,cpu4-cpu-l3-lat/max_freq
;;
*)
;;
esac
case "$product" in
"sm6150_au")
setprop vendor.display.lcd_density 160
;;
*)
;;
esac
case "$product" in
"sdmshrike_au")
setprop vendor.display.lcd_density 160
;;
*)
;;
esac
case "$product" in
"msmnile_gvmq")
setprop vendor.display.lcd_density 160
;;
*)
;;
esac
# Setup display nodes & permissions
# HDMI can be fb1 or fb2
# Loop through the sysfs nodes and determine
# the HDMI(dtv panel)
function set_perms() {
#Usage set_perms <filename> <ownership> <permission>
chown -h $2 $1
chmod $3 $1
}
# check for the type of driver FB or DRM
fb_driver=/sys/class/graphics/fb0
if [ -e "$fb_driver" ]
then
# check for mdp caps
file=/sys/class/graphics/fb0/mdp/caps
if [ -f "$file" ]
then
setprop vendor.gralloc.disable_ubwc 1
cat $file | while read line; do
case "$line" in
*"ubwc"*)
setprop vendor.gralloc.enable_fb_ubwc 1
setprop vendor.gralloc.disable_ubwc 0
esac
done
fi
else
set_perms /sys/devices/virtual/hdcp/msm_hdcp/min_level_change system.graphics 0660
fi
# allow system_graphics group to access pmic secure_mode node
set_perms /sys/class/lcd_bias/secure_mode system.graphics 0660
set_perms /sys/class/leds/wled/secure_mode system.graphics 0660
boot_reason=`cat /proc/sys/kernel/boot_reason`
reboot_reason=`getprop ro.boot.alarmboot`
if [ "$boot_reason" = "3" ] || [ "$reboot_reason" = "true" ]; then
setprop ro.vendor.alarm_boot true
else
setprop ro.vendor.alarm_boot false
fi
# copy GPU frequencies to vendor property
if [ -f /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies ]; then
gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null
setprop vendor.gpu.available_frequencies "$gpu_freq"
fi
+35
View File
@@ -0,0 +1,35 @@
#! /vendor/bin/sh
# Copyright (c) 2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
PATH=/system/bin:$PATH
export PATH
cat /sys/devices/platform/rs300000a7.65536/force_sync
cat /sys/devices/platform/rs300100a7.65536/force_sync
+5801
View File
File diff suppressed because it is too large. Load diff
+78
View File
@@ -0,0 +1,78 @@
#! /vendor/bin/sh
# Copyright (c) 2010, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# For successful WLAN card detection, WLAN needs SDIO polling turned on.
# This script can be used to turn on/off SDIO polling on appropriate
# SDIO slot on the MSM target (e.g. slot 3 on 7x30 surf).
arg=$1
target=`getprop ro.board.platform`
case "$target" in
"msm7627_6x")
echo 1 > /sys/devices/platform/msm_sdcc.1/polling
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
;;
"msm7627_ffa")
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
;;
"msm7627_surf")
echo 1 > /sys/devices/platform/msm_sdcc.1/polling
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
;;
"msm7627a")
echo 1 > /sys/devices/platform/msm_sdcc.2/polling
;;
"msm7630_surf")
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
;;
"msm7630_1x")
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
;;
"msm7630_fusion")
echo 1 > /sys/devices/platform/msm_sdcc.3/polling
;;
"msm8660")
echo 1 > /sys/devices/platform/msm_sdcc.4/polling
;;
"msm8660_csfb")
echo 1 > /sys/devices/platform/msm_sdcc.4/polling
;;
esac
exit 0
+33
View File
@@ -0,0 +1,33 @@
#!/vendor/bin/sh
# Copyright (c) 2020 The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Function to start sensors for SSC enabled platforms
#
cp /vendor/etc/sensors/scripts/* /data/vendor/sensors/scripts/
chmod a+rw /data/vendor/sensors/scripts/*
+465
View File
@@ -0,0 +1,465 @@
#! /vendor/bin/sh
# Copyright (c) 2009-2016, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
target=`getprop ro.board.platform`
low_ram=`getprop ro.config.low_ram`
if [ -f /sys/devices/soc0/soc_id ]; then
platformid=`cat /sys/devices/soc0/soc_id`
else
platformid=`cat /sys/devices/system/soc/soc0/id`
fi
start_battery_monitor()
{
if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then
chown -h root.system /sys/module/pm8921_bms/parameters/*
chown -h root.system /sys/module/qpnp_bms/parameters/*
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp
chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl
chmod 0660 /sys/module/qpnp_bms/parameters/*
chmod 0660 /sys/module/pm8921_bms/parameters/*
mkdir -p /data/bms
chown -h root.system /data/bms
chmod 0770 /data/bms
start battery_monitor
fi
}
start_charger_monitor()
{
if ls /sys/module/qpnp_charger/parameters/charger_monitor; then
chown -h root.system /sys/module/qpnp_charger/parameters/*
chown -h root.system /sys/class/power_supply/battery/input_current_max
chown -h root.system /sys/class/power_supply/battery/input_current_trim
chown -h root.system /sys/class/power_supply/battery/input_current_settled
chown -h root.system /sys/class/power_supply/battery/voltage_min
chmod 0664 /sys/class/power_supply/battery/input_current_max
chmod 0664 /sys/class/power_supply/battery/input_current_trim
chmod 0664 /sys/class/power_supply/battery/input_current_settled
chmod 0664 /sys/class/power_supply/battery/voltage_min
chmod 0664 /sys/module/qpnp_charger/parameters/charger_monitor
start charger_monitor
fi
}
start_vm_bms()
{
if [ -e /dev/vm_bms ]; then
chown -h root.system /sys/class/power_supply/bms/current_now
chown -h root.system /sys/class/power_supply/bms/voltage_ocv
chmod 0664 /sys/class/power_supply/bms/current_now
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
start vm_bms
fi
}
start_msm_irqbalance_8939()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
case "$platformid" in
"239" | "293" | "294" | "295" | "304" | "338" | "313" | "353" | "354")
start vendor.msm_irqbalance;;
"349" | "350" )
start vendor.msm_irqbal_lb;;
esac
fi
}
start_msm_irqbalance_msmnile()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_kona()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_lito()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance_atoll()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance660()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
case "$platformid" in
"317" | "321" | "324" | "325" | "326" | "336" | "345" | "346" | "360" | "393")
start vendor.msm_irqbalance;;
"318" | "327" | "385")
start vendor.msm_irqbl_sdm630;;
esac
fi
}
start_msm_irqbalance()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
baseband=`getprop ro.baseband`
echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
case "$baseband" in
"svlte2a")
start bridgemgrd
;;
esac
case "$target" in
"msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
if [ -f /sys/devices/soc0/hw_platform ]; then
value=`cat /sys/devices/soc0/hw_platform`
else
value=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$value" in
"Fluid")
start profiler_daemon;;
esac
;;
"msm8660" )
if [ -f /sys/devices/soc0/hw_platform ]; then
platformvalue=`cat /sys/devices/soc0/hw_platform`
else
platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
esac
;;
"msm8960")
case "$baseband" in
"msm")
start_battery_monitor;;
esac
if [ -f /sys/devices/soc0/hw_platform ]; then
platformvalue=`cat /sys/devices/soc0/hw_platform`
else
platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
;;
"msm8974")
platformvalue=`cat /sys/devices/soc0/hw_platform`
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
case "$baseband" in
"msm")
start_battery_monitor
;;
esac
start_charger_monitor
;;
"sdm660")
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"317" | "324" | "325" | "326" | "318" | "327" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
start_msm_irqbalance660
;;
"apq8084")
platformvalue=`cat /sys/devices/soc0/hw_platform`
case "$platformvalue" in
"Fluid")
start profiler_daemon;;
"Liquid")
start profiler_daemon;;
esac
;;
"msm8226")
start_charger_monitor
;;
"msm8610")
start_charger_monitor
;;
"msm8916")
start_vm_bms
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/platform_subtype_id ]; then
platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
fi
case "$soc_id" in
"239")
case "$hw_platform" in
"Surf")
case "$platform_subtype_id" in
"1")
setprop qemu.hw.mainkeys 0
;;
esac
;;
"MTP")
case "$platform_subtype_id" in
"3")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
esac
;;
"msm8994" | "msm8992" | "msm8998" | "apq8098_latv" | "sdm845" | "sdm710" | "qcs605" | "sm6150" | "trinket" | "bengal")
start_msm_irqbalance
;;
"msm8996")
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
fi
case "$hw_platform" in
"MTP" | "CDP")
#Loop through the sysfs nodes and determine the correct sysfs to change the permission and ownership.
for count in 0 1 2 3 4 5 6 7 8 9 10
do
dir="/sys/devices/soc/75ba000.i2c/i2c-12/12-0020/input/input"$count
if [ -d "$dir" ]; then
chmod 0660 $dir/secure_touch_enable
chmod 0440 $dir/secure_touch
chown system.drmrpc $dir/secure_touch_enable
chown system.drmrpc $dir/secure_touch
break
fi
done
;;
esac
;;
"msm8909")
start_vm_bms
;;
"msmnile")
start_msm_irqbalance_msmnile
;;
"kona")
start_msm_irqbalance_kona
;;
"lito")
start_msm_irqbalance_lito
;;
"atoll")
start_msm_irqbalance_atoll
;;
"msm8937")
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
if [ "$low_ram" != "true" ]; then
case "$soc_id" in
"294" | "295" | "303" | "307" | "308" | "309" | "313" | "320" | "353" | "354" | "363" | "364")
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
fi
;;
"msm8953")
start_msm_irqbalance_8939
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"293" | "304" | "338" | "351" | "349" | "350" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
"sdm710")
if [ -f /sys/devices/soc0/soc_id ]; then
soc_id=`cat /sys/devices/soc0/soc_id`
else
soc_id=`cat /sys/devices/system/soc/soc0/id`
fi
if [ -f /sys/devices/soc0/hw_platform ]; then
hw_platform=`cat /sys/devices/soc0/hw_platform`
else
hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
fi
case "$soc_id" in
"336" | "337" | "347" | "360" | "393" )
case "$hw_platform" in
"Surf")
setprop qemu.hw.mainkeys 0
;;
"MTP")
setprop qemu.hw.mainkeys 0
;;
"RCM")
setprop qemu.hw.mainkeys 0
;;
"QRD")
setprop qemu.hw.mainkeys 0
;;
esac
;;
esac
;;
esac
#
# Make modem config folder and copy firmware config to that folder for RIL
#
if [ -f /data/vendor/modem_config/ver_info.txt ]; then
prev_version_info=`cat /data/vendor/modem_config/ver_info.txt`
else
prev_version_info=""
fi
cur_version_info=`cat /vendor/firmware_mnt/verinfo/ver_info.txt`
if [ ! -f /vendor/firmware_mnt/verinfo/ver_info.txt -o "$prev_version_info" != "$cur_version_info" ]; then
# add W for group recursively before delete
chmod g+w -R /data/vendor/modem_config/*
rm -rf /data/vendor/modem_config/*
# preserve the read only mode for all subdir and files
cp --preserve=m -dr /vendor/firmware_mnt/image/modem_pr/mcfg/configs/* /data/vendor/modem_config
cp --preserve=m -d /vendor/firmware_mnt/verinfo/ver_info.txt /data/vendor/modem_config/
cp --preserve=m -d /vendor/firmware_mnt/image/modem_pr/mbn_ota.txt /data/vendor/modem_config/
# the group must be root, otherwise this script could not add "W" for group recursively
chown -hR radio.root /data/vendor/modem_config/*
fi
chmod g-w /data/vendor/modem_config
setprop ro.vendor.ril.mbn_copy_completed 1
#check build variant for printk logging
#current default minimum boot-time-default
buildvariant=`getprop ro.build.type`
case "$buildvariant" in
"userdebug" | "eng")
#set default loglevel to KERN_INFO
echo "6 6 1 7" > /proc/sys/kernel/printk
;;
*)
#set default loglevel to KERN_WARNING
echo "4 4 1 4" > /proc/sys/kernel/printk
;;
esac
+57
View File
@@ -0,0 +1,57 @@
#! /vendor/bin/sh
#
# Copyright (c) 2019-2021, 2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2019 The Linux Foundation. All rights reserved.
#
export PATH=/vendor/bin
soc_id=`getprop ro.vendor.qti.soc_id`
if [ "$soc_id" -eq 415 ] || [ "$soc_id" -eq 439 ] || [ "$soc_id" -eq 450 ] || [ "$soc_id" -eq 475 ] || [ "$soc_id" -eq 515 ]; then
setprop persist.vendor.hvdcp_opti.start 2
exit 0
fi
if [ "$soc_id" -eq 441 ] || [ "$soc_id" -eq 471 ]; then
#Scuba does not support usb-pd or charge pumps
find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system
else
find /sys/class/power_supply/battery/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/bms/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/main/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/usb/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/charge_pump_master/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/pc_port/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/dc/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/power_supply/parallel/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/usbpd/usbpd0/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/qc-vdm/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/charge_pump/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/qcom-battery/ -type f -maxdepth 1 | xargs chown system.system
find /sys/class/qbg/qbg_context -type f -maxdepth 1 | xargs chown system.system
chmod 0664 /sys/class/power_supply/battery/charge_control_limit
for i in 0 1 2 3 4 5 6 7 8 9
do
devname=`cat /sys/bus/iio/devices/iio:device$i/name`
if [[ "$devname" == *smb* ]] || [[ "$devname" == *qg* ]] || [[ "$devname" == *div2_cp* ]] || [[ "$devname" == *div2-cp* ]]; then
find /sys/bus/iio/devices/iio:device$i/ -type f -maxdepth 1 | xargs chown system.system
fi
done
fi
aon_present=`getprop ro.vendor.qc_aon_presence`
if [ "$aon_present" -eq 1 ]; then
setprop persist.vendor.hvdcp_opti.start 2
exit 0
fi
setprop persist.vendor.hvdcp_opti.start 1
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+47
View File
@@ -0,0 +1,47 @@
#=============================================================================
# Copyright (c) 2020-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
if [ -f /sys/devices/soc0/soc_id ]; then
platformid=`cat /sys/devices/soc0/soc_id`
fi
case "$platformid" in
"507"|"578")
/vendor/bin/sh /vendor/bin/init.qti.kernel.debug-blair.sh
;;
"454"|"472")
/vendor/bin/sh /vendor/bin/init.qti.kernel.debug-holi.sh
;;
*)
echo "***WARNING***: Invalid chip family\n\t skipping debug script!!\n"
;;
esac
+206
View File
@@ -0,0 +1,206 @@
#=============================================================================
# Copyright (c) 2022-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
enable_sched_events()
{
local instance=/sys/kernel/tracing
echo > $instance/trace
echo > $instance/set_event
# timer
echo 1 > $instance/events/timer/timer_expire_entry/enable
echo 1 > $instance/events/timer/timer_expire_exit/enable
echo 1 > $instance/events/timer/hrtimer_cancel/enable
echo 1 > $instance/events/timer/hrtimer_expire_entry/enable
echo 1 > $instance/events/timer/hrtimer_expire_exit/enable
echo 1 > $instance/events/timer/hrtimer_init/enable
echo 1 > $instance/events/timer/hrtimer_start/enable
#enble FTRACE for softirq events
echo 1 > $instance/events/irq/enable
#enble FTRACE for Workqueue events
echo 1 > $instance/events/workqueue/enable
# sched
#echo 1 > $instance/events/sched/sched_cpu_hotplug/enable
echo 1 > $instance/events/sched/sched_migrate_task/enable
echo 1 > $instance/events/sched/sched_pi_setprio/enable
echo 1 > $instance/events/sched/sched_switch/enable
echo 1 > $instance/events/sched/sched_wakeup/enable
echo 1 > $instance/events/sched/sched_wakeup_new/enable
echo 1 > $instance/events/schedwalt/halt_cpus/enable
echo 1 > $instance/events/schedwalt/halt_cpus_start/enable
# hot-plug
echo 1 > $instance/events/cpuhp/enable
echo 1 > $instance/events/power/cpu_frequency/enable
echo 1 > $instance/tracing_on
}
enable_rproc_events()
{
local instance=/sys/kernel/tracing/instances/rproc_qcom
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
# enable rproc events as soon as available
/vendor/bin/init.qti.write.sh $instance/events/rproc_qcom/enable 1
echo 1 > $instance/tracing_on
}
# Suspend events are also noisy when going into suspend/resume
enable_suspend_events()
{
local instance=/sys/kernel/tracing/instances/suspend
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/power/suspend_resume/enable
echo 1 > $instance/events/power/device_pm_callback_start/enable
echo 1 > $instance/events/power/device_pm_callback_end/enable
echo 1 > $instance/tracing_on
}
enable_clock_reg_events()
{
local instance=/sys/kernel/tracing/instances/clock_reg
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
# clock
echo 1 > $instance/events/clk/enable
echo 1 > $instance/events/clk_qcom/enable
# interconnect
echo 1 > $instance/events/interconnect/enable
# regulator
echo 1 > $instance/events/regulator/enable
# rpmh
echo 1 > $instance/events/rpmh/enable
echo 1 > $instance/tracing_on
}
enable_memory_events()
{
local instance=/sys/kernel/tracing/instances/memory
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
#memory pressure events/oom
#echo 1 > $instance/events/psi/psi_event/enable
#echo 1 > $instance/events/psi/psi_window_vmstat/enable
echo 1 > $instance/events/arm_smmu/enable
echo 1 > $instance/tracing_on
}
# binder tracing can be noisy
enable_binder_events()
{
local instance=/sys/kernel/tracing/instances/binder
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/binder/enable
echo 1 > $instance/tracing_on
}
enable_rwmmio_events()
{
if [ ! -d /sys/kernel/tracing/events/rwmmio ]
then
return
fi
local instance=/sys/kernel/tracing/instances/rwmmio
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/rwmmio/rwmmio_read/enable
echo 1 > $instance/events/rwmmio/rwmmio_write/enable
echo 1 > $instance/tracing_on
}
find_build_type()
{
linux_banner=`cat /proc/version`
if [[ "$linux_banner" == *"-consolidate"* ]]
then
debug_build=true
fi
}
debug_build=false
enable_tracing_events()
{
# bail out if its perf config
find_build_type
if [ "$debug_build" = false ]
then
return
fi
# bail out if ftrace events aren't present
if [ ! -d /sys/kernel/tracing/events ] ; then
return
fi
enable_sched_events
enable_rproc_events
enable_suspend_events
enable_binder_events
enable_clock_reg_events
enable_memory_events
enable_rwmmio_events
}
enable_tracing_events
+206
View File
@@ -0,0 +1,206 @@
#=============================================================================
# Copyright (c) 2022-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
enable_sched_events()
{
local instance=/sys/kernel/tracing
echo > $instance/trace
echo > $instance/set_event
# timer
echo 1 > $instance/events/timer/timer_expire_entry/enable
echo 1 > $instance/events/timer/timer_expire_exit/enable
echo 1 > $instance/events/timer/hrtimer_cancel/enable
echo 1 > $instance/events/timer/hrtimer_expire_entry/enable
echo 1 > $instance/events/timer/hrtimer_expire_exit/enable
echo 1 > $instance/events/timer/hrtimer_init/enable
echo 1 > $instance/events/timer/hrtimer_start/enable
#enble FTRACE for softirq events
echo 1 > $instance/events/irq/enable
#enble FTRACE for Workqueue events
echo 1 > $instance/events/workqueue/enable
# sched
#echo 1 > $instance/events/sched/sched_cpu_hotplug/enable
echo 1 > $instance/events/sched/sched_migrate_task/enable
echo 1 > $instance/events/sched/sched_pi_setprio/enable
echo 1 > $instance/events/sched/sched_switch/enable
echo 1 > $instance/events/sched/sched_wakeup/enable
echo 1 > $instance/events/sched/sched_wakeup_new/enable
echo 1 > $instance/events/schedwalt/halt_cpus/enable
echo 1 > $instance/events/schedwalt/halt_cpus_start/enable
# hot-plug
echo 1 > $instance/events/cpuhp/enable
echo 1 > $instance/events/power/cpu_frequency/enable
echo 1 > $instance/tracing_on
}
enable_rproc_events()
{
local instance=/sys/kernel/tracing/instances/rproc_qcom
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
# enable rproc events as soon as available
/vendor/bin/init.qti.write.sh $instance/events/rproc_qcom/enable 1
echo 1 > $instance/tracing_on
}
# Suspend events are also noisy when going into suspend/resume
enable_suspend_events()
{
local instance=/sys/kernel/tracing/instances/suspend
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/power/suspend_resume/enable
echo 1 > $instance/events/power/device_pm_callback_start/enable
echo 1 > $instance/events/power/device_pm_callback_end/enable
echo 1 > $instance/tracing_on
}
enable_clock_reg_events()
{
local instance=/sys/kernel/tracing/instances/clock_reg
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
# clock
echo 1 > $instance/events/clk/enable
echo 1 > $instance/events/clk_qcom/enable
# interconnect
echo 1 > $instance/events/interconnect/enable
# regulator
echo 1 > $instance/events/regulator/enable
# rpmh
echo 1 > $instance/events/rpmh/enable
echo 1 > $instance/tracing_on
}
enable_memory_events()
{
local instance=/sys/kernel/tracing/instances/memory
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
#memory pressure events/oom
#echo 1 > $instance/events/psi/psi_event/enable
#echo 1 > $instance/events/psi/psi_window_vmstat/enable
echo 1 > $instance/events/arm_smmu/enable
echo 1 > $instance/tracing_on
}
# binder tracing can be noisy
enable_binder_events()
{
local instance=/sys/kernel/tracing/instances/binder
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/binder/enable
echo 1 > $instance/tracing_on
}
enable_rwmmio_events()
{
if [ ! -d /sys/kernel/tracing/events/rwmmio ]
then
return
fi
local instance=/sys/kernel/tracing/instances/rwmmio
mkdir $instance
echo > $instance/trace
echo > $instance/set_event
echo 1 > $instance/events/rwmmio/rwmmio_read/enable
echo 1 > $instance/events/rwmmio/rwmmio_write/enable
echo 1 > $instance/tracing_on
}
find_build_type()
{
linux_banner=`cat /proc/version`
if [[ "$linux_banner" == *"-consolidate"* ]]
then
debug_build=true
fi
}
debug_build=false
enable_tracing_events()
{
# bail out if its perf config
find_build_type
if [ "$debug_build" = false ]
then
return
fi
# bail out if ftrace events aren't present
if [ ! -d /sys/kernel/tracing/events ] ; then
return
fi
enable_sched_events
enable_rproc_events
enable_suspend_events
enable_binder_events
enable_clock_reg_events
enable_memory_events
enable_rwmmio_events
}
enable_tracing_events
+47
View File
@@ -0,0 +1,47 @@
#=============================================================================
# Copyright (c) 2020-2023 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
if [ -f /sys/devices/soc0/soc_id ]; then
platformid=`cat /sys/devices/soc0/soc_id`
fi
case "$platformid" in
"507"|"578")
/vendor/bin/sh /vendor/bin/init.qti.kernel.early_debug-blair.sh
;;
"454"|"472")
/vendor/bin/sh /vendor/bin/init.qti.kernel.early_debug-holi.sh
;;
*)
echo "***WARNING***: Invalid SoC ID\n\t Not running early debug scripts!!\n"
;;
esac
+40
View File
@@ -0,0 +1,40 @@
#! /vendor/bin/sh
#=============================================================================
# Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
start_msm_irqbalance()
{
if [ -f /vendor/bin/msm_irqbalance ]; then
start vendor.msm_irqbalance
fi
}
start_msm_irqbalance
+203
View File
@@ -0,0 +1,203 @@
#! /vendor/bin/sh
#==============================================================================
# init.qti.media.sh
#
# Copyright (c) 2020-2023, Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2020, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#===============================================================================
build_codename=`getprop vendor.media.system.build_codename`
low_ram=`getprop ro.config.low_ram`
if [ -f /sys/devices/soc0/soc_id ]; then
soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
else
soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
fi
target=`getprop ro.board.platform`
case "$target" in
"neo")
setprop vendor.mm.target.enable.qcom_parser 1040463
setprop vendor.netflix.bsp_rev ""
case "$soc_hwid" in
579)
setprop vendor.media.target_variant "_neo_v2"
;;
*)
setprop vendor.media.target_variant "_neo_v1"
;;
esac
;;
"blair")
setprop vendor.mm.target.enable.qcom_parser 0
setprop vendor.netflix.bsp_rev ""
case "$soc_hwid" in
507|565)
setprop vendor.media.target_variant "_blair"
if [ $build_codename -le "14" ]; then
setprop vendor.netflix.bsp_rev "Q6375-38927-1"
fi
;;
578)
setprop vendor.media.target_variant "_blair_lite"
if [ $build_codename -le "14" ]; then
setprop vendor.netflix.bsp_rev "Q4350-32962-1"
fi
;;
454)
setprop vendor.media.target_variant "_holi"
if [ $build_codename -le "14" ]; then
setprop vendor.netflix.bsp_rev "Q4350-32962-1"
fi
;;
472)
setprop vendor.media.target_variant "_holi_pro"
if [ $build_codename -le "14" ]; then
setprop vendor.netflix.bsp_rev "Q4350-32962-1"
fi
;;
esac
;;
# TODO-MB: Update below fields later
"pitti")
setprop vendor.mm.target.enable.qcom_parser 0
setprop vendor.netflix.bsp_rev ""
case "$soc_hwid" in
623)
if [ "$low_ram" == "true" ]; then
setprop vendor.media.target_variant "_pitti_32go"
else
setprop vendor.media.target_variant "_pitti"
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q4350-32962-1"
fi
fi
;;
esac
;;
"parrot")
setprop vendor.mm.target.enable.qcom_parser 1040463
case "$soc_hwid" in
568|602|581|582)
setprop vendor.media.target_variant "_ravelin"
;;
*)
setprop vendor.media.target_variant "_parrot_v2"
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc/sku_version` 2> /dev/null
if [ $sku_ver -eq 0 ]; then
setprop vendor.media.target_variant "_parrot_v0"
elif [ $sku_ver -eq 1 ]; then
setprop vendor.media.target_variant "_parrot_v1"
fi
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q6450-36256-1"
fi
;;
esac
;;
"taro")
setprop vendor.mm.target.enable.qcom_parser 1040463
case "$soc_hwid" in
506|547|564)
setprop vendor.media.target_variant "_diwali_v2"
setprop vendor.netflix.bsp_rev ""
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc/sku_version` 2> /dev/null
if [ $sku_ver -eq 0 ]; then
setprop vendor.media.target_variant "_diwali_v0"
elif [ $sku_ver -eq 1 ]; then
setprop vendor.media.target_variant "_diwali_v1"
fi
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q7450-35705-1"
fi
;;
591)
setprop vendor.media.target_variant "_ukee"
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;
530|531|540)
setprop vendor.media.target_variant "_cape"
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;
*)
setprop vendor.media.target_variant "_taro"
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q8450-34634-1"
fi
;;
esac
;;
"lahaina")
case "$soc_hwid" in
450)
setprop vendor.media.target_variant "_shima_v3"
setprop vendor.netflix.bsp_rev ""
sku_ver=`cat /sys/devices/platform/soc/aa00000.qcom,vidc/sku_version` 2> /dev/null
if [ $sku_ver -eq 1 ]; then
setprop vendor.media.target_variant "_shima_v1"
elif [ $sku_ver -eq 2 ]; then
setprop vendor.media.target_variant "_shima_v2"
fi
;;
*)
setprop vendor.media.target_variant "_lahaina"
setprop vendor.netflix.bsp_rev "Q875-32408-1"
;;
esac
;;
"bengal")
setprop vendor.mm.target.enable.qcom_parser 0
case "$soc_hwid" in
518|561|585|586)
setprop vendor.media.target_variant "_khaje_v0"
if [ $build_codename -le "13" ]; then
setprop vendor.netflix.bsp_rev "Q6115-31409-1"
fi
;;
esac
;;
"holi")
setprop vendor.media.target_variant "_holi"
;;
"msmnile")
setprop vendor.media.target_variant "_msmnile"
;;
"monaco")
setprop vendor.media.target_variant "_monaco"
;;
esac
+107
View File
@@ -0,0 +1,107 @@
#! /vendor/bin/sh
#=============================================================================
# Copyright (c) 2020, 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#=============================================================================
soc_id=`cat /sys/devices/soc0/soc_id` 2> /dev/null
# Store soc_id in ro.vendor.qti.soc_id
setprop ro.vendor.qti.soc_id $soc_id
# For chipsets in QCV family, convert soc_id to soc_name
# and store it in ro.vendor.qti.soc_name.
if [ "$soc_id" -eq 636 ]; then
setprop ro.vendor.qti.soc_name volcano
setprop ro.vendor.qti.soc_model SM7635
elif [ "$soc_id" -eq 640 ]; then
setprop ro.vendor.qti.soc_name volcano
setprop ro.vendor.qti.soc_model SM6650
elif [ "$soc_id" -eq 641 ]; then
setprop ro.vendor.qti.soc_name volcano
setprop ro.vendor.qti.soc_model SM6650P
elif [ "$soc_id" -eq 623 ]; then
setprop ro.vendor.qti.soc_name pitti
setprop ro.vendor.qti.soc_model SM4635
elif [ "$soc_id" -eq 618 ]; then
setprop ro.vendor.qti.soc_name sun
setprop ro.vendor.qti.soc_model SM8750
setprop ro.vendor.media_performance_class 34
elif [ "$soc_id" -eq 507 ] || [ "$soc_id" -eq 565 ]; then
setprop ro.vendor.qti.soc_name blair
setprop ro.vendor.qti.soc_model SM6375
elif [ "$soc_id" -eq 578 ]; then
setprop ro.vendor.qti.soc_name blair
setprop ro.vendor.qti.soc_model SM4375
elif [ "$soc_id" -eq 454 ]; then
setprop ro.vendor.qti.soc_name holi
setprop ro.vendor.qti.soc_model SM4350
elif [ "$soc_id" -eq 472 ]; then
setprop ro.vendor.qti.soc_name holi
setprop ro.vendor.qti.soc_model SM6325
elif [ "$soc_id" -eq 557 ] || [ "$soc_id" -eq 577 ]; then
setprop ro.vendor.qti.soc_name pineapple
setprop ro.vendor.qti.soc_model SM8650
setprop ro.vendor.media_performance_class 34
elif [ "$soc_id" -eq 632 ]; then
setprop ro.vendor.qti.soc_name cliffs
setprop ro.vendor.qti.soc_model SM7675
elif [ "$soc_id" -eq 614 ]; then
setprop ro.vendor.qti.soc_name cliffs
setprop ro.vendor.qti.soc_model SM8635
setprop ro.vendor.media_performance_class 34
elif [ "$soc_id" -eq 642 ]; then
setprop ro.vendor.qti.soc_name cliffs
setprop ro.vendor.qti.soc_model SM8635P
elif [ "$soc_id" -eq 643 ]; then
setprop ro.vendor.qti.soc_name cliffs
setprop ro.vendor.qti.soc_model SM7675P
elif [ "$soc_id" -eq 519 ] || [ "$soc_id" -eq 536 ] || [ "$soc_id" -eq 600 ] || [ "$soc_id" -eq 601 ]; then
setprop ro.vendor.qti.soc_name kalama
setprop ro.vendor.qti.soc_model SM8550
setprop ro.vendor.media_performance_class 33
elif [ "$soc_id" -eq 608 ]; then
setprop ro.vendor.qti.soc_name crow
setprop ro.vendor.qti.soc_model SM7550
elif [ "$soc_id" -eq 457 ] || [ "$soc_id" -eq 482 ] || [ "$soc_id" -eq 552 ]; then
setprop ro.vendor.qti.soc_name taro
setprop ro.vendor.qti.soc_model SM8450
setprop ro.vendor.media_performance_class 31
elif [ "$soc_id" -eq 537 ] || [ "$soc_id" -eq 583 ]; then
setprop ro.vendor.qti.soc_name parrot
setprop ro.vendor.qti.soc_model SM6450
elif [ "$soc_id" -eq 613 ]; then
setprop ro.vendor.qti.soc_name parrot
setprop ro.vendor.qti.soc_model SM7435
elif [ "$soc_id" -eq 568 ] || [ "$soc_id" -eq 602 ]; then
setprop ro.vendor.qti.soc_name ravelin
setprop ro.vendor.qti.soc_model SM4450
elif [ "$soc_id" -eq 581 ]; then
setprop ro.vendor.qti.soc_name ravelin
setprop ro.vendor.qti.soc_model QCM4490
elif [ "$soc_id" -eq 582 ]; then
setprop ro.vendor.qti.soc_name ravelin
setprop ro.vendor.qti.soc_model QCS4490
elif [ "$soc_id" -eq 506 ] || [ "$soc_id" -eq 547 ] || [ "$soc_id" -eq 564 ]; then
setprop ro.vendor.qti.soc_name diwali
setprop ro.vendor.qti.soc_model SM7450
elif [ "$soc_id" -eq 591 ]; then
setprop ro.vendor.qti.soc_name ukee
setprop ro.vendor.qti.soc_model SM7475
elif [ "$soc_id" -eq 530 ] || [ "$soc_id" -eq 531 ] || [ "$soc_id" -eq 540 ]; then
setprop ro.vendor.qti.soc_name cape
setprop ro.vendor.qti.soc_model SM8475
setprop ro.vendor.media_performance_class 31
elif [ "$soc_id" -eq 415 ] || [ "$soc_id" -eq 439 ] || [ "$soc_id" -eq 456 ] ||
[ "$soc_id" -eq 501 ] || [ "$soc_id" -eq 502 ]; then
setprop ro.vendor.qti.soc_name lahaina
setprop ro.vendor.qti.soc_model SM8350
elif [ "$soc_id" -eq 450 ]; then
setprop ro.vendor.qti.soc_name shima
setprop ro.vendor.qti.soc_model SM7350
elif [ "$soc_id" -eq 475 ] || [ "$soc_id" -eq 499 ] || [ "$soc_id" -eq 497 ] ||
[ "$soc_id" -eq 498 ] || [ "$soc_id" -eq 515 ]; then
setprop ro.vendor.qti.soc_name yupik
setprop ro.vendor.qti.soc_model SM7325
fi
+27
View File
@@ -0,0 +1,27 @@
#!/vendor/bin/sh
#=============================================================================
# Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#=============================================================================
write_with_check() {
local i=60
while [ $i -gt 0 ]
do
if [ -f "$1" ]; then
break
fi
sleep 1
i=$(($i-1))
done
if [ ! -f "$1" ]; then
exit 1
fi
echo $2 > $1
}
write_with_check "$1" "$2"
BIN
View File
Binary file not shown.
Vendored Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Vendored Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Vendored Executable
BIN
View File
Binary file not shown.
+54
View File
@@ -0,0 +1,54 @@
#!/bin/sh --
# Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
ril_db="/data/vendor/radio/qcrilNr.db"
help() {
echo "Syntax error! Example: qtigetprop [config_name]"
}
if [ $# -gt 1 ]; then
help
exit 1
elif [ $# -eq 1 ]; then
prop_name=$1
fi
# Disable exit on non 0
set +e
if [[ ! -f $ril_db ]]; then
getprop "$@"
else
if [ ! -z "$prop_name" ]; then
query_result=`echo "SELECT 1 FROM qcril_properties_table WHERE property='$prop_name';" | sqlite3 $ril_db`
if [[ $query_result == "1" ]]; then
result=`echo "SELECT value FROM qcril_properties_table WHERE property='$1';" | sqlite3 $ril_db`
if [ "$result" == "" ]; then
echo "SELECT def_val FROM qcril_properties_table WHERE property='$1';" | sqlite3 $ril_db
else
echo $result
fi
else
getprop $prop_name
fi
else
# print RIL configs
all_props=`echo "SELECT * FROM qcril_properties_table;" | sqlite3 $ril_db`
for each_prop in $all_props; do
IFS='|' read -ra values <<< "$each_prop"
prop_name="${values[0]}"
def_val="${values[1]}"
val="${values[2]}"
if [[ $val == "" ]]; then
val=$def_val
fi
echo "$prop_name=$val"
done
# print Android properties
getprop
fi
fi
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh --
# Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
ril_db="/data/vendor/radio/qcrilNr.db"
help() {
echo "Syntax error! Example: qtisetprop config_name config_val"
}
if [ $# -ne 2 ]; then
help
exit 1
fi
# Disable exit on non 0
set +e
query_result="0"
if [[ -f $ril_db ]]; then
query_result=`echo "SELECT 1 FROM qcril_properties_table WHERE property='$1';" | sqlite3 $ril_db`
fi
if [[ $query_result == "1" ]]; then
echo "INSERT OR REPLACE INTO qcril_properties_table(property, value) VALUES('$1', '$2');" | sqlite3 $ril_db
else
setprop $1 $2
fi
Vendored Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Loaded 100 of 936 files, more files were not shown because too many files have changed in this diff. Show more