├── CPI3_linux_4.20 ├── cpi3_linux_4_20_1902.patch ├── md5sum ├── sun8i-r16-clockworkpi-cpi3-hdmi.dtb ├── sun8i-r16-clockworkpi-cpi3.dtb └── uImage ├── LICENSE ├── README.md ├── cpi3-linux_4_14_2.patch ├── uImage ├── usb_ethernet.patch ├── v0.2 ├── MD5SUM ├── sun8i-r16-clockworkpi-cpi3-hdmi.dtb ├── sun8i-r16-clockworkpi-cpi3.dtb ├── u-boot-sunxi-with-spl.bin └── uImage ├── v0.4 ├── 52rc4.patch ├── how_to_flash_u-boot.md └── u-boot-sunxi-with-spl.bin └── v0.6 ├── 515_defconfig.patch ├── 515_display.patch ├── 515_dts.patch ├── 515_logo.patch ├── 515_power.patch ├── 515_sound.patch ├── 515_wifi.patch └── README.md /CPI3_linux_4.20/md5sum: -------------------------------------------------------------------------------- 1 | bcba81428b6346dbf01a84be7f29c210 cpi3_linux_4_20_1902.patch 2 | cb276a7738733f4eb79c6334802042a4 sun8i-r16-clockworkpi-cpi3.dtb 3 | 743c15ad45fbd6ffa524ac1264f9d4b5 sun8i-r16-clockworkpi-cpi3-hdmi.dtb 4 | e2baa5ab77335bba3eeec46e03ad4219 uImage 5 | 6 | -------------------------------------------------------------------------------- /CPI3_linux_4.20/sun8i-r16-clockworkpi-cpi3-hdmi.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/CPI3_linux_4.20/sun8i-r16-clockworkpi-cpi3-hdmi.dtb -------------------------------------------------------------------------------- /CPI3_linux_4.20/sun8i-r16-clockworkpi-cpi3.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/CPI3_linux_4.20/sun8i-r16-clockworkpi-cpi3.dtb -------------------------------------------------------------------------------- /CPI3_linux_4.20/uImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/CPI3_linux_4.20/uImage -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kernel 2 | clockworkPI (CPI3) Linux Kernel 4.14.2 Patch 3 | 4 | ## Cross compiler: 5 | gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf 6 | 7 | ## Compilation process: 8 | * cp ./arch/arm/configs/clockworkpi_cpi3_defconfig .config 9 | * make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 10 | * mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n "Linux kernel" -d arch/arm/boot/zImage uImage 11 | -------------------------------------------------------------------------------- /uImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/uImage -------------------------------------------------------------------------------- /usb_ethernet.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/configs/clockworkpi_cpi3_defconfig b/arch/arm/configs/clockworkpi_cpi3_defconfig 2 | index 84774c4b..71d0392a 100644 3 | --- a/arch/arm/configs/clockworkpi_cpi3_defconfig 4 | +++ b/arch/arm/configs/clockworkpi_cpi3_defconfig 5 | @@ -848,6 +848,7 @@ CONFIG_BLK_DEV=y 6 | # CONFIG_ATA_OVER_ETH is not set 7 | # CONFIG_BLK_DEV_RBD is not set 8 | # CONFIG_NVME_FC is not set 9 | +# CONFIG_NVME_TARGET is not set 10 | 11 | # 12 | # Misc devices 13 | @@ -2173,7 +2174,29 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 14 | # CONFIG_USB_NET2272 is not set 15 | # CONFIG_USB_GADGET_XILINX is not set 16 | # CONFIG_USB_DUMMY_HCD is not set 17 | +CONFIG_USB_LIBCOMPOSITE=y 18 | +CONFIG_USB_U_ETHER=y 19 | +CONFIG_USB_F_ECM=y 20 | +CONFIG_USB_F_SUBSET=y 21 | +CONFIG_USB_F_RNDIS=y 22 | # CONFIG_USB_CONFIGFS is not set 23 | +# CONFIG_USB_ZERO is not set 24 | +# CONFIG_USB_AUDIO is not set 25 | +CONFIG_USB_ETH=y 26 | +CONFIG_USB_ETH_RNDIS=y 27 | +# CONFIG_USB_ETH_EEM is not set 28 | +# CONFIG_USB_G_NCM is not set 29 | +# CONFIG_USB_GADGETFS is not set 30 | +# CONFIG_USB_FUNCTIONFS is not set 31 | +# CONFIG_USB_MASS_STORAGE is not set 32 | +# CONFIG_USB_G_SERIAL is not set 33 | +# CONFIG_USB_MIDI_GADGET is not set 34 | +# CONFIG_USB_G_PRINTER is not set 35 | +# CONFIG_USB_CDC_COMPOSITE is not set 36 | +# CONFIG_USB_G_ACM_MS is not set 37 | +# CONFIG_USB_G_MULTI is not set 38 | +# CONFIG_USB_G_HID is not set 39 | +# CONFIG_USB_G_DBGP is not set 40 | 41 | # 42 | # USB Power Delivery and Type-C drivers 43 | @@ -2908,6 +2931,7 @@ CONFIG_FS_MBCACHE=y 44 | # CONFIG_JFS_FS is not set 45 | # CONFIG_XFS_FS is not set 46 | # CONFIG_GFS2_FS is not set 47 | +# CONFIG_OCFS2_FS is not set 48 | # CONFIG_BTRFS_FS is not set 49 | # CONFIG_NILFS2_FS is not set 50 | # CONFIG_F2FS_FS is not set 51 | @@ -2962,7 +2986,7 @@ CONFIG_TMPFS=y 52 | # CONFIG_TMPFS_POSIX_ACL is not set 53 | # CONFIG_TMPFS_XATTR is not set 54 | # CONFIG_HUGETLB_PAGE is not set 55 | -# CONFIG_CONFIGFS_FS is not set 56 | +CONFIG_CONFIGFS_FS=y 57 | # CONFIG_MISC_FILESYSTEMS is not set 58 | CONFIG_NETWORK_FILESYSTEMS=y 59 | CONFIG_NFS_FS=y 60 | @@ -3040,6 +3064,7 @@ CONFIG_NLS_ISO8859_1=y 61 | # CONFIG_NLS_MAC_ROMANIAN is not set 62 | # CONFIG_NLS_MAC_TURKISH is not set 63 | # CONFIG_NLS_UTF8 is not set 64 | +# CONFIG_DLM is not set 65 | 66 | # 67 | # Kernel hacking 68 | -------------------------------------------------------------------------------- /v0.2/MD5SUM: -------------------------------------------------------------------------------- 1 | 52fde6c2ca66fcd2f4bb9f6c88e0248e sun8i-r16-clockworkpi-cpi3.dtb 2 | 7abbcf88d988320cec453169264579de sun8i-r16-clockworkpi-cpi3-hdmi.dtb 3 | 197a43b90d61e0b8565500f5c7a235b0 u-boot-sunxi-with-spl.bin 4 | 89f3e589149a0d12eb2953b301537098 uImage 5 | -------------------------------------------------------------------------------- /v0.2/sun8i-r16-clockworkpi-cpi3-hdmi.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/v0.2/sun8i-r16-clockworkpi-cpi3-hdmi.dtb -------------------------------------------------------------------------------- /v0.2/sun8i-r16-clockworkpi-cpi3.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/v0.2/sun8i-r16-clockworkpi-cpi3.dtb -------------------------------------------------------------------------------- /v0.2/u-boot-sunxi-with-spl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/v0.2/u-boot-sunxi-with-spl.bin -------------------------------------------------------------------------------- /v0.2/uImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/v0.2/uImage -------------------------------------------------------------------------------- /v0.4/how_to_flash_u-boot.md: -------------------------------------------------------------------------------- 1 | sudo dd if=u-boot-sunxi-with-spl.bin of=$1 bs=1024 seek=8 2 | -------------------------------------------------------------------------------- /v0.4/u-boot-sunxi-with-spl.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clockworkpi/Kernel/83d370d0558fd58d04f1649724320708fb5b31a6/v0.4/u-boot-sunxi-with-spl.bin -------------------------------------------------------------------------------- /v0.6/515_display.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c 2 | index 1a9685eb8002..8bdb02aeaf0c 100644 3 | --- a/drivers/gpu/drm/panel/panel-simple.c 4 | +++ b/drivers/gpu/drm/panel/panel-simple.c 5 | @@ -4466,6 +4466,44 @@ static const struct panel_desc arm_rtsm = { 6 | .bus_format = MEDIA_BUS_FMT_RGB888_1X24, 7 | }; 8 | 9 | +static const struct drm_display_mode clockwork_cpi3_lcd_mode = { 10 | + .clock = 5800, 11 | + .hdisplay = 320, 12 | + .hsync_start = 320 + 6, 13 | + .hsync_end = 320 + 6 + 2, 14 | + .htotal = 320 + 6 + 2 + 60, 15 | + .vdisplay = 240, 16 | + .vsync_start = 240 + 2, 17 | + .vsync_end = 240 + 2 + 2, 18 | + .vtotal = 240 + 2 + 2 + 6, 19 | + .flags = DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_PHSYNC, 20 | +}; 21 | + 22 | +static const struct panel_desc clockwork_cpi3_lcd = { 23 | + .modes = &clockwork_cpi3_lcd_mode, 24 | + .num_modes = 1, 25 | + .bpc = 8, 26 | +}; 27 | + 28 | +static const struct drm_display_mode clockwork_cpi3_hdmi_mode = { 29 | + .clock = 74250, 30 | + .hdisplay = 1280, 31 | + .hsync_start = 1280 + 110, 32 | + .hsync_end = 1280 + 110 + 40, 33 | + .htotal = 1280 + 110 + 40 + 220, 34 | + .vdisplay = 720, 35 | + .vsync_start = 720 + 5, 36 | + .vsync_end = 720 + 5 + 5, 37 | + .vtotal = 720 + 5 + 5 + 20, 38 | + .flags = DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_PHSYNC, 39 | +}; 40 | + 41 | +static const struct panel_desc clockwork_cpi3_hdmi = { 42 | + .modes = &clockwork_cpi3_hdmi_mode, 43 | + .num_modes = 1, 44 | + .bpc = 8, 45 | +}; 46 | + 47 | static const struct of_device_id platform_of_match[] = { 48 | { 49 | .compatible = "ampire,am-1280800n3tzqw-t00h", 50 | @@ -4906,6 +4944,12 @@ static const struct of_device_id platform_of_match[] = { 51 | /* Must be the last entry */ 52 | .compatible = "panel-dpi", 53 | .data = &panel_dpi, 54 | + }, { 55 | + .compatible = "clockwork,cpi3-lcd", 56 | + .data = &clockwork_cpi3_lcd, 57 | + }, { 58 | + .compatible = "clockwork,cpi3-hdmi", 59 | + .data = &clockwork_cpi3_hdmi, 60 | }, { 61 | /* sentinel */ 62 | } 63 | diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig 64 | index e32694c13da5..9b606f172f80 100644 65 | --- a/drivers/video/backlight/Kconfig 66 | +++ b/drivers/video/backlight/Kconfig 67 | @@ -135,6 +135,12 @@ config LCD_OTM3225A 68 | If you have a panel based on the OTM3225A controller 69 | chip then say y to include a driver for it. 70 | 71 | +config LCD_KD027 72 | + tristate "STARTEK KD027 LCD Driver" 73 | + help 74 | + If you have a KD027 LCD panel, say Y to enable its LCD control 75 | + driver. 76 | + 77 | endif # LCD_CLASS_DEVICE 78 | 79 | # 80 | @@ -464,6 +470,12 @@ config BACKLIGHT_LED 81 | If you have a LCD backlight adjustable by LED class driver, say Y 82 | to enable this driver. 83 | 84 | +config BACKLIGHT_OCP8178 85 | + tristate "OCP8178 Backlight Driver" 86 | + depends on GPIOLIB 87 | + help 88 | + If you have an OCP8178, say Y to enable the backlight driver. 89 | + 90 | endif # BACKLIGHT_CLASS_DEVICE 91 | 92 | endmenu 93 | diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile 94 | index cae2c83422ae..7eaf58dda80f 100644 95 | --- a/drivers/video/backlight/Makefile 96 | +++ b/drivers/video/backlight/Makefile 97 | @@ -17,6 +17,7 @@ obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o 98 | obj-$(CONFIG_LCD_TDO24M) += tdo24m.o 99 | obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o 100 | obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o 101 | +obj-$(CONFIG_LCD_KD027) += kd027_lcd.o 102 | 103 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o 104 | obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o 105 | @@ -58,3 +59,4 @@ obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o 106 | obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o 107 | obj-$(CONFIG_BACKLIGHT_RAVE_SP) += rave-sp-backlight.o 108 | obj-$(CONFIG_BACKLIGHT_LED) += led_bl.o 109 | +obj-$(CONFIG_BACKLIGHT_OCP8178) += ocp8178_bl.o 110 | diff --git a/drivers/video/backlight/kd027_lcd.c b/drivers/video/backlight/kd027_lcd.c 111 | new file mode 100644 112 | index 000000000000..24abec39d3bd 113 | --- /dev/null 114 | +++ b/drivers/video/backlight/kd027_lcd.c 115 | @@ -0,0 +1,250 @@ 116 | +/* 117 | + * kd027_lcd.c 118 | + * 119 | + * This program is free software; you can redistribute it and/or modify 120 | + * it under the terms of the GNU General Public License as published by 121 | + * the Free Software Foundation; either version 2 of the License, or 122 | + * (at your option) any later version. 123 | + * 124 | + * 125 | + * 126 | + */ 127 | + 128 | +#include /* Only for legacy support */ 129 | +#include 130 | +#include 131 | +#include 132 | +#include 133 | +#include 134 | +#include 135 | +#include 136 | +#include 137 | +#include 138 | +#include 139 | +#include 140 | +#include 141 | +#include 142 | +#include 143 | +#include 144 | +#include 145 | +#include 146 | +#include 147 | +#include 148 | + 149 | +struct kd027_lcd { 150 | + struct gpio_desc* rst_pin; 151 | + struct gpio_desc* cs_pin; 152 | + struct gpio_desc* sck_pin; 153 | + struct gpio_desc* sda_pin; 154 | + unsigned char init_seq[100]; 155 | + unsigned char suspend_seq[20]; 156 | + unsigned char resume_seq[20]; 157 | + int init_seq_len; 158 | + int suspend_seq_len; 159 | + int resume_seq_len; 160 | +}; 161 | + 162 | +struct kd027_lcd * lcd_data; 163 | + 164 | +static void kd027_write_lcd(unsigned char data) 165 | +{ 166 | + unsigned char i; 167 | + 168 | + for(i = 0; i < 8; i++) { 169 | + if (data & 0x80) 170 | + gpiod_set_value(lcd_data->sda_pin, 1); 171 | + else 172 | + gpiod_set_value(lcd_data->sda_pin, 0); 173 | + gpiod_set_value(lcd_data->sck_pin, 0); 174 | + gpiod_set_value(lcd_data->sck_pin, 1); 175 | + data <<= 1; 176 | + } 177 | +} 178 | + 179 | +static void kd027_write_cmd_data(unsigned char c, unsigned char d) 180 | +{ 181 | + gpiod_set_value(lcd_data->cs_pin, 0); 182 | + kd027_write_lcd(c); 183 | + kd027_write_lcd(d); 184 | + gpiod_set_value(lcd_data->cs_pin, 1); 185 | +} 186 | + 187 | +static void kd027_init(void) 188 | +{ 189 | + int i; 190 | + for(i = 0; i < lcd_data->init_seq_len/2; i++) { 191 | + kd027_write_cmd_data(lcd_data->init_seq[i * 2], lcd_data->init_seq[i * 2 + 1]); 192 | + } 193 | +} 194 | + 195 | +#ifdef CONFIG_PROC_FS 196 | +static char global_buffer[64]; 197 | + 198 | +static int kd027_proc_show(struct seq_file *m, void *v) 199 | +{ 200 | + seq_printf(m, "kd027\n"); 201 | + return 0; 202 | +} 203 | + 204 | +static int kd027_proc_open(struct inode *inode, struct file *file) 205 | +{ 206 | + return single_open(file, kd027_proc_show, NULL); 207 | +} 208 | + 209 | +static ssize_t kd027_proc_read(struct file * file, char __user * buf, size_t size, loff_t * loff) 210 | +{ 211 | + return 0; 212 | +} 213 | + 214 | +static ssize_t kd027_proc_write(struct file * file, const char __user * buf, size_t size, loff_t * loff) 215 | +{ 216 | + int cmd, data; 217 | + char* tmp; 218 | + 219 | + if(copy_from_user(global_buffer, buf, size)) 220 | + return -EFAULT; 221 | + 222 | + global_buffer[size] = 0; 223 | + cmd = simple_strtol(global_buffer, 0, 16); 224 | + tmp = strchr(global_buffer, ' '); 225 | + if(tmp) { 226 | + data = simple_strtol(tmp+1, 0, 16); 227 | + kd027_write_cmd_data(cmd, data); 228 | + } 229 | + 230 | + return size; 231 | +} 232 | + 233 | +static const struct proc_ops kd027_proc_fops = { 234 | + .proc_open = kd027_proc_open, 235 | + .proc_read = kd027_proc_read, 236 | + .proc_write = kd027_proc_write, 237 | + .proc_lseek = seq_lseek, 238 | + .proc_release = single_release, 239 | +}; 240 | + 241 | +static int __init kd027_proc_init(void) 242 | +{ 243 | + struct proc_dir_entry *r; 244 | + 245 | + r = proc_create("driver/lcd", S_IRWXUGO, NULL, &kd027_proc_fops); 246 | + if (!r) 247 | + return -ENOMEM; 248 | + return 0; 249 | +} 250 | +#else 251 | +static inline int kd027_proc_init(void) { return 0; } 252 | +#endif /* CONFIG_PROC_FS */ 253 | + 254 | +static int kd027_probe(struct platform_device *pdev) 255 | +{ 256 | + int ret; 257 | + struct device_node *np = pdev->dev.of_node; 258 | + struct device *dev = &pdev->dev; 259 | + 260 | + if ( !np) { 261 | + dev_err(&pdev->dev, 262 | + "failed to find platform data or device tree node.\n"); 263 | + return -ENODEV; 264 | + } 265 | + 266 | + lcd_data = devm_kzalloc(&pdev->dev, sizeof(*lcd_data), GFP_KERNEL); 267 | + if (lcd_data == NULL) 268 | + return -ENOMEM; 269 | + 270 | + lcd_data->init_seq_len = of_property_read_variable_u8_array(np, "init-seq", lcd_data->init_seq, 1, 100); 271 | + lcd_data->suspend_seq_len = of_property_read_variable_u8_array(np, "suspend-seq", lcd_data->suspend_seq, 1, 20); 272 | + lcd_data->resume_seq_len = of_property_read_variable_u8_array(np, "resume-seq", lcd_data->resume_seq, 1, 20); 273 | + 274 | + lcd_data->rst_pin = devm_gpiod_get(dev, "lcd-rst", GPIOD_OUT_HIGH); 275 | + if (IS_ERR(lcd_data->rst_pin)) { 276 | + ret = PTR_ERR(lcd_data->rst_pin); 277 | + 278 | + if (ret != -EPROBE_DEFER) { 279 | + dev_err(dev, 280 | + "Error: The gpios parameter is missing or invalid.\n"); 281 | + } 282 | + return ret; 283 | + } 284 | + 285 | + lcd_data->cs_pin = devm_gpiod_get(dev, "lcd-cs", GPIOD_OUT_HIGH); 286 | + if (IS_ERR(lcd_data->cs_pin)) { 287 | + ret = PTR_ERR(lcd_data->cs_pin); 288 | + 289 | + if (ret != -EPROBE_DEFER) { 290 | + dev_err(dev, 291 | + "Error: The gpios parameter is missing or invalid.\n"); 292 | + } 293 | + return ret; 294 | + } 295 | + 296 | + lcd_data->sck_pin = devm_gpiod_get(dev, "lcd-sck", GPIOD_OUT_HIGH); 297 | + if (IS_ERR(lcd_data->sck_pin)) { 298 | + ret = PTR_ERR(lcd_data->sck_pin); 299 | + 300 | + if (ret != -EPROBE_DEFER) { 301 | + dev_err(dev, 302 | + "Error: The gpios parameter is missing or invalid.\n"); 303 | + } 304 | + return ret; 305 | + } 306 | + 307 | + lcd_data->sda_pin = devm_gpiod_get(dev, "lcd-sda", GPIOD_OUT_HIGH); 308 | + if (IS_ERR(lcd_data->sda_pin)) { 309 | + ret = PTR_ERR(lcd_data->sda_pin); 310 | + 311 | + if (ret != -EPROBE_DEFER) { 312 | + dev_err(dev, 313 | + "Error: The gpios parameter is missing or invalid.\n"); 314 | + } 315 | + return ret; 316 | + } 317 | + 318 | + kd027_init(); 319 | + kd027_proc_init(); 320 | + 321 | + return 0; 322 | +} 323 | + 324 | +static int kd027_suspend(struct platform_device * pdev, pm_message_t state) 325 | +{ 326 | + int i; 327 | + for(i = 0; i < lcd_data->suspend_seq_len/2; i++) { 328 | + kd027_write_cmd_data(lcd_data->suspend_seq[i * 2], lcd_data->suspend_seq[i * 2 + 1]); 329 | + } 330 | + return 0; 331 | +} 332 | + 333 | +static int kd027_resume(struct platform_device * pdev) 334 | +{ 335 | + int i; 336 | + for(i = 0; i < lcd_data->resume_seq_len/2; i++) { 337 | + kd027_write_cmd_data(lcd_data->resume_seq[i * 2], lcd_data->resume_seq[i * 2 + 1]); 338 | + } 339 | + return 0; 340 | +} 341 | + 342 | +#ifdef CONFIG_OF 343 | +static struct of_device_id kd027_of_match[] = { 344 | + { .compatible = "kd027-lcd" }, 345 | + { /* sentinel */ } 346 | +}; 347 | + 348 | +MODULE_DEVICE_TABLE(of, kd027_of_match); 349 | +#endif 350 | + 351 | +static struct platform_driver kd027_device_driver = { 352 | + .probe = kd027_probe, 353 | + .suspend = kd027_suspend, 354 | + .resume = kd027_resume, 355 | + .driver = { 356 | + .name = "kd027-lcd", 357 | + .of_match_table = of_match_ptr(kd027_of_match), 358 | + }, 359 | +}; 360 | + 361 | +module_platform_driver(kd027_device_driver); 362 | + 363 | +MODULE_LICENSE("GPL"); 364 | +MODULE_DESCRIPTION("KD027 Driver"); 365 | + 366 | diff --git a/drivers/video/backlight/ocp8178_bl.c b/drivers/video/backlight/ocp8178_bl.c 367 | new file mode 100644 368 | index 000000000000..0ffb9e513e50 369 | --- /dev/null 370 | +++ b/drivers/video/backlight/ocp8178_bl.c 371 | @@ -0,0 +1,349 @@ 372 | +/* 373 | + * ocp8178_bl.c - ocp8178 backlight driver 374 | + * 375 | + * This program is free software; you can redistribute it and/or modify 376 | + * it under the terms of the GNU General Public License version 2 as 377 | + * published by the Free Software Foundation. 378 | + */ 379 | + 380 | +#include 381 | +#include 382 | +#include 383 | +#include /* Only for legacy support */ 384 | +#include 385 | +#include 386 | +#include 387 | +#include 388 | +#include 389 | +#include 390 | +#include 391 | +#include 392 | +#include 393 | +#include 394 | +#include 395 | +#include 396 | +#include 397 | +#include 398 | +#include 399 | +#include 400 | +#include 401 | +#include 402 | +#include 403 | + 404 | +struct ocp8178_backlight { 405 | + struct device *dev; 406 | + struct device *fbdev; 407 | + 408 | + struct gpio_desc *gpiod; 409 | + int def_value; 410 | + int current_value; 411 | +}; 412 | + 413 | +#define DETECT_DELAY 200 414 | +#define DETECT_TIME 500 415 | +#define DETECT_WINDOW_TIME 1000 416 | +#define START_TIME 10 417 | +#define END_TIME 10 418 | +#define SHUTDOWN_TIME 3000 419 | +#define LOW_BIT_HIGH_TIME 10 420 | +#define LOW_BIT_LOW_TIME 50 421 | +#define HIGH_BIT_HIGH_TIME 50 422 | +#define HIGH_BIT_LOW_TIME 10 423 | +#define MAX_BRIGHTNESS_VALUE 9 424 | + 425 | +static void entry_1wire_mode(struct ocp8178_backlight *gbl) 426 | +{ 427 | + unsigned long flags = 0; 428 | + local_irq_save(flags); 429 | + gpiod_set_value(gbl->gpiod, 0); 430 | + mdelay(SHUTDOWN_TIME/1000); 431 | + gpiod_set_value(gbl->gpiod, 1); 432 | + udelay(DETECT_DELAY); 433 | + gpiod_set_value(gbl->gpiod, 0); 434 | + udelay(DETECT_TIME); 435 | + gpiod_set_value(gbl->gpiod, 1); 436 | + udelay(DETECT_WINDOW_TIME); 437 | + local_irq_restore(flags); 438 | +} 439 | + 440 | +static inline void write_bit(struct ocp8178_backlight *gbl, int bit) 441 | +{ 442 | + if (bit) { 443 | + gpiod_set_value(gbl->gpiod, 0); 444 | + udelay(HIGH_BIT_LOW_TIME); 445 | + gpiod_set_value(gbl->gpiod, 1); 446 | + udelay(HIGH_BIT_HIGH_TIME); 447 | + } else { 448 | + gpiod_set_value(gbl->gpiod, 0); 449 | + udelay(LOW_BIT_LOW_TIME); 450 | + gpiod_set_value(gbl->gpiod, 1); 451 | + udelay(LOW_BIT_HIGH_TIME); 452 | + } 453 | +} 454 | + 455 | +static void write_byte(struct ocp8178_backlight *gbl, int byte) 456 | +{ 457 | + unsigned long flags = 0; 458 | + unsigned char data = 0x72; 459 | + int i; 460 | + 461 | + local_irq_save(flags); 462 | + 463 | + gpiod_set_value(gbl->gpiod, 1); 464 | + udelay(START_TIME); 465 | + for(i = 0; i < 8; i++) { 466 | + if(data & 0x80) { 467 | + write_bit(gbl, 1); 468 | + } else { 469 | + write_bit(gbl, 0); 470 | + } 471 | + data <<= 1; 472 | + } 473 | + gpiod_set_value(gbl->gpiod, 0); 474 | + udelay(END_TIME); 475 | + 476 | + data = byte & 0x1f; 477 | + 478 | + gpiod_set_value(gbl->gpiod, 1); 479 | + udelay(START_TIME); 480 | + for(i = 0; i < 8; i++) { 481 | + if(data & 0x80) { 482 | + write_bit(gbl, 1); 483 | + } else { 484 | + write_bit(gbl, 0); 485 | + } 486 | + data <<= 1; 487 | + } 488 | + gpiod_set_value(gbl->gpiod, 0); 489 | + udelay(END_TIME); 490 | + gpiod_set_value(gbl->gpiod, 1); 491 | + 492 | + local_irq_restore(flags); 493 | +} 494 | + 495 | +unsigned char ocp8178_bl_table[MAX_BRIGHTNESS_VALUE+1] = {0, 1, 4, 8, 12, 16, 20, 24, 28, 31}; 496 | + 497 | +static int ocp8178_update_status(struct backlight_device *bl) 498 | +{ 499 | + struct ocp8178_backlight *gbl = bl_get_data(bl); 500 | + int brightness = bl->props.brightness; 501 | + 502 | + if (bl->props.power != FB_BLANK_UNBLANK || 503 | + bl->props.fb_blank != FB_BLANK_UNBLANK || 504 | + bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 505 | + brightness = 0; 506 | + 507 | + if(brightness > MAX_BRIGHTNESS_VALUE) { 508 | + brightness = MAX_BRIGHTNESS_VALUE; 509 | + } 510 | + 511 | + write_byte(gbl, ocp8178_bl_table[brightness]); 512 | + gbl->current_value = brightness; 513 | + 514 | + return 0; 515 | +} 516 | + 517 | +static int ocp8178_get_brightness(struct backlight_device *bl) 518 | +{ 519 | + struct ocp8178_backlight *gbl = bl_get_data(bl); 520 | + return gbl->current_value; 521 | +} 522 | + 523 | +static int ocp8178_check_fb(struct backlight_device *bl, 524 | + struct fb_info *info) 525 | +{ 526 | + struct ocp8178_backlight *gbl = bl_get_data(bl); 527 | + return gbl->fbdev == NULL || gbl->fbdev == info->dev; 528 | +} 529 | + 530 | +static const struct backlight_ops ocp8178_backlight_ops = { 531 | + .options = BL_CORE_SUSPENDRESUME, 532 | + .update_status = ocp8178_update_status, 533 | + .get_brightness = ocp8178_get_brightness, 534 | + .check_fb = ocp8178_check_fb, 535 | +}; 536 | + 537 | +static int ocp8178_probe_dt(struct platform_device *pdev, 538 | + struct ocp8178_backlight *gbl) 539 | +{ 540 | + struct device *dev = &pdev->dev; 541 | + struct device_node *np = dev->of_node; 542 | + enum gpiod_flags flags; 543 | + int ret = 0; 544 | + u32 value32; 545 | + 546 | + of_property_read_u32(np, "default-brightness", &value32); 547 | + if(value32 > MAX_BRIGHTNESS_VALUE) 548 | + gbl->def_value = MAX_BRIGHTNESS_VALUE; 549 | + else 550 | + gbl->def_value = value32; 551 | + flags = gbl->def_value ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; 552 | + 553 | + gbl->gpiod = devm_gpiod_get(dev, "backlight-control", flags); 554 | + if (IS_ERR(gbl->gpiod)) { 555 | + ret = PTR_ERR(gbl->gpiod); 556 | + 557 | + if (ret != -EPROBE_DEFER) { 558 | + dev_err(dev, 559 | + "Error: The gpios parameter is missing or invalid.\n"); 560 | + } 561 | + } 562 | + 563 | + return ret; 564 | +} 565 | + 566 | +static struct backlight_device *backlight; 567 | + 568 | +#ifdef CONFIG_PROC_FS 569 | +static char global_buffer[64]; 570 | + 571 | +static int ocp8178_proc_show(struct seq_file *m, void *v) 572 | +{ 573 | + seq_printf(m, "ocp8178\n"); 574 | + return 0; 575 | +} 576 | + 577 | +static int ocp8178_proc_open(struct inode *inode, struct file *file) 578 | +{ 579 | + return single_open(file, ocp8178_proc_show, NULL); 580 | +} 581 | + 582 | +static int ocp8178_proc_read(struct file * file, char __user * buf, size_t size, loff_t * loff) 583 | +{ 584 | + int value, len; 585 | + struct backlight_device *bl = backlight; 586 | + value = ocp8178_get_brightness(bl); 587 | + len = snprintf(global_buffer, sizeof(global_buffer), "%d\n", value); 588 | + return simple_read_from_buffer(buf, size, loff, global_buffer, len); 589 | +} 590 | + 591 | +static int ocp8178_proc_write(struct file * file, const char __user * buf, size_t size, loff_t * loff) 592 | +{ 593 | + int data; 594 | + struct backlight_device *bl = backlight; 595 | + 596 | + if(copy_from_user(global_buffer, buf, size)) 597 | + return -EFAULT; 598 | + 599 | + global_buffer[size] = 0; 600 | + if(global_buffer[0] == '+') { 601 | + bl->props.brightness = (bl->props.brightness + 1) % (MAX_BRIGHTNESS_VALUE + 1); 602 | + } else if(global_buffer[0] == '-') { 603 | + bl->props.brightness = (bl->props.brightness + MAX_BRIGHTNESS_VALUE) % (MAX_BRIGHTNESS_VALUE + 1); 604 | + } else { 605 | + data = simple_strtol(global_buffer, 0, 10); 606 | + if(data < 0) { 607 | + bl->props.brightness = 0; 608 | + } else if(data > MAX_BRIGHTNESS_VALUE) { 609 | + bl->props.brightness = MAX_BRIGHTNESS_VALUE; 610 | + } else { 611 | + bl->props.brightness = data; 612 | + } 613 | + } 614 | + backlight_update_status(bl); 615 | + 616 | + return size; 617 | +} 618 | + 619 | +static const struct proc_ops ocp8178_proc_fops = { 620 | + .proc_open = ocp8178_proc_open, 621 | + .proc_read = ocp8178_proc_read, 622 | + .proc_write = ocp8178_proc_write, 623 | + .proc_lseek = seq_lseek, 624 | + .proc_release = single_release, 625 | +}; 626 | + 627 | +static int __init ocp8178_proc_init(void) 628 | +{ 629 | + struct proc_dir_entry *r; 630 | + 631 | + r = proc_create("driver/backlight", S_IRWXUGO, NULL, &ocp8178_proc_fops); 632 | + if (!r) 633 | + return -ENOMEM; 634 | + return 0; 635 | +} 636 | +#else 637 | +static inline int ocp8178_proc_init(void) { return 0; } 638 | +#endif /* CONFIG_PROC_FS */ 639 | + 640 | +static int ocp8178_probe(struct platform_device *pdev) 641 | +{ 642 | + struct backlight_properties props; 643 | + struct backlight_device *bl; 644 | + struct ocp8178_backlight *gbl; 645 | + struct device_node *np = pdev->dev.of_node; 646 | + int ret; 647 | + 648 | + if ( !np) { 649 | + dev_err(&pdev->dev, 650 | + "failed to find platform data or device tree node.\n"); 651 | + return -ENODEV; 652 | + } 653 | + 654 | + gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL); 655 | + if (gbl == NULL) 656 | + return -ENOMEM; 657 | + 658 | + gbl->dev = &pdev->dev; 659 | + 660 | + ret = ocp8178_probe_dt(pdev, gbl); 661 | + if (ret) 662 | + return ret; 663 | + 664 | + gbl->current_value = gbl->def_value; 665 | + 666 | + memset(&props, 0, sizeof(props)); 667 | + props.type = BACKLIGHT_RAW; 668 | + props.max_brightness = MAX_BRIGHTNESS_VALUE; 669 | + bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev), 670 | + &pdev->dev, gbl, &ocp8178_backlight_ops, 671 | + &props); 672 | + if (IS_ERR(bl)) { 673 | + dev_err(&pdev->dev, "failed to register backlight\n"); 674 | + return PTR_ERR(bl); 675 | + } 676 | + 677 | + entry_1wire_mode(gbl); 678 | + 679 | + bl->props.brightness = gbl->def_value; 680 | + backlight_update_status(bl); 681 | + 682 | + platform_set_drvdata(pdev, bl); 683 | + 684 | + backlight = bl; 685 | + ocp8178_proc_init(); 686 | + 687 | + return 0; 688 | +} 689 | + 690 | +static int ocp8178_suspend(struct platform_device *pdev, pm_message_t state) 691 | +{ 692 | + return 0; 693 | +} 694 | + 695 | +static int ocp8178_resume(struct platform_device *pdev) 696 | +{ 697 | + return 0; 698 | +} 699 | + 700 | +static struct of_device_id ocp8178_of_match[] = { 701 | + { .compatible = "ocp8178-backlight" }, 702 | + { /* sentinel */ } 703 | +}; 704 | + 705 | +MODULE_DEVICE_TABLE(of, ocp8178_of_match); 706 | + 707 | +static struct platform_driver ocp8178_driver = { 708 | + .driver = { 709 | + .name = "ocp8178-backlight", 710 | + .of_match_table = of_match_ptr(ocp8178_of_match), 711 | + }, 712 | + .probe = ocp8178_probe, 713 | + .suspend = ocp8178_suspend, 714 | + .resume = ocp8178_resume, 715 | +}; 716 | + 717 | +module_platform_driver(ocp8178_driver); 718 | + 719 | +MODULE_DESCRIPTION("OCP8178 Driver"); 720 | +MODULE_LICENSE("GPL"); 721 | diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c 722 | index e035a63bbe5b..b2eb9cf314fb 100644 723 | --- a/drivers/video/fbdev/core/fbcon.c 724 | +++ b/drivers/video/fbdev/core/fbcon.c 725 | @@ -357,6 +357,7 @@ static int get_color(struct vc_data *vc, struct fb_info *info, 726 | 727 | static void fb_flashcursor(struct work_struct *work) 728 | { 729 | +#if 0 730 | struct fb_info *info = container_of(work, struct fb_info, queue); 731 | struct fbcon_ops *ops = info->fbcon_par; 732 | struct vc_data *vc = NULL; 733 | @@ -387,6 +388,7 @@ static void fb_flashcursor(struct work_struct *work) 734 | ops->cursor(vc, info, mode, get_color(vc, info, c, 1), 735 | get_color(vc, info, c, 0)); 736 | console_unlock(); 737 | +#endif 738 | } 739 | 740 | static void cursor_timer_handler(struct timer_list *t) 741 | @@ -1319,6 +1321,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int bottom_only) 742 | 743 | static void fbcon_cursor(struct vc_data *vc, int mode) 744 | { 745 | +#if 0 746 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; 747 | struct fbcon_ops *ops = info->fbcon_par; 748 | int c = scr_readw((u16 *) vc->vc_pos); 749 | @@ -1340,6 +1343,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode) 750 | 751 | ops->cursor(vc, info, mode, get_color(vc, info, c, 1), 752 | get_color(vc, info, c, 0)); 753 | +#endif 754 | } 755 | 756 | static int scrollback_phys_max = 0; 757 | diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c 758 | index 528c87ff14d8..21ae9491051c 100644 759 | --- a/drivers/video/fbdev/core/fbmem.c 760 | +++ b/drivers/video/fbdev/core/fbmem.c 761 | @@ -524,6 +524,9 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, 762 | 763 | image.width = logo->width; 764 | image.height = logo->height; 765 | + image.dx = (info->var.xres/2) - (logo->width/2); 766 | + image.dy = (info->var.yres/2) - (logo->height/2); 767 | + n = 1; 768 | 769 | if (rotate) { 770 | logo_rotate = kmalloc_array(logo->width, logo->height, 771 | -------------------------------------------------------------------------------- /v0.6/515_dts.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile 2 | index 7a72fc636a7a..fa7ad973969c 100644 3 | --- a/arch/arm/boot/dts/Makefile 4 | +++ b/arch/arm/boot/dts/Makefile 5 | @@ -1267,6 +1267,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \ 6 | sun8i-h3-zeropi.dtb \ 7 | sun8i-h3-emlid-neutis-n5h3-devboard.dtb \ 8 | sun8i-r16-bananapi-m2m.dtb \ 9 | + sun8i-r16-clockworkpi-cpi3.dtb \ 10 | + sun8i-r16-clockworkpi-cpi3-hdmi.dtb \ 11 | sun8i-r16-nintendo-nes-classic.dtb \ 12 | sun8i-r16-nintendo-super-nes-classic.dtb \ 13 | sun8i-r16-parrot.dtb \ 14 | diff --git a/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts 15 | new file mode 100644 16 | index 000000000000..e2c15df25b30 17 | --- /dev/null 18 | +++ b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3-hdmi.dts 19 | @@ -0,0 +1,380 @@ 20 | +/* 21 | + * Copyright (c) 2018 Clockwork 22 | + * 23 | + * This file is dual-licensed: you can use it either under the terms 24 | + * of the GPL or the X11 license, at your option. Note that this dual 25 | + * licensing only applies to this file, and not this project as a 26 | + * whole. 27 | + * 28 | + * a) This file is free software; you can redistribute it and/or 29 | + * modify it under the terms of the GNU General Public License as 30 | + * published by the Free Software Foundation; either version 2 of the 31 | + * License, or (at your option) any later version. 32 | + * 33 | + * This file is distributed in the hope that it will be useful, 34 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | + * GNU General Public License for more details. 37 | + * 38 | + * Or, alternatively, 39 | + * 40 | + * b) Permission is hereby granted, free of charge, to any person 41 | + * obtaining a copy of this software and associated documentation 42 | + * files (the "Software"), to deal in the Software without 43 | + * restriction, including without limitation the rights to use, 44 | + * copy, modify, merge, publish, distribute, sublicense, and/or 45 | + * sell copies of the Software, and to permit persons to whom the 46 | + * Software is furnished to do so, subject to the following 47 | + * conditions: 48 | + * 49 | + * The above copyright notice and this permission notice shall be 50 | + * included in all copies or substantial portions of the Software. 51 | + * 52 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 53 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 54 | + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 55 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 56 | + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 57 | + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 58 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 59 | + * OTHER DEALINGS IN THE SOFTWARE. 60 | + */ 61 | + 62 | +/dts-v1/; 63 | +#include "sun8i-a33.dtsi" 64 | +#include "sunxi-common-regulators.dtsi" 65 | + 66 | +#include 67 | +#include 68 | + 69 | +/ { 70 | + model = "Clockwork CPI3"; 71 | + compatible = "clockwork,clockworkpi-cpi3", "allwinner,sun8i-a33"; 72 | + 73 | + aliases { 74 | + serial0 = &uart0; 75 | + mmc0 = &mmc0; 76 | + mmc1 = &mmc1; 77 | + }; 78 | + 79 | + chosen { 80 | + stdout-path = "serial0:115200n8"; 81 | + }; 82 | + 83 | + leds { 84 | + compatible = "gpio-leds"; 85 | + pinctrl-names = "default"; 86 | + pinctrl-0 = <&led_pins>; 87 | + 88 | + led1 { 89 | + label = "led1"; 90 | + gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; /* PB7 */ 91 | + }; 92 | + }; 93 | + 94 | + wifi_pwrseq: wifi_pwrseq { 95 | + compatible = "mmc-pwrseq-simple"; 96 | + reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ 97 | + }; 98 | + 99 | + rfkill_gpio: rfkill_gpio { 100 | + compatible = "rfkill_gpio"; 101 | + type = "bluetooth"; 102 | + pinctrl-names = "default"; 103 | + pinctrl-0 = <&bt_control_pin>; 104 | + reset-gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ 105 | + shutdown-gpio = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ 106 | + }; 107 | + 108 | + panel { 109 | + compatible = "clockwork,cpi3-hdmi"; 110 | + 111 | + ports { 112 | + #address-cells = <1>; 113 | + #size-cells = <0>; 114 | + port@0 { 115 | + #address-cells = <1>; 116 | + #size-cells = <0>; 117 | + reg = <0>; 118 | + 119 | + rgb_input: endpoint@0 { 120 | + reg = <0>; 121 | + remote-endpoint = <&tcon0_out_rgb>; 122 | + }; 123 | + }; 124 | + }; 125 | + }; 126 | +}; 127 | + 128 | +&codec { 129 | + pinctrl-names = "default"; 130 | + pinctrl-0 = <&hdmi_i2s_pins>; 131 | + status = "okay"; 132 | +}; 133 | + 134 | +&dai { 135 | + status = "okay"; 136 | +}; 137 | + 138 | +&sound { 139 | + simple-audio-card,routing = 140 | + "AIF2 ADCL Stereo Mux", "AIF2 ADCL", 141 | + "AIF1 DA0L", "AIF1 DA0L Stereo Mux", 142 | + "AIF2 ADCR Stereo Mux", "AIF2 ADCR", 143 | + "AIF1 DA0R", "AIF1 DA0R Stereo Mux"; 144 | + 145 | + status = "okay"; 146 | +}; 147 | + 148 | +&link_codec { 149 | + sound-dai = <&codec 1>; 150 | +}; 151 | + 152 | +&de { 153 | + status = "okay"; 154 | +}; 155 | + 156 | +&tcon0 { 157 | + status = "okay"; 158 | +}; 159 | + 160 | +&tcon0_out { 161 | + tcon0_out_rgb: endpoint@0 { 162 | + reg = <0>; 163 | + remote-endpoint = <&rgb_input>; 164 | + }; 165 | +}; 166 | + 167 | +&ehci0 { 168 | + status = "okay"; 169 | +}; 170 | + 171 | +&mmc0 { 172 | + pinctrl-names = "default"; 173 | + pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>; 174 | + vmmc-supply = <®_dcdc1>; 175 | + cd-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 */ 176 | + bus-width = <4>; 177 | + status = "okay"; 178 | +}; 179 | + 180 | +&mmc1 { 181 | + pinctrl-names = "default"; 182 | + pinctrl-0 = <&mmc1_pg_pins>, <&wifi_reset_pin>; 183 | + vmmc-supply = <®_aldo1>; 184 | + mmc-pwrseq = <&wifi_pwrseq>; 185 | + bus-width = <4>; 186 | + non-removable; 187 | + keep-power-in-suspend; 188 | + status = "okay"; 189 | +}; 190 | + 191 | +&ohci0 { 192 | + status = "okay"; 193 | +}; 194 | + 195 | +&pio { 196 | + mmc0_cd_pin: mmc0_cd_pin@0 { 197 | + pins = "PB3"; 198 | + function = "gpio_in"; 199 | + bias-pull-up; 200 | + }; 201 | + 202 | + hdmi_i2s_pins: hdmi_i2s_pins@0 { 203 | + pins = "PB4", "PB5", "PB6"; 204 | + function = "aif2"; 205 | + }; 206 | + 207 | + led_pins: led_pins@0 { 208 | + pins = "PB7"; 209 | + function = "gpio_out"; 210 | + }; 211 | +}; 212 | + 213 | +&r_pio { 214 | + usb1_vbus_pin: usb1_vbus_pin@0 { 215 | + pins = "PL2"; 216 | + function = "gpio_out"; 217 | + }; 218 | + 219 | + usb0_id_det: usb0_id_detect_pin@0 { 220 | + pins = "PL4"; 221 | + function = "gpio_in"; 222 | + bias-pull-up; 223 | + }; 224 | + 225 | + wifi_reset_pin: wifi_reset_pin@0 { 226 | + pins = "PL6"; 227 | + function = "gpio_out"; 228 | + }; 229 | + 230 | + bt_control_pin: bt_control_pin@0 { 231 | + pins = "PL8", "PL10"; 232 | + function = "gpio_out"; 233 | + }; 234 | +}; 235 | + 236 | +&r_rsb { 237 | + status = "okay"; 238 | + 239 | + axp22x: pmic@3a3 { 240 | + compatible = "x-powers,axp223"; 241 | + reg = <0x3a3>; 242 | + interrupt-parent = <&r_intc>; 243 | + interrupts = ; 244 | + drivevbus-supply = <®_vcc5v0>; 245 | + x-powers,drive-vbus-en; 246 | + }; 247 | +}; 248 | + 249 | +#include "axp223.dtsi" 250 | + 251 | +®_aldo1 { 252 | + regulator-always-on; 253 | + regulator-min-microvolt = <3000000>; 254 | + regulator-max-microvolt = <3000000>; 255 | + regulator-name = "vcc-io"; 256 | +}; 257 | + 258 | +®_aldo2 { 259 | + regulator-always-on; 260 | + regulator-min-microvolt = <2500000>; 261 | + regulator-max-microvolt = <2500000>; 262 | + regulator-name = "vdd-dll"; 263 | +}; 264 | + 265 | +®_aldo3 { 266 | + regulator-always-on; 267 | + regulator-min-microvolt = <3000000>; 268 | + regulator-max-microvolt = <3000000>; 269 | + regulator-name = "vcc-pll-avcc"; 270 | +}; 271 | + 272 | +®_dc5ldo { 273 | + regulator-always-on; 274 | + regulator-min-microvolt = <1100000>; 275 | + regulator-max-microvolt = <1100000>; 276 | + regulator-name = "vdd-cpus"; 277 | +}; 278 | + 279 | +®_dcdc1 { 280 | + regulator-always-on; 281 | + regulator-min-microvolt = <3000000>; 282 | + regulator-max-microvolt = <3000000>; 283 | + regulator-name = "vcc-3v0"; 284 | +}; 285 | + 286 | +®_dcdc2 { 287 | + regulator-always-on; 288 | + regulator-min-microvolt = <1100000>; 289 | + regulator-max-microvolt = <1100000>; 290 | + regulator-name = "vdd-sys"; 291 | +}; 292 | + 293 | +®_dcdc3 { 294 | + regulator-always-on; 295 | + regulator-min-microvolt = <1200000>; 296 | + regulator-max-microvolt = <1200000>; 297 | + regulator-name = "vdd-cpu"; 298 | +}; 299 | + 300 | +®_dcdc5 { 301 | + regulator-always-on; 302 | + regulator-min-microvolt = <1500000>; 303 | + regulator-max-microvolt = <1500000>; 304 | + regulator-name = "vcc-dram"; 305 | +}; 306 | + 307 | +®_dldo1 { 308 | + /* 309 | + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. 310 | + * Remove next line once it is possible to sync two regulators. 311 | + */ 312 | + regulator-always-on; 313 | + regulator-min-microvolt = <3300000>; 314 | + regulator-max-microvolt = <3300000>; 315 | + regulator-name = "vcc-wifi0"; 316 | +}; 317 | + 318 | +®_dldo2 { 319 | + /* 320 | + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. 321 | + * Remove next line once it is possible to sync two regulators. 322 | + */ 323 | + regulator-always-on; 324 | + regulator-min-microvolt = <3300000>; 325 | + regulator-max-microvolt = <3300000>; 326 | + regulator-name = "vcc-wifi1"; 327 | +}; 328 | + 329 | +®_dldo3 { 330 | + regulator-always-on; 331 | + regulator-min-microvolt = <3300000>; 332 | + regulator-max-microvolt = <3300000>; 333 | + regulator-name = "vcc-amp"; 334 | +}; 335 | + 336 | +®_dldo4 { 337 | + /* 338 | + * TODO: WiFi chip needs dldo1 AND dldo2 AND dldo4 to be on to be powered. 339 | + * Remove next line once it is possible to sync two regulators. 340 | + */ 341 | + regulator-always-on; 342 | + regulator-min-microvolt = <3300000>; 343 | + regulator-max-microvolt = <3300000>; 344 | + regulator-name = "vcc-wifi2"; 345 | +}; 346 | + 347 | +®_drivevbus { 348 | + regulator-name = "usb0-vbus"; 349 | + status = "okay"; 350 | +}; 351 | + 352 | +®_eldo1 { 353 | + regulator-always-on; 354 | + regulator-min-microvolt = <3300000>; 355 | + regulator-max-microvolt = <3300000>; 356 | + regulator-name = "vcc-hdmi"; 357 | +}; 358 | + 359 | +®_usb1_vbus { 360 | + pinctrl-names = "default"; 361 | + pinctrl-0 = <&usb1_vbus_pin>; 362 | + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ 363 | + status = "okay"; 364 | +}; 365 | + 366 | +&battery_power_supply { 367 | + status = "okay"; 368 | +}; 369 | + 370 | +&uart0 { 371 | + pinctrl-names = "default"; 372 | + pinctrl-0 = <&uart0_pb_pins>; 373 | + status = "okay"; 374 | +}; 375 | + 376 | +&uart1 { 377 | + pinctrl-names = "default"; 378 | + pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; 379 | + status = "okay"; 380 | +}; 381 | + 382 | +&usb_otg { 383 | + dr_mode = "otg"; 384 | + status = "okay"; 385 | +}; 386 | + 387 | +&usb_power_supply { 388 | + status = "okay"; 389 | +}; 390 | + 391 | +&usbphy { 392 | + status = "okay"; 393 | + pinctrl-names = "default"; 394 | + pinctrl-0 = <&usb0_id_det>; 395 | + usb0_vbus-supply = <®_drivevbus>; 396 | + usb0_id_det-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ 397 | + usb0_vbus_power-supply = <&usb_power_supply>; 398 | + usb1_vbus-supply = <®_usb1_vbus>; 399 | +}; 400 | diff --git a/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts 401 | new file mode 100644 402 | index 000000000000..a3e04b8adf8d 403 | --- /dev/null 404 | +++ b/arch/arm/boot/dts/sun8i-r16-clockworkpi-cpi3.dts 405 | @@ -0,0 +1,399 @@ 406 | +/* 407 | + * Copyright (c) 2018 Clockwork 408 | + * 409 | + * This file is dual-licensed: you can use it either under the terms 410 | + * of the GPL or the X11 license, at your option. Note that this dual 411 | + * licensing only applies to this file, and not this project as a 412 | + * whole. 413 | + * 414 | + * a) This file is free software; you can redistribute it and/or 415 | + * modify it under the terms of the GNU General Public License as 416 | + * published by the Free Software Foundation; either version 2 of the 417 | + * License, or (at your option) any later version. 418 | + * 419 | + * This file is distributed in the hope that it will be useful, 420 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 421 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 422 | + * GNU General Public License for more details. 423 | + * 424 | + * Or, alternatively, 425 | + * 426 | + * b) Permission is hereby granted, free of charge, to any person 427 | + * obtaining a copy of this software and associated documentation 428 | + * files (the "Software"), to deal in the Software without 429 | + * restriction, including without limitation the rights to use, 430 | + * copy, modify, merge, publish, distribute, sublicense, and/or 431 | + * sell copies of the Software, and to permit persons to whom the 432 | + * Software is furnished to do so, subject to the following 433 | + * conditions: 434 | + * 435 | + * The above copyright notice and this permission notice shall be 436 | + * included in all copies or substantial portions of the Software. 437 | + * 438 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 439 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 440 | + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 441 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 442 | + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 443 | + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 444 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 445 | + * OTHER DEALINGS IN THE SOFTWARE. 446 | + */ 447 | + 448 | +/dts-v1/; 449 | +#include "sun8i-a33.dtsi" 450 | +#include "sunxi-common-regulators.dtsi" 451 | + 452 | +#include 453 | +#include 454 | + 455 | +/ { 456 | + model = "Clockwork CPI3"; 457 | + compatible = "clockwork,clockworkpi-cpi3", "allwinner,sun8i-a33"; 458 | + 459 | + aliases { 460 | + serial0 = &uart0; 461 | + mmc0 = &mmc0; 462 | + mmc1 = &mmc1; 463 | + }; 464 | + 465 | + chosen { 466 | + stdout-path = "serial0:115200n8"; 467 | + }; 468 | + 469 | + leds { 470 | + compatible = "gpio-leds"; 471 | + pinctrl-names = "default"; 472 | + pinctrl-0 = <&led_pins>; 473 | + 474 | + led1 { 475 | + label = "led1"; 476 | + gpios = <&pio 1 7 GPIO_ACTIVE_LOW>; /* PB7 */ 477 | + }; 478 | + }; 479 | + 480 | + wifi_pwrseq: wifi_pwrseq { 481 | + compatible = "mmc-pwrseq-simple"; 482 | + reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ 483 | + }; 484 | + 485 | + rfkill_gpio: rfkill_gpio { 486 | + compatible = "rfkill_gpio"; 487 | + type = "bluetooth"; 488 | + pinctrl-names = "default"; 489 | + pinctrl-0 = <&bt_control_pin>; 490 | + reset-gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ 491 | + shutdown-gpio = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ 492 | + }; 493 | + 494 | + backlight { 495 | + compatible = "ocp8178-backlight"; 496 | + pinctrl-names = "default"; 497 | + pinctrl-0 = <&backlight_control_pin>; 498 | + backlight-control-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ 499 | + default-brightness = <5>; 500 | + }; 501 | + 502 | + lcd { 503 | + compatible = "kd027-lcd"; 504 | + pinctrl-names = "default"; 505 | + pinctrl-0 = <&lcd_control_pin>; 506 | + lcd-rst-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */ 507 | + lcd-cs-gpios = <&pio 2 3 GPIO_ACTIVE_HIGH>; /* PC3 */ 508 | + lcd-sck-gpios = <&pio 2 2 GPIO_ACTIVE_HIGH>; /* PC2 */ 509 | + lcd-sda-gpios = <&pio 2 0 GPIO_ACTIVE_HIGH>; /* PC0 */ 510 | + init-seq = /bits/ 8 <0x2b 0x01 0x00 0x07 0x0c 0x27 0x16 0x04>; 511 | + suspend-seq = /bits/ 8 <0x2b 0x00>; 512 | + resume-seq = /bits/ 8 <0x2b 0x01>; 513 | + }; 514 | + 515 | + panel { 516 | + compatible = "clockwork,cpi3-lcd"; 517 | + 518 | + ports { 519 | + #address-cells = <1>; 520 | + #size-cells = <0>; 521 | + port@0 { 522 | + #address-cells = <1>; 523 | + #size-cells = <0>; 524 | + reg = <0>; 525 | + 526 | + rgb_input: endpoint@0 { 527 | + reg = <0>; 528 | + remote-endpoint = <&tcon0_out_rgb>; 529 | + }; 530 | + }; 531 | + }; 532 | + }; 533 | +}; 534 | + 535 | +&codec { 536 | + status = "okay"; 537 | +}; 538 | + 539 | +&dai { 540 | + status = "okay"; 541 | +}; 542 | + 543 | +&sound { 544 | + status = "okay"; 545 | +}; 546 | + 547 | +&codec_analog { 548 | + pinctrl-names = "default"; 549 | + pinctrl-0 = <&speaker_amplifier_pin>; 550 | + speaker-amplifier-gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>; /* PL3 */ 551 | + interrupts = ; 552 | +}; 553 | + 554 | +&de { 555 | + status = "okay"; 556 | +}; 557 | + 558 | +&tcon0 { 559 | + status = "okay"; 560 | +}; 561 | + 562 | +&tcon0_out { 563 | + tcon0_out_rgb: endpoint@0 { 564 | + reg = <0>; 565 | + remote-endpoint = <&rgb_input>; 566 | + }; 567 | +}; 568 | + 569 | +&ehci0 { 570 | + status = "okay"; 571 | +}; 572 | + 573 | +&mmc0 { 574 | + pinctrl-names = "default"; 575 | + pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>; 576 | + vmmc-supply = <®_dcdc1>; 577 | + cd-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 */ 578 | + bus-width = <4>; 579 | + status = "okay"; 580 | +}; 581 | + 582 | +&mmc1 { 583 | + pinctrl-names = "default"; 584 | + pinctrl-0 = <&mmc1_pg_pins>, <&wifi_reset_pin>; 585 | + vmmc-supply = <®_aldo1>; 586 | + mmc-pwrseq = <&wifi_pwrseq>; 587 | + bus-width = <4>; 588 | + non-removable; 589 | + keep-power-in-suspend; 590 | + status = "okay"; 591 | +}; 592 | + 593 | +&ohci0 { 594 | + status = "okay"; 595 | +}; 596 | + 597 | +&pio { 598 | + mmc0_cd_pin: mmc0_cd_pin@0 { 599 | + pins = "PB3"; 600 | + function = "gpio_in"; 601 | + bias-pull-up; 602 | + }; 603 | + 604 | + led_pins: led_pins@0 { 605 | + pins = "PB7"; 606 | + function = "gpio_out"; 607 | + }; 608 | + 609 | + lcd_control_pin: lcd_control_pin@0 { 610 | + pins = "PB2", "PC0", "PC2", "PC3"; 611 | + function = "gpio_out"; 612 | + }; 613 | + 614 | + backlight_control_pin: backlight_control_pin@0 { 615 | + pins = "PH1"; 616 | + function = "gpio_out"; 617 | + }; 618 | +}; 619 | + 620 | +&r_pio { 621 | + usb1_vbus_pin: usb1_vbus_pin@0 { 622 | + pins = "PL2"; 623 | + function = "gpio_out"; 624 | + }; 625 | + 626 | + speaker_amplifier_pin: speaker_amplifier_pin@0 { 627 | + pins = "PL3"; 628 | + function = "gpio_out"; 629 | + }; 630 | + 631 | + usb0_id_det: usb0_id_detect_pin@0 { 632 | + pins = "PL4"; 633 | + function = "gpio_in"; 634 | + bias-pull-up; 635 | + }; 636 | + 637 | + wifi_reset_pin: wifi_reset_pin@0 { 638 | + pins = "PL6"; 639 | + function = "gpio_out"; 640 | + }; 641 | + 642 | + bt_control_pin: bt_control_pin@0 { 643 | + pins = "PL8", "PL10"; 644 | + function = "gpio_out"; 645 | + }; 646 | +}; 647 | + 648 | +&r_rsb { 649 | + status = "okay"; 650 | + 651 | + axp22x: pmic@3a3 { 652 | + compatible = "x-powers,axp223"; 653 | + reg = <0x3a3>; 654 | + interrupt-parent = <&r_intc>; 655 | + interrupts = ; 656 | + drivevbus-supply = <®_vcc5v0>; 657 | + x-powers,drive-vbus-en; 658 | + }; 659 | +}; 660 | + 661 | +#include "axp223.dtsi" 662 | + 663 | +®_aldo1 { 664 | + regulator-always-on; 665 | + regulator-min-microvolt = <3000000>; 666 | + regulator-max-microvolt = <3000000>; 667 | + regulator-name = "vcc-io"; 668 | +}; 669 | + 670 | +®_aldo2 { 671 | + regulator-always-on; 672 | + regulator-min-microvolt = <2500000>; 673 | + regulator-max-microvolt = <2500000>; 674 | + regulator-name = "vdd-dll"; 675 | +}; 676 | + 677 | +®_aldo3 { 678 | + regulator-always-on; 679 | + regulator-min-microvolt = <3000000>; 680 | + regulator-max-microvolt = <3000000>; 681 | + regulator-name = "vcc-pll-avcc"; 682 | +}; 683 | + 684 | +®_dc5ldo { 685 | + regulator-always-on; 686 | + regulator-min-microvolt = <1100000>; 687 | + regulator-max-microvolt = <1100000>; 688 | + regulator-name = "vdd-cpus"; 689 | +}; 690 | + 691 | +®_dcdc1 { 692 | + regulator-always-on; 693 | + regulator-min-microvolt = <3000000>; 694 | + regulator-max-microvolt = <3000000>; 695 | + regulator-name = "vcc-3v0"; 696 | +}; 697 | + 698 | +®_dcdc2 { 699 | + regulator-always-on; 700 | + regulator-min-microvolt = <1100000>; 701 | + regulator-max-microvolt = <1100000>; 702 | + regulator-name = "vdd-sys"; 703 | +}; 704 | + 705 | +®_dcdc3 { 706 | + regulator-always-on; 707 | + regulator-min-microvolt = <1200000>; 708 | + regulator-max-microvolt = <1200000>; 709 | + regulator-name = "vdd-cpu"; 710 | +}; 711 | + 712 | +®_dcdc5 { 713 | + regulator-always-on; 714 | + regulator-min-microvolt = <1500000>; 715 | + regulator-max-microvolt = <1500000>; 716 | + regulator-name = "vcc-dram"; 717 | +}; 718 | + 719 | +®_dldo1 { 720 | + /* 721 | + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. 722 | + * Remove next line once it is possible to sync two regulators. 723 | + */ 724 | + regulator-always-on; 725 | + regulator-min-microvolt = <3300000>; 726 | + regulator-max-microvolt = <3300000>; 727 | + regulator-name = "vcc-wifi0"; 728 | +}; 729 | + 730 | +®_dldo2 { 731 | + /* 732 | + * TODO: WiFi chip needs dldo1 AND dldo2 to be on to be powered. 733 | + * Remove next line once it is possible to sync two regulators. 734 | + */ 735 | + regulator-always-on; 736 | + regulator-min-microvolt = <3300000>; 737 | + regulator-max-microvolt = <3300000>; 738 | + regulator-name = "vcc-wifi1"; 739 | +}; 740 | + 741 | +®_dldo3 { 742 | + regulator-always-on; 743 | + regulator-min-microvolt = <3300000>; 744 | + regulator-max-microvolt = <3300000>; 745 | + regulator-name = "vcc-amp"; 746 | +}; 747 | + 748 | +®_dldo4 { 749 | + /* 750 | + * TODO: WiFi chip needs dldo1 AND dldo2 AND dldo4 to be on to be powered. 751 | + * Remove next line once it is possible to sync two regulators. 752 | + */ 753 | + regulator-always-on; 754 | + regulator-min-microvolt = <3300000>; 755 | + regulator-max-microvolt = <3300000>; 756 | + regulator-name = "vcc-wifi2"; 757 | +}; 758 | + 759 | +®_drivevbus { 760 | + regulator-name = "usb0-vbus"; 761 | + status = "okay"; 762 | +}; 763 | + 764 | +®_usb1_vbus { 765 | + pinctrl-names = "default"; 766 | + pinctrl-0 = <&usb1_vbus_pin>; 767 | + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ 768 | + status = "okay"; 769 | +}; 770 | + 771 | +&battery_power_supply { 772 | + status = "okay"; 773 | +}; 774 | + 775 | +&uart0 { 776 | + pinctrl-names = "default"; 777 | + pinctrl-0 = <&uart0_pb_pins>; 778 | + status = "okay"; 779 | +}; 780 | + 781 | +&uart1 { 782 | + pinctrl-names = "default"; 783 | + pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; 784 | + status = "okay"; 785 | +}; 786 | + 787 | +&usb_otg { 788 | + dr_mode = "otg"; 789 | + status = "okay"; 790 | +}; 791 | + 792 | +&usb_power_supply { 793 | + status = "okay"; 794 | +}; 795 | + 796 | +&usbphy { 797 | + status = "okay"; 798 | + pinctrl-names = "default"; 799 | + pinctrl-0 = <&usb0_id_det>; 800 | + usb0_vbus-supply = <®_drivevbus>; 801 | + usb0_id_det-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ 802 | + usb0_vbus_power-supply = <&usb_power_supply>; 803 | + usb1_vbus-supply = <®_usb1_vbus>; 804 | +}; 805 | -------------------------------------------------------------------------------- /v0.6/515_power.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c 2 | index 9c6386b2af33..6cf1ddda0788 100644 3 | --- a/drivers/input/misc/axp20x-pek.c 4 | +++ b/drivers/input/misc/axp20x-pek.c 5 | @@ -215,10 +215,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr) 6 | * The power-button is connected to ground so a falling edge (dbf) 7 | * means it is pressed. 8 | */ 9 | - if (irq == axp20x_pek->irq_dbf) 10 | + if (irq == axp20x_pek->irq_dbf) { 11 | input_report_key(idev, KEY_POWER, true); 12 | - else if (irq == axp20x_pek->irq_dbr) 13 | + msleep(100); 14 | input_report_key(idev, KEY_POWER, false); 15 | + } 16 | + else if (irq == axp20x_pek->irq_dbr) { 17 | + } 18 | 19 | input_sync(idev); 20 | 21 | diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c 22 | index 092eb59a7d32..00ab1f315f6b 100644 23 | --- a/drivers/leds/leds-gpio.c 24 | +++ b/drivers/leds/leds-gpio.c 25 | @@ -26,6 +26,8 @@ struct gpio_led_data { 26 | gpio_blink_set_t platform_gpio_blink_set; 27 | }; 28 | 29 | +static int leds_gpio_proc_init(const char *name); 30 | + 31 | static inline struct gpio_led_data * 32 | cdev_to_gpio_led_data(struct led_classdev *led_cdev) 33 | { 34 | @@ -119,6 +121,8 @@ static int create_gpio_led(const struct gpio_led *template, 35 | &init_data); 36 | } 37 | 38 | + leds_gpio_proc_init(led_dat->cdev.name); 39 | + 40 | return ret; 41 | } 42 | 43 | @@ -127,6 +131,8 @@ struct gpio_leds_priv { 44 | struct gpio_led_data leds[]; 45 | }; 46 | 47 | +static struct gpio_leds_priv *leds_priv; 48 | + 49 | static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) 50 | { 51 | struct device *dev = &pdev->dev; 52 | @@ -181,6 +187,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev) 53 | priv->num_leds++; 54 | } 55 | 56 | + leds_priv = priv; 57 | return priv; 58 | } 59 | 60 | @@ -307,6 +314,82 @@ static struct platform_driver gpio_led_driver = { 61 | 62 | module_platform_driver(gpio_led_driver); 63 | 64 | +#ifdef CONFIG_PROC_FS 65 | + 66 | +#include 67 | +#include 68 | + 69 | +static char global_buffer[64]; 70 | + 71 | +static int leds_gpio_proc_show(struct seq_file *m, void *v) 72 | +{ 73 | + seq_printf(m, "leds_gpio\n"); 74 | + return 0; 75 | +} 76 | + 77 | +static int leds_gpio_proc_open(struct inode *inode, struct file *file) 78 | +{ 79 | + return single_open(file, leds_gpio_proc_show, NULL); 80 | +} 81 | + 82 | +static int leds_gpio_proc_read(struct file * file, char __user * buf, size_t size, loff_t * loff) 83 | +{ 84 | + int value, len, i; 85 | + 86 | + for(i = 0; i < leds_priv->num_leds; i++) { 87 | + if(strcmp(leds_priv->leds[i].cdev.name, file->f_path.dentry->d_iname) == 0) { 88 | + value = leds_priv->leds[i].cdev.brightness; 89 | + len = snprintf(global_buffer, sizeof(global_buffer), "%d\n", value); 90 | + return simple_read_from_buffer(buf, size, loff, global_buffer, len); 91 | + } 92 | + } 93 | + 94 | + return 0; 95 | +} 96 | + 97 | +static int leds_gpio_proc_write(struct file * file, const char __user * buf, size_t size, loff_t * loff) 98 | +{ 99 | + int value, i; 100 | + 101 | + if(copy_from_user(global_buffer, buf, size)) 102 | + return -EFAULT; 103 | + 104 | + global_buffer[size] = 0; 105 | + for(i = 0; i < leds_priv->num_leds; i++) { 106 | + if(strcmp(leds_priv->leds[i].cdev.name, file->f_path.dentry->d_iname) == 0) { 107 | + value = simple_strtol(global_buffer, 0, 10); 108 | + gpio_led_set(&leds_priv->leds[i].cdev, value); 109 | + leds_priv->leds[i].cdev.brightness = value; 110 | + break; 111 | + } 112 | + } 113 | + 114 | + return size; 115 | +} 116 | + 117 | +static const struct proc_ops leds_gpio_proc_fops = { 118 | + .proc_open = leds_gpio_proc_open, 119 | + .proc_read = leds_gpio_proc_read, 120 | + .proc_write = leds_gpio_proc_write, 121 | + .proc_lseek = seq_lseek, 122 | + .proc_release = single_release, 123 | +}; 124 | + 125 | +static int leds_gpio_proc_init(const char *name) 126 | +{ 127 | + struct proc_dir_entry *r; 128 | + char buf[50]; 129 | + 130 | + sprintf(buf, "driver/%s", name); 131 | + r = proc_create(buf, S_IRWXUGO, NULL, &leds_gpio_proc_fops); 132 | + if (!r) 133 | + return -ENOMEM; 134 | + return 0; 135 | +} 136 | +#else 137 | +static inline int leds_gpio_proc_init(const char *name) { return 0; } 138 | +#endif /* CONFIG_PROC_FS */ 139 | + 140 | MODULE_AUTHOR("Raphael Assenat , Trent Piepho "); 141 | MODULE_DESCRIPTION("GPIO LED driver"); 142 | MODULE_LICENSE("GPL"); 143 | diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c 144 | index 8161a5dc68e8..3b342db209dc 100644 145 | --- a/drivers/mfd/axp20x.c 146 | +++ b/drivers/mfd/axp20x.c 147 | @@ -203,8 +203,8 @@ static const struct resource axp803_usb_power_supply_resources[] = { 148 | }; 149 | 150 | static const struct resource axp22x_pek_resources[] = { 151 | - DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_RIS_EDGE, "PEK_DBR"), 152 | - DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_FAL_EDGE, "PEK_DBF"), 153 | + DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_SHORT, "PEK_DBR"), 154 | + DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_LONG, "PEK_DBF"), 155 | }; 156 | 157 | static const struct resource axp288_power_button_resources[] = { 158 | diff --git a/drivers/mfd/sun6i-prcm.c b/drivers/mfd/sun6i-prcm.c 159 | index ee03db0b8485..a8c833df4f05 100644 160 | --- a/drivers/mfd/sun6i-prcm.c 161 | +++ b/drivers/mfd/sun6i-prcm.c 162 | @@ -12,7 +12,7 @@ 163 | #include 164 | 165 | #define SUN8I_CODEC_ANALOG_BASE 0x1c0 166 | -#define SUN8I_CODEC_ANALOG_SIZE 0x4 167 | +#define SUN8I_CODEC_ANALOG_SIZE 0x10 168 | 169 | struct prcm_data { 170 | int nsubdevs; 171 | -------------------------------------------------------------------------------- /v0.6/515_sound.patch: -------------------------------------------------------------------------------- 1 | diff --git a/sound/soc/sunxi/sun8i-codec-analog.c b/sound/soc/sunxi/sun8i-codec-analog.c 2 | index be872eefa61e..ca5f4e43476b 100644 3 | --- a/sound/soc/sunxi/sun8i-codec-analog.c 4 | +++ b/sound/soc/sunxi/sun8i-codec-analog.c 5 | @@ -19,6 +19,8 @@ 6 | #include 7 | 8 | #include "sun8i-adda-pr-regmap.h" 9 | +#include 10 | +#include 11 | 12 | /* Codec analog control register offsets and bit fields */ 13 | #define SUN8I_ADDA_HP_VOLC 0x00 14 | @@ -113,6 +115,81 @@ 15 | #define SUN8I_ADDA_ADC_AP_EN_ADCLEN 6 16 | #define SUN8I_ADDA_ADC_AP_EN_ADCG 0 17 | 18 | +/* Analog control register access bits */ 19 | +#define ADDA_PR 0x0 /* PRCM base + 0x1c0 */ 20 | +#define ADDA_PR_RESET BIT(28) 21 | +#define ADDA_PR_WRITE BIT(24) 22 | +#define ADDA_PR_ADDR_SHIFT 16 23 | +#define ADDA_PR_ADDR_MASK GENMASK(4, 0) 24 | +#define ADDA_PR_DATA_IN_SHIFT 8 25 | +#define ADDA_PR_DATA_IN_MASK GENMASK(7, 0) 26 | +#define ADDA_PR_DATA_OUT_SHIFT 0 27 | +#define ADDA_PR_DATA_OUT_MASK GENMASK(7, 0) 28 | + 29 | +/* regmap access bits */ 30 | +static int adda_reg_read(void *context, unsigned int reg, unsigned int *val) 31 | +{ 32 | + void __iomem *base = (void __iomem *)context; 33 | + u32 tmp; 34 | + 35 | + /* De-assert reset */ 36 | + writel(readl(base) | ADDA_PR_RESET, base); 37 | + 38 | + /* Clear write bit */ 39 | + writel(readl(base) & ~ADDA_PR_WRITE, base); 40 | + 41 | + /* Set register address */ 42 | + tmp = readl(base); 43 | + tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); 44 | + tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; 45 | + writel(tmp, base); 46 | + 47 | + /* Read back value */ 48 | + *val = readl(base) & ADDA_PR_DATA_OUT_MASK; 49 | + 50 | + return 0; 51 | +} 52 | + 53 | +static int adda_reg_write(void *context, unsigned int reg, unsigned int val) 54 | +{ 55 | + void __iomem *base = (void __iomem *)context; 56 | + u32 tmp; 57 | + 58 | + /* De-assert reset */ 59 | + writel(readl(base) | ADDA_PR_RESET, base); 60 | + 61 | + /* Set register address */ 62 | + tmp = readl(base); 63 | + tmp &= ~(ADDA_PR_ADDR_MASK << ADDA_PR_ADDR_SHIFT); 64 | + tmp |= (reg & ADDA_PR_ADDR_MASK) << ADDA_PR_ADDR_SHIFT; 65 | + writel(tmp, base); 66 | + 67 | + /* Set data to write */ 68 | + tmp = readl(base); 69 | + tmp &= ~(ADDA_PR_DATA_IN_MASK << ADDA_PR_DATA_IN_SHIFT); 70 | + tmp |= (val & ADDA_PR_DATA_IN_MASK) << ADDA_PR_DATA_IN_SHIFT; 71 | + writel(tmp, base); 72 | + 73 | + /* Set write bit to signal a write */ 74 | + writel(readl(base) | ADDA_PR_WRITE, base); 75 | + 76 | + /* Clear write bit */ 77 | + writel(readl(base) & ~ADDA_PR_WRITE, base); 78 | + 79 | + return 0; 80 | +} 81 | + 82 | +static const struct regmap_config adda_pr_regmap_cfg = { 83 | + .name = "adda-pr", 84 | + .reg_bits = 5, 85 | + .reg_stride = 1, 86 | + .val_bits = 8, 87 | + .reg_read = adda_reg_read, 88 | + .reg_write = adda_reg_write, 89 | + .fast_io = true, 90 | + .max_register = 24, 91 | +}; 92 | + 93 | /* mixer controls */ 94 | static const struct snd_kcontrol_new sun8i_codec_mixer_controls[] = { 95 | SOC_DAPM_DOUBLE_R("DAC Playback Switch", 96 | @@ -316,7 +393,7 @@ static const struct snd_soc_dapm_route sun8i_codec_mixer_routes[] = { 97 | /* headphone specific controls, widgets, and routes */ 98 | static const DECLARE_TLV_DB_SCALE(sun8i_codec_hp_vol_scale, -6300, 100, 1); 99 | static const struct snd_kcontrol_new sun8i_codec_headphone_controls[] = { 100 | - SOC_SINGLE_TLV("Headphone Playback Volume", 101 | + SOC_SINGLE_TLV("Master Playback Volume", 102 | SUN8I_ADDA_HP_VOLC, 103 | SUN8I_ADDA_HP_VOLC_HP_VOL, 0x3f, 0, 104 | sun8i_codec_hp_vol_scale), 105 | @@ -673,7 +750,7 @@ struct sun8i_codec_analog_quirks { 106 | 107 | static const struct sun8i_codec_analog_quirks sun8i_a23_quirks = { 108 | .has_headphone = true, 109 | - .has_hmic = true, 110 | +// .has_hmic = true, 111 | .has_linein = true, 112 | .has_mbias = true, 113 | .has_mic2 = true, 114 | @@ -817,10 +894,148 @@ static const struct of_device_id sun8i_codec_analog_of_match[] = { 115 | }; 116 | MODULE_DEVICE_TABLE(of, sun8i_codec_analog_of_match); 117 | 118 | +#define SUNXI_HMIC_ENABLE (0x4) 119 | +#define SUNXI_HMIC_CTL (0x8) 120 | +#define SUNXI_HMIC_DATA (0xc) 121 | + 122 | +/* 123 | +* SUNXI_HMIC_CTL 124 | +*HMIC Control Register 125 | +*CONFIG_ARCH_SUN8IW5:0x1c8 126 | +*/ 127 | +#define HMIC_M (28) 128 | +#define HMIC_N (24) 129 | +#define HMIC_DIRQ (23) 130 | +#define HMIC_TH1_HYS (21) 131 | +#define HMIC_EARPHONE_OUT_IRQ_EN (20) 132 | +#define HMIC_EARPHONE_IN_IRQ_EN (19) 133 | +#define HMIC_KEY_UP_IRQ_EN (18) 134 | +#define HMIC_KEY_DOWN_IRQ_EN (17) 135 | +#define HMIC_DATA_IRQ_EN (16) 136 | +#define HMIC_DS_SAMP (14) 137 | +#define HMIC_TH2_HYS (13) 138 | +#define HMIC_TH2_KEY (8) 139 | +#define HMIC_SF_SMOOTH_FIL (6) 140 | +#define KEY_UP_IRQ_PEND (5) 141 | +#define HMIC_TH1_EARPHONE (0) 142 | + 143 | +/* 144 | +* SUNXI_HMIC_DATA 145 | +*HMIC Data Register 146 | +* 147 | +*CONFIG_ARCH_SUN8IW5:0x1cc 148 | +*/ 149 | +#define HMIC_EARPHONE_OUT_IRQ_PEND (20) 150 | +#define HMIC_EARPHONE_IN_IRQ_PEND (19) 151 | +#define HMIC_KEY_UP_IRQ_PEND (18) 152 | +#define HMIC_KEY_DOWN_IRQ_PEND (17) 153 | +#define HMIC_DATA_IRQ_PEND (16) 154 | +#define HMIC_ADC_DATA (0) 155 | + 156 | +#define HP_VOLC (0x00) 157 | +#define LOMIXSC (0x01) 158 | +#define ROMIXSC (0x02) 159 | +#define DAC_PA_SRC (0x03) 160 | +#define PAEN_HP_CTRL (0x07) 161 | +#define ADDA_APT2 (0x12) 162 | +#define MIC1G_MICBIAS_CTRL (0x0B) 163 | +#define PA_ANTI_POP_REG_CTRL (0x0E) 164 | +#define PA_SLOPE_SELECT (3) 165 | +#define PA_ANTI_POP_EN (0) 166 | + 167 | +static void __iomem *sun8i_codec_analog_base; 168 | +static struct gpio_desc * speaker_amplifier_gpio; 169 | + 170 | +static int hmic_wrreg_prcm_bits(unsigned short reg, unsigned int mask, unsigned int value) 171 | +{ 172 | + unsigned int old, new; 173 | + 174 | + adda_reg_read(sun8i_codec_analog_base, reg, &old); 175 | + new = (old & ~mask) | value; 176 | + adda_reg_write(sun8i_codec_analog_base, reg,new); 177 | + 178 | + return 0; 179 | +} 180 | + 181 | +static int hmic_wr_prcm_control(u32 reg, u32 mask, u32 shift, u32 val) 182 | +{ 183 | + u32 reg_val; 184 | + reg_val = val << shift; 185 | + mask = mask << shift; 186 | + hmic_wrreg_prcm_bits(reg, mask, reg_val); 187 | + return 0; 188 | +} 189 | + 190 | +static int hmic_wrreg_bits(unsigned short reg, unsigned int mask, unsigned int value) 191 | +{ 192 | + unsigned int old, new; 193 | + 194 | + old = readl(sun8i_codec_analog_base + reg); 195 | + new = (old & ~mask) | value; 196 | + 197 | + writel(new, sun8i_codec_analog_base + reg); 198 | + 199 | + return 0; 200 | +} 201 | + 202 | +static int hmic_wr_control(u32 reg, u32 mask, u32 shift, u32 val) 203 | +{ 204 | + u32 reg_val; 205 | + reg_val = val << shift; 206 | + mask = mask << shift; 207 | + hmic_wrreg_bits(reg, mask, reg_val); 208 | + return 0; 209 | +} 210 | + 211 | +static irqreturn_t sunxi_codec_analog_irq(int irq, void *dev_id) 212 | +{ 213 | + u32 tmp; 214 | + 215 | + hmic_wr_control(SUNXI_HMIC_DATA, 0x1, HMIC_KEY_DOWN_IRQ_PEND, 0x1); 216 | + hmic_wr_control(SUNXI_HMIC_DATA, 0x1, HMIC_EARPHONE_IN_IRQ_PEND, 0x1); 217 | + hmic_wr_control(SUNXI_HMIC_DATA, 0x1, HMIC_KEY_UP_IRQ_PEND, 0x1); 218 | + hmic_wr_control(SUNXI_HMIC_DATA, 0x1, HMIC_EARPHONE_OUT_IRQ_PEND, 0x1); 219 | + hmic_wr_control(SUNXI_HMIC_DATA, 0x1, HMIC_DATA_IRQ_PEND, 0x1); 220 | + 221 | + tmp = readl(sun8i_codec_analog_base + SUNXI_HMIC_DATA); 222 | + if(tmp & 0x1f) 223 | + gpiod_set_value(speaker_amplifier_gpio, 0); 224 | + else 225 | + gpiod_set_value(speaker_amplifier_gpio, 1); 226 | + 227 | + return IRQ_HANDLED; 228 | +} 229 | + 230 | +static void sunxi_hppa_enable(void) { 231 | + /*fix the resume blaze blaze noise*/ 232 | + hmic_wr_prcm_control(ADDA_APT2, 0x1, PA_SLOPE_SELECT, 0x0); 233 | + hmic_wr_prcm_control(SUN8I_ADDA_PAEN_HP_CTRL, 0x3, SUN8I_ADDA_PAEN_HP_CTRL_PA_ANTI_POP_CTRL, 0x1); 234 | + hmic_wr_prcm_control(PA_ANTI_POP_REG_CTRL, 0x7, PA_ANTI_POP_EN, 0x2); 235 | + usleep_range(100,200); 236 | + /*enable pa*/ 237 | + hmic_wr_prcm_control(SUN8I_ADDA_PAEN_HP_CTRL, 0x1, SUN8I_ADDA_PAEN_HP_CTRL_HPPAEN, 0x1); 238 | +} 239 | + 240 | +static void sunxi_hbias_enable(void) { 241 | + /*audio codec hardware bug. the HBIASADCEN bit must be enable in init*/ 242 | + hmic_wr_prcm_control(SUN8I_ADDA_MIC1G_MICBIAS_CTRL, 0x1, SUN8I_ADDA_MIC1G_MICBIAS_CTRL_HMICBIAS_MODE, 0x1); 243 | + hmic_wr_prcm_control(SUN8I_ADDA_MIC1G_MICBIAS_CTRL, 0x1, SUN8I_ADDA_MIC1G_MICBIAS_CTRL_HMICBIASEN, 0x1); 244 | +} 245 | + 246 | +static void codec_init_events(void) 247 | +{ 248 | + /*fix the resume blaze blaze noise*/ 249 | + sunxi_hppa_enable(); 250 | + msleep(450); 251 | + /*audio codec hardware bug. the HBIASADCEN bit must be enable in init*/ 252 | + sunxi_hbias_enable(); 253 | +} 254 | + 255 | static int sun8i_codec_analog_probe(struct platform_device *pdev) 256 | { 257 | struct regmap *regmap; 258 | void __iomem *base; 259 | + int irq, ret; 260 | 261 | base = devm_platform_ioremap_resource(pdev, 0); 262 | if (IS_ERR(base)) { 263 | @@ -828,6 +1043,38 @@ static int sun8i_codec_analog_probe(struct platform_device *pdev) 264 | return PTR_ERR(base); 265 | } 266 | 267 | + sun8i_codec_analog_base = base; 268 | + speaker_amplifier_gpio = devm_gpiod_get_optional(&pdev->dev, "speaker-amplifier", GPIOD_OUT_HIGH); 269 | + if (!IS_ERR_OR_NULL(speaker_amplifier_gpio)) { 270 | + 271 | + hmic_wr_control(SUNXI_HMIC_CTL, 0xf, HMIC_M, 0x0); /*0xf should be get from hw_debug 28*/ 272 | + hmic_wr_control(SUNXI_HMIC_CTL, 0xf, HMIC_N, 0x0); /*0xf should be get from hw_debug 24 0xf*/ 273 | +// hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_DIRQ, 0x1); /*23*/ 274 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_EARPHONE_OUT_IRQ_EN, 0x1); /*20*/ 275 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_EARPHONE_IN_IRQ_EN, 0x1); /*19*/ 276 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_KEY_UP_IRQ_EN, 0x1); /*18*/ 277 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_KEY_DOWN_IRQ_EN, 0x1); /*17*/ 278 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1, HMIC_DATA_IRQ_EN, 0x1); /*16*/ 279 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x3, HMIC_DS_SAMP, 0x0); /*14 */ 280 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1f, HMIC_TH2_KEY, 0x0); /*0xf should be get from hw_debug 8*/ 281 | + hmic_wr_control(SUNXI_HMIC_CTL, 0x1f, HMIC_TH1_EARPHONE, 0x1); /*0x1 should be get from hw_debug 0*/ 282 | + 283 | + irq = platform_get_irq(pdev, 0); 284 | + if (irq < 0) { 285 | + dev_err(&pdev->dev, "Can't retrieve our interrupt\n"); 286 | + return irq; 287 | + } 288 | + 289 | + ret = devm_request_irq(&pdev->dev, irq, sunxi_codec_analog_irq, 0, "audio_hmic_irq", NULL); 290 | + if (ret) { 291 | + dev_err(&pdev->dev, "can't register interrupt handler irq %d: %d\n", 292 | + irq, ret); 293 | + return ret; 294 | + } 295 | + 296 | + codec_init_events(); 297 | + } 298 | + 299 | regmap = sun8i_adda_pr_regmap_init(&pdev->dev, base); 300 | if (IS_ERR(regmap)) { 301 | dev_err(&pdev->dev, "Failed to create regmap\n"); 302 | diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c 303 | index 518bfb724a5b..b6a90e33f20a 100644 304 | --- a/sound/soc/sunxi/sun8i-codec.c 305 | +++ b/sound/soc/sunxi/sun8i-codec.c 306 | @@ -257,6 +257,9 @@ static int sun8i_codec_update_sample_rate(struct sun8i_codec *scodec) 307 | regmap_update_bits(scodec->regmap, SUN8I_SYS_SR_CTRL, 308 | SUN8I_SYS_SR_CTRL_AIF1_FS_MASK, 309 | hw_rate << SUN8I_SYS_SR_CTRL_AIF1_FS); 310 | + regmap_update_bits(scodec->regmap, SUN8I_SYS_SR_CTRL, 311 | + SUN8I_SYS_SR_CTRL_AIF2_FS_MASK, 312 | + hw_rate << SUN8I_SYS_SR_CTRL_AIF2_FS); 313 | 314 | return 0; 315 | } 316 | @@ -288,6 +291,9 @@ static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 317 | SUN8I_AIF3_CLK_CTRL_AIF3_CLK_SRC_MASK, 318 | SUN8I_AIF3_CLK_CTRL_AIF3_CLK_SRC_AIF2); 319 | } else { 320 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 321 | + BIT(SUN8I_AIF_CLK_CTRL_MSTR_MOD), 322 | + value << SUN8I_AIF_CLK_CTRL_MSTR_MOD); 323 | regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id), 324 | BIT(SUN8I_AIF_CLK_CTRL_MSTR_MOD), 325 | value << SUN8I_AIF_CLK_CTRL_MSTR_MOD); 326 | @@ -321,6 +327,9 @@ static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 327 | if (format != 3) 328 | return -EINVAL; 329 | } else { 330 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 331 | + SUN8I_AIF_CLK_CTRL_DATA_FMT_MASK, 332 | + format << SUN8I_AIF_CLK_CTRL_DATA_FMT); 333 | regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id), 334 | SUN8I_AIF_CLK_CTRL_DATA_FMT_MASK, 335 | format << SUN8I_AIF_CLK_CTRL_DATA_FMT); 336 | @@ -365,6 +374,9 @@ static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 337 | invert ^= scodec->quirks->lrck_inversion; 338 | } 339 | 340 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 341 | + SUN8I_AIF_CLK_CTRL_CLK_INV_MASK, 342 | + invert << SUN8I_AIF_CLK_CTRL_CLK_INV); 343 | regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id), 344 | SUN8I_AIF_CLK_CTRL_CLK_INV_MASK, 345 | invert << SUN8I_AIF_CLK_CTRL_CLK_INV); 346 | @@ -519,6 +531,9 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, 347 | return -EINVAL; 348 | } 349 | 350 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 351 | + SUN8I_AIF_CLK_CTRL_WORD_SIZ_MASK, 352 | + word_size << SUN8I_AIF_CLK_CTRL_WORD_SIZ); 353 | regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id), 354 | SUN8I_AIF_CLK_CTRL_WORD_SIZ_MASK, 355 | word_size << SUN8I_AIF_CLK_CTRL_WORD_SIZ); 356 | @@ -548,6 +563,9 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, 357 | clk_reg = SUN8I_AIF_CLK_CTRL(dai->id); 358 | } 359 | 360 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 361 | + SUN8I_AIF_CLK_CTRL_LRCK_DIV_MASK, 362 | + (lrck_div_order - 4) << SUN8I_AIF_CLK_CTRL_LRCK_DIV); 363 | regmap_update_bits(scodec->regmap, clk_reg, 364 | SUN8I_AIF_CLK_CTRL_LRCK_DIV_MASK, 365 | (lrck_div_order - 4) << SUN8I_AIF_CLK_CTRL_LRCK_DIV); 366 | @@ -557,6 +575,9 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, 367 | if (bclk_div < 0) 368 | return bclk_div; 369 | 370 | + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(SUN8I_CODEC_AIF1), 371 | + SUN8I_AIF_CLK_CTRL_BCLK_DIV_MASK, 372 | + bclk_div << SUN8I_AIF_CLK_CTRL_BCLK_DIV); 373 | regmap_update_bits(scodec->regmap, clk_reg, 374 | SUN8I_AIF_CLK_CTRL_BCLK_DIV_MASK, 375 | bclk_div << SUN8I_AIF_CLK_CTRL_BCLK_DIV); 376 | @@ -1226,6 +1247,7 @@ static const struct snd_soc_component_driver sun8i_soc_component = { 377 | }; 378 | 379 | static const struct regmap_config sun8i_codec_regmap_config = { 380 | + .name = "sun8i_codec", 381 | .reg_bits = 32, 382 | .reg_stride = 4, 383 | .val_bits = 32, 384 | -------------------------------------------------------------------------------- /v0.6/515_wifi.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 2 | index f7961b22e051..c3f51e123990 100644 3 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 4 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 5 | @@ -4431,6 +4431,55 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) 6 | return fwreq; 7 | } 8 | 9 | +static char brcmf_fw_name[BRCMF_FW_NAME_LEN]; 10 | + 11 | +#ifdef CONFIG_PROC_FS 12 | +#include 13 | + 14 | +static int brcmf_sdio_proc_show(struct seq_file *m, void *v) 15 | +{ 16 | + seq_printf(m, "brcmf_sdio\n"); 17 | + return 0; 18 | +} 19 | + 20 | +static int brcmf_sdio_proc_open(struct inode *inode, struct file *file) 21 | +{ 22 | + return single_open(file, brcmf_sdio_proc_show, NULL); 23 | +} 24 | + 25 | +static ssize_t brcmf_sdio_proc_read(struct file * file, char __user * buf, size_t size, loff_t * loff) 26 | +{ 27 | + int len; 28 | + len = strlen(brcmf_fw_name); 29 | + return simple_read_from_buffer(buf, size, loff, brcmf_fw_name, len); 30 | +} 31 | + 32 | +static ssize_t brcmf_sdio_proc_write(struct file * file, const char __user * buf, size_t size, loff_t * loff) 33 | +{ 34 | + return size; 35 | +} 36 | + 37 | +static const struct proc_ops brcmf_sdio_proc_fops = { 38 | + .proc_open = brcmf_sdio_proc_open, 39 | + .proc_read = brcmf_sdio_proc_read, 40 | + .proc_write = brcmf_sdio_proc_write, 41 | + .proc_lseek = seq_lseek, 42 | + .proc_release = single_release, 43 | +}; 44 | + 45 | +static int __init brcmf_sdio_proc_init(void) 46 | +{ 47 | + struct proc_dir_entry *r; 48 | + 49 | + r = proc_create("driver/brcmf_fw", S_IRWXUGO, NULL, &brcmf_sdio_proc_fops); 50 | + if (!r) 51 | + return -ENOMEM; 52 | + return 0; 53 | +} 54 | +#else 55 | +static inline int brcmf_sdio_proc_init(void) { return 0; } 56 | +#endif /* CONFIG_PROC_FS */ 57 | + 58 | struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) 59 | { 60 | int ret; 61 | @@ -4439,6 +4488,7 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) 62 | struct brcmf_fw_request *fwreq; 63 | 64 | brcmf_dbg(TRACE, "Enter\n"); 65 | + msleep(1000); 66 | 67 | /* Allocate private bus interface state */ 68 | bus = kzalloc(sizeof(struct brcmf_sdio), GFP_ATOMIC); 69 | @@ -4533,6 +4583,9 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) 70 | goto fail; 71 | } 72 | 73 | + sprintf(brcmf_fw_name, "%s\n", sdiodev->fw_name); 74 | + brcmf_sdio_proc_init(); 75 | + 76 | return bus; 77 | 78 | fail: 79 | -------------------------------------------------------------------------------- /v0.6/README.md: -------------------------------------------------------------------------------- 1 | Linux kernel branch 5.15.y 2 | 3 | ``` 4 | git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 5 | ``` 6 | 7 | linux-5.15.y 8 | 9 | git commit hash `5827ddaf4534c52d31dd464679a186b41810ef76` 10 | 11 | 12 | After git apply all patches 13 | 14 | ``` 15 | make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clockworkpi_cpi3_defconfig 16 | mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n "Linux kernel" -d arch/arm/boot/zImage uImage 17 | ``` 18 | 19 | 20 | --------------------------------------------------------------------------------