summaryrefslogtreecommitdiff
path: root/rootdir/init.qcom.power.rc
blob: db91a37f4330b1f6e4495c86bcd0a6f084d05d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
on early-init
    write /sys/block/mmcblk0/bdi/read_ahead_kb 512
    
on init
    # cpuquiet rqbalance permissions
    chown system system /sys/devices/system/cpu/cpuquiet/nr_min_cpus
    chown system system /sys/devices/system/cpu/cpuquiet/nr_power_max_cpus
    chown system system /sys/devices/system/cpu/cpuquiet/nr_thermal_max_cpus
    chown system system /sys/devices/system/cpu/cpuquiet/rqbalance/balance_level
    chown system system /sys/devices/system/cpu/cpuquiet/rqbalance/nr_run_thresholds
    chown system system /sys/devices/system/cpu/cpuquiet/rqbalance/nr_down_run_thresholds
    chmod 0660 /sys/devices/system/cpu/cpuquiet/nr_min_cpus
    chmod 0660 /sys/devices/system/cpu/cpuquiet/nr_power_max_cpus
    chmod 0660 /sys/devices/system/cpu/cpuquiet/nr_thermal_max_cpus
    chmod 0660 /sys/devices/system/cpu/cpuquiet/rqbalance/balance_level
    chmod 0660 /sys/devices/system/cpu/cpuquiet/rqbalance/nr_run_thresholds
    chmod 0660 /sys/devices/system/cpu/cpuquiet/rqbalance/nr_down_run_thresholds

on charger
	write /sys/module/lpm_levels/enable_low_power/l2 2
    write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1
    write /sys/module/msm_thermal/core_control/enabled 0
    
    # Enable Power modes and set the CPU Freq Sampling rates
    write /sys/module/msm_thermal/core_control/enabled 0
    write /sys/devices/system/cpu/cpu1/online 1
    write /sys/devices/system/cpu/cpu2/online 1
    write /sys/devices/system/cpu/cpu3/online 1
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "powersave"
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000
    write /sys/module/msm_thermal/core_control/enabled 1
    write /sys/devices/system/cpu/cpu1/online 0
    write /sys/devices/system/cpu/cpu2/online 0
    write /sys/devices/system/cpu/cpu3/online 0

on boot
    # Disable thermal
    write /sys/module/msm_thermal/core_control/enabled 0

    # Device boots with performance governor.
    # Switch one core to interactive to set permissions, for power hal and system server.
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
    chown system system /dev/cpuctl/cpu.notify_on_migrate
    chmod 0660 /dev/cpuctl/cpu.notify_on_migrate
    chown root system /sys/devices/system/cpu/cpu1/online
    chown root system /sys/devices/system/cpu/cpu2/online
    chown root system /sys/devices/system/cpu/cpu3/online
    chmod 664 /sys/devices/system/cpu/cpu1/online
    chmod 664 /sys/devices/system/cpu/cpu2/online
    chmod 664 /sys/devices/system/cpu/cpu3/online

    # Bring CPUs online
    write /sys/devices/system/cpu/cpu0/online 1
    write /sys/devices/system/cpu/cpu1/online 1
    write /sys/devices/system/cpu/cpu2/online 1
    write /sys/devices/system/cpu/cpu3/online 1
    
    trigger enable-low-power
    
on enable-low-power
    write /sys/module/lpm_levels/enable_low_power/l2 4
    write /sys/module/msm_pm/modes/cpu0/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled 1
    write /sys/module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu0/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu1/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu2/retention/idle_enabled 1
    write /sys/module/msm_pm/modes/cpu3/retention/idle_enabled 1

on property:init.svc.bootanim=stopped
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor "interactive"
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq 300000
    write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay "20000 1400000:40000 1700000:20000"
    write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 90
    write /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 1190400
    write /sys/devices/system/cpu/cpufreq/interactive/io_is_busy 1
    write /sys/devices/system/cpu/cpufreq/interactive/target_loads "85 1500000:90 1800000:70"
    write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 40000
    write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 30000
    write /sys/devices/system/cpu/cpufreq/interactive/timer_slack 20000
    write /sys/class/kgsl/kgsl-3d0/devfreq/governor "msm-adreno-tz"
    write /dev/cpuctl/cpu.notify_on_migrate 1

    # Enable thermal
    write /sys/module/msm_thermal/core_control/enabled 1

    # Switch to interactive and let PowerHAL configure it
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
    chown system system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
    chown system system /sys/devices/system/cpu/cpufreq/interactive/align_windows
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/align_windows
    chown system system /sys/devices/system/cpu/cpufreq/interactive/boost
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/boost
    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    chown system system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
    chown system system /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/io_is_busy
    chown system system /sys/devices/system/cpu/cpufreq/interactive/max_freq_hysteresis
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/max_freq_hysteresis
    chown system system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
    chown system system /sys/devices/system/cpu/cpufreq/interactive/target_loads
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/target_loads
    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/timer_slack
    chown system system /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/use_migration_notif
    chown system system /sys/devices/system/cpu/cpufreq/interactive/use_sched_load
    chmod 0644 /sys/devices/system/cpu/cpufreq/interactive/use_sched_load
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

on property:init.svc.recovery=running
    trigger enable-low-power

on property:dev.bootcomplete=1
    rm /data/system/perfd/default_values
    setprop sys.io.scheduler "bfq"