android_device_xiaomi_sm835.../rootdir/etc/init.qcom.rc
Ziqi Chen 3ba9fbc3d6 sm8350-common: rootdir: Tuning UFS clkgate and ah8 during boot time
Disabling UFS clkgate and ah8 during boot time helps in reducing
IO delays, which helps in reducing the total boot time. This change
will disable UFS clkgate and ah8 during early-init and then enable
it back after boot completion.

Change-Id: I6a10cd57a30fe3bdc4fba72a0d84cdfa3b1fd513
2022-04-01 17:24:10 +02:00

332 lines
12 KiB
Plaintext

# Copyright (c) 2009-2012, 2014-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.
#
import /vendor/etc/init/hw/init.qcom.usb.rc
import /vendor/etc/init/hw/init.target.rc
on early-init
# Change ownership of sysfs power control node
chown system graphics /sys/class/drm/card0/device/power/control
# Disable UFS clock scaling
write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 0
# Disable UFS auto_hibern8
write /sys/bus/platform/devices/1d84000.ufshc/auto_hibern8 0
# Disable UFS clock gating
write /sys/bus/platform/devices/1d84000.ufshc/clkgate_enable 0
on early-boot
write /sys/class/drm/card0-DSI-1/status "detect"
write /sys/module/drm/parameters/vblankoffdelay -1
chown system graphics /sys/devices/virtual/hdcp/msm_hdcp/min_level_change
chmod 0660 /sys/devices/virtual/hdcp/msm_hdcp/min_level_change
# SSR setup
write /sys/bus/msm_subsys/devices/subsys0/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys1/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys2/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys3/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys4/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys5/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys6/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys7/restart_level "related"
write /sys/bus/msm_subsys/devices/subsys8/restart_level "related"
chown system system /mnt/vendor/persist/data/pfm/licenses
chmod 0775 /mnt/vendor/persist/data/pfm/licenses
on boot
chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
chmod 0660 /sys/class/rfkill/rfkill0/type
chmod 0660 /sys/class/rfkill/rfkill0/state
chown bluetooth net_bt /dev/ttyHS0
chmod 0660 /dev/ttyHS0
chown system system /sys/kernel/boot_slpi/ssr
# This location is used by QCRIL to host UNIX domain
# socket files used for internal IPC within QCRIL
# modules
mkdir /dev/socket/qmux_radio 0770 radio radio
chmod 2770 /dev/socket/qmux_radio
mkdir /mnt/vendor/persist/time 0770 system system
mkdir /mnt/vendor/persist/secnvm 0770 system system
mkdir /mnt/vendor/persist/iar_db 0770 system system
mkdir /mnt/vendor/spunvm 0770 system system
# To prevent out of order acknowledgements from making
# connection tracking to treat them as not belonging to
# the connection they belong to.
# Otherwise, a weird issue happens in which some long
# connections on high-throughput links get dropped when
# an ack packet comes out of order
write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
chown system system /sys/class/backlight/panel0-backlight/brightness
chown system system /sys/class/backlight/panel0-backlight/max_brightness
chown system system /sys/class/backlight/panel1-backlight/brightness
chown system system /sys/class/backlight/panel1-backlight/max_brightness
# Create directory used for display
mkdir /mnt/vendor/persist/display 0770 system graphics
# Create vpp directory
mkdir /mnt/vendor/persist/vpp 0770 media media
copy /vendor/etc/tunings.txt /mnt/vendor/persist/vpp/tunings.txt
# Create hvdcp_opti directory
mkdir /mnt/vendor/persist/hvdcp_opti 0770 root system
# Create persist for camera calibration data
mkdir /mnt/vendor/persist/camera 0755 system cameraserver
# limit discard size to 128MB in order to avoid long IO latency
write /sys/block/sda/queue/discard_max_bytes 134217728
# Enable qcrild and data services
enable vendor.qcrild
enable vendor.qcrild2
enable vendor.dataqti
enable vendor.dataadpl
# msm specific files that need to be created on /data
on post-fs-data
mkdir /data/vendor/misc 01771 system system
# Create directory used by display clients
mkdir /data/vendor/display 0770 system graphics
# Change lm related dirs
mkdir /data/vendor/lm 0700 root root
# Create directory used by media clients
mkdir /data/vendor/media 0770 mediacodec media
# Create /data/vendor/tzstorage directory for SFS listener
mkdir /data/vendor/tzstorage 0770 system system
# Create directory for apps access via QTEEConnector
mkdir /data/vendor/qtee 0770 system system
# Create folder for camera
mkdir /data/vendor/camera 0770 camera camera
# Create directory for tftp
mkdir /data/vendor/tombstones 0771 system system
mkdir /data/vendor/tombstones/rfs 0771 system system
# Create directory for bluetooth
mkdir /data/vendor/bluetooth 0770 bluetooth bluetooth
# Create the directories used by the Wireless subsystem
mkdir /data/vendor/wifi 0770 wifi wifi
mkdir /data/vendor/wifi/sockets 0770 wifi wifi
mkdir /data/vendor/wifi/hostapd 0770 wifi wifi
mkdir /data/vendor/wifi/hostapd/ctrl 0770 wifi wifi
mkdir /data/vendor/wifi/wpa_supplicant 0770 wifi wifi
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
mkdir /data/vendor/mac_addr 0770 system wifi
# Create the directories used by CnE subsystem
mkdir /data/vendor/connectivity 0771 radio radio
chown radio radio /data/vendor/connectivity
# Create directory used by audio subsystem
mkdir /data/vendor/audio 0771 audio audio
# Create directory for audio delta files
mkdir /data/vendor/audio/acdbdata 0770 media audio
mkdir /data/vendor/audio/acdbdata/delta 0770 media audio
# Create directory for radio
mkdir /data/vendor/radio 0770 system radio
rm /data/vendor/radio/shmbus
# Create directory for modem_config
mkdir /data/vendor/modem_config 0570 radio root
# Create directories for Location services
mkdir /data/vendor/location 0770 gps gps
mkdir /data/vendor/location/mq 0770 gps gps
mkdir /data/vendor/location/xtwifi 0770 gps gps
mkdir /dev/socket/location 0770 gps gps
mkdir /dev/socket/location/mq 0770 gps gps
mkdir /dev/socket/location/xtra 0770 gps gps
# Create directories for wifihal services
mkdir /dev/socket/wifihal 0770 wifi wifi
chmod 2770 /dev/socket/wifihal
# Create /data/time folder for time-services
mkdir /data/vendor/time/ 0700 system system
# Create PERFD deamon related dirs
mkdir /data/vendor/perfd 0770 root system
chmod 2770 /data/vendor/perfd
rm /data/vendor/perfd/default_values
mkdir /data/vendor/secure_element 0777 system system
# Create IOP deamon related dirs
mkdir /data/vendor/iop 0700 root system
# Mark the copy complete flag to not completed
write /data/vendor/radio/copy_complete 0
chown radio radio /data/vendor/radio/copy_complete
chmod 0660 /data/vendor/radio/copy_complete
# Copy prebuilt qcril.db files always
copy /vendor/radio/qcril_database/qcril.db /data/vendor/radio/qcril_prebuilt.db
chown radio radio /data/vendor/radio/qcril_prebuilt.db
chmod 0660 /data/vendor/radio/qcril_prebuilt.db
copy /vendor/radio/qcril_database/qcrilNr.db /data/vendor/radio/qcrilNr_prebuilt.db
copy /vendor/etc/qcril_database/qcrilNr.db /data/vendor/radio/qcrilNr_prebuilt.db
chown radio radio /data/vendor/radio/qcrilNr_prebuilt.db
chmod 0660 /data/vendor/radio/qcrilNr_prebuilt.db
# File flags for prebuilt ril db file
write /data/vendor/radio/prebuilt_db_support 1
chown radio radio /data/vendor/radio/prebuilt_db_support
chmod 0400 /data/vendor/radio/prebuilt_db_support
write /data/vendor/radio/db_check_done 0
chown radio radio /data/vendor/radio/db_check_done
chmod 0660 /data/vendor/radio/db_check_done
# Create vpp directory
mkdir /data/vendor/vpp 0770 media media
setprop vold.post_fs_data_done 1
service qcomsysd /system/vendor/bin/qcom-system-daemon
class main
user root
group root diag oem_2901
disabled
on property:persist.vendor.qcomsysd.enabled=1
enable qcomsysd
on property:persist.vendor.qcomsysd.enabled=0
stop qcomsysd
on property:sys.boot_completed=1
# Enable UFS clock scaling back
write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 1
# Enable UFS auto_hibern8 back
write /sys/bus/platform/devices/1d84000.ufshc/auto_hibern8 5000
# Enable UFS clock gating back
write /sys/bus/platform/devices/1d84000.ufshc/clkgate_enable 1
# WDSP FW boot sysfs node used by STHAL
chown media audio /sys/kernel/wdsp0/boot
chown media audio /sys/kernel/wcd_cpe0/fw_name
# Reinit lmkd to reconfigure lmkd properties
setprop lmkd.reinit 1
service vendor.qrtr-ns /vendor/bin/qrtr-ns -f
class core
user vendor_qrtr
group vendor_qrtr
capabilities NET_BIND_SERVICE
service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
class core
user root
oneshot
service cnss-daemon /system/vendor/bin/cnss-daemon -n -l
class late_start
user system
group system inet net_admin wifi
capabilities NET_ADMIN
on property:sys.shutdown.requested=*
write /sys/kernel/shutdown_wlan/shutdown 1
stop cnss-daemon
service ssgqmigd /vendor/bin/ssgqmigd
class late_start
user radio
group radio gps system
socket ssgqmig seqpacket 0660 radio inet
service mlid /vendor/bin/mlid
class late_start
user gps
group gps
socket mlid stream 0666 gps gps
service loc_launcher /system/vendor/bin/loc_launcher
class late_start
user gps
group gps
service qcom-sh /vendor/bin/init.qcom.sh
class late_start
user root
group root system radio
oneshot
on property:ro.vendor.ril.mbn_copy_completed=1
write /data/vendor/radio/copy_complete 1
service vendor.atfwd /vendor/bin/ATFWD-daemon
class late_start
user system
group system radio
service charger /system/bin/charger
class charger
user system
group system graphics input
capabilities SYS_BOOT
seclabel u:r:charger:s0
service vendor.power_off_alarm /vendor/bin/power_off_alarm
class core
group system
disabled
oneshot
service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service
override
class hal
user audioserver
# media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct oem_2901 wakelock
capabilities BLOCK_SUSPEND
ioprio rt 4
writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks
socket audio_hw_socket seqpacket 0666 system system
onrestart restart audioserver