├── LICENSE
├── META-INF
└── com
│ └── google
│ └── android
│ ├── update-binary
│ └── updater-script
├── README.md
├── common
├── list_of_bootable
└── runWIPE.sh
├── magisk_install
├── common
│ └── service.sh
├── config.sh
├── magisk-script
└── module.prop
└── platforms
├── atom_z3560_z3580
└── powercfg.apk
├── exynos_7420
└── powercfg.apk
├── exynos_8890
└── powercfg.apk
├── exynos_8895
└── powercfg.apk
├── helio_x10
└── powercfg.apk
├── helio_x20_x25
└── powercfg.apk
├── kirin_950_955
└── powercfg.apk
├── kirin_960
└── powercfg.apk
├── kirin_970
└── powercfg.apk
├── sd_615_616
├── NOTICE
└── powercfg.apk
├── sd_625_626
└── powercfg.apk
├── sd_636
└── powercfg.apk
├── sd_652_650
└── powercfg.apk
├── sd_660
└── powercfg.apk
├── sd_801_800_805
└── powercfg.apk
├── sd_810_808
└── powercfg.apk
├── sd_820_821
└── powercfg.apk
├── sd_835
└── powercfg.apk
└── sd_845
└── powercfg.apk
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/update-binary:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 | # Author: cjybyjk (cjybyjk@gmail.com)
3 | # auto-chosen script for flashing Project WIPE
4 | # supported platform: any supported in Project WIPE
5 |
6 | OUTFD=$2
7 | ZIP=$3
8 | exitcode=0
9 |
10 | # Detect whether in boot mode
11 | ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
12 | $BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
13 | $BOOTMODE || id | grep -q 'uid=0' || BOOTMODE=true
14 |
15 | ui_print() {
16 | $BOOTMODE && echo "$1" || echo -e "ui_print $1\nui_print" >> /proc/self/fd/$OUTFD
17 | }
18 |
19 | lcasechar() {
20 | lowercase=$(echo $* | tr '[A-Z]' '[a-z]')
21 | # use echo to replace return
22 | echo $lowercase
23 | }
24 |
25 | get_prop() {
26 | # use echo to replace return
27 | echo $(lcasechar `getprop "$1"`)
28 | }
29 |
30 | get_platform() {
31 | if [ "unsupported" != "$platform" ]; then
32 | return 0
33 | fi
34 | case "$1" in
35 | # Qualcomm Snapdragon
36 | "msm8939" ) platform="sd_615_616";;
37 | "msm8953" | "msm8953pro" ) platform="sd_625_626";;
38 | "sdm636" ) platform="sd_636";;
39 | "msm8976" | "msm8956" ) platform="sd_652_650";;
40 | "sdm660" ) platform="sd_660";;
41 | "msm8974" | "apq8084" ) platform="sd_801_800_805";;
42 | "msm8994" | "msm8992" ) platform="sd_810_808";;
43 | "msm8996" | "msm8996pro" ) platform="sd_820_821";;
44 | "msm8998" ) platform="sd_835";;
45 | "sdm845" ) platform="sd_845";;
46 | # Mediatek
47 | "mt6795" ) platform="helio_x10";;
48 | "mt6797" | "mt6797t" ) platform="helio_x20_x25";;
49 | # Intel Atom
50 | "moorefield" ) platform="atom_z3560_z3580";;
51 | # Samsung Exynos
52 | "universal7420" | "exynos7420" ) platform="exynos_7420";;
53 | "universal8890" | "exynos8890" ) platform="exynos_8890";;
54 | "universal8895" | "exynos8895" ) platform="exynos_8895";;
55 | # Hwawei Kirin
56 | "hi3650" | "kirin950" | "kirin955" ) platform="kirin_950_955";;
57 | "hi3660" | "kirin960" ) platform="kirin_960";;
58 | "hi3670" | "kirin970" ) platform="kirin_970";;
59 | esac
60 | }
61 |
62 | # $1:file $2:add head
63 | wipe_write() {
64 | writefile=$1
65 | if [ "$2" == "1" ]; then
66 | echo "#!/system/bin/sh" > "$writefile"
67 | chmod 0755 "$writefile"
68 | fi
69 | cat ./common/runWIPE.sh >> "$writefile"
70 | }
71 |
72 | ui_print " "
73 | ui_print "**************************"
74 | ui_print " Project WIPE installer"
75 | ui_print " Authors:"
76 | ui_print " Project WIPE: yc9559"
77 | ui_print " ZIP flashable: cjybyjk"
78 | ui_print " Version: 0603.2"
79 | ui_print "**************************"
80 | ui_print " "
81 |
82 | TMPDIR=/dev/tmp
83 |
84 | # get platform
85 | platform="unsupported"
86 | platformA=$(lcasechar `grep "Hardware" /proc/cpuinfo | awk '{print \$NF}'`)
87 | platformB=$(get_prop "ro.product.board")
88 | platformC=$(get_prop "ro.board.platform")
89 | get_platform $platformA
90 | get_platform $platformB
91 | get_platform $platformC
92 |
93 | ui_print "- Mounting /system, /vendor and /data"
94 | mount /system
95 | mount /vendor
96 | mount /data
97 |
98 | ui_print "- Extracting files"
99 | mkdir -p $TMPDIR
100 | cd $TMPDIR
101 | unzip -o "$ZIP" > /dev/null
102 |
103 | ui_print "- Platform: $platform"
104 | if [ -f "./platforms/$platform/powercfg.apk" ]; then
105 | # Show notice when flashing
106 | if [ -f "./platforms/$platform/NOTICE" ]; then
107 | ui_print "- NOTICE:"
108 | ui_print " `cat ./platforms/$platform/NOTICE`"
109 | fi
110 | ui_print "- Installing..."
111 | ui_print "- Checking Magisk Framework"
112 | magiskFlag=0
113 | [ -d "/data/adb/magisk" ] && magiskFlag=1
114 | [ -f "/data/magisk.img" ] && magiskFlag=2
115 | [ -f "/data/adb/magisk.img" ] && magiskFlag=3
116 | [ -f "/wipe_no_magisk" ] && magiskFlag=0
117 | ui_print " Magisk flag: $magiskFlag"
118 | if [ 0 -eq $magiskFlag ]; then
119 | flagBootApply=0
120 | flagApplyOnce=true
121 | [ -f "/wipe_no_apply_once" ] && flagApplyOnce=false
122 | mkdir ./mountimg
123 | while read lineinText
124 | do
125 | fileFormat=`echo $lineinText | awk '{print \$1}'`
126 | pathtofile=`echo $lineinText | awk -F \" '{print \$2}'`
127 | bootinIMG=`echo $lineinText | awk -F \" '{print \$4}'`
128 | pathinIMG=`echo $lineinText | awk -F \" '{print \$6}'`
129 | case "$fileFormat" in
130 | "[D]" )
131 | if [ -d "$pathtofile" ]; then
132 | ui_print " $pathtofile found, creating file on it..."
133 | wipe_write "$pathtofile/99prjwipe" 1
134 | let flagBootApply=flagBootApply+1
135 | ui_print " copying powercfg to system/bin"
136 | cp ./platforms/$platform/powercfg.apk /system/bin/powercfg
137 | chmod 0755 /system/bin/powercfg
138 | $flagApplyOnce && break
139 | fi
140 | ;;
141 | "[F]" )
142 | if [ -f "$pathtofile" ]; then
143 | # restore backup
144 | if [ -f "$pathtofile.wipebak" ]; then
145 | rm -f "$pathtofile"
146 | cp "$pathtofile.wipebak" "$pathtofile"
147 | else
148 | cp "$pathtofile" "$pathtofile.wipebak"
149 | fi
150 | ui_print " $pathtofile found, adding lines to it..."
151 | wipe_write "$pathtofile" 0
152 | let flagBootApply=flagBootApply+1
153 | ui_print " copying powercfg to system/bin"
154 | cp ./platforms/$platform/powercfg.apk /system/bin/powercfg
155 | chmod 0755 /system/bin/powercfg
156 | $flagApplyOnce && break
157 | fi
158 | ;;
159 | "[I]" )
160 | if [ -f "$pathtofile" ]; then
161 | ui_print " $pathtofile found, mounting..."
162 | mount "$pathtofile" ./mountimg
163 | if [ -d ./mountimg/$pathinIMG ]; then
164 | ui_print " copying powercfg to $pathinIMG..."
165 | cp ./platforms/$platform/powercfg.apk ./mountimg/$pathinIMG/powercfg
166 | chmod 0755 ./mountimg/$pathinIMG/powercfg
167 | else
168 | ui_print " copying powercfg to system/bin"
169 | cp ./platforms/$platform/powercfg.apk /system/bin/powercfg
170 | chmod 0755 /system/bin/powercfg
171 | fi
172 | ui_print " creating file on $bootinIMG..."
173 | wipe_write "./mountimg/$bootinIMG/99prjwipe" 1
174 | let flagBootApply=flagBootApply+1
175 | ui_print " Unmounting $pathtofile"
176 | umount ./mountimg
177 | $flagApplyOnce && break
178 | fi
179 | ;;
180 | esac
181 | done < ./common/list_of_bootable
182 | [ 0 -eq $flagBootApply ] && ui_print "! WARNING: No method to apply on boot!"
183 | else
184 | ui_print "- Magisk Framework found"
185 | ui_print " Copying files..."
186 | mkdir -p ./magisk/system/bin/
187 | cp ./platforms/$platform/powercfg.apk ./magisk/system/bin/powercfg
188 | ui_print " Running install script"
189 | sh ./magisk_install/magisk-script $1 $2 $3 $PWD
190 | exitcode=$?
191 | if [ 0 -ne $exitcode ]; then
192 | ui_print "! WARNING: Magisk install script return $exitcode"
193 | fi
194 | fi
195 | # check Vboot & Scene and link powercfg
196 | ui_print "- Checking Vboot & Scene"
197 | if [ -d "/data/data/com.omarea.vboot" ]; then
198 | ui_print " found:Vboot"
199 | if [ ! -f "/data/powercfg" ]; then
200 | ui_print "link: /data/powercfg <- /system/bin/powercfg"
201 | ln -s /system/bin/powercfg /data/powercfg
202 | fi
203 | fi
204 | if [ -d "/data/data/com.omarea.vtools" ]; then
205 | ui_print " found:Scene"
206 | if [ ! -f "/data/powercfg.sh" ]; then
207 | ui_print "link: /data/powercfg.sh <- /system/bin/powercfg"
208 | ln -s /system/bin/powercfg /data/powercfg.sh
209 | fi
210 | fi
211 | ui_print "- Default mode: balance"
212 | [ ! -f "/data/wipe_mode" ] && echo "balance" > /data/wipe_mode
213 | ui_print "- You can choose mode by using this two ways:"
214 | ui_print " 1. Enter powercfg \$MODE in terminal"
215 | ui_print " 2. Modify /data/wipe_mode and reboot"
216 | else
217 | ui_print "! Unsupported device!"
218 | ui_print " Please check this:"
219 | ui_print " Platform: $platformA $platformB $platformC"
220 | exitcode=1
221 | fi
222 |
223 | ui_print "- Cleaning files"
224 | cd /
225 | rm -rf $TMPDIR
226 |
227 | ui_print "- Unmouting /system, /vendor"
228 | umount /system
229 | umount /vendor
230 |
231 | ui_print "- Done!"
232 | exit $exitcode
233 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/updater-script:
--------------------------------------------------------------------------------
1 | #MAGISK
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WIPE_flashable
2 | A script for flash [Project_WIPE](https://github.com/yc9559/cpufreq-interactive-opt) into your device
3 |
4 | ### Version 0603.2
5 | 好用的话记得给颗Star~
6 |
7 | ### Thanks to
8 | [@yc9559](https://github.com/yc9559)
9 |
10 | ### How to use
11 | #### 刷入 (Flash)
12 | - 下载zip到你的设备中
13 | (Download zip to your device.)
14 | - [下载卡刷包 (Download the flashable ZIP)](https://github.com/cjybyjk/WIPE_flashable/releases)
15 | - 重启到Recovery模式下并刷入zip
16 | (Reboot to recovery mode and flash it.)
17 | - 如果不想安装为magisk模块,可以执行这个命令后重新刷入
18 | ```bash
19 | touch /wipe_no_magisk
20 | ```
21 | - 如果以传统模式安装后没有成功应用,可以执行这个命令后重新刷入
22 | ```bash
23 | touch /wipe_no_apply_once
24 | ```
25 | #### 更改模式 (Change Mode)
26 | ##### 自动应用 重启后生效 (Apply on boot)
27 | - 在终端以root身份执行命令
28 | (Run command as root in terminal):
29 | ```bash
30 | echo "powersave" > /data/wipe_mode #省电
31 | echo "balance" > /data/wipe_mode #平衡(默认)
32 | echo "performance" > /data/wipe_mode #性能
33 | echo "fast" > /data/wipe_mode #低延迟
34 | echo "disabled" > /data/wipe_mode #停用
35 | ```
36 |
37 | ##### 临时应用 立即生效 (Temporary Apply (NOW))
38 | - 在终端以root身份执行命令
39 | (Run command as root in terminal):
40 | ```bash
41 | powercfg powersave #省电
42 | powercfg balance #平衡
43 | powercfg performance #性能
44 | powercfg fast #低延迟
45 | ```
46 | #### SELinux问题 (SELinux problem)
47 | ##### 如果这个脚本导致了SELinux问题(例如不正确的SELinux permissive),请按以下步骤操作
48 | - 安装为magisk模块
49 | - 使用文本编辑器打开这些文件(如果存在) , 将 `RestoreSELinux=false` 改为 `RestoreSELinux=true`, 然后保存
50 | - /sbin/.core/img/prjWIPE/service.sh
51 | - SuperSU Systemless
52 | - 使用文本编辑器打开这些文件(如果存在) , 将 `RestoreSELinux=false` 改为 `RestoreSELinux=true`, 然后保存
53 | - /su/su.d/99prjwipe
54 | - 传统安装方式
55 | - 使用文本编辑器打开这些文件(如果存在) , 将 `RestoreSELinux=false` 改为 `RestoreSELinux=true`, 然后保存
56 | - /system/etc/init.qcom.post_boot.sh
57 | - /vendor/bin/init.qcom.post_boot.sh
58 | - /system/su.d/99prjwipe
59 | - /system/etc/init.d/99prjwipe
60 | - /system/addon.d/99prjwipe
61 | - /system/etc/install-recovery.sh
62 | - /system/bin/sysinit
63 | - /system/bin/install-recovery.sh
64 |
65 | #### 卸载 (Uninstall)
66 | - 下载 WIPE_Flashable Remover
67 | (Download WIPE_Flashable Remover.)
68 | - 重启到Recovery模式下并刷入
69 | (Reboot to recovery mode and flash it.)
70 |
--------------------------------------------------------------------------------
/common/list_of_bootable:
--------------------------------------------------------------------------------
1 | #
2 | # List of bootable file/folder/img
3 | # [I]:img [D]:folder [F]:file
4 | #
5 |
6 | # [I] "/data/magisk.img" ".core/service.d"
7 | [F] "/system/etc/init.qcom.post_boot.sh"
8 | [F] "/system/vendor/bin/init.qcom.post_boot.sh"
9 | [I] "/data/su.img" "su.d" "bin"
10 | [D] "/system/su.d/"
11 | [D] "/system/etc/init.d/"
12 | [D] "/system/addon.d/"
13 | [F] "/system/etc/install-recovery.sh"
14 | [F] "/system/bin/sysinit"
15 | [F] "/system/bin/install-recovery.sh"
16 |
--------------------------------------------------------------------------------
/common/runWIPE.sh:
--------------------------------------------------------------------------------
1 | # Project WIPE support
2 |
3 | RestoreSELinux=false
4 | SEStatus=`getenforce`
5 |
6 | MODE=`cat /data/wipe_mode`
7 | [ "" == "$MODE" ] && MODE=`cat /sdcard/wipe_mode`
8 | [ "" == "$MODE" ] && MODE=`cat /data/media/0/wipe_mode`
9 | [ "disabled" == "$MODE" ] && exit 0
10 | rm -f /dev/.project_wipe
11 | rm -f /dev/project_wipe_runonce
12 | powercfg $MODE > /dev/project_wipe_state
13 |
14 | $RestoreSELinux && setenforce $SEStatus
15 |
--------------------------------------------------------------------------------
/magisk_install/common/service.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | MODDIR=${0%/*}
3 | # Project WIPE support
4 |
5 | # wait for boot complete
6 | until [ "`getprop sys.boot_completed`" = "1" ]
7 | do
8 | sleep 10
9 | done
10 |
11 | #SELinux restore flag
12 | RestoreSELinux=false
13 | SEStatus=`getenforce`
14 |
15 | # mode detect
16 | MODE=`cat /data/wipe_mode`
17 | [ "" == "$MODE" ] && MODE=`cat /sdcard/wipe_mode`
18 | [ "" == "$MODE" ] && MODE=`cat /data/media/0/wipe_mode`
19 | [ "disabled" == "$MODE" ] && exit 0
20 |
21 | powercfg $MODE > /dev/project_wipe_state
22 |
23 | # restore SELinux
24 | $RestoreSELinux && setenforce $SEStatus
25 |
--------------------------------------------------------------------------------
/magisk_install/config.sh:
--------------------------------------------------------------------------------
1 | ##########################################################################################
2 | #
3 | # Magisk Module Template Config Script
4 | # by topjohnwu
5 | #
6 | ##########################################################################################
7 | ##########################################################################################
8 | #
9 | # Instructions:
10 | #
11 | # 1. Place your files into system folder (delete the placeholder file)
12 | # 2. Fill in your module's info into module.prop
13 | # 3. Configure the settings in this file (config.sh)
14 | # 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
15 | # 5. Add your additional or modified system properties into common/system.prop
16 | #
17 | ##########################################################################################
18 |
19 | ##########################################################################################
20 | # Configs
21 | ##########################################################################################
22 |
23 | # Set to true if you need to enable Magic Mount
24 | # Most mods would like it to be enabled
25 | AUTOMOUNT=true
26 |
27 | # Set to true if you need to load system.prop
28 | PROPFILE=false
29 |
30 | # Set to true if you need post-fs-data script
31 | POSTFSDATA=false
32 |
33 | # Set to true if you need late_start service script
34 | LATESTARTSERVICE=true
35 |
36 | ##########################################################################################
37 | # Installation Message
38 | ##########################################################################################
39 |
40 | # Set what you want to show when installing your mod
41 |
42 | print_modname() {
43 | ui_print "*******************************"
44 | ui_print " Project WIPE Systemless "
45 | ui_print "*******************************"
46 | }
47 |
48 | ##########################################################################################
49 | # Replace list
50 | ##########################################################################################
51 |
52 | # List all directories you want to directly replace in the system
53 | # Check the documentations for more info about how Magic Mount works, and why you need this
54 |
55 | # This is an example
56 | REPLACE="
57 | /system/app/Youtube
58 | /system/priv-app/SystemUI
59 | /system/priv-app/Settings
60 | /system/framework
61 | "
62 |
63 | # Construct your own list here, it will override the example above
64 | # !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now
65 | REPLACE="
66 | "
67 |
68 | ##########################################################################################
69 | # Permissions
70 | ##########################################################################################
71 |
72 | set_permissions() {
73 | # Only some special files require specific permissions
74 | # The default permissions should be good enough for most cases
75 |
76 | # Here are some examples for the set_perm functions:
77 |
78 | # set_perm_recursive (default: u:object_r:system_file:s0)
79 | # set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
80 |
81 | # set_perm (default: u:object_r:system_file:s0)
82 | # set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
83 | # set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
84 | # set_perm $MODPATH/system/lib/libart.so 0 0 0644
85 |
86 | # The following is default permissions, DO NOT remove
87 | set_perm_recursive $MODPATH 0 0 0755 0644
88 | set_perm $MODPATH/system/bin/powercfg 0 0 0755
89 | set_perm $MODPATH/system/vendor/bin/init.qcom.post_boot.sh 0 0 0755
90 | }
91 |
92 | ##########################################################################################
93 | # Custom Functions
94 | ##########################################################################################
95 |
96 | # This file (config.sh) will be sourced by the main flash script after util_functions.sh
97 | # If you need custom logic, please add them here as functions, and call these functions in
98 | # update-binary. Refrain from adding code directly into update-binary, as it will make it
99 | # difficult for you to migrate your modules to newer template versions.
100 | # Make update-binary as clean as possible, try to only do function calls in it.
101 |
--------------------------------------------------------------------------------
/magisk_install/magisk-script:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 | ##########################################################################################
3 | #
4 | # Magisk Module Template Install Script
5 | # by topjohnwu
6 | #
7 | ##########################################################################################
8 |
9 | # Detect whether in boot mode
10 | ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
11 | $BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
12 |
13 | TMPDIR=/dev/tmp
14 | INSTALLER=$TMPDIR/magisk_install
15 | MAGISKBIN=/data/adb/magisk
16 | WIPEDIR=$4/magisk
17 |
18 | # Default permissions
19 | umask 022
20 |
21 | # Initial cleanup
22 | #rm -rf $TMPDIR 2>/dev/null
23 | #mkdir -p $INSTALLER
24 |
25 | # echo before loading util_functions
26 | ui_print() { echo "$1"; }
27 |
28 | require_new_magisk() {
29 | ui_print "*******************************"
30 | ui_print " Please install Magisk v15.0+! "
31 | ui_print "*******************************"
32 | exit 1
33 | }
34 |
35 | ##########################################################################################
36 | # Environment
37 | ##########################################################################################
38 |
39 | OUTFD=$2
40 | ZIP=$3
41 |
42 | mount /data 2>/dev/null
43 |
44 | # Utility functions must exist
45 | [ -f $MAGISKBIN/util_functions.sh ] || require_new_magisk
46 | # Load utility fuctions
47 | . $MAGISKBIN/util_functions.sh
48 |
49 | # We can't alter magisk image live, use alternative image if required
50 | $BOOTMODE && IMG=/data/adb/magisk_merge.img
51 | # Always mount under tmp
52 | MOUNTPATH=$TMPDIR/magisk_img
53 |
54 | # Preperation for flashable zips
55 | get_outfd
56 |
57 | # Mount partitions
58 | mount_partitions
59 |
60 | # Detect version and architecture
61 | api_level_arch_detect
62 |
63 | # You can get the Android API version from $API, the CPU architecture from $ARCH
64 | # Useful if you are creating Android version / platform dependent mods
65 |
66 | # Setup busybox and binaries
67 | $BOOTMODE && boot_actions || recovery_actions
68 |
69 | ##########################################################################################
70 | # Preparation
71 | ##########################################################################################
72 |
73 | # Extract common files
74 | #unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
75 |
76 | [ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
77 | # Load configurations
78 | . $INSTALLER/config.sh
79 |
80 | # Check the installed magisk version
81 | MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop`
82 | [ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk
83 | MODID=`grep_prop id $INSTALLER/module.prop`
84 | MODPATH=$MOUNTPATH/$MODID
85 |
86 | # Print mod name
87 | print_modname
88 |
89 | # Please leave this message in your flashable zip for credits :)
90 | ui_print "******************************"
91 | ui_print "Powered by Magisk (@topjohnwu)"
92 | ui_print "******************************"
93 |
94 | ##########################################################################################
95 | # Install
96 | ##########################################################################################
97 |
98 | # Get the variable reqSizeM. Use your own method to determine reqSizeM if needed
99 | request_zip_size_check "$ZIP"
100 |
101 | # This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM
102 | mount_magisk_img
103 |
104 | # Create mod paths
105 | rm -rf $MODPATH 2>/dev/null
106 | mkdir -p $MODPATH
107 |
108 | # Extract files to system. Use your own method if needed
109 | ui_print "- Extracting module files"
110 | #unzip -o "$ZIP" 'system/*' -d $MODPATH >&2
111 | cp -R $WIPEDIR/* $MODPATH
112 |
113 | # Remove placeholder
114 | rm -f $MODPATH/system/placeholder 2>/dev/null
115 |
116 | # Handle replace folders
117 | for TARGET in $REPLACE; do
118 | mktouch $MODPATH$TARGET/.replace
119 | done
120 |
121 | # Auto Mount
122 | $AUTOMOUNT && touch $MODPATH/auto_mount
123 |
124 | # prop files
125 | $PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
126 |
127 | # Module info
128 | cp -af $INSTALLER/module.prop $MODPATH/module.prop
129 | if $BOOTMODE; then
130 | # Update info for Magisk Manager
131 | mktouch /sbin/.core/img/$MODID/update
132 | cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop
133 | fi
134 |
135 | # post-fs-data mode scripts
136 | $POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
137 |
138 | # service mode scripts
139 | $LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
140 |
141 | ui_print "- Setting permissions"
142 | set_permissions
143 |
144 | ##########################################################################################
145 | # Finalizing
146 | ##########################################################################################
147 |
148 | # Unmount magisk image and shrink if possible
149 | unmount_magisk_img
150 |
151 | $BOOTMODE || recovery_cleanup
152 | rm -rf $TMPDIR
153 |
154 | ui_print "- Done"
155 | exit 0
156 |
--------------------------------------------------------------------------------
/magisk_install/module.prop:
--------------------------------------------------------------------------------
1 | id=prjWIPE
2 | name=Project WIPE Systemless
3 | version=w_0603.2,m_1030
4 | versionCode=103002
5 | author=yc9559 & cjybyjk @ coolapk
6 | description=A Module to insert Project WIPE 0603.2 to system.
7 | minMagisk=1500
8 |
--------------------------------------------------------------------------------
/platforms/atom_z3560_z3580/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: atom_z3560_z3580
5 | # Generated at: Thu Jun 28 05:59:09 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpufreq/interactive"
8 | C1_GOVERNOR_DIR=""
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR=""
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | :
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
28 | }
29 |
30 | function unify_environment()
31 | {
32 | # SELinux permissive
33 | setenforce 0
34 | # in case of using ondemand as default governor
35 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
36 | }
37 |
38 | function runonce_custom()
39 | {
40 | :
41 | }
42 |
43 | function before_modify()
44 | {
45 | chown 0.0 ${C0_GOVERNOR_DIR}/*
46 | chmod 0666 ${C0_GOVERNOR_DIR}/*
47 | lock_value 480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
48 | }
49 |
50 | function after_modify()
51 | {
52 | chmod 0444 ${C0_GOVERNOR_DIR}/*
53 | verify_param
54 | }
55 |
56 | function powersave_custom()
57 | {
58 | :
59 | }
60 |
61 | function balance_custom()
62 | {
63 | :
64 | }
65 |
66 | function performance_custom()
67 | {
68 | :
69 | }
70 |
71 | function fast_custom()
72 | {
73 | :
74 | }
75 |
76 |
77 |
78 | # $1:value $2:file path
79 | function set_value()
80 | {
81 | if [ -f $2 ]; then
82 | echo $1 > $2
83 | fi
84 | }
85 |
86 | # $1:value $2:file path
87 | function lock_value()
88 | {
89 | if [ -f $2 ]; then
90 | # chown 0.0 $2
91 | chmod 0666 $2
92 | echo $1 > $2
93 | chmod 0444 $2
94 | fi
95 | }
96 |
97 | # $1:io-scheduler $2:block-path
98 | function set_io()
99 | {
100 | if [ -f $2/queue/scheduler ]; then
101 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
102 | echo $1 > $2/queue/scheduler
103 | echo 512 > $2/queue/read_ahead_kb
104 | lock_value 0 $2/queue/iostats
105 | lock_value 256 $2/queue/nr_requests
106 | lock_value 0 $2/queue/iosched/slice_idle
107 | fi
108 | fi
109 | }
110 |
111 | # $1:display-name $2:file path
112 | function print_value()
113 | {
114 | if [ -f $2 ]; then
115 | echo $1
116 | cat $2
117 | fi
118 | }
119 |
120 | function verify_param()
121 | {
122 | expected_target=${C0_GOVERNOR_DIR}/target_loads
123 | if [ "$action" = "powersave" ]; then
124 | expected_value="80 580000:56 680000:44 780000:33 880000:48 980000:62 1080000:74 1280000:89 1480000:98"
125 | elif [ "$action" = "balance" ]; then
126 | expected_value="80 580000:53 680000:38 880000:49 980000:60 1180000:65 1280000:82 1380000:63 1480000:97"
127 | elif [ "$action" = "performance" ]; then
128 | expected_value="80 580000:59 680000:36 780000:75 880000:39 1080000:56 1380000:52 1480000:57 1580000:97"
129 | elif [ "$action" = "fast" ]; then
130 | expected_value="80 1780000:90"
131 | fi
132 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
133 | echo "${action} OK"
134 | else
135 | echo "${action} FAIL"
136 | fi
137 | }
138 |
139 | action=$1
140 | if [ ! -n "$action" ]; then
141 | action="balance"
142 | fi
143 |
144 | if [ "$action" = "debug" ]; then
145 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
146 | echo "Author: yc9559"
147 | echo "Platform: atom_z3560_z3580"
148 | echo "Generated at: Thu Jun 28 05:59:09 2018"
149 | echo ""
150 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
151 | print_param above_hispeed_delay
152 | print_param target_loads
153 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
154 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
155 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
156 | which perfd
157 | exit 0
158 | fi
159 |
160 | if [ ! -f /dev/.project_wipe ]; then
161 | unify_environment
162 | fi
163 |
164 | before_modify
165 |
166 | # RunOnce
167 | if [ ! -f /dev/.project_wipe ]; then
168 | # set flag
169 | touch /dev/.project_wipe
170 |
171 | runonce_custom
172 |
173 | set_io cfq /sys/block/mmcblk0
174 | set_io cfq /sys/block/sda
175 |
176 | # shared interactive parameters
177 | set_param_little timer_rate 20000
178 | set_param_little timer_slack 180000
179 | set_param_little boost 0
180 | set_param_little boostpulse_duration 0
181 | set_param_big timer_rate 20000
182 | set_param_big timer_slack 180000
183 | set_param_big boost 0
184 | set_param_big boostpulse_duration 0
185 | fi
186 |
187 | if [ "$action" = "powersave" ]; then
188 | powersave_custom
189 | set_param_little above_hispeed_delay "18000 1480000:98000"
190 | set_param_little hispeed_freq 1180000
191 | set_param_little go_hispeed_load 95
192 | set_param_little target_loads "80 580000:56 680000:44 780000:33 880000:48 980000:62 1080000:74 1280000:89 1480000:98"
193 | set_param_little min_sample_time 18000
194 | set_param_big above_hispeed_delay "18000 1480000:98000"
195 | set_param_big hispeed_freq 1180000
196 | set_param_big go_hispeed_load 95
197 | set_param_big target_loads "80 580000:56 680000:44 780000:33 880000:48 980000:62 1080000:74 1280000:89 1480000:98"
198 | set_param_big min_sample_time 18000
199 | fi
200 |
201 | if [ "$action" = "balance" ]; then
202 | balance_custom
203 | set_param_little above_hispeed_delay "18000 1480000:98000"
204 | set_param_little hispeed_freq 1380000
205 | set_param_little go_hispeed_load 98
206 | set_param_little target_loads "80 580000:53 680000:38 880000:49 980000:60 1180000:65 1280000:82 1380000:63 1480000:97"
207 | set_param_little min_sample_time 18000
208 | set_param_big above_hispeed_delay "18000 1480000:98000"
209 | set_param_big hispeed_freq 1380000
210 | set_param_big go_hispeed_load 98
211 | set_param_big target_loads "80 580000:53 680000:38 880000:49 980000:60 1180000:65 1280000:82 1380000:63 1480000:97"
212 | set_param_big min_sample_time 18000
213 | fi
214 |
215 | if [ "$action" = "performance" ]; then
216 | performance_custom
217 | set_param_little above_hispeed_delay "38000 1580000:98000 1680000:38000"
218 | set_param_little hispeed_freq 1480000
219 | set_param_little go_hispeed_load 95
220 | set_param_little target_loads "80 580000:59 680000:36 780000:75 880000:39 1080000:56 1380000:52 1480000:57 1580000:97"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "38000 1580000:98000 1680000:38000"
223 | set_param_big hispeed_freq 1480000
224 | set_param_big go_hispeed_load 95
225 | set_param_big target_loads "80 580000:59 680000:36 780000:75 880000:39 1080000:56 1380000:52 1480000:57 1580000:97"
226 | set_param_big min_sample_time 18000
227 | fi
228 |
229 | if [ "$action" = "fast" ]; then
230 | fast_custom
231 | lock_value 1380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
232 | set_param_little above_hispeed_delay "18000 1680000:198000"
233 | set_param_little hispeed_freq 1380000
234 | set_param_little target_loads "80 1780000:90"
235 | set_param_little min_sample_time 38000
236 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
237 | set_param_big above_hispeed_delay "18000 1680000:198000"
238 | set_param_big hispeed_freq 1380000
239 | set_param_big target_loads "80 1780000:90"
240 | set_param_big min_sample_time 38000
241 | fi
242 |
243 | after_modify
244 |
245 | exit 0
--------------------------------------------------------------------------------
/platforms/exynos_7420/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: exynos_7420
5 | # Generated at: Thu Jun 28 05:27:01 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 780000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 480000:28 580000:19 680000:37 780000:51 880000:61 1080000:83 1180000:66 1280000:91 1380000:96"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 480000:29 580000:12 680000:69 780000:22 880000:36 1080000:80 1180000:89 1480000:63"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 480000:26 580000:32 680000:69 780000:50 880000:15 1080000:80 1180000:85 1480000:56"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1480000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: exynos_7420"
176 | echo "Generated at: Thu Jun 28 05:27:01 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "38000 1280000:78000 1380000:98000 1480000:58000"
218 | set_param_little hispeed_freq 1180000
219 | set_param_little go_hispeed_load 96
220 | set_param_little target_loads "80 480000:28 580000:19 680000:37 780000:51 880000:61 1080000:83 1180000:66 1280000:91 1380000:96"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "98000 1880000:138000"
223 | set_param_big hispeed_freq 1480000
224 | set_param_big go_hispeed_load 97
225 | set_param_big target_loads "80 880000:74 980000:56 1080000:80 1180000:92 1380000:85 1480000:93 1580000:98"
226 | set_param_big min_sample_time 18000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "58000 1280000:18000 1380000:98000 1480000:58000"
232 | set_param_little hispeed_freq 1180000
233 | set_param_little go_hispeed_load 97
234 | set_param_little target_loads "80 480000:29 580000:12 680000:69 780000:22 880000:36 1080000:80 1180000:89 1480000:63"
235 | set_param_little min_sample_time 38000
236 | set_param_big above_hispeed_delay "18000 1480000:78000 1580000:98000 1880000:138000"
237 | set_param_big hispeed_freq 1380000
238 | set_param_big go_hispeed_load 96
239 | set_param_big target_loads "80 880000:27 980000:44 1080000:71 1180000:32 1280000:64 1380000:78 1480000:87 1580000:98"
240 | set_param_big min_sample_time 18000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "18000 1280000:98000 1380000:38000 1480000:58000"
246 | set_param_little hispeed_freq 1180000
247 | set_param_little go_hispeed_load 97
248 | set_param_little target_loads "80 480000:26 580000:32 680000:69 780000:50 880000:15 1080000:80 1180000:85 1480000:56"
249 | set_param_little min_sample_time 38000
250 | set_param_big above_hispeed_delay "18000 880000:38000 980000:58000 1080000:18000 1180000:38000 1280000:18000 1480000:78000 1580000:98000 1880000:38000"
251 | set_param_big hispeed_freq 780000
252 | set_param_big go_hispeed_load 98
253 | set_param_big target_loads "80 880000:4 980000:29 1080000:57 1280000:66 1480000:44 1580000:66 1680000:98"
254 | set_param_big min_sample_time 18000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1380000:198000"
261 | set_param_little hispeed_freq 1280000
262 | set_param_little target_loads "80 1480000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1880000:198000"
266 | set_param_big hispeed_freq 1380000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/exynos_8890/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: exynos_8890
5 | # Generated at: Thu Jun 28 04:56:48 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 680000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 480000:51 680000:28 780000:56 880000:63 1080000:71 1180000:75 1280000:97"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 480000:49 680000:34 780000:61 880000:33 980000:63 1080000:69 1180000:77 1480000:98"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 480000:54 780000:61 880000:24 980000:63 1080000:57 1180000:81 1280000:71 1480000:96 1580000:87"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1580000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: exynos_8890"
176 | echo "Generated at: Thu Jun 28 04:56:48 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "38000 1280000:18000 1480000:98000 1580000:58000"
218 | set_param_little hispeed_freq 1180000
219 | set_param_little go_hispeed_load 96
220 | set_param_little target_loads "80 480000:51 680000:28 780000:56 880000:63 1080000:71 1180000:75 1280000:97"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "18000 1480000:98000 1880000:138000"
223 | set_param_big hispeed_freq 1280000
224 | set_param_big go_hispeed_load 98
225 | set_param_big target_loads "80 780000:4 880000:77 980000:14 1080000:90 1180000:68 1280000:92 1480000:96"
226 | set_param_big min_sample_time 18000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "18000 1280000:38000 1480000:98000 1580000:18000"
232 | set_param_little hispeed_freq 1180000
233 | set_param_little go_hispeed_load 98
234 | set_param_little target_loads "80 480000:49 680000:34 780000:61 880000:33 980000:63 1080000:69 1180000:77 1480000:98"
235 | set_param_little min_sample_time 18000
236 | set_param_big above_hispeed_delay "18000 1580000:98000 1880000:138000"
237 | set_param_big hispeed_freq 1380000
238 | set_param_big go_hispeed_load 93
239 | set_param_big target_loads "80 780000:33 880000:67 980000:42 1080000:75 1180000:65 1280000:74 1480000:97"
240 | set_param_big min_sample_time 18000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "18000 1480000:38000"
246 | set_param_little hispeed_freq 1180000
247 | set_param_little go_hispeed_load 97
248 | set_param_little target_loads "80 480000:54 780000:61 880000:24 980000:63 1080000:57 1180000:81 1280000:71 1480000:96 1580000:87"
249 | set_param_little min_sample_time 38000
250 | set_param_big above_hispeed_delay "18000 1580000:98000 1880000:38000"
251 | set_param_big hispeed_freq 1480000
252 | set_param_big go_hispeed_load 90
253 | set_param_big target_loads "80 780000:6 880000:37 980000:59 1180000:42 1280000:67 1580000:96"
254 | set_param_big min_sample_time 18000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1480000:198000"
261 | set_param_little hispeed_freq 1280000
262 | set_param_little target_loads "80 1580000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1880000:198000"
266 | set_param_big hispeed_freq 1380000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/exynos_8895/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: exynos_8895
5 | # Generated at: Thu Jun 28 04:26:24 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 580000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 680000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 680000:27 780000:39 880000:61 980000:68 1380000:98 1680000:94"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 780000:53 880000:70 980000:50 1180000:71 1380000:97 1680000:92"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 780000:31 880000:62 980000:42 1180000:69 1380000:95 1680000:78"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1680000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: exynos_8895"
176 | echo "Generated at: Thu Jun 28 04:26:24 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "38000 1380000:98000"
218 | set_param_little hispeed_freq 1180000
219 | set_param_little go_hispeed_load 82
220 | set_param_little target_loads "80 680000:27 780000:39 880000:61 980000:68 1380000:98 1680000:94"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
223 | set_param_big hispeed_freq 1380000
224 | set_param_big go_hispeed_load 98
225 | set_param_big target_loads "80 780000:73 880000:79 980000:55 1080000:69 1180000:84 1380000:98"
226 | set_param_big min_sample_time 18000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "38000 1380000:98000"
232 | set_param_little hispeed_freq 1180000
233 | set_param_little go_hispeed_load 98
234 | set_param_little target_loads "80 780000:53 880000:70 980000:50 1180000:71 1380000:97 1680000:92"
235 | set_param_little min_sample_time 58000
236 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
237 | set_param_big hispeed_freq 1380000
238 | set_param_big go_hispeed_load 98
239 | set_param_big target_loads "80 780000:40 880000:34 980000:66 1080000:31 1180000:72 1380000:86 1680000:98"
240 | set_param_big min_sample_time 18000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "38000"
246 | set_param_little hispeed_freq 1180000
247 | set_param_little go_hispeed_load 97
248 | set_param_little target_loads "80 780000:31 880000:62 980000:42 1180000:69 1380000:95 1680000:78"
249 | set_param_little min_sample_time 58000
250 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:38000"
251 | set_param_big hispeed_freq 1380000
252 | set_param_big go_hispeed_load 96
253 | set_param_big target_loads "80 780000:22 880000:3 980000:14 1080000:34 1180000:47 1380000:63 1680000:72 1780000:98"
254 | set_param_big min_sample_time 18000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1180000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1380000:198000"
261 | set_param_little hispeed_freq 1180000
262 | set_param_little target_loads "80 1680000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1880000:198000"
266 | set_param_big hispeed_freq 1380000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/helio_x10/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: helio_x10
5 | # Generated at: Thu Jun 28 06:33:16 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpufreq/interactive"
8 | C1_GOVERNOR_DIR=""
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR=""
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | :
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
28 | }
29 |
30 | function unify_environment()
31 | {
32 | # SELinux permissive
33 | setenforce 0
34 | # in case of using ondemand as default governor
35 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
36 | }
37 |
38 | function runonce_custom()
39 | {
40 | # CORE CONTROL
41 | lock_value 40 /proc/hps/down_threshold
42 | # avoid permission problem, do not set 0444
43 | set_value 2-3 /dev/cpuset/background/cpus
44 | set_value 0-3 /dev/cpuset/system-background/cpus
45 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
46 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
47 | }
48 |
49 | function before_modify()
50 | {
51 | chown 0.0 ${C0_GOVERNOR_DIR}/*
52 | chmod 0666 ${C0_GOVERNOR_DIR}/*
53 | lock_value 380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
54 | }
55 |
56 | function after_modify()
57 | {
58 | chmod 0444 ${C0_GOVERNOR_DIR}/*
59 | verify_param
60 | }
61 |
62 | function powersave_custom()
63 | {
64 | lock_value 90 /proc/hps/up_threshold
65 | lock_value 2 /proc/hps/num_base_perf_serv
66 | }
67 |
68 | function balance_custom()
69 | {
70 | lock_value 80 /proc/hps/up_threshold
71 | lock_value 3 /proc/hps/num_base_perf_serv
72 | }
73 |
74 | function performance_custom()
75 | {
76 | lock_value 70 /proc/hps/up_threshold
77 | lock_value 3 /proc/hps/num_base_perf_serv
78 | }
79 |
80 | function fast_custom()
81 | {
82 | lock_value 60 /proc/hps/up_threshold
83 | lock_value 4 /proc/hps/num_base_perf_serv
84 | }
85 |
86 |
87 |
88 | # $1:value $2:file path
89 | function set_value()
90 | {
91 | if [ -f $2 ]; then
92 | echo $1 > $2
93 | fi
94 | }
95 |
96 | # $1:value $2:file path
97 | function lock_value()
98 | {
99 | if [ -f $2 ]; then
100 | # chown 0.0 $2
101 | chmod 0666 $2
102 | echo $1 > $2
103 | chmod 0444 $2
104 | fi
105 | }
106 |
107 | # $1:io-scheduler $2:block-path
108 | function set_io()
109 | {
110 | if [ -f $2/queue/scheduler ]; then
111 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
112 | echo $1 > $2/queue/scheduler
113 | echo 512 > $2/queue/read_ahead_kb
114 | lock_value 0 $2/queue/iostats
115 | lock_value 256 $2/queue/nr_requests
116 | lock_value 0 $2/queue/iosched/slice_idle
117 | fi
118 | fi
119 | }
120 |
121 | # $1:display-name $2:file path
122 | function print_value()
123 | {
124 | if [ -f $2 ]; then
125 | echo $1
126 | cat $2
127 | fi
128 | }
129 |
130 | function verify_param()
131 | {
132 | expected_target=${C0_GOVERNOR_DIR}/target_loads
133 | if [ "$action" = "powersave" ]; then
134 | expected_value="80 780000:51 1180000:65 1280000:83 1480000:98"
135 | elif [ "$action" = "balance" ]; then
136 | expected_value="80 780000:60 1180000:86 1280000:79 1480000:97"
137 | elif [ "$action" = "performance" ]; then
138 | expected_value="80 780000:61 1180000:65 1280000:83 1480000:63 1580000:96"
139 | elif [ "$action" = "fast" ]; then
140 | expected_value="80 1880000:90"
141 | fi
142 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
143 | echo "${action} OK"
144 | else
145 | echo "${action} FAIL"
146 | fi
147 | }
148 |
149 | action=$1
150 | if [ ! -n "$action" ]; then
151 | action="balance"
152 | fi
153 |
154 | if [ "$action" = "debug" ]; then
155 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
156 | echo "Author: yc9559"
157 | echo "Platform: helio_x10"
158 | echo "Generated at: Thu Jun 28 06:33:16 2018"
159 | echo ""
160 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
161 | print_param above_hispeed_delay
162 | print_param target_loads
163 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
164 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
165 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
166 | which perfd
167 | exit 0
168 | fi
169 |
170 | if [ ! -f /dev/.project_wipe ]; then
171 | unify_environment
172 | fi
173 |
174 | before_modify
175 |
176 | # RunOnce
177 | if [ ! -f /dev/.project_wipe ]; then
178 | # set flag
179 | touch /dev/.project_wipe
180 |
181 | runonce_custom
182 |
183 | set_io cfq /sys/block/mmcblk0
184 | set_io cfq /sys/block/sda
185 |
186 | # shared interactive parameters
187 | set_param_little timer_rate 20000
188 | set_param_little timer_slack 180000
189 | set_param_little boost 0
190 | set_param_little boostpulse_duration 0
191 | set_param_big timer_rate 20000
192 | set_param_big timer_slack 180000
193 | set_param_big boost 0
194 | set_param_big boostpulse_duration 0
195 | fi
196 |
197 | if [ "$action" = "powersave" ]; then
198 | powersave_custom
199 | set_param_little above_hispeed_delay "38000 1280000:18000 1480000:98000"
200 | set_param_little hispeed_freq 1180000
201 | set_param_little go_hispeed_load 98
202 | set_param_little target_loads "80 780000:51 1180000:65 1280000:83 1480000:98"
203 | set_param_little min_sample_time 18000
204 | set_param_big above_hispeed_delay "38000 1280000:18000 1480000:98000"
205 | set_param_big hispeed_freq 1180000
206 | set_param_big go_hispeed_load 98
207 | set_param_big target_loads "80 780000:51 1180000:65 1280000:83 1480000:98"
208 | set_param_big min_sample_time 18000
209 | fi
210 |
211 | if [ "$action" = "balance" ]; then
212 | balance_custom
213 | set_param_little above_hispeed_delay "18000 1480000:98000"
214 | set_param_little hispeed_freq 1180000
215 | set_param_little go_hispeed_load 98
216 | set_param_little target_loads "80 780000:60 1180000:86 1280000:79 1480000:97"
217 | set_param_little min_sample_time 38000
218 | set_param_big above_hispeed_delay "18000 1480000:98000"
219 | set_param_big hispeed_freq 1180000
220 | set_param_big go_hispeed_load 98
221 | set_param_big target_loads "80 780000:60 1180000:86 1280000:79 1480000:97"
222 | set_param_big min_sample_time 38000
223 | fi
224 |
225 | if [ "$action" = "performance" ]; then
226 | performance_custom
227 | set_param_little above_hispeed_delay "38000 1580000:98000"
228 | set_param_little hispeed_freq 1480000
229 | set_param_little go_hispeed_load 98
230 | set_param_little target_loads "80 780000:61 1180000:65 1280000:83 1480000:63 1580000:96"
231 | set_param_little min_sample_time 38000
232 | set_param_big above_hispeed_delay "38000 1580000:98000"
233 | set_param_big hispeed_freq 1480000
234 | set_param_big go_hispeed_load 98
235 | set_param_big target_loads "80 780000:61 1180000:65 1280000:83 1480000:63 1580000:96"
236 | set_param_big min_sample_time 38000
237 | fi
238 |
239 | if [ "$action" = "fast" ]; then
240 | fast_custom
241 | lock_value 1280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
242 | set_param_little above_hispeed_delay "18000 1580000:198000"
243 | set_param_little hispeed_freq 1280000
244 | set_param_little target_loads "80 1880000:90"
245 | set_param_little min_sample_time 38000
246 | lock_value 1280000 ${C1_CPUFREQ_DIR}/scaling_min_freq
247 | set_param_big above_hispeed_delay "18000 1580000:198000"
248 | set_param_big hispeed_freq 1280000
249 | set_param_big target_loads "80 1880000:90"
250 | set_param_big min_sample_time 38000
251 | fi
252 |
253 | after_modify
254 |
255 | exit 0
--------------------------------------------------------------------------------
/platforms/helio_x20_x25/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: helio_x20_x25
5 | # Generated at: Thu Jun 28 06:18:15 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpufreq/interactive"
8 | C1_GOVERNOR_DIR=""
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR=""
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | :
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
28 | }
29 |
30 | function unify_environment()
31 | {
32 | # SELinux permissive
33 | setenforce 0
34 | # in case of using ondemand as default governor
35 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
36 | }
37 |
38 | function runonce_custom()
39 | {
40 | # CORE CONTROL
41 | lock_value 40 /proc/hps/down_threshold
42 | # avoid permission problem, do not set 0444
43 | set_value 2-3 /dev/cpuset/background/cpus
44 | set_value 0-3 /dev/cpuset/system-background/cpus
45 | set_value 0-3,4-7,8 /dev/cpuset/foreground/cpus
46 | set_value 0-3,4-7,8 /dev/cpuset/top-app/cpus
47 | }
48 |
49 | function before_modify()
50 | {
51 | chown 0.0 ${C0_GOVERNOR_DIR}/*
52 | chmod 0666 ${C0_GOVERNOR_DIR}/*
53 | lock_value 280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
54 | }
55 |
56 | function after_modify()
57 | {
58 | chmod 0444 ${C0_GOVERNOR_DIR}/*
59 | verify_param
60 | }
61 |
62 | function powersave_custom()
63 | {
64 | lock_value 90 /proc/hps/up_threshold
65 | lock_value "2 2 0" /proc/hps/num_base_perf_serv
66 | }
67 |
68 | function balance_custom()
69 | {
70 | lock_value 80 /proc/hps/up_threshold
71 | lock_value "3 3 0" /proc/hps/num_base_perf_serv
72 | }
73 |
74 | function performance_custom()
75 | {
76 | lock_value 70 /proc/hps/up_threshold
77 | lock_value "3 3 1" /proc/hps/num_base_perf_serv
78 | }
79 |
80 | function fast_custom()
81 | {
82 | lock_value 60 /proc/hps/up_threshold
83 | lock_value "4 4 1" /proc/hps/num_base_perf_serv
84 | }
85 |
86 |
87 |
88 | # $1:value $2:file path
89 | function set_value()
90 | {
91 | if [ -f $2 ]; then
92 | echo $1 > $2
93 | fi
94 | }
95 |
96 | # $1:value $2:file path
97 | function lock_value()
98 | {
99 | if [ -f $2 ]; then
100 | # chown 0.0 $2
101 | chmod 0666 $2
102 | echo $1 > $2
103 | chmod 0444 $2
104 | fi
105 | }
106 |
107 | # $1:io-scheduler $2:block-path
108 | function set_io()
109 | {
110 | if [ -f $2/queue/scheduler ]; then
111 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
112 | echo $1 > $2/queue/scheduler
113 | echo 512 > $2/queue/read_ahead_kb
114 | lock_value 0 $2/queue/iostats
115 | lock_value 256 $2/queue/nr_requests
116 | lock_value 0 $2/queue/iosched/slice_idle
117 | fi
118 | fi
119 | }
120 |
121 | # $1:display-name $2:file path
122 | function print_value()
123 | {
124 | if [ -f $2 ]; then
125 | echo $1
126 | cat $2
127 | fi
128 | }
129 |
130 | function verify_param()
131 | {
132 | expected_target=${C0_GOVERNOR_DIR}/target_loads
133 | if [ "$action" = "powersave" ]; then
134 | expected_value="80 380000:15 480000:25 780000:36 880000:80 980000:66 1180000:91 1280000:96"
135 | elif [ "$action" = "balance" ]; then
136 | expected_value="80 380000:8 580000:14 680000:9 780000:41 880000:56 1080000:65 1180000:92 1380000:85 1480000:97"
137 | elif [ "$action" = "performance" ]; then
138 | expected_value="80 380000:10 780000:57 1080000:27 1180000:65 1280000:82 1380000:6 1480000:80 1580000:98"
139 | elif [ "$action" = "fast" ]; then
140 | expected_value="80 1780000:90"
141 | fi
142 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
143 | echo "${action} OK"
144 | else
145 | echo "${action} FAIL"
146 | fi
147 | }
148 |
149 | action=$1
150 | if [ ! -n "$action" ]; then
151 | action="balance"
152 | fi
153 |
154 | if [ "$action" = "debug" ]; then
155 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
156 | echo "Author: yc9559"
157 | echo "Platform: helio_x20_x25"
158 | echo "Generated at: Thu Jun 28 06:18:15 2018"
159 | echo ""
160 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
161 | print_param above_hispeed_delay
162 | print_param target_loads
163 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
164 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
165 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
166 | which perfd
167 | exit 0
168 | fi
169 |
170 | if [ ! -f /dev/.project_wipe ]; then
171 | unify_environment
172 | fi
173 |
174 | before_modify
175 |
176 | # RunOnce
177 | if [ ! -f /dev/.project_wipe ]; then
178 | # set flag
179 | touch /dev/.project_wipe
180 |
181 | runonce_custom
182 |
183 | set_io cfq /sys/block/mmcblk0
184 | set_io cfq /sys/block/sda
185 |
186 | # shared interactive parameters
187 | set_param_little timer_rate 20000
188 | set_param_little timer_slack 180000
189 | set_param_little boost 0
190 | set_param_little boostpulse_duration 0
191 | set_param_big timer_rate 20000
192 | set_param_big timer_slack 180000
193 | set_param_big boost 0
194 | set_param_big boostpulse_duration 0
195 | fi
196 |
197 | if [ "$action" = "powersave" ]; then
198 | powersave_custom
199 | set_param_little above_hispeed_delay "18000 1380000:98000"
200 | set_param_little hispeed_freq 1180000
201 | set_param_little go_hispeed_load 94
202 | set_param_little target_loads "80 380000:15 480000:25 780000:36 880000:80 980000:66 1180000:91 1280000:96"
203 | set_param_little min_sample_time 18000
204 | set_param_big above_hispeed_delay "18000 1380000:98000"
205 | set_param_big hispeed_freq 1180000
206 | set_param_big go_hispeed_load 94
207 | set_param_big target_loads "80 380000:15 480000:25 780000:36 880000:80 980000:66 1180000:91 1280000:96"
208 | set_param_big min_sample_time 18000
209 | fi
210 |
211 | if [ "$action" = "balance" ]; then
212 | balance_custom
213 | set_param_little above_hispeed_delay "18000 1380000:98000"
214 | set_param_little hispeed_freq 1180000
215 | set_param_little go_hispeed_load 93
216 | set_param_little target_loads "80 380000:8 580000:14 680000:9 780000:41 880000:56 1080000:65 1180000:92 1380000:85 1480000:97"
217 | set_param_little min_sample_time 18000
218 | set_param_big above_hispeed_delay "18000 1380000:98000"
219 | set_param_big hispeed_freq 1180000
220 | set_param_big go_hispeed_load 93
221 | set_param_big target_loads "80 380000:8 580000:14 680000:9 780000:41 880000:56 1080000:65 1180000:92 1380000:85 1480000:97"
222 | set_param_big min_sample_time 18000
223 | fi
224 |
225 | if [ "$action" = "performance" ]; then
226 | performance_custom
227 | set_param_little above_hispeed_delay "18000 1380000:58000 1480000:98000 1680000:38000"
228 | set_param_little hispeed_freq 1180000
229 | set_param_little go_hispeed_load 85
230 | set_param_little target_loads "80 380000:10 780000:57 1080000:27 1180000:65 1280000:82 1380000:6 1480000:80 1580000:98"
231 | set_param_little min_sample_time 18000
232 | set_param_big above_hispeed_delay "18000 1380000:58000 1480000:98000 1680000:38000"
233 | set_param_big hispeed_freq 1180000
234 | set_param_big go_hispeed_load 85
235 | set_param_big target_loads "80 380000:10 780000:57 1080000:27 1180000:65 1280000:82 1380000:6 1480000:80 1580000:98"
236 | set_param_big min_sample_time 18000
237 | fi
238 |
239 | if [ "$action" = "fast" ]; then
240 | fast_custom
241 | lock_value 1280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
242 | set_param_little above_hispeed_delay "18000 1680000:198000"
243 | set_param_little hispeed_freq 1280000
244 | set_param_little target_loads "80 1780000:90"
245 | set_param_little min_sample_time 38000
246 | lock_value 1280000 ${C1_CPUFREQ_DIR}/scaling_min_freq
247 | set_param_big above_hispeed_delay "18000 1680000:198000"
248 | set_param_big hispeed_freq 1280000
249 | set_param_big target_loads "80 1780000:90"
250 | set_param_big min_sample_time 38000
251 | fi
252 |
253 | after_modify
254 |
255 | exit 0
--------------------------------------------------------------------------------
/platforms/kirin_950_955/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: kirin_950_955
5 | # Generated at: Thu Jun 28 00:11:29 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 780000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 780000:62 980000:71 1280000:77 1480000:98"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 780000:69 980000:76 1280000:80 1480000:96"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 780000:66 980000:17 1280000:81 1480000:96 1780000:87"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1780000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: kirin_950_955"
176 | echo "Generated at: Thu Jun 28 00:11:29 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "18000 1480000:98000"
218 | set_param_little hispeed_freq 1280000
219 | set_param_little go_hispeed_load 98
220 | set_param_little target_loads "80 780000:62 980000:71 1280000:77 1480000:98"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "18000 1480000:98000 1780000:138000"
223 | set_param_big hispeed_freq 780000
224 | set_param_big go_hispeed_load 80
225 | set_param_big target_loads "80 1180000:89 1480000:98"
226 | set_param_big min_sample_time 38000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "18000 1480000:98000"
232 | set_param_little hispeed_freq 1280000
233 | set_param_little go_hispeed_load 97
234 | set_param_little target_loads "80 780000:69 980000:76 1280000:80 1480000:96"
235 | set_param_little min_sample_time 58000
236 | set_param_big above_hispeed_delay "18000 1780000:138000"
237 | set_param_big hispeed_freq 1180000
238 | set_param_big go_hispeed_load 80
239 | set_param_big target_loads "80 1180000:75 1480000:93 1780000:98"
240 | set_param_big min_sample_time 38000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "18000 1480000:38000"
246 | set_param_little hispeed_freq 1280000
247 | set_param_little go_hispeed_load 97
248 | set_param_little target_loads "80 780000:66 980000:17 1280000:81 1480000:96 1780000:87"
249 | set_param_little min_sample_time 78000
250 | set_param_big above_hispeed_delay "18000 1780000:138000"
251 | set_param_big hispeed_freq 1180000
252 | set_param_big go_hispeed_load 80
253 | set_param_big target_loads "80 1180000:65 1480000:85 1780000:96"
254 | set_param_big min_sample_time 38000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1480000:198000"
261 | set_param_little hispeed_freq 1480000
262 | set_param_little target_loads "80 1780000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1180000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1780000:198000"
266 | set_param_big hispeed_freq 1180000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/kirin_960/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: kirin_960
5 | # Generated at: Thu Jun 28 00:36:43 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 880000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 980000:93 1380000:97"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 980000:97 1380000:78 1680000:98"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 980000:58 1380000:75 1680000:98"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1780000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: kirin_960"
176 | echo "Generated at: Thu Jun 28 00:36:43 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "38000 1680000:98000"
218 | set_param_little hispeed_freq 1380000
219 | set_param_little go_hispeed_load 97
220 | set_param_little target_loads "80 980000:93 1380000:97"
221 | set_param_little min_sample_time 58000
222 | set_param_big above_hispeed_delay "18000 1780000:138000"
223 | set_param_big hispeed_freq 880000
224 | set_param_big go_hispeed_load 84
225 | set_param_big target_loads "80 1380000:98"
226 | set_param_big min_sample_time 38000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "38000 1680000:98000"
232 | set_param_little hispeed_freq 1380000
233 | set_param_little go_hispeed_load 97
234 | set_param_little target_loads "80 980000:97 1380000:78 1680000:98"
235 | set_param_little min_sample_time 78000
236 | set_param_big above_hispeed_delay "18000 1380000:98000 1780000:138000"
237 | set_param_big hispeed_freq 880000
238 | set_param_big go_hispeed_load 95
239 | set_param_big target_loads "80 1380000:59 1780000:98"
240 | set_param_big min_sample_time 38000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "38000"
246 | set_param_little hispeed_freq 1380000
247 | set_param_little go_hispeed_load 97
248 | set_param_little target_loads "80 980000:58 1380000:75 1680000:98"
249 | set_param_little min_sample_time 78000
250 | set_param_big above_hispeed_delay "18000 1380000:38000 1780000:138000"
251 | set_param_big hispeed_freq 880000
252 | set_param_big go_hispeed_load 93
253 | set_param_big target_loads "80 1380000:59 1780000:97"
254 | set_param_big min_sample_time 38000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1680000:198000"
261 | set_param_little hispeed_freq 1380000
262 | set_param_little target_loads "80 1780000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1780000:198000"
266 | set_param_big hispeed_freq 1380000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/kirin_970/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: kirin_970
5 | # Generated at: Thu Jun 28 01:02:05 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # Exynos hotplug
36 | lock_value 0 /sys/power/cpuhotplug/enabled
37 | lock_value 0 /sys/devices/system/cpu/cpuhotplug/enabled
38 | lock_value 1 /sys/devices/system/cpu/cpu4/online
39 | lock_value 1 /sys/devices/system/cpu/cpu5/online
40 | lock_value 1 /sys/devices/system/cpu/cpu6/online
41 | lock_value 1 /sys/devices/system/cpu/cpu7/online
42 | # in case of using ondemand as default governor
43 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
44 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
45 | }
46 |
47 | function runonce_custom()
48 | {
49 | # avoid permission problem, do not set 0444
50 | set_value 2-3 /dev/cpuset/background/cpus
51 | set_value 0-3 /dev/cpuset/system-background/cpus
52 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
53 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
54 |
55 | # Linaro HMP, between 0 and 1024, maybe compare to the capacity of current cluster
56 | # PELT and period average smoothing sampling, so the parameter style differ from WALT by Qualcomm a lot.
57 | # https://lists.linaro.org/pipermail/linaro-dev/2012-November/014485.html
58 | # https://www.anandtech.com/show/9330/exynos-7420-deep-dive/6
59 | # lock_value 60 /sys/kernel/hmp/load_avg_period_ms
60 | lock_value 256 /sys/kernel/hmp/down_threshold
61 | lock_value 640 /sys/kernel/hmp/up_threshold
62 | lock_value 0 /sys/kernel/hmp/boost
63 | }
64 |
65 | function before_modify()
66 | {
67 | chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 680000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | :
87 | }
88 |
89 | function balance_custom()
90 | {
91 | :
92 | }
93 |
94 | function performance_custom()
95 | {
96 | :
97 | }
98 |
99 | function fast_custom()
100 | {
101 | :
102 | }
103 |
104 |
105 |
106 | # $1:value $2:file path
107 | function set_value()
108 | {
109 | if [ -f $2 ]; then
110 | echo $1 > $2
111 | fi
112 | }
113 |
114 | # $1:value $2:file path
115 | function lock_value()
116 | {
117 | if [ -f $2 ]; then
118 | # chown 0.0 $2
119 | chmod 0666 $2
120 | echo $1 > $2
121 | chmod 0444 $2
122 | fi
123 | }
124 |
125 | # $1:io-scheduler $2:block-path
126 | function set_io()
127 | {
128 | if [ -f $2/queue/scheduler ]; then
129 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
130 | echo $1 > $2/queue/scheduler
131 | echo 512 > $2/queue/read_ahead_kb
132 | lock_value 0 $2/queue/iostats
133 | lock_value 256 $2/queue/nr_requests
134 | lock_value 0 $2/queue/iosched/slice_idle
135 | fi
136 | fi
137 | }
138 |
139 | # $1:display-name $2:file path
140 | function print_value()
141 | {
142 | if [ -f $2 ]; then
143 | echo $1
144 | cat $2
145 | fi
146 | }
147 |
148 | function verify_param()
149 | {
150 | expected_target=${C0_GOVERNOR_DIR}/target_loads
151 | if [ "$action" = "powersave" ]; then
152 | expected_value="80 980000:60 1180000:87 1380000:70 1480000:98"
153 | elif [ "$action" = "balance" ]; then
154 | expected_value="80 980000:61 1180000:88 1380000:70 1480000:96"
155 | elif [ "$action" = "performance" ]; then
156 | expected_value="80 980000:63 1180000:76 1480000:96"
157 | elif [ "$action" = "fast" ]; then
158 | expected_value="80 1780000:90"
159 | fi
160 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
161 | echo "${action} OK"
162 | else
163 | echo "${action} FAIL"
164 | fi
165 | }
166 |
167 | action=$1
168 | if [ ! -n "$action" ]; then
169 | action="balance"
170 | fi
171 |
172 | if [ "$action" = "debug" ]; then
173 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
174 | echo "Author: yc9559"
175 | echo "Platform: kirin_970"
176 | echo "Generated at: Thu Jun 28 01:02:05 2018"
177 | echo ""
178 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
179 | print_param above_hispeed_delay
180 | print_param target_loads
181 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
182 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
183 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
184 | which perfd
185 | exit 0
186 | fi
187 |
188 | if [ ! -f /dev/.project_wipe ]; then
189 | unify_environment
190 | fi
191 |
192 | before_modify
193 |
194 | # RunOnce
195 | if [ ! -f /dev/.project_wipe ]; then
196 | # set flag
197 | touch /dev/.project_wipe
198 |
199 | runonce_custom
200 |
201 | set_io cfq /sys/block/mmcblk0
202 | set_io cfq /sys/block/sda
203 |
204 | # shared interactive parameters
205 | set_param_little timer_rate 20000
206 | set_param_little timer_slack 180000
207 | set_param_little boost 0
208 | set_param_little boostpulse_duration 0
209 | set_param_big timer_rate 20000
210 | set_param_big timer_slack 180000
211 | set_param_big boost 0
212 | set_param_big boostpulse_duration 0
213 | fi
214 |
215 | if [ "$action" = "powersave" ]; then
216 | powersave_custom
217 | set_param_little above_hispeed_delay "18000 1380000:38000 1480000:98000"
218 | set_param_little hispeed_freq 1180000
219 | set_param_little go_hispeed_load 98
220 | set_param_little target_loads "80 980000:60 1180000:87 1380000:70 1480000:98"
221 | set_param_little min_sample_time 18000
222 | set_param_big above_hispeed_delay "18000 1580000:98000 1780000:138000"
223 | set_param_big hispeed_freq 1280000
224 | set_param_big go_hispeed_load 98
225 | set_param_big target_loads "80 1280000:98 1480000:91 1580000:98"
226 | set_param_big min_sample_time 18000
227 | fi
228 |
229 | if [ "$action" = "balance" ]; then
230 | balance_custom
231 | set_param_little above_hispeed_delay "18000 1480000:38000 1680000:98000"
232 | set_param_little hispeed_freq 1180000
233 | set_param_little go_hispeed_load 97
234 | set_param_little target_loads "80 980000:61 1180000:88 1380000:70 1480000:96"
235 | set_param_little min_sample_time 38000
236 | set_param_big above_hispeed_delay "18000 1580000:98000 1780000:138000"
237 | set_param_big hispeed_freq 1280000
238 | set_param_big go_hispeed_load 94
239 | set_param_big target_loads "80 980000:72 1280000:77 1580000:98"
240 | set_param_big min_sample_time 18000
241 | fi
242 |
243 | if [ "$action" = "performance" ]; then
244 | performance_custom
245 | set_param_little above_hispeed_delay "18000 1680000:38000"
246 | set_param_little hispeed_freq 1180000
247 | set_param_little go_hispeed_load 98
248 | set_param_little target_loads "80 980000:63 1180000:76 1480000:96"
249 | set_param_little min_sample_time 78000
250 | set_param_big above_hispeed_delay "18000 1580000:98000 1780000:38000"
251 | set_param_big hispeed_freq 1480000
252 | set_param_big go_hispeed_load 86
253 | set_param_big target_loads "80 980000:57 1280000:70 1480000:65 1580000:98"
254 | set_param_big min_sample_time 18000
255 | fi
256 |
257 | if [ "$action" = "fast" ]; then
258 | fast_custom
259 | lock_value 1480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
260 | set_param_little above_hispeed_delay "18000 1680000:198000"
261 | set_param_little hispeed_freq 1480000
262 | set_param_little target_loads "80 1780000:90"
263 | set_param_little min_sample_time 38000
264 | lock_value 1280000 ${C1_CPUFREQ_DIR}/scaling_min_freq
265 | set_param_big above_hispeed_delay "18000 1780000:198000"
266 | set_param_big hispeed_freq 1280000
267 | set_param_big target_loads "80 1980000:90"
268 | set_param_big min_sample_time 38000
269 | fi
270 |
271 | after_modify
272 |
273 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_615_616/NOTICE:
--------------------------------------------------------------------------------
1 | This is NOT Project_WIPE !
--------------------------------------------------------------------------------
/platforms/sd_615_616/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # This is NOT Project WIPE!
3 | # Author: cjybyjk
4 | # Modified from Project WIPE 180603.2 (sd_625_626)
5 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
6 | # Project WIPE Author: yc9559
7 |
8 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
10 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
12 |
13 | # $1:timer_rate $2:value
14 | function set_param_little()
15 | {
16 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
17 | }
18 |
19 | # $1:timer_rate $2:value
20 | function set_param_big()
21 | {
22 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
23 | }
24 |
25 | # $1:timer_rate
26 | function print_param()
27 | {
28 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
58 |
59 | set_value 25 /proc/sys/kernel/sched_downmigrate
60 | set_value 45 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
63 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
64 |
65 | set_param_little use_sched_load 1
66 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
67 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
68 | set_param_big use_sched_load 1
69 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
70 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
71 | }
72 |
73 | function before_modify()
74 | {
75 | chown 0.0 ${C0_GOVERNOR_DIR}/*
76 | chmod 0666 ${C0_GOVERNOR_DIR}/*
77 | lock_value 580000 ${C0_CPUFREQ_DIR}/scaling_min_freq
78 |
79 | set_value 1 /sys/devices/system/cpu/cpu4/online
80 | chown 0.0 ${C1_GOVERNOR_DIR}/*
81 | chmod 0666 ${C1_GOVERNOR_DIR}/*
82 | lock_value 580000 ${C1_CPUFREQ_DIR}/scaling_min_freq
83 | }
84 |
85 | function after_modify()
86 | {
87 | chmod 0444 ${C0_GOVERNOR_DIR}/*
88 | chmod 0444 ${C1_GOVERNOR_DIR}/*
89 | verify_param
90 | }
91 |
92 | function powersave_custom()
93 | {
94 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function balance_custom()
98 | {
99 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
100 | }
101 |
102 | function performance_custom()
103 | {
104 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
105 | }
106 |
107 | function fast_custom()
108 | {
109 | :
110 | }
111 |
112 |
113 |
114 | # $1:value $2:file path
115 | function set_value()
116 | {
117 | if [ -f $2 ]; then
118 | echo $1 > $2
119 | fi
120 | }
121 |
122 | # $1:value $2:file path
123 | function lock_value()
124 | {
125 | if [ -f $2 ]; then
126 | # chown 0.0 $2
127 | chmod 0666 $2
128 | echo $1 > $2
129 | chmod 0444 $2
130 | fi
131 | }
132 |
133 | # $1:io-scheduler $2:block-path
134 | function set_io()
135 | {
136 | if [ -f $2/queue/scheduler ]; then
137 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
138 | echo $1 > $2/queue/scheduler
139 | echo 512 > $2/queue/read_ahead_kb
140 | lock_value 0 $2/queue/iostats
141 | lock_value 256 $2/queue/nr_requests
142 | lock_value 0 $2/queue/iosched/slice_idle
143 | fi
144 | fi
145 | }
146 |
147 | # $1:display-name $2:file path
148 | function print_value()
149 | {
150 | if [ -f $2 ]; then
151 | echo $1
152 | cat $2
153 | fi
154 | }
155 |
156 | function verify_param()
157 | {
158 | expected_target=${C0_GOVERNOR_DIR}/target_loads
159 | if [ "$action" = "powersave" ]; then
160 | expected_value="80 980000:66 1113000:96"
161 | elif [ "$action" = "balance" ]; then
162 | expected_value="80 980000:63 1113000:72 1344000:97"
163 | elif [ "$action" = "performance" ]; then
164 | expected_value="80 980000:55 1113000:75 1344000:98"
165 | elif [ "$action" = "fast" ]; then
166 | expected_value="80 1497000:90"
167 | fi
168 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
169 | echo "${action} OK"
170 | else
171 | echo "${action} FAIL"
172 | fi
173 | }
174 |
175 | action=$1
176 | if [ ! -n "$action" ]; then
177 | action="balance"
178 | fi
179 |
180 | if [ "$action" = "debug" ]; then
181 | echo "This is NOT Project WIPE!"
182 | echo "Author: cjybyjk"
183 | echo "Modified from Project WIPE 180603.2 (sd_625_626)"
184 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
185 | echo "Project WIPE Author: yc9559"
186 | echo "Platform: sd_615_616"
187 | echo ""
188 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
189 | print_param above_hispeed_delay
190 | print_param target_loads
191 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
192 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
193 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
194 | which perfd
195 | exit 0
196 | fi
197 |
198 | if [ ! -f /dev/.project_wipe ]; then
199 | unify_environment
200 | fi
201 |
202 | before_modify
203 |
204 | # RunOnce
205 | if [ ! -f /dev/.project_wipe ]; then
206 | # set flag
207 | touch /dev/.project_wipe
208 |
209 | runonce_custom
210 |
211 | set_io cfq /sys/block/mmcblk0
212 | set_io cfq /sys/block/sda
213 |
214 | # shared interactive parameters
215 | set_param_little timer_rate 20000
216 | set_param_little timer_slack 180000
217 | set_param_little boost 0
218 | set_param_little boostpulse_duration 0
219 | set_param_big timer_rate 20000
220 | set_param_big timer_slack 180000
221 | set_param_big boost 0
222 | set_param_big boostpulse_duration 0
223 | fi
224 |
225 | if [ "$action" = "powersave" ]; then
226 | powersave_custom
227 | set_param_little above_hispeed_delay "18000 1344000:98000 1459000:138000"
228 | set_param_little hispeed_freq 1113000
229 | set_param_little go_hispeed_load 94
230 | set_param_little target_loads "80 980000:66 1113000:96"
231 | set_param_little min_sample_time 18000
232 | set_param_big above_hispeed_delay "18000 1344000:98000 1459000:138000"
233 | set_param_big hispeed_freq 1344000
234 | set_param_big go_hispeed_load 94
235 | set_param_big target_loads "80 980000:66 1113000:96"
236 | set_param_big min_sample_time 18000
237 | fi
238 |
239 | if [ "$action" = "balance" ]; then
240 | balance_custom
241 | set_param_little above_hispeed_delay "98000 1459000:138000"
242 | set_param_little hispeed_freq 1113000
243 | set_param_little go_hispeed_load 97
244 | set_param_little target_loads "80 980000:63 1113000:72 1344000:97"
245 | set_param_little min_sample_time 18000
246 | set_param_big above_hispeed_delay "98000 1459000:138000"
247 | set_param_big hispeed_freq 1344000
248 | set_param_big go_hispeed_load 97
249 | set_param_big target_loads "80 980000:63 1113000:72 1344000:97"
250 | set_param_big min_sample_time 18000
251 | fi
252 |
253 | if [ "$action" = "performance" ]; then
254 | performance_custom
255 | set_param_little above_hispeed_delay "18000 1344000:98000 1459000:38000"
256 | set_param_little hispeed_freq 1113000
257 | set_param_little go_hispeed_load 89
258 | set_param_little target_loads "80 980000:55 1113000:75 1344000:98"
259 | set_param_little min_sample_time 78000
260 | set_param_big above_hispeed_delay "18000 1344000:98000 1459000:38000"
261 | set_param_big hispeed_freq 1344000
262 | set_param_big go_hispeed_load 89
263 | set_param_big target_loads "80 980000:55 1113000:75 1344000:98"
264 | set_param_big min_sample_time 78000
265 | fi
266 |
267 | if [ "$action" = "fast" ]; then
268 | fast_custom
269 | lock_value 1113000 ${C0_CPUFREQ_DIR}/scaling_min_freq
270 | set_param_little above_hispeed_delay "18000 1459000:198000"
271 | set_param_little hispeed_freq 1113000
272 | set_param_little target_loads "80 1497000:90"
273 | set_param_little min_sample_time 38000
274 | lock_value 1113000 ${C1_CPUFREQ_DIR}/scaling_min_freq
275 | set_param_big above_hispeed_delay "18000 1459000:198000"
276 | set_param_big hispeed_freq 1113000
277 | set_param_big target_loads "80 1497000:90"
278 | set_param_big min_sample_time 38000
279 | fi
280 |
281 | after_modify
282 |
283 | exit 0
284 |
--------------------------------------------------------------------------------
/platforms/sd_625_626/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_625_626
5 | # Generated at: Thu Jun 28 01:59:58 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpufreq/interactive"
8 | C1_GOVERNOR_DIR=""
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | :
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
28 | }
29 |
30 | function unify_environment()
31 | {
32 | # SELinux permissive
33 | setenforce 0
34 | # disable hotplug to switch governor
35 | set_value 0 /sys/module/msm_thermal/core_control/enabled
36 | set_value N /sys/module/msm_thermal/parameters/enabled
37 | # in case of using ondemand as default governor
38 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
39 | # Perfd, nothing to worry about, if error the script will continue
40 | stop perfd
41 | }
42 |
43 | function runonce_custom()
44 | {
45 | set_value 90 /proc/sys/kernel/sched_spill_load
46 | set_value 0 /proc/sys/kernel/sched_boost
47 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
48 | set_value 40 /proc/sys/kernel/sched_init_task_load
49 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
50 |
51 | # avoid permission problem, do not set 0444
52 | set_value 2-3 /dev/cpuset/background/cpus
53 | set_value 0-3 /dev/cpuset/system-background/cpus
54 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
55 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
56 |
57 | set_value 25 /proc/sys/kernel/sched_downmigrate
58 | set_value 45 /proc/sys/kernel/sched_upmigrate
59 |
60 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
61 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
62 |
63 | set_param_little use_sched_load 1
64 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
65 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
66 | }
67 |
68 | function before_modify()
69 | {
70 | chown 0.0 ${C0_GOVERNOR_DIR}/*
71 | chmod 0666 ${C0_GOVERNOR_DIR}/*
72 | lock_value 580000 ${C0_CPUFREQ_DIR}/scaling_min_freq
73 | set_value 1 /sys/devices/system/cpu/cpu4/online
74 | }
75 |
76 | function after_modify()
77 | {
78 | chmod 0444 ${C0_GOVERNOR_DIR}/*
79 | verify_param
80 | }
81 |
82 | function powersave_custom()
83 | {
84 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
85 | }
86 |
87 | function balance_custom()
88 | {
89 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
90 | }
91 |
92 | function performance_custom()
93 | {
94 | lock_value "0:980000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function fast_custom()
98 | {
99 | :
100 | }
101 |
102 |
103 |
104 | # $1:value $2:file path
105 | function set_value()
106 | {
107 | if [ -f $2 ]; then
108 | echo $1 > $2
109 | fi
110 | }
111 |
112 | # $1:value $2:file path
113 | function lock_value()
114 | {
115 | if [ -f $2 ]; then
116 | # chown 0.0 $2
117 | chmod 0666 $2
118 | echo $1 > $2
119 | chmod 0444 $2
120 | fi
121 | }
122 |
123 | # $1:io-scheduler $2:block-path
124 | function set_io()
125 | {
126 | if [ -f $2/queue/scheduler ]; then
127 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
128 | echo $1 > $2/queue/scheduler
129 | echo 512 > $2/queue/read_ahead_kb
130 | lock_value 0 $2/queue/iostats
131 | lock_value 256 $2/queue/nr_requests
132 | lock_value 0 $2/queue/iosched/slice_idle
133 | fi
134 | fi
135 | }
136 |
137 | # $1:display-name $2:file path
138 | function print_value()
139 | {
140 | if [ -f $2 ]; then
141 | echo $1
142 | cat $2
143 | fi
144 | }
145 |
146 | function verify_param()
147 | {
148 | expected_target=${C0_GOVERNOR_DIR}/target_loads
149 | if [ "$action" = "powersave" ]; then
150 | expected_value="80 980000:66 1380000:96"
151 | elif [ "$action" = "balance" ]; then
152 | expected_value="80 980000:63 1380000:72 1680000:97"
153 | elif [ "$action" = "performance" ]; then
154 | expected_value="80 980000:55 1380000:75 1680000:98"
155 | elif [ "$action" = "fast" ]; then
156 | expected_value="80 1980000:90"
157 | fi
158 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
159 | echo "${action} OK"
160 | else
161 | echo "${action} FAIL"
162 | fi
163 | }
164 |
165 | action=$1
166 | if [ ! -n "$action" ]; then
167 | action="balance"
168 | fi
169 |
170 | if [ "$action" = "debug" ]; then
171 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
172 | echo "Author: yc9559"
173 | echo "Platform: sd_625_626"
174 | echo "Generated at: Thu Jun 28 01:59:58 2018"
175 | echo ""
176 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
177 | print_param above_hispeed_delay
178 | print_param target_loads
179 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
180 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
181 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
182 | which perfd
183 | exit 0
184 | fi
185 |
186 | if [ ! -f /dev/.project_wipe ]; then
187 | unify_environment
188 | fi
189 |
190 | before_modify
191 |
192 | # RunOnce
193 | if [ ! -f /dev/.project_wipe ]; then
194 | # set flag
195 | touch /dev/.project_wipe
196 |
197 | runonce_custom
198 |
199 | set_io cfq /sys/block/mmcblk0
200 | set_io cfq /sys/block/sda
201 |
202 | # shared interactive parameters
203 | set_param_little timer_rate 20000
204 | set_param_little timer_slack 180000
205 | set_param_little boost 0
206 | set_param_little boostpulse_duration 0
207 | set_param_big timer_rate 20000
208 | set_param_big timer_slack 180000
209 | set_param_big boost 0
210 | set_param_big boostpulse_duration 0
211 | fi
212 |
213 | if [ "$action" = "powersave" ]; then
214 | powersave_custom
215 | set_param_little above_hispeed_delay "18000 1680000:98000 1880000:138000"
216 | set_param_little hispeed_freq 1380000
217 | set_param_little go_hispeed_load 94
218 | set_param_little target_loads "80 980000:66 1380000:96"
219 | set_param_little min_sample_time 18000
220 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
221 | set_param_big hispeed_freq 1380000
222 | set_param_big go_hispeed_load 94
223 | set_param_big target_loads "80 980000:66 1380000:96"
224 | set_param_big min_sample_time 18000
225 | fi
226 |
227 | if [ "$action" = "balance" ]; then
228 | balance_custom
229 | set_param_little above_hispeed_delay "98000 1880000:138000"
230 | set_param_little hispeed_freq 1680000
231 | set_param_little go_hispeed_load 97
232 | set_param_little target_loads "80 980000:63 1380000:72 1680000:97"
233 | set_param_little min_sample_time 18000
234 | set_param_big above_hispeed_delay "98000 1880000:138000"
235 | set_param_big hispeed_freq 1680000
236 | set_param_big go_hispeed_load 97
237 | set_param_big target_loads "80 980000:63 1380000:72 1680000:97"
238 | set_param_big min_sample_time 18000
239 | fi
240 |
241 | if [ "$action" = "performance" ]; then
242 | performance_custom
243 | set_param_little above_hispeed_delay "18000 1680000:98000 1880000:38000"
244 | set_param_little hispeed_freq 980000
245 | set_param_little go_hispeed_load 89
246 | set_param_little target_loads "80 980000:55 1380000:75 1680000:98"
247 | set_param_little min_sample_time 78000
248 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:38000"
249 | set_param_big hispeed_freq 980000
250 | set_param_big go_hispeed_load 89
251 | set_param_big target_loads "80 980000:55 1380000:75 1680000:98"
252 | set_param_big min_sample_time 78000
253 | fi
254 |
255 | if [ "$action" = "fast" ]; then
256 | fast_custom
257 | lock_value 1380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
258 | set_param_little above_hispeed_delay "18000 1880000:198000"
259 | set_param_little hispeed_freq 1380000
260 | set_param_little target_loads "80 1980000:90"
261 | set_param_little min_sample_time 38000
262 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
263 | set_param_big above_hispeed_delay "18000 1880000:198000"
264 | set_param_big hispeed_freq 1380000
265 | set_param_big target_loads "80 1980000:90"
266 | set_param_big min_sample_time 38000
267 | fi
268 |
269 | after_modify
270 |
271 | exit 0
272 |
--------------------------------------------------------------------------------
/platforms/sd_636/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_636
5 | # Generated at: Thu Jun 28 03:15:54 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
58 |
59 | # set_value 85 /proc/sys/kernel/sched_downmigrate
60 | # set_value 95 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
63 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
64 |
65 | set_param_little use_sched_load 1
66 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
67 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
68 | set_param_big use_sched_load 1
69 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
70 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
71 | }
72 |
73 | function before_modify()
74 | {
75 | chown 0.0 ${C0_GOVERNOR_DIR}/*
76 | chmod 0666 ${C0_GOVERNOR_DIR}/*
77 | lock_value 580000 ${C0_CPUFREQ_DIR}/scaling_min_freq
78 |
79 | set_value 1 /sys/devices/system/cpu/cpu4/online
80 | chown 0.0 ${C1_GOVERNOR_DIR}/*
81 | chmod 0666 ${C1_GOVERNOR_DIR}/*
82 | lock_value 1080000 ${C1_CPUFREQ_DIR}/scaling_min_freq
83 | }
84 |
85 | function after_modify()
86 | {
87 | chmod 0444 ${C0_GOVERNOR_DIR}/*
88 | chmod 0444 ${C1_GOVERNOR_DIR}/*
89 | verify_param
90 | }
91 |
92 | function powersave_custom()
93 | {
94 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function balance_custom()
98 | {
99 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
100 | }
101 |
102 | function performance_custom()
103 | {
104 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
105 | }
106 |
107 | function fast_custom()
108 | {
109 | :
110 | }
111 |
112 |
113 |
114 | # $1:value $2:file path
115 | function set_value()
116 | {
117 | if [ -f $2 ]; then
118 | echo $1 > $2
119 | fi
120 | }
121 |
122 | # $1:value $2:file path
123 | function lock_value()
124 | {
125 | if [ -f $2 ]; then
126 | # chown 0.0 $2
127 | chmod 0666 $2
128 | echo $1 > $2
129 | chmod 0444 $2
130 | fi
131 | }
132 |
133 | # $1:io-scheduler $2:block-path
134 | function set_io()
135 | {
136 | if [ -f $2/queue/scheduler ]; then
137 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
138 | echo $1 > $2/queue/scheduler
139 | echo 512 > $2/queue/read_ahead_kb
140 | lock_value 0 $2/queue/iostats
141 | lock_value 256 $2/queue/nr_requests
142 | lock_value 0 $2/queue/iosched/slice_idle
143 | fi
144 | fi
145 | }
146 |
147 | # $1:display-name $2:file path
148 | function print_value()
149 | {
150 | if [ -f $2 ]; then
151 | echo $1
152 | cat $2
153 | fi
154 | }
155 |
156 | function verify_param()
157 | {
158 | expected_target=${C0_GOVERNOR_DIR}/target_loads
159 | if [ "$action" = "powersave" ]; then
160 | expected_value="80 880000:62 1080000:98 1380000:84 1480000:97"
161 | elif [ "$action" = "balance" ]; then
162 | expected_value="80 880000:62 1080000:94 1380000:75 1480000:96"
163 | elif [ "$action" = "performance" ]; then
164 | expected_value="80 880000:59 1080000:77 1380000:52 1480000:98 1580000:94"
165 | elif [ "$action" = "fast" ]; then
166 | expected_value="80 1580000:90"
167 | fi
168 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
169 | echo "${action} OK"
170 | else
171 | echo "${action} FAIL"
172 | fi
173 | }
174 |
175 | action=$1
176 | if [ ! -n "$action" ]; then
177 | action="balance"
178 | fi
179 |
180 | if [ "$action" = "debug" ]; then
181 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
182 | echo "Author: yc9559"
183 | echo "Platform: sd_636"
184 | echo "Generated at: Thu Jun 28 03:15:54 2018"
185 | echo ""
186 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
187 | print_param above_hispeed_delay
188 | print_param target_loads
189 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
190 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
191 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
192 | which perfd
193 | exit 0
194 | fi
195 |
196 | if [ ! -f /dev/.project_wipe ]; then
197 | unify_environment
198 | fi
199 |
200 | before_modify
201 |
202 | # RunOnce
203 | if [ ! -f /dev/.project_wipe ]; then
204 | # set flag
205 | touch /dev/.project_wipe
206 |
207 | runonce_custom
208 |
209 | set_io cfq /sys/block/mmcblk0
210 | set_io cfq /sys/block/sda
211 |
212 | # shared interactive parameters
213 | set_param_little timer_rate 20000
214 | set_param_little timer_slack 180000
215 | set_param_little boost 0
216 | set_param_little boostpulse_duration 0
217 | set_param_big timer_rate 20000
218 | set_param_big timer_slack 180000
219 | set_param_big boost 0
220 | set_param_big boostpulse_duration 0
221 | fi
222 |
223 | if [ "$action" = "powersave" ]; then
224 | powersave_custom
225 | set_param_little above_hispeed_delay "18000 1380000:78000 1480000:98000 1580000:38000"
226 | set_param_little hispeed_freq 1080000
227 | set_param_little go_hispeed_load 98
228 | set_param_little target_loads "80 880000:62 1080000:98 1380000:84 1480000:97"
229 | set_param_little min_sample_time 58000
230 | set_param_big above_hispeed_delay "18000 1680000:98000"
231 | set_param_big hispeed_freq 1080000
232 | set_param_big go_hispeed_load 86
233 | set_param_big target_loads "80 1380000:84 1680000:98"
234 | set_param_big min_sample_time 18000
235 | fi
236 |
237 | if [ "$action" = "balance" ]; then
238 | balance_custom
239 | set_param_little above_hispeed_delay "18000 1380000:78000 1480000:98000 1580000:78000"
240 | set_param_little hispeed_freq 1080000
241 | set_param_little go_hispeed_load 98
242 | set_param_little target_loads "80 880000:62 1080000:94 1380000:75 1480000:96"
243 | set_param_little min_sample_time 58000
244 | set_param_big above_hispeed_delay "18000 1680000:98000"
245 | set_param_big hispeed_freq 1080000
246 | set_param_big go_hispeed_load 81
247 | set_param_big target_loads "80 1380000:70 1680000:98"
248 | set_param_big min_sample_time 18000
249 | fi
250 |
251 | if [ "$action" = "performance" ]; then
252 | performance_custom
253 | set_param_little above_hispeed_delay "18000 1380000:98000 1480000:38000"
254 | set_param_little hispeed_freq 880000
255 | set_param_little go_hispeed_load 85
256 | set_param_little target_loads "80 880000:59 1080000:77 1380000:52 1480000:98 1580000:94"
257 | set_param_little min_sample_time 78000
258 | set_param_big above_hispeed_delay "18000 1380000:78000 1680000:38000"
259 | set_param_big hispeed_freq 1080000
260 | set_param_big go_hispeed_load 89
261 | set_param_big target_loads "80 1380000:64 1680000:98"
262 | set_param_big min_sample_time 78000
263 | fi
264 |
265 | if [ "$action" = "fast" ]; then
266 | fast_custom
267 | lock_value 1080000 ${C0_CPUFREQ_DIR}/scaling_min_freq
268 | set_param_little above_hispeed_delay "18000 1480000:198000"
269 | set_param_little hispeed_freq 1080000
270 | set_param_little target_loads "80 1580000:90"
271 | set_param_little min_sample_time 38000
272 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
273 | set_param_big above_hispeed_delay "18000 1680000:198000"
274 | set_param_big hispeed_freq 1380000
275 | set_param_big target_loads "80 1780000:90"
276 | set_param_big min_sample_time 38000
277 | fi
278 |
279 | after_modify
280 |
281 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_652_650/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_652_650
5 | # Generated at: Thu Jun 28 01:29:15 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
58 |
59 | # set_value 85 /proc/sys/kernel/sched_downmigrate
60 | # set_value 95 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
63 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
64 |
65 | set_param_little use_sched_load 1
66 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
67 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
68 | set_param_big use_sched_load 1
69 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
70 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
71 | }
72 |
73 | function before_modify()
74 | {
75 | chown 0.0 ${C0_GOVERNOR_DIR}/*
76 | chmod 0666 ${C0_GOVERNOR_DIR}/*
77 | lock_value 380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
78 |
79 | set_value 1 /sys/devices/system/cpu/cpu4/online
80 | chown 0.0 ${C1_GOVERNOR_DIR}/*
81 | chmod 0666 ${C1_GOVERNOR_DIR}/*
82 | lock_value 380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
83 | }
84 |
85 | function after_modify()
86 | {
87 | chmod 0444 ${C0_GOVERNOR_DIR}/*
88 | chmod 0444 ${C1_GOVERNOR_DIR}/*
89 | verify_param
90 | }
91 |
92 | function powersave_custom()
93 | {
94 | lock_value "0:680000 4:880000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function balance_custom()
98 | {
99 | lock_value "0:680000 4:880000" /sys/module/cpu_boost/parameters/input_boost_freq
100 | }
101 |
102 | function performance_custom()
103 | {
104 | lock_value "0:680000 4:880000" /sys/module/cpu_boost/parameters/input_boost_freq
105 | }
106 |
107 | function fast_custom()
108 | {
109 | :
110 | }
111 |
112 |
113 |
114 | # $1:value $2:file path
115 | function set_value()
116 | {
117 | if [ -f $2 ]; then
118 | echo $1 > $2
119 | fi
120 | }
121 |
122 | # $1:value $2:file path
123 | function lock_value()
124 | {
125 | if [ -f $2 ]; then
126 | # chown 0.0 $2
127 | chmod 0666 $2
128 | echo $1 > $2
129 | chmod 0444 $2
130 | fi
131 | }
132 |
133 | # $1:io-scheduler $2:block-path
134 | function set_io()
135 | {
136 | if [ -f $2/queue/scheduler ]; then
137 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
138 | echo $1 > $2/queue/scheduler
139 | echo 512 > $2/queue/read_ahead_kb
140 | lock_value 0 $2/queue/iostats
141 | lock_value 256 $2/queue/nr_requests
142 | lock_value 0 $2/queue/iosched/slice_idle
143 | fi
144 | fi
145 | }
146 |
147 | # $1:display-name $2:file path
148 | function print_value()
149 | {
150 | if [ -f $2 ]; then
151 | echo $1
152 | cat $2
153 | fi
154 | }
155 |
156 | function verify_param()
157 | {
158 | expected_target=${C0_GOVERNOR_DIR}/target_loads
159 | if [ "$action" = "powersave" ]; then
160 | expected_value="80 680000:58 980000:68 1280000:97"
161 | elif [ "$action" = "balance" ]; then
162 | expected_value="80 680000:68 780000:60 980000:97 1180000:63 1280000:97 1380000:84"
163 | elif [ "$action" = "performance" ]; then
164 | expected_value="80 680000:90 780000:57 980000:61 1180000:96 1380000:7"
165 | elif [ "$action" = "fast" ]; then
166 | expected_value="80 1380000:90"
167 | fi
168 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
169 | echo "${action} OK"
170 | else
171 | echo "${action} FAIL"
172 | fi
173 | }
174 |
175 | action=$1
176 | if [ ! -n "$action" ]; then
177 | action="balance"
178 | fi
179 |
180 | if [ "$action" = "debug" ]; then
181 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
182 | echo "Author: yc9559"
183 | echo "Platform: sd_652_650"
184 | echo "Generated at: Thu Jun 28 01:29:15 2018"
185 | echo ""
186 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
187 | print_param above_hispeed_delay
188 | print_param target_loads
189 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
190 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
191 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
192 | which perfd
193 | exit 0
194 | fi
195 |
196 | if [ ! -f /dev/.project_wipe ]; then
197 | unify_environment
198 | fi
199 |
200 | before_modify
201 |
202 | # RunOnce
203 | if [ ! -f /dev/.project_wipe ]; then
204 | # set flag
205 | touch /dev/.project_wipe
206 |
207 | runonce_custom
208 |
209 | set_io cfq /sys/block/mmcblk0
210 | set_io cfq /sys/block/sda
211 |
212 | # shared interactive parameters
213 | set_param_little timer_rate 20000
214 | set_param_little timer_slack 180000
215 | set_param_little boost 0
216 | set_param_little boostpulse_duration 0
217 | set_param_big timer_rate 20000
218 | set_param_big timer_slack 180000
219 | set_param_big boost 0
220 | set_param_big boostpulse_duration 0
221 | fi
222 |
223 | if [ "$action" = "powersave" ]; then
224 | powersave_custom
225 | set_param_little above_hispeed_delay "98000 1380000:78000"
226 | set_param_little hispeed_freq 1180000
227 | set_param_little go_hispeed_load 95
228 | set_param_little target_loads "80 680000:58 980000:68 1280000:97"
229 | set_param_little min_sample_time 18000
230 | set_param_big above_hispeed_delay "18000 1280000:38000 1380000:18000 1580000:98000"
231 | set_param_big hispeed_freq 1080000
232 | set_param_big go_hispeed_load 98
233 | set_param_big target_loads "80 880000:51 980000:69 1080000:90 1280000:72 1380000:94 1580000:98"
234 | set_param_big min_sample_time 18000
235 | fi
236 |
237 | if [ "$action" = "balance" ]; then
238 | balance_custom
239 | set_param_little above_hispeed_delay "98000 1380000:58000"
240 | set_param_little hispeed_freq 1180000
241 | set_param_little go_hispeed_load 97
242 | set_param_little target_loads "80 680000:68 780000:60 980000:97 1180000:63 1280000:97 1380000:84"
243 | set_param_little min_sample_time 58000
244 | set_param_big above_hispeed_delay "18000 1580000:98000"
245 | set_param_big hispeed_freq 1280000
246 | set_param_big go_hispeed_load 98
247 | set_param_big target_loads "80 880000:47 980000:68 1280000:74 1380000:92 1580000:98"
248 | set_param_big min_sample_time 18000
249 | fi
250 |
251 | if [ "$action" = "performance" ]; then
252 | performance_custom
253 | set_param_little above_hispeed_delay "98000 1280000:38000 1380000:78000"
254 | set_param_little hispeed_freq 1180000
255 | set_param_little go_hispeed_load 96
256 | set_param_little target_loads "80 680000:90 780000:57 980000:61 1180000:96 1380000:7"
257 | set_param_little min_sample_time 78000
258 | set_param_big above_hispeed_delay "98000 1680000:38000"
259 | set_param_big hispeed_freq 1580000
260 | set_param_big go_hispeed_load 98
261 | set_param_big target_loads "80 880000:47 1080000:52 1180000:63 1280000:71 1380000:76 1580000:98"
262 | set_param_big min_sample_time 18000
263 | fi
264 |
265 | if [ "$action" = "fast" ]; then
266 | fast_custom
267 | lock_value 1180000 ${C0_CPUFREQ_DIR}/scaling_min_freq
268 | set_param_little above_hispeed_delay "18000 1280000:198000"
269 | set_param_little hispeed_freq 1180000
270 | set_param_little target_loads "80 1380000:90"
271 | set_param_little min_sample_time 38000
272 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
273 | set_param_big above_hispeed_delay "18000 1680000:198000"
274 | set_param_big hispeed_freq 1380000
275 | set_param_big target_loads "80 1780000:90"
276 | set_param_big min_sample_time 38000
277 | fi
278 |
279 | after_modify
280 |
281 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_660/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_660
5 | # Generated at: Thu Jun 28 02:52:22 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
58 |
59 | # set_value 85 /proc/sys/kernel/sched_downmigrate
60 | # set_value 95 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
63 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
64 |
65 | set_param_little use_sched_load 1
66 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
67 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
68 | set_param_big use_sched_load 1
69 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
70 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
71 | }
72 |
73 | function before_modify()
74 | {
75 | chown 0.0 ${C0_GOVERNOR_DIR}/*
76 | chmod 0666 ${C0_GOVERNOR_DIR}/*
77 | lock_value 580000 ${C0_CPUFREQ_DIR}/scaling_min_freq
78 |
79 | set_value 1 /sys/devices/system/cpu/cpu4/online
80 | chown 0.0 ${C1_GOVERNOR_DIR}/*
81 | chmod 0666 ${C1_GOVERNOR_DIR}/*
82 | lock_value 1080000 ${C1_CPUFREQ_DIR}/scaling_min_freq
83 | }
84 |
85 | function after_modify()
86 | {
87 | chmod 0444 ${C0_GOVERNOR_DIR}/*
88 | chmod 0444 ${C1_GOVERNOR_DIR}/*
89 | verify_param
90 | }
91 |
92 | function powersave_custom()
93 | {
94 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function balance_custom()
98 | {
99 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
100 | }
101 |
102 | function performance_custom()
103 | {
104 | lock_value "0:880000 4:1380000" /sys/module/cpu_boost/parameters/input_boost_freq
105 | }
106 |
107 | function fast_custom()
108 | {
109 | :
110 | }
111 |
112 |
113 |
114 | # $1:value $2:file path
115 | function set_value()
116 | {
117 | if [ -f $2 ]; then
118 | echo $1 > $2
119 | fi
120 | }
121 |
122 | # $1:value $2:file path
123 | function lock_value()
124 | {
125 | if [ -f $2 ]; then
126 | # chown 0.0 $2
127 | chmod 0666 $2
128 | echo $1 > $2
129 | chmod 0444 $2
130 | fi
131 | }
132 |
133 | # $1:io-scheduler $2:block-path
134 | function set_io()
135 | {
136 | if [ -f $2/queue/scheduler ]; then
137 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
138 | echo $1 > $2/queue/scheduler
139 | echo 512 > $2/queue/read_ahead_kb
140 | lock_value 0 $2/queue/iostats
141 | lock_value 256 $2/queue/nr_requests
142 | lock_value 0 $2/queue/iosched/slice_idle
143 | fi
144 | fi
145 | }
146 |
147 | # $1:display-name $2:file path
148 | function print_value()
149 | {
150 | if [ -f $2 ]; then
151 | echo $1
152 | cat $2
153 | fi
154 | }
155 |
156 | function verify_param()
157 | {
158 | expected_target=${C0_GOVERNOR_DIR}/target_loads
159 | if [ "$action" = "powersave" ]; then
160 | expected_value="80 880000:45 1080000:64 1480000:98"
161 | elif [ "$action" = "balance" ]; then
162 | expected_value="80 880000:59 1080000:90 1380000:78 1480000:98"
163 | elif [ "$action" = "performance" ]; then
164 | expected_value="80 880000:60 1080000:80 1380000:54 1480000:98"
165 | elif [ "$action" = "fast" ]; then
166 | expected_value="80 1780000:90"
167 | fi
168 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
169 | echo "${action} OK"
170 | else
171 | echo "${action} FAIL"
172 | fi
173 | }
174 |
175 | action=$1
176 | if [ ! -n "$action" ]; then
177 | action="balance"
178 | fi
179 |
180 | if [ "$action" = "debug" ]; then
181 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
182 | echo "Author: yc9559"
183 | echo "Platform: sd_660"
184 | echo "Generated at: Thu Jun 28 02:52:22 2018"
185 | echo ""
186 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
187 | print_param above_hispeed_delay
188 | print_param target_loads
189 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
190 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
191 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
192 | which perfd
193 | exit 0
194 | fi
195 |
196 | if [ ! -f /dev/.project_wipe ]; then
197 | unify_environment
198 | fi
199 |
200 | before_modify
201 |
202 | # RunOnce
203 | if [ ! -f /dev/.project_wipe ]; then
204 | # set flag
205 | touch /dev/.project_wipe
206 |
207 | runonce_custom
208 |
209 | set_io cfq /sys/block/mmcblk0
210 | set_io cfq /sys/block/sda
211 |
212 | # shared interactive parameters
213 | set_param_little timer_rate 20000
214 | set_param_little timer_slack 180000
215 | set_param_little boost 0
216 | set_param_little boostpulse_duration 0
217 | set_param_big timer_rate 20000
218 | set_param_big timer_slack 180000
219 | set_param_big boost 0
220 | set_param_big boostpulse_duration 0
221 | fi
222 |
223 | if [ "$action" = "powersave" ]; then
224 | powersave_custom
225 | set_param_little above_hispeed_delay "38000 1380000:98000"
226 | set_param_little hispeed_freq 1080000
227 | set_param_little go_hispeed_load 98
228 | set_param_little target_loads "80 880000:45 1080000:64 1480000:98"
229 | set_param_little min_sample_time 18000
230 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
231 | set_param_big hispeed_freq 1080000
232 | set_param_big go_hispeed_load 98
233 | set_param_big target_loads "80 1680000:98"
234 | set_param_big min_sample_time 18000
235 | fi
236 |
237 | if [ "$action" = "balance" ]; then
238 | balance_custom
239 | set_param_little above_hispeed_delay "98000"
240 | set_param_little hispeed_freq 1480000
241 | set_param_little go_hispeed_load 98
242 | set_param_little target_loads "80 880000:59 1080000:90 1380000:78 1480000:98"
243 | set_param_little min_sample_time 38000
244 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
245 | set_param_big hispeed_freq 1080000
246 | set_param_big go_hispeed_load 83
247 | set_param_big target_loads "80 1380000:70 1680000:98"
248 | set_param_big min_sample_time 18000
249 | fi
250 |
251 | if [ "$action" = "performance" ]; then
252 | performance_custom
253 | set_param_little above_hispeed_delay "18000 1380000:98000 1680000:38000"
254 | set_param_little hispeed_freq 880000
255 | set_param_little go_hispeed_load 89
256 | set_param_little target_loads "80 880000:60 1080000:80 1380000:54 1480000:98"
257 | set_param_little min_sample_time 78000
258 | set_param_big above_hispeed_delay "18000 1380000:78000 1680000:98000 1880000:38000"
259 | set_param_big hispeed_freq 1080000
260 | set_param_big go_hispeed_load 98
261 | set_param_big target_loads "80 1380000:65 1680000:98"
262 | set_param_big min_sample_time 78000
263 | fi
264 |
265 | if [ "$action" = "fast" ]; then
266 | fast_custom
267 | lock_value 1080000 ${C0_CPUFREQ_DIR}/scaling_min_freq
268 | set_param_little above_hispeed_delay "18000 1680000:198000"
269 | set_param_little hispeed_freq 1080000
270 | set_param_little target_loads "80 1780000:90"
271 | set_param_little min_sample_time 38000
272 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
273 | set_param_big above_hispeed_delay "18000 1880000:198000"
274 | set_param_big hispeed_freq 1380000
275 | set_param_big target_loads "80 1980000:90"
276 | set_param_big min_sample_time 38000
277 | fi
278 |
279 | after_modify
280 |
281 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_801_800_805/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_801_800_805
5 | # Generated at: Thu Jun 28 03:43:49 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpufreq/interactive"
8 | C1_GOVERNOR_DIR=""
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR=""
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | :
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "${1}" ${C0_GOVERNOR_DIR}/${1}
28 | }
29 |
30 | function unify_environment()
31 | {
32 | # SELinux permissive
33 | setenforce 0
34 | # disable hotplug to switch governor
35 | set_value 0 /sys/module/msm_thermal/core_control/enabled
36 | set_value N /sys/module/msm_thermal/parameters/enabled
37 | # in case of using ondemand as default governor
38 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
39 | }
40 |
41 | function runonce_custom()
42 | {
43 | setprop ro.qualcomm.perf.cores_online 2
44 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
45 | }
46 |
47 | function before_modify()
48 | {
49 | stop mpdecision
50 | chown 0.0 ${C0_GOVERNOR_DIR}/*
51 | chmod 0666 ${C0_GOVERNOR_DIR}/*
52 | set_value 1 /sys/devices/system/cpu/cpu0/online
53 | set_value 1 /sys/devices/system/cpu/cpu1/online
54 | set_value 1 /sys/devices/system/cpu/cpu2/online
55 | set_value 1 /sys/devices/system/cpu/cpu3/online
56 | lock_value 280000 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
57 | lock_value 280000 /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
58 | lock_value 280000 /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq
59 | lock_value 280000 /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq
60 | }
61 |
62 | function after_modify()
63 | {
64 | chmod 0444 ${C0_GOVERNOR_DIR}/*
65 | start mpdecision
66 | verify_param
67 | }
68 |
69 | function powersave_custom()
70 | {
71 | lock_value "380000" /sys/module/cpu_boost/parameters/input_boost_freq
72 | }
73 |
74 | function balance_custom()
75 | {
76 | lock_value "380000" /sys/module/cpu_boost/parameters/input_boost_freq
77 | }
78 |
79 | function performance_custom()
80 | {
81 | lock_value "380000" /sys/module/cpu_boost/parameters/input_boost_freq
82 | }
83 |
84 | function fast_custom()
85 | {
86 | :
87 | }
88 |
89 |
90 |
91 | # $1:value $2:file path
92 | function set_value()
93 | {
94 | if [ -f $2 ]; then
95 | echo $1 > $2
96 | fi
97 | }
98 |
99 | # $1:value $2:file path
100 | function lock_value()
101 | {
102 | if [ -f $2 ]; then
103 | # chown 0.0 $2
104 | chmod 0666 $2
105 | echo $1 > $2
106 | chmod 0444 $2
107 | fi
108 | }
109 |
110 | # $1:io-scheduler $2:block-path
111 | function set_io()
112 | {
113 | if [ -f $2/queue/scheduler ]; then
114 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
115 | echo $1 > $2/queue/scheduler
116 | echo 512 > $2/queue/read_ahead_kb
117 | lock_value 0 $2/queue/iostats
118 | lock_value 256 $2/queue/nr_requests
119 | lock_value 0 $2/queue/iosched/slice_idle
120 | fi
121 | fi
122 | }
123 |
124 | # $1:display-name $2:file path
125 | function print_value()
126 | {
127 | if [ -f $2 ]; then
128 | echo $1
129 | cat $2
130 | fi
131 | }
132 |
133 | function verify_param()
134 | {
135 | expected_target=${C0_GOVERNOR_DIR}/target_loads
136 | if [ "$action" = "powersave" ]; then
137 | expected_value="80 380000:6 580000:25 680000:43 880000:61 980000:86 1180000:97"
138 | elif [ "$action" = "balance" ]; then
139 | expected_value="80 380000:32 580000:47 680000:82 880000:32 980000:39 1180000:83 1480000:79 1680000:98"
140 | elif [ "$action" = "performance" ]; then
141 | expected_value="80 380000:32 580000:45 680000:81 880000:63 980000:47 1180000:89 1480000:79 1680000:98"
142 | elif [ "$action" = "fast" ]; then
143 | expected_value="80 1980000:90"
144 | fi
145 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
146 | echo "${action} OK"
147 | else
148 | echo "${action} FAIL"
149 | fi
150 | }
151 |
152 | action=$1
153 | if [ ! -n "$action" ]; then
154 | action="balance"
155 | fi
156 |
157 | if [ "$action" = "debug" ]; then
158 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
159 | echo "Author: yc9559"
160 | echo "Platform: sd_801_800_805"
161 | echo "Generated at: Thu Jun 28 03:43:49 2018"
162 | echo ""
163 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
164 | print_param above_hispeed_delay
165 | print_param target_loads
166 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
167 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
168 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
169 | which perfd
170 | exit 0
171 | fi
172 |
173 | if [ ! -f /dev/.project_wipe ]; then
174 | unify_environment
175 | fi
176 |
177 | before_modify
178 |
179 | # RunOnce
180 | if [ ! -f /dev/.project_wipe ]; then
181 | # set flag
182 | touch /dev/.project_wipe
183 |
184 | runonce_custom
185 |
186 | set_io cfq /sys/block/mmcblk0
187 | set_io cfq /sys/block/sda
188 |
189 | # shared interactive parameters
190 | set_param_little timer_rate 20000
191 | set_param_little timer_slack 180000
192 | set_param_little boost 0
193 | set_param_little boostpulse_duration 0
194 | set_param_big timer_rate 20000
195 | set_param_big timer_slack 180000
196 | set_param_big boost 0
197 | set_param_big boostpulse_duration 0
198 | fi
199 |
200 | if [ "$action" = "powersave" ]; then
201 | powersave_custom
202 | set_param_little above_hispeed_delay "18000 1680000:98000 1880000:138000"
203 | set_param_little hispeed_freq 1180000
204 | set_param_little go_hispeed_load 97
205 | set_param_little target_loads "80 380000:6 580000:25 680000:43 880000:61 980000:86 1180000:97"
206 | set_param_little min_sample_time 18000
207 | set_param_big above_hispeed_delay "18000 1680000:98000 1880000:138000"
208 | set_param_big hispeed_freq 1180000
209 | set_param_big go_hispeed_load 97
210 | set_param_big target_loads "80 380000:6 580000:25 680000:43 880000:61 980000:86 1180000:97"
211 | set_param_big min_sample_time 18000
212 | fi
213 |
214 | if [ "$action" = "balance" ]; then
215 | balance_custom
216 | set_param_little above_hispeed_delay "38000 1480000:78000 1680000:98000 1880000:138000"
217 | set_param_little hispeed_freq 1180000
218 | set_param_little go_hispeed_load 97
219 | set_param_little target_loads "80 380000:32 580000:47 680000:82 880000:32 980000:39 1180000:83 1480000:79 1680000:98"
220 | set_param_little min_sample_time 18000
221 | set_param_big above_hispeed_delay "38000 1480000:78000 1680000:98000 1880000:138000"
222 | set_param_big hispeed_freq 1180000
223 | set_param_big go_hispeed_load 97
224 | set_param_big target_loads "80 380000:32 580000:47 680000:82 880000:32 980000:39 1180000:83 1480000:79 1680000:98"
225 | set_param_big min_sample_time 18000
226 | fi
227 |
228 | if [ "$action" = "performance" ]; then
229 | performance_custom
230 | set_param_little above_hispeed_delay "18000 1480000:98000 1880000:38000"
231 | set_param_little hispeed_freq 1180000
232 | set_param_little go_hispeed_load 97
233 | set_param_little target_loads "80 380000:32 580000:45 680000:81 880000:63 980000:47 1180000:89 1480000:79 1680000:98"
234 | set_param_little min_sample_time 38000
235 | set_param_big above_hispeed_delay "18000 1480000:98000 1880000:38000"
236 | set_param_big hispeed_freq 1180000
237 | set_param_big go_hispeed_load 97
238 | set_param_big target_loads "80 380000:32 580000:45 680000:81 880000:63 980000:47 1180000:89 1480000:79 1680000:98"
239 | set_param_big min_sample_time 38000
240 | fi
241 |
242 | if [ "$action" = "fast" ]; then
243 | fast_custom
244 | lock_value 1480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
245 | set_param_little above_hispeed_delay "18000 1880000:198000"
246 | set_param_little hispeed_freq 1480000
247 | set_param_little target_loads "80 1980000:90"
248 | set_param_little min_sample_time 38000
249 | lock_value 1480000 ${C1_CPUFREQ_DIR}/scaling_min_freq
250 | set_param_big above_hispeed_delay "18000 1880000:198000"
251 | set_param_big hispeed_freq 1480000
252 | set_param_big target_loads "80 1980000:90"
253 | set_param_big min_sample_time 38000
254 | fi
255 |
256 | after_modify
257 |
258 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_810_808/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_810_808
5 | # Generated at: Sat Jul 14 16:45:37 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 1 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-5 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-5 /dev/cpuset/top-app/cpus
58 |
59 | set_value 85 /proc/sys/kernel/sched_downmigrate
60 | set_value 99 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 0 /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
63 | lock_value 2 /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
64 |
65 | lock_value "0:1344000 4:1440000" /sys/module/msm_performance/parameters/cpu_max_freq
66 | lock_value 1344000 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
67 | lock_value 1440000 /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq
68 |
69 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
70 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
71 |
72 | set_param_little use_sched_load 1
73 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
74 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
75 | set_param_big use_sched_load 1
76 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
77 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
78 | }
79 |
80 | function before_modify()
81 | {
82 | chown 0.0 ${C0_GOVERNOR_DIR}/*
83 | chmod 0666 ${C0_GOVERNOR_DIR}/*
84 | lock_value 380000 ${C0_CPUFREQ_DIR}/scaling_min_freq
85 |
86 | set_value 1 /sys/devices/system/cpu/cpu4/online
87 | chown 0.0 ${C1_GOVERNOR_DIR}/*
88 | chmod 0666 ${C1_GOVERNOR_DIR}/*
89 | lock_value 380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
90 | }
91 |
92 | function after_modify()
93 | {
94 | chmod 0444 ${C0_GOVERNOR_DIR}/*
95 | chmod 0444 ${C1_GOVERNOR_DIR}/*
96 | verify_param
97 | }
98 |
99 | function powersave_custom()
100 | {
101 | lock_value "0:580000 4:480000" /sys/module/cpu_boost/parameters/input_boost_freq
102 | }
103 |
104 | function balance_custom()
105 | {
106 | lock_value "0:580000 4:480000" /sys/module/cpu_boost/parameters/input_boost_freq
107 | }
108 |
109 | function performance_custom()
110 | {
111 | lock_value "0:580000 4:480000" /sys/module/cpu_boost/parameters/input_boost_freq
112 | }
113 |
114 | function fast_custom()
115 | {
116 | :
117 | }
118 |
119 |
120 |
121 | # $1:value $2:file path
122 | function set_value()
123 | {
124 | if [ -f $2 ]; then
125 | echo $1 > $2
126 | fi
127 | }
128 |
129 | # $1:value $2:file path
130 | function lock_value()
131 | {
132 | if [ -f $2 ]; then
133 | # chown 0.0 $2
134 | chmod 0666 $2
135 | echo $1 > $2
136 | chmod 0444 $2
137 | fi
138 | }
139 |
140 | # $1:io-scheduler $2:block-path
141 | function set_io()
142 | {
143 | if [ -f $2/queue/scheduler ]; then
144 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
145 | echo $1 > $2/queue/scheduler
146 | echo 512 > $2/queue/read_ahead_kb
147 | lock_value 0 $2/queue/iostats
148 | lock_value 256 $2/queue/nr_requests
149 | lock_value 0 $2/queue/iosched/slice_idle
150 | fi
151 | fi
152 | }
153 |
154 | # $1:display-name $2:file path
155 | function print_value()
156 | {
157 | if [ -f $2 ]; then
158 | echo $1
159 | cat $2
160 | fi
161 | }
162 |
163 | function verify_param()
164 | {
165 | expected_target=${C0_GOVERNOR_DIR}/target_loads
166 | if [ "$action" = "powersave" ]; then
167 | expected_value="80 580000:27 680000:48 780000:68 880000:82 1180000:98"
168 | elif [ "$action" = "balance" ]; then
169 | expected_value="80 580000:59 680000:54 780000:63 880000:85 1180000:98 1280000:94"
170 | elif [ "$action" = "performance" ]; then
171 | expected_value="80 580000:63 680000:54 780000:60 880000:32 1180000:98 1280000:93"
172 | elif [ "$action" = "fast" ]; then
173 | expected_value="80 1280000:90"
174 | fi
175 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
176 | echo "${action} OK"
177 | else
178 | echo "${action} FAIL"
179 | fi
180 | }
181 |
182 | action=$1
183 | if [ ! -n "$action" ]; then
184 | action="balance"
185 | fi
186 |
187 | if [ "$action" = "debug" ]; then
188 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
189 | echo "Author: yc9559"
190 | echo "Platform: sd_810_808"
191 | echo "Generated at: Sat Jul 14 16:45:37 2018"
192 | echo ""
193 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
194 | print_param above_hispeed_delay
195 | print_param target_loads
196 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
197 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
198 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
199 | which perfd
200 | exit 0
201 | fi
202 |
203 | if [ ! -f /dev/.project_wipe ]; then
204 | unify_environment
205 | fi
206 |
207 | before_modify
208 |
209 | # RunOnce
210 | if [ ! -f /dev/.project_wipe ]; then
211 | # set flag
212 | touch /dev/.project_wipe
213 |
214 | runonce_custom
215 |
216 | set_io cfq /sys/block/mmcblk0
217 | set_io cfq /sys/block/sda
218 |
219 | # shared interactive parameters
220 | set_param_little timer_rate 20000
221 | set_param_little timer_slack 180000
222 | set_param_little boost 0
223 | set_param_little boostpulse_duration 0
224 | set_param_big timer_rate 20000
225 | set_param_big timer_slack 180000
226 | set_param_big boost 0
227 | set_param_big boostpulse_duration 0
228 | fi
229 |
230 | if [ "$action" = "powersave" ]; then
231 | powersave_custom
232 | set_param_little above_hispeed_delay "98000 1280000:38000"
233 | set_param_little hispeed_freq 1180000
234 | set_param_little go_hispeed_load 98
235 | set_param_little target_loads "80 580000:27 680000:48 780000:68 880000:82 1180000:98"
236 | set_param_little min_sample_time 18000
237 | set_param_big above_hispeed_delay "18000 1180000:98000 1380000:18000"
238 | set_param_big hispeed_freq 880000
239 | set_param_big go_hispeed_load 98
240 | set_param_big target_loads "80 580000:49 680000:40 780000:58 880000:94 1180000:98"
241 | set_param_big min_sample_time 38000
242 | fi
243 |
244 | if [ "$action" = "balance" ]; then
245 | balance_custom
246 | set_param_little above_hispeed_delay "98000"
247 | set_param_little hispeed_freq 1180000
248 | set_param_little go_hispeed_load 97
249 | set_param_little target_loads "80 580000:59 680000:54 780000:63 880000:85 1180000:98 1280000:94"
250 | set_param_little min_sample_time 38000
251 | set_param_big above_hispeed_delay "18000 1180000:98000"
252 | set_param_big hispeed_freq 880000
253 | set_param_big go_hispeed_load 98
254 | set_param_big target_loads "80 580000:64 680000:58 780000:19 880000:97"
255 | set_param_big min_sample_time 78000
256 | fi
257 |
258 | if [ "$action" = "performance" ]; then
259 | performance_custom
260 | set_param_little above_hispeed_delay "38000 1280000:58000"
261 | set_param_little hispeed_freq 1180000
262 | set_param_little go_hispeed_load 98
263 | set_param_little target_loads "80 580000:63 680000:54 780000:60 880000:32 1180000:98 1280000:93"
264 | set_param_little min_sample_time 38000
265 | set_param_big above_hispeed_delay "78000 1280000:38000"
266 | set_param_big hispeed_freq 1180000
267 | set_param_big go_hispeed_load 98
268 | set_param_big target_loads "80 480000:44 580000:65 680000:61 780000:20 880000:90 1180000:74 1280000:98"
269 | set_param_big min_sample_time 78000
270 | fi
271 |
272 | if [ "$action" = "fast" ]; then
273 | fast_custom
274 | lock_value 880000 ${C0_CPUFREQ_DIR}/scaling_min_freq
275 | set_param_little above_hispeed_delay "18000 1180000:198000"
276 | set_param_little hispeed_freq 880000
277 | set_param_little target_loads "80 1280000:90"
278 | set_param_little min_sample_time 38000
279 | lock_value 880000 ${C1_CPUFREQ_DIR}/scaling_min_freq
280 | set_param_big above_hispeed_delay "18000 1280000:198000"
281 | set_param_big hispeed_freq 880000
282 | set_param_big target_loads "80 1380000:90"
283 | set_param_big min_sample_time 38000
284 | fi
285 |
286 | after_modify
287 |
288 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_820_821/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_820_821
5 | # Generated at: Wed Jun 27 23:36:04 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu2/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu2/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | echo -n disable > /sys/devices/soc/soc:qcom,bcl/mode
38 | set_value N /sys/module/msm_thermal/parameters/enabled
39 | # in case of using ondemand as default governor
40 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
41 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
42 | # Perfd, nothing to worry about, if error the script will continue
43 | stop perfd
44 | }
45 |
46 | function runonce_custom()
47 | {
48 | set_value 90 /proc/sys/kernel/sched_spill_load
49 | set_value 0 /proc/sys/kernel/sched_boost
50 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
51 | set_value 40 /proc/sys/kernel/sched_init_task_load
52 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
53 |
54 | # avoid permission problem, do not set 0444
55 | set_value 1 /dev/cpuset/background/cpus
56 | set_value 0-1 /dev/cpuset/system-background/cpus
57 | set_value 0-1,2-3 /dev/cpuset/foreground/cpus
58 | set_value 0-1,2-3 /dev/cpuset/top-app/cpus
59 |
60 | set_value 25 /proc/sys/kernel/sched_downmigrate
61 | set_value 45 /proc/sys/kernel/sched_upmigrate
62 |
63 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
64 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
65 |
66 | set_param_little use_sched_load 1
67 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
68 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
69 | set_param_big use_sched_load 1
70 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
71 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
72 | }
73 |
74 | function before_modify()
75 | {
76 | chown 0.0 ${C0_GOVERNOR_DIR}/*
77 | chmod 0666 ${C0_GOVERNOR_DIR}/*
78 | lock_value 280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
79 |
80 | set_value 1 /sys/devices/system/cpu/cpu2/online
81 | chown 0.0 ${C1_GOVERNOR_DIR}/*
82 | chmod 0666 ${C1_GOVERNOR_DIR}/*
83 | lock_value 280000 ${C1_CPUFREQ_DIR}/scaling_min_freq
84 | }
85 |
86 | function after_modify()
87 | {
88 | chmod 0444 ${C0_GOVERNOR_DIR}/*
89 | chmod 0444 ${C1_GOVERNOR_DIR}/*
90 | verify_param
91 | }
92 |
93 | function powersave_custom()
94 | {
95 | lock_value "0:380000 2:380000" /sys/module/cpu_boost/parameters/input_boost_freq
96 | }
97 |
98 | function balance_custom()
99 | {
100 | lock_value "0:380000 2:380000" /sys/module/cpu_boost/parameters/input_boost_freq
101 | }
102 |
103 | function performance_custom()
104 | {
105 | lock_value "0:380000 2:380000" /sys/module/cpu_boost/parameters/input_boost_freq
106 | }
107 |
108 | function fast_custom()
109 | {
110 | :
111 | }
112 |
113 |
114 |
115 | # $1:value $2:file path
116 | function set_value()
117 | {
118 | if [ -f $2 ]; then
119 | echo $1 > $2
120 | fi
121 | }
122 |
123 | # $1:value $2:file path
124 | function lock_value()
125 | {
126 | if [ -f $2 ]; then
127 | # chown 0.0 $2
128 | chmod 0666 $2
129 | echo $1 > $2
130 | chmod 0444 $2
131 | fi
132 | }
133 |
134 | # $1:io-scheduler $2:block-path
135 | function set_io()
136 | {
137 | if [ -f $2/queue/scheduler ]; then
138 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
139 | echo $1 > $2/queue/scheduler
140 | echo 512 > $2/queue/read_ahead_kb
141 | lock_value 0 $2/queue/iostats
142 | lock_value 256 $2/queue/nr_requests
143 | lock_value 0 $2/queue/iosched/slice_idle
144 | fi
145 | fi
146 | }
147 |
148 | # $1:display-name $2:file path
149 | function print_value()
150 | {
151 | if [ -f $2 ]; then
152 | echo $1
153 | cat $2
154 | fi
155 | }
156 |
157 | function verify_param()
158 | {
159 | expected_target=${C0_GOVERNOR_DIR}/target_loads
160 | if [ "$action" = "powersave" ]; then
161 | expected_value="80 380000:5 580000:42 680000:60 780000:70 880000:83 980000:92 1180000:97"
162 | elif [ "$action" = "balance" ]; then
163 | expected_value="80 380000:9 580000:36 780000:62 880000:71 980000:87 1080000:75 1180000:98"
164 | elif [ "$action" = "performance" ]; then
165 | expected_value="80 380000:7 480000:31 580000:13 680000:58 780000:63 980000:73 1180000:98"
166 | elif [ "$action" = "fast" ]; then
167 | expected_value="80 1580000:90"
168 | fi
169 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
170 | echo "${action} OK"
171 | else
172 | echo "${action} FAIL"
173 | fi
174 | }
175 |
176 | action=$1
177 | if [ ! -n "$action" ]; then
178 | action="balance"
179 | fi
180 |
181 | if [ "$action" = "debug" ]; then
182 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
183 | echo "Author: yc9559"
184 | echo "Platform: sd_820_821"
185 | echo "Generated at: Wed Jun 27 23:36:04 2018"
186 | echo ""
187 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
188 | print_param above_hispeed_delay
189 | print_param target_loads
190 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
191 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
192 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
193 | which perfd
194 | exit 0
195 | fi
196 |
197 | if [ ! -f /dev/.project_wipe ]; then
198 | unify_environment
199 | fi
200 |
201 | before_modify
202 |
203 | # RunOnce
204 | if [ ! -f /dev/.project_wipe ]; then
205 | # set flag
206 | touch /dev/.project_wipe
207 |
208 | runonce_custom
209 |
210 | set_io cfq /sys/block/mmcblk0
211 | set_io cfq /sys/block/sda
212 |
213 | # shared interactive parameters
214 | set_param_little timer_rate 20000
215 | set_param_little timer_slack 180000
216 | set_param_little boost 0
217 | set_param_little boostpulse_duration 0
218 | set_param_big timer_rate 20000
219 | set_param_big timer_slack 180000
220 | set_param_big boost 0
221 | set_param_big boostpulse_duration 0
222 | fi
223 |
224 | if [ "$action" = "powersave" ]; then
225 | powersave_custom
226 | set_param_little above_hispeed_delay "18000 1180000:78000 1280000:98000"
227 | set_param_little hispeed_freq 1080000
228 | set_param_little go_hispeed_load 97
229 | set_param_little target_loads "80 380000:5 580000:42 680000:60 780000:70 880000:83 980000:92 1180000:97"
230 | set_param_little min_sample_time 18000
231 | set_param_big above_hispeed_delay "18000 1280000:98000 1380000:58000 1480000:98000 1880000:138000"
232 | set_param_big hispeed_freq 1180000
233 | set_param_big go_hispeed_load 98
234 | set_param_big target_loads "80 380000:53 480000:38 580000:63 780000:69 880000:85 1080000:93 1380000:72 1480000:98"
235 | set_param_big min_sample_time 18000
236 | fi
237 |
238 | if [ "$action" = "balance" ]; then
239 | balance_custom
240 | set_param_little above_hispeed_delay "58000 1280000:98000 1580000:58000"
241 | set_param_little hispeed_freq 1180000
242 | set_param_little go_hispeed_load 98
243 | set_param_little target_loads "80 380000:9 580000:36 780000:62 880000:71 980000:87 1080000:75 1180000:98"
244 | set_param_little min_sample_time 18000
245 | set_param_big above_hispeed_delay "38000 1480000:98000 1880000:138000"
246 | set_param_big hispeed_freq 1380000
247 | set_param_big go_hispeed_load 98
248 | set_param_big target_loads "80 380000:39 480000:35 680000:29 780000:63 880000:71 1180000:91 1380000:83 1480000:98"
249 | set_param_big min_sample_time 18000
250 | fi
251 |
252 | if [ "$action" = "performance" ]; then
253 | performance_custom
254 | set_param_little above_hispeed_delay "18000 1280000:98000 1480000:38000"
255 | set_param_little hispeed_freq 1180000
256 | set_param_little go_hispeed_load 97
257 | set_param_little target_loads "80 380000:7 480000:31 580000:13 680000:58 780000:63 980000:73 1180000:98"
258 | set_param_little min_sample_time 38000
259 | set_param_big above_hispeed_delay "18000 1580000:98000 1880000:38000"
260 | set_param_big hispeed_freq 1480000
261 | set_param_big go_hispeed_load 98
262 | set_param_big target_loads "80 380000:34 680000:40 780000:63 880000:57 1080000:72 1380000:78 1480000:98"
263 | set_param_big min_sample_time 18000
264 | fi
265 |
266 | if [ "$action" = "fast" ]; then
267 | fast_custom
268 | lock_value 1080000 ${C0_CPUFREQ_DIR}/scaling_min_freq
269 | set_param_little above_hispeed_delay "18000 1480000:198000"
270 | set_param_little hispeed_freq 1080000
271 | set_param_little target_loads "80 1580000:90"
272 | set_param_little min_sample_time 38000
273 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
274 | set_param_big above_hispeed_delay "18000 1880000:198000"
275 | set_param_big hispeed_freq 1380000
276 | set_param_big target_loads "80 1980000:90"
277 | set_param_big min_sample_time 38000
278 | fi
279 |
280 | after_modify
281 |
282 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_835/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # Project WIPE https://github.com/yc9559/cpufreq-interactive-opt
3 | # Author: yc9559
4 | # Platform: sd_835
5 | # Generated at: Thu Jun 28 02:18:56 2018
6 |
7 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/interactive"
8 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/interactive"
9 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
10 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
11 |
12 | # $1:timer_rate $2:value
13 | function set_param_little()
14 | {
15 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
16 | }
17 |
18 | # $1:timer_rate $2:value
19 | function set_param_big()
20 | {
21 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
22 | }
23 |
24 | # $1:timer_rate
25 | function print_param()
26 | {
27 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
28 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
29 | }
30 |
31 | function unify_environment()
32 | {
33 | # SELinux permissive
34 | setenforce 0
35 | # disable hotplug to switch governor
36 | set_value 0 /sys/module/msm_thermal/core_control/enabled
37 | set_value N /sys/module/msm_thermal/parameters/enabled
38 | # in case of using ondemand as default governor
39 | lock_value "interactive" ${C0_CPUFREQ_DIR}/scaling_governor
40 | lock_value "interactive" ${C1_CPUFREQ_DIR}/scaling_governor
41 | # Perfd, nothing to worry about, if error the script will continue
42 | stop perfd
43 | }
44 |
45 | function runonce_custom()
46 | {
47 | set_value 90 /proc/sys/kernel/sched_spill_load
48 | set_value 0 /proc/sys/kernel/sched_boost
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 40 /proc/sys/kernel/sched_init_task_load
51 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
52 |
53 | # avoid permission problem, do not set 0444
54 | set_value 2-3 /dev/cpuset/background/cpus
55 | set_value 0-3 /dev/cpuset/system-background/cpus
56 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
57 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
58 |
59 | # set_value 85 /proc/sys/kernel/sched_downmigrate
60 | # set_value 95 /proc/sys/kernel/sched_upmigrate
61 |
62 | lock_value 2500 /sys/module/cpu_boost/parameters/input_boost_ms
63 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
64 |
65 | set_param_little use_sched_load 1
66 | lock_value 0 ${C0_GOVERNOR_DIR}/ignore_hispeed_on_notif
67 | lock_value 0 ${C0_GOVERNOR_DIR}/enable_prediction
68 | set_param_big use_sched_load 1
69 | lock_value 0 ${C1_GOVERNOR_DIR}/ignore_hispeed_on_notif
70 | lock_value 0 ${C1_GOVERNOR_DIR}/enable_prediction
71 | }
72 |
73 | function before_modify()
74 | {
75 | chown 0.0 ${C0_GOVERNOR_DIR}/*
76 | chmod 0666 ${C0_GOVERNOR_DIR}/*
77 | lock_value 280000 ${C0_CPUFREQ_DIR}/scaling_min_freq
78 |
79 | set_value 1 /sys/devices/system/cpu/cpu4/online
80 | chown 0.0 ${C1_GOVERNOR_DIR}/*
81 | chmod 0666 ${C1_GOVERNOR_DIR}/*
82 | lock_value 280000 ${C1_CPUFREQ_DIR}/scaling_min_freq
83 | }
84 |
85 | function after_modify()
86 | {
87 | chmod 0444 ${C0_GOVERNOR_DIR}/*
88 | chmod 0444 ${C1_GOVERNOR_DIR}/*
89 | verify_param
90 | }
91 |
92 | function powersave_custom()
93 | {
94 | lock_value "0:380000 4:380000" /sys/module/cpu_boost/parameters/input_boost_freq
95 | }
96 |
97 | function balance_custom()
98 | {
99 | lock_value "0:380000 4:380000" /sys/module/cpu_boost/parameters/input_boost_freq
100 | }
101 |
102 | function performance_custom()
103 | {
104 | lock_value "0:380000 4:380000" /sys/module/cpu_boost/parameters/input_boost_freq
105 | }
106 |
107 | function fast_custom()
108 | {
109 | :
110 | }
111 |
112 |
113 |
114 | # $1:value $2:file path
115 | function set_value()
116 | {
117 | if [ -f $2 ]; then
118 | echo $1 > $2
119 | fi
120 | }
121 |
122 | # $1:value $2:file path
123 | function lock_value()
124 | {
125 | if [ -f $2 ]; then
126 | # chown 0.0 $2
127 | chmod 0666 $2
128 | echo $1 > $2
129 | chmod 0444 $2
130 | fi
131 | }
132 |
133 | # $1:io-scheduler $2:block-path
134 | function set_io()
135 | {
136 | if [ -f $2/queue/scheduler ]; then
137 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
138 | echo $1 > $2/queue/scheduler
139 | echo 512 > $2/queue/read_ahead_kb
140 | lock_value 0 $2/queue/iostats
141 | lock_value 256 $2/queue/nr_requests
142 | lock_value 0 $2/queue/iosched/slice_idle
143 | fi
144 | fi
145 | }
146 |
147 | # $1:display-name $2:file path
148 | function print_value()
149 | {
150 | if [ -f $2 ]; then
151 | echo $1
152 | cat $2
153 | fi
154 | }
155 |
156 | function verify_param()
157 | {
158 | expected_target=${C0_GOVERNOR_DIR}/target_loads
159 | if [ "$action" = "powersave" ]; then
160 | expected_value="80 380000:59 480000:51 580000:29 780000:92 880000:76 1180000:90 1280000:98 1380000:84 1480000:97"
161 | elif [ "$action" = "balance" ]; then
162 | expected_value="80 380000:30 480000:41 580000:29 680000:4 780000:60 1180000:88 1280000:70 1380000:78 1480000:97"
163 | elif [ "$action" = "performance" ]; then
164 | expected_value="80 380000:42 580000:80 680000:15 980000:36 1080000:9 1180000:90 1280000:59 1480000:88 1680000:98"
165 | elif [ "$action" = "fast" ]; then
166 | expected_value="80 1880000:90"
167 | fi
168 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
169 | echo "${action} OK"
170 | else
171 | echo "${action} FAIL"
172 | fi
173 | }
174 |
175 | action=$1
176 | if [ ! -n "$action" ]; then
177 | action="balance"
178 | fi
179 |
180 | if [ "$action" = "debug" ]; then
181 | echo "Project WIPE https://github.com/yc9559/cpufreq-interactive-opt"
182 | echo "Author: yc9559"
183 | echo "Platform: sd_835"
184 | echo "Generated at: Thu Jun 28 02:18:56 2018"
185 | echo ""
186 | print_value "Cluster 0: min_freq" ${C0_CPUFREQ_DIR}/scaling_min_freq
187 | print_param above_hispeed_delay
188 | print_param target_loads
189 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
190 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
191 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
192 | which perfd
193 | exit 0
194 | fi
195 |
196 | if [ ! -f /dev/.project_wipe ]; then
197 | unify_environment
198 | fi
199 |
200 | before_modify
201 |
202 | # RunOnce
203 | if [ ! -f /dev/.project_wipe ]; then
204 | # set flag
205 | touch /dev/.project_wipe
206 |
207 | runonce_custom
208 |
209 | set_io cfq /sys/block/mmcblk0
210 | set_io cfq /sys/block/sda
211 |
212 | # shared interactive parameters
213 | set_param_little timer_rate 20000
214 | set_param_little timer_slack 180000
215 | set_param_little boost 0
216 | set_param_little boostpulse_duration 0
217 | set_param_big timer_rate 20000
218 | set_param_big timer_slack 180000
219 | set_param_big boost 0
220 | set_param_big boostpulse_duration 0
221 | fi
222 |
223 | if [ "$action" = "powersave" ]; then
224 | powersave_custom
225 | set_param_little above_hispeed_delay "18000 1380000:58000 1480000:18000 1580000:98000"
226 | set_param_little hispeed_freq 1180000
227 | set_param_little go_hispeed_load 98
228 | set_param_little target_loads "80 380000:59 480000:51 580000:29 780000:92 880000:76 1180000:90 1280000:98 1380000:84 1480000:97"
229 | set_param_little min_sample_time 18000
230 | set_param_big above_hispeed_delay "18000 1480000:58000 1580000:98000 1880000:138000"
231 | set_param_big hispeed_freq 1280000
232 | set_param_big go_hispeed_load 98
233 | set_param_big target_loads "80 380000:45 480000:36 580000:41 680000:65 780000:88 1080000:92 1280000:98 1380000:90 1580000:97"
234 | set_param_big min_sample_time 18000
235 | fi
236 |
237 | if [ "$action" = "balance" ]; then
238 | balance_custom
239 | set_param_little above_hispeed_delay "18000 1580000:98000"
240 | set_param_little hispeed_freq 1180000
241 | set_param_little go_hispeed_load 98
242 | set_param_little target_loads "80 380000:30 480000:41 580000:29 680000:4 780000:60 1180000:88 1280000:70 1380000:78 1480000:97"
243 | set_param_little min_sample_time 18000
244 | set_param_big above_hispeed_delay "18000 1380000:78000 1480000:18000 1580000:98000 1880000:138000"
245 | set_param_big hispeed_freq 1280000
246 | set_param_big go_hispeed_load 98
247 | set_param_big target_loads "80 380000:39 580000:58 780000:63 980000:81 1080000:92 1180000:77 1280000:98 1380000:86 1580000:98"
248 | set_param_big min_sample_time 18000
249 | fi
250 |
251 | if [ "$action" = "performance" ]; then
252 | performance_custom
253 | set_param_little above_hispeed_delay "18000 1580000:98000 1780000:38000"
254 | set_param_little hispeed_freq 1480000
255 | set_param_little go_hispeed_load 98
256 | set_param_little target_loads "80 380000:42 580000:80 680000:15 980000:36 1080000:9 1180000:90 1280000:59 1480000:88 1680000:98"
257 | set_param_little min_sample_time 18000
258 | set_param_big above_hispeed_delay "18000 1580000:98000 1880000:38000"
259 | set_param_big hispeed_freq 1280000
260 | set_param_big go_hispeed_load 94
261 | set_param_big target_loads "80 380000:44 480000:19 680000:54 780000:63 980000:54 1080000:63 1280000:71 1580000:98"
262 | set_param_big min_sample_time 18000
263 | fi
264 |
265 | if [ "$action" = "fast" ]; then
266 | fast_custom
267 | lock_value 1480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
268 | set_param_little above_hispeed_delay "18000 1780000:198000"
269 | set_param_little hispeed_freq 1480000
270 | set_param_little target_loads "80 1880000:90"
271 | set_param_little min_sample_time 38000
272 | lock_value 1380000 ${C1_CPUFREQ_DIR}/scaling_min_freq
273 | set_param_big above_hispeed_delay "18000 1880000:198000"
274 | set_param_big hispeed_freq 1380000
275 | set_param_big target_loads "80 1980000:90"
276 | set_param_big min_sample_time 38000
277 | fi
278 |
279 | after_modify
280 |
281 | exit 0
--------------------------------------------------------------------------------
/platforms/sd_845/powercfg.apk:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 | # EAS parameter adjustment for SDM 845
3 | # https://github.com/yc9559/cpufreq-interactive-opt
4 | # Author: yc9559
5 | # Platform: sd_845
6 | # Generated at: Sat Jun 30 12:28:56 2018
7 |
8 | C0_GOVERNOR_DIR="/sys/devices/system/cpu/cpu0/cpufreq/schedutil"
9 | C1_GOVERNOR_DIR="/sys/devices/system/cpu/cpu4/cpufreq/schedutil"
10 | C0_CPUFREQ_DIR="/sys/devices/system/cpu/cpu0/cpufreq"
11 | C1_CPUFREQ_DIR="/sys/devices/system/cpu/cpu4/cpufreq"
12 |
13 | # $1:timer_rate $2:value
14 | function set_param_little()
15 | {
16 | echo ${2} > ${C0_GOVERNOR_DIR}/${1}
17 | }
18 |
19 | # $1:timer_rate $2:value
20 | function set_param_big()
21 | {
22 | echo ${2} > ${C1_GOVERNOR_DIR}/${1}
23 | }
24 |
25 | # $1:timer_rate
26 | function print_param()
27 | {
28 | print_value "LITTLE: ${1}" ${C0_GOVERNOR_DIR}/${1}
29 | print_value "big: ${1}" ${C1_GOVERNOR_DIR}/${1}
30 | }
31 |
32 | function unify_environment()
33 | {
34 | # SELinux permissive
35 | setenforce 0
36 | # disable hotplug to switch governor
37 | set_value 0 /sys/module/msm_thermal/core_control/enabled
38 | set_value N /sys/module/msm_thermal/parameters/enabled
39 | # in case of using ondemand as default governor
40 | lock_value "schedutil" ${C0_CPUFREQ_DIR}/scaling_governor
41 | lock_value "schedutil" ${C1_CPUFREQ_DIR}/scaling_governor
42 | # Perfd, nothing to worry about, if error the script will continue
43 | stop perfd
44 | }
45 |
46 | function runonce_custom()
47 | {
48 | set_value 90 /proc/sys/kernel/sched_spill_load
49 | set_value 1 /proc/sys/kernel/sched_prefer_sync_wakee_to_waker
50 | set_value 3000000 /proc/sys/kernel/sched_freq_inc_notify
51 |
52 | # avoid permission problem, do not set 0444
53 | set_value 2-3 /dev/cpuset/background/cpus
54 | set_value 0-3 /dev/cpuset/system-background/cpus
55 | set_value 0-3,4-7 /dev/cpuset/foreground/cpus
56 | set_value 0-3,4-7 /dev/cpuset/top-app/cpus
57 |
58 | # set_value 85 /proc/sys/kernel/sched_downmigrate
59 | # set_value 95 /proc/sys/kernel/sched_upmigrate
60 |
61 | lock_value 80 /sys/module/cpu_boost/parameters/input_boost_ms
62 | lock_value 0 /sys/module/msm_performance/parameters/touchboost
63 | }
64 |
65 | function before_modify()
66 | {
67 | # chown 0.0 ${C0_GOVERNOR_DIR}/*
68 | chmod 0666 ${C0_GOVERNOR_DIR}/*
69 | lock_value 480000 ${C0_CPUFREQ_DIR}/scaling_min_freq
70 |
71 | set_value 1 /sys/devices/system/cpu/cpu4/online
72 | # chown 0.0 ${C1_GOVERNOR_DIR}/*
73 | chmod 0666 ${C1_GOVERNOR_DIR}/*
74 | lock_value 480000 ${C1_CPUFREQ_DIR}/scaling_min_freq
75 | }
76 |
77 | function after_modify()
78 | {
79 | # chmod 0444 ${C0_GOVERNOR_DIR}/*
80 | # chmod 0444 ${C1_GOVERNOR_DIR}/*
81 | verify_param
82 | }
83 |
84 | function powersave_custom()
85 | {
86 | lock_value "0:1680000 4:1880000" /sys/module/msm_performance/parameters/cpu_max_freq
87 | lock_value "0:1080000 4:0" /sys/module/cpu_boost/parameters/input_boost_freq
88 | lock_value 2 /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
89 | lock_value 2 /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
90 | }
91 |
92 | function balance_custom()
93 | {
94 | lock_value "0:1780000 4:2280000" /sys/module/msm_performance/parameters/cpu_max_freq
95 | lock_value "0:1080000 4:0" /sys/module/cpu_boost/parameters/input_boost_freq
96 | lock_value 2 /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
97 | lock_value 4 /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
98 | }
99 |
100 | function performance_custom()
101 | {
102 | lock_value "0:1780000 4:2880000" /sys/module/msm_performance/parameters/cpu_max_freq
103 | lock_value "0:1180000 4:0" /sys/module/cpu_boost/parameters/input_boost_freq
104 | lock_value 2 /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
105 | lock_value 4 /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
106 | }
107 |
108 | function fast_custom()
109 | {
110 | lock_value "0:1780000 4:2280000" /sys/module/msm_performance/parameters/cpu_max_freq
111 | lock_value "0:1480000 4:1680000" /sys/module/cpu_boost/parameters/input_boost_freq
112 | lock_value 4 /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
113 | lock_value 4 /sys/devices/system/cpu/cpu4/core_ctl/max_cpus
114 | }
115 |
116 |
117 |
118 | # $1:value $2:file path
119 | function set_value()
120 | {
121 | if [ -f $2 ]; then
122 | echo $1 > $2
123 | fi
124 | }
125 |
126 | # $1:value $2:file path
127 | function lock_value()
128 | {
129 | if [ -f $2 ]; then
130 | # chown 0.0 $2
131 | chmod 0666 $2
132 | echo $1 > $2
133 | chmod 0444 $2
134 | fi
135 | }
136 |
137 | # $1:io-scheduler $2:block-path
138 | function set_io()
139 | {
140 | if [ -f $2/queue/scheduler ]; then
141 | if [ `grep -c $1 $2/queue/scheduler` = 1 ]; then
142 | echo $1 > $2/queue/scheduler
143 | echo 512 > $2/queue/read_ahead_kb
144 | lock_value 0 $2/queue/iostats
145 | lock_value 256 $2/queue/nr_requests
146 | lock_value 0 $2/queue/iosched/slice_idle
147 | fi
148 | fi
149 | }
150 |
151 | # $1:display-name $2:file path
152 | function print_value()
153 | {
154 | if [ -f $2 ]; then
155 | echo $1
156 | cat $2
157 | fi
158 | }
159 |
160 | function verify_param()
161 | {
162 | expected_target=${C0_GOVERNOR_DIR}/hispeed_freq
163 | if [ "$action" = "powersave" ]; then
164 | expected_value="1180000"
165 | elif [ "$action" = "balance" ]; then
166 | expected_value="1280000"
167 | elif [ "$action" = "performance" ]; then
168 | expected_value="1380000"
169 | elif [ "$action" = "fast" ]; then
170 | expected_value="1480000"
171 | fi
172 | if [ "`cat ${expected_target}`" = "${expected_value}" ]; then
173 | echo "${action} OK"
174 | else
175 | echo "${action} FAIL"
176 | fi
177 | }
178 |
179 | action=$1
180 | if [ ! -n "$action" ]; then
181 | action="balance"
182 | fi
183 |
184 | if [ "$action" = "debug" ]; then
185 | echo "EAS parameter adjustment for SDM 845"
186 | echo "https://github.com/yc9559/cpufreq-interactive-opt"
187 | echo "Author: yc9559"
188 | echo "Generated at: Sat Jun 30 12:28:56 2018"
189 | echo ""
190 | print_value "big: max_freq" ${C1_CPUFREQ_DIR}/scaling_max_freq
191 | print_param hispeed_freq
192 | print_param pl
193 | print_value "sched_spill_load" /proc/sys/kernel/sched_spill_load
194 | print_value "eMMC IO scheduler" /sys/block/mmcblk0/queue/scheduler
195 | print_value "UFS IO scheduler" /sys/block/sda/queue/scheduler
196 | which perfd
197 | exit 0
198 | fi
199 |
200 | if [ ! -f /dev/.project_wipe ]; then
201 | unify_environment
202 | fi
203 |
204 | before_modify
205 |
206 | # RunOnce
207 | if [ ! -f /dev/.project_wipe ]; then
208 | # set flag
209 | touch /dev/.project_wipe
210 |
211 | runonce_custom
212 |
213 | set_io cfq /sys/block/mmcblk0
214 | set_io cfq /sys/block/sda
215 | fi
216 |
217 | if [ "$action" = "powersave" ]; then
218 | powersave_custom
219 | set_param_little hispeed_freq 1180000
220 | set_param_little hispeed_load 90
221 | set_param_little pl 0
222 | set_param_big hispeed_freq 1080000
223 | set_param_big hispeed_load 90
224 | set_param_big pl 0
225 | fi
226 |
227 | if [ "$action" = "balance" ]; then
228 | balance_custom
229 | set_param_little hispeed_freq 1280000
230 | set_param_little hispeed_load 90
231 | set_param_little pl 0
232 | set_param_big hispeed_freq 1280000
233 | set_param_big hispeed_load 90
234 | set_param_big pl 0
235 | fi
236 |
237 | if [ "$action" = "performance" ]; then
238 | performance_custom
239 | set_param_little hispeed_freq 1380000
240 | set_param_little hispeed_load 90
241 | set_param_little pl 1
242 | set_param_big hispeed_freq 1480000
243 | set_param_big hispeed_load 95
244 | set_param_big pl 1
245 | fi
246 |
247 | if [ "$action" = "fast" ]; then
248 | fast_custom
249 | set_param_little hispeed_freq 1480000
250 | set_param_little hispeed_load 85
251 | set_param_little pl 1
252 | set_param_big hispeed_freq 1480000
253 | set_param_big hispeed_load 90
254 | set_param_big pl 1
255 | fi
256 |
257 | after_modify
258 |
259 | exit 0
--------------------------------------------------------------------------------