├── LICENSE ├── README.md ├── sun7i_tvd-lichee-android-linux3.3 ├── Kconfig ├── Makefile ├── bsp_tvd.c ├── bsp_tvd.h ├── drv_tvd.c └── drv_tvd.h ├── sun7i_tvd-linux-3.3 ├── Kconfig ├── Makefile ├── bsp_tvd.c ├── bsp_tvd.h ├── drv_tvd.c └── drv_tvd.h └── sun7i_tvd-linux-3.4-working ├── .bsp_tvd.o.cmd ├── .drv_tvd.o.cmd ├── .sun7i_tvd.ko.cmd ├── .sun7i_tvd.mod.o.cmd ├── .sun7i_tvd.o.cmd ├── Kconfig ├── Makefile ├── bsp_tvd.c ├── bsp_tvd.h ├── drv_tvd.c └── drv_tvd.h /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | (This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.) 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | {description} 474 | Copyright (C) {year} {fullname} 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 489 | USA 490 | 491 | Also add information on how to contact you by electronic and paper mail. 492 | 493 | You should also get your employer (if you work as a programmer) or your 494 | school, if any, to sign a "copyright disclaimer" for the library, if 495 | necessary. Here is a sample; alter the names: 496 | 497 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 498 | library `Frob' (a library for tweaking knobs) written by James Random 499 | Hacker. 500 | 501 | {signature of Ty Coon}, 1 April 1990 502 | Ty Coon, President of Vice 503 | 504 | That's all there is to it! 505 | 506 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | These are the TV-decoder drivers for the Allwinner A20. 2 | 3 | * sun7i_tvd-linux-3.3: This is the driver as found in Linux 3.3 for Cubieboard 4 | (https://github.com/cubieboard2/linux-sunxi/tree/sunxi-3.3-cb2) 5 | * sun7i_tvd-lichee-android-linux3.3: The working driver distributed in Android 4.2 for MarsBoard 6 | (http://www.haoyuelectronics.com/service/A10-A20/A20-android-source-code/) 7 | * sun7i_tvd-linux-3.4-working: Barebones porting to Linux 3.4 8 | 9 | The Cubieboard and Android versions have some slight differences in the registers initialized and 10 | in clock initialization code. My porting is pretty rough but can capture images (changes by Rodolfo 11 | Zitellini): 12 | 13 | * I "added" some missing #defines form missing files (this should be done in a better way) 14 | * I forced the video field to be returned V4L2_FIELD_NONE as the docs specify 15 | * I fixed the returned video dimensions (so ffmpeg is happy for example) 16 | 17 | Changes by Iñigo Huguet: 18 | 19 | * Partially fixed clock selection: select a used clock if it has the desired frequency, keeping the other free 20 | * Return correct bytesperline format info 21 | * Return applied format in s_fmt ioctl, as required by v4l2 22 | * Inform about min buffers num required 23 | * Fixed bug with buffers management when dequeueing is not fast enough 24 | * Makefile allow to build as loadadble module 25 | * Enum formats and framesizes in different ioctl, as required by v4l2 26 | * Select camera or multi-camera using s_input (before it could only be done in a driver-specific way) 27 | * Allow fps selection 28 | 29 | 30 | BUILDING 31 | ======== 32 | 33 | To have it working add the following lines to Kconfig: 34 | 35 | ``` 36 | source "drivers/media/video/sun7i_tvd/Kconfig" 37 | ``` 38 | 39 | and Makefile in the /drivers/media/video directory.: 40 | 41 | ``` 42 | obj-$(CONFIG_SUN7I_TVD) += sun7i_tvd/ 43 | ``` 44 | Then build/rebuild the kernel. 45 | 46 | You can also build it as loadable module: 47 | 48 | ``` 49 | cd SOURCE_DIR 50 | make 51 | make install 52 | ``` 53 | 54 | and load it with: 55 | 56 | ``` 57 | modprobe sunxi_tvd 58 | ``` 59 | 60 | 61 | TESTING 62 | ======= 63 | 64 | Test with ffmpeg: 65 | 66 | ``` 67 | ffmpeg -f v4l2 -s 720x576 -pix_fmt nv12 -r 25 -t 10 -i /dev/video1 m.mpg 68 | ``` 69 | 70 | Test with gstreamer (save to file and play with mpv player, gstreamer videosink doesn't work, I don't know why): 71 | 72 | ``` 73 | gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=NV12,width=720,height=576,framerate=25/1 ! filesink location=raw_video.bin 74 | mpv --demuxer rawvideo --demuxer-rawvideo-w 720 --demuxer-rawvideo-h 576 --demuxer-rawvideo-mp-format nv12 --demuxer-rawvideo-fps 25 raw_video.bin 75 | ``` 76 | 77 | 78 | SELECTING CAMERA/INPUT 79 | ====================== 80 | 81 | * Check available inputs: `v4l2-ctl -d /dev/video1 --list-inputs` 82 | * Get current input: `v4l2-ctl -d /dev/video1 --get-input` 83 | * Change input: `v4l2-ctl -d /dev/video1 --set-input=X` 84 | * Check available formats and framesizes FOR CURRENT INPUT: `v4l2-ctl -d /dev/video1 -list-formats-ext` 85 | 86 | Available inputs: 87 | 88 | * input 0 = TV input 1 89 | * input 1 = TV input 2 90 | * input 2 = TV input 3 91 | * input 3 = TV input 4 92 | * input 4 = TV inputs 1 + 2 93 | * input 5 = TV inputs 1 + 3 94 | * input 6 = TV inputs 1 + 4 95 | * input 7 = TV inputs 2 + 3 96 | * input 8 = TV inputs 2 + 4 97 | * input 9 = TV inputs 3 + 4 98 | * input 10 = TV inputs 1 + 2 + 3 + 4 99 | 100 | Input types: 101 | 102 | * Inputs 0 - 3: video from only one camera 103 | * Inputs 4 - 9: video splited in 2 parts, one camera in each one 104 | * Input 10: video splited in 4 parts, one camera in each one 105 | 106 | 107 | SELECTING FRAMESIZE 108 | =================== 109 | 110 | Framesize can be selected by Gstreamer or ffmpeg as shown above. They select 111 | the framesize calling s_fmt ioctl of the driver. 112 | 113 | Available framesizes: 114 | 115 | * for single camera (inputs 0 - 3): 720x480, 720x576, 704x480, 704x576 116 | * for 2 cameras, vertical split (inputs 4 - 9): 1440x480, 1440x576, 1408x480, 1408x576 117 | * for 2 cameras, horizontal split (inputs 4 - 9): 720x960, 720x1152, 704x960, 704x1152 118 | * for 4 cameras (input 10): 1440x960, 1440x1152, 1408x960, 1408x1152 119 | 120 | To display multi-camera with ffmpeg or gstreamer, select input with v4l2-ctl 121 | first and run ffmpeg or gstreamer with commands from above with a valid resolution 122 | for the chosen input. 123 | 124 | 125 | SELECTING FPS 126 | ============= 127 | 128 | Different framerates (fps) can be selected, use lower framerates if the 129 | hardware can't process video at the camera framerate (usually 25fps for PAL 130 | cameras and 30fps for NTSC cameras). Framerate is not ensured to be applied 131 | with high precission, and it highly depends on the camera framerate, over 132 | which the driver have no control at all (real fps will be the camera fps 133 | divided by an integer). 134 | 135 | Gstreamer and ffmpeg can select fps calling to s_parm ioctl of the driver. 136 | 137 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/Kconfig: -------------------------------------------------------------------------------- 1 | config SUN7I_TVD 2 | tristate "TV Decoder" 3 | default m 4 | depends on VIDEO_DEV && VIDEO_V4L2 5 | select VIDEOBUF_DMA_CONTIG 6 | help 7 | This is the driver of TV decoder. 8 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_SUN7I_TVD) += sun7i_tvd.o 2 | 3 | sun7i_tvd-objs := drv_tvd.o bsp_tvd.o 4 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/bsp_tvd.c: -------------------------------------------------------------------------------- 1 | #include "bsp_tvd.h" 2 | #include 3 | 4 | #define REG_RD32(reg) (*((volatile __u32 *)(reg))) 5 | #define REG_WR32(reg, value) (*((volatile __u32 *)(reg)) = (value)) 6 | 7 | static __u32 addr_base = 0; 8 | 9 | void TVD_init(void *addr) 10 | { 11 | __u32 i; 12 | addr_base = (__u32)addr; 13 | for(i=0;i<4;i++){ 14 | REG_WR32(addr_base+0x0130+0x100*i,0x04000000);//reg for set once here 15 | } 16 | } 17 | 18 | void TVD_config(__u32 interface, __u32 system) 19 | { 20 | //global reg set here 21 | REG_WR32(addr_base+0x0500,0x00000f11); //first, open adc, so the tvd has clock 22 | REG_WR32(addr_base+0x0000,0x00001f00); //reset tvd 23 | msleep(1); //need delay here for tvd reset 24 | if(interface==TVD_CVBS) //composite 25 | { 26 | switch(system) 27 | { 28 | case TVD_NTSC://NTSC 29 | REG_WR32(addr_base+0x0008,0x00590000);//ntsc vs pal 30 | REG_WR32(addr_base+0x000c,0x00000010);//ntsc vs pal 31 | REG_WR32(addr_base+0x0018,0x00002080); 32 | REG_WR32(addr_base+0x0024,0x0682810a); 33 | REG_WR32(addr_base+0x0028,0x00006440); 34 | REG_WR32(addr_base+0x002c,0x0000cb74);//ntsc vs pal 35 | REG_WR32(addr_base+0x0030,0x21f07c1f);//ntsc vs pal 36 | REG_WR32(addr_base+0x0034,0x20000000); 37 | 38 | //REG_WR32(addr_base+0x0024,0x05C8B10A); 39 | //REG_WR32(addr_base+0x0028,0x00005838); 40 | //REG_WR32(addr_base+0x002c,0x0000cb74); 41 | //REG_WR32(addr_base+0x0030,0x262E8BA2); 42 | //REG_WR32(addr_base+0x0034,0x24000000); 43 | 44 | REG_WR32(addr_base+0x0044,0x50823925); 45 | REG_WR32(addr_base+0x004c,0x0e70106c); 46 | REG_WR32(addr_base+0x0050,0x00000a00); 47 | REG_WR32(addr_base+0x005c,0x0000006f); 48 | REG_WR32(addr_base+0x0070,0x00002050); 49 | REG_WR32(addr_base+0x0074,0x000003c3); 50 | REG_WR32(addr_base+0x0080,0x00500082);//ntsc vs pal 51 | REG_WR32(addr_base+0x0084,0x00610022);//ntsc vs pal 52 | break; 53 | case TVD_PAL://PAL 54 | REG_WR32(addr_base+0x0008,0x11590102);//ntsc vs pal 55 | REG_WR32(addr_base+0x000c,0x0000001e);//ntsc vs pal 56 | REG_WR32(addr_base+0x0018,0x00002480); 57 | REG_WR32(addr_base+0x0024,0x0682810a); 58 | REG_WR32(addr_base+0x0028,0x00006440); 59 | REG_WR32(addr_base+0x002c,0x00000d74);//ntsc vs pal 60 | REG_WR32(addr_base+0x0030,0x2a098acb);//ntsc vs pal 61 | REG_WR32(addr_base+0x0034,0x20000000); 62 | REG_WR32(addr_base+0x0044,0x50823925); 63 | REG_WR32(addr_base+0x004c,0x0e70106c); 64 | REG_WR32(addr_base+0x0050,0x00000a00); 65 | REG_WR32(addr_base+0x005c,0x0000006f); 66 | REG_WR32(addr_base+0x0070,0x00002050); 67 | REG_WR32(addr_base+0x0074,0x000003c3); 68 | REG_WR32(addr_base+0x0080,0x00500087);//ntsc vs pal 69 | REG_WR32(addr_base+0x0084,0x00c10026);//ntsc vs pal 70 | break; 71 | default: 72 | break; 73 | } 74 | REG_WR32(addr_base+0x0504,0x00000000); 75 | REG_WR32(addr_base+0x052c,0xe0110000); 76 | //1 channel cvbs 77 | //REG_WR32(addr_base+0x0500,0x00000111); 78 | //REG_WR32(addr_base+0x0000,0x00000321); 79 | //default open all 4 channels if you don't care power consumption 80 | REG_WR32(addr_base+0x0500,0x00000f11); 81 | REG_WR32(addr_base+0x0000,0x00001f2f); 82 | } 83 | else if(interface==TVD_YPBPR_I)//ypbpr 480i/576i 84 | { 85 | switch(system) 86 | { 87 | case TVD_NTSC://480i 88 | REG_WR32(addr_base+0x0008,0x00594001); 89 | REG_WR32(addr_base+0x0018,0x00002080); 90 | REG_WR32(addr_base+0x0080,0x00500082); 91 | REG_WR32(addr_base+0x0084,0x00610022); 92 | break; 93 | case TVD_PAL://576i 94 | REG_WR32(addr_base+0x0008,0x10594101); 95 | REG_WR32(addr_base+0x0018,0x00002480); 96 | REG_WR32(addr_base+0x0080,0x00500087); 97 | REG_WR32(addr_base+0x0084,0x00c10026); 98 | break; 99 | } 100 | REG_WR32(addr_base+0x0504,0x00000000); 101 | REG_WR32(addr_base+0x052c,0xe0110000); 102 | REG_WR32(addr_base+0x0500,0x00020711); 103 | REG_WR32(addr_base+0x0000,0x00000321); 104 | } 105 | else if(interface==TVD_YPBPR_P)//ypbpr 480p/576p 106 | { 107 | switch(system) 108 | { 109 | case TVD_NTSC://480p 110 | REG_WR32(addr_base+0x0008,0x80594001); 111 | REG_WR32(addr_base+0x0034,0x20000000); 112 | REG_WR32(addr_base+0x0070,0x00002050); 113 | break; 114 | case TVD_PAL://576p not work 115 | REG_WR32(addr_base+0x0008,0x90594101); 116 | REG_WR32(addr_base+0x0034,0x20000000); 117 | REG_WR32(addr_base+0x0070,0x00002050); 118 | REG_WR32(addr_base+0x0080,0x00500087); 119 | REG_WR32(addr_base+0x0084,0x00c10026); 120 | break; 121 | } 122 | REG_WR32(addr_base+0x0504,0x00000000); 123 | REG_WR32(addr_base+0x052c,0xe0110000); 124 | REG_WR32(addr_base+0x0500,0x00020711); 125 | REG_WR32(addr_base+0x0000,0x00000321); 126 | } 127 | } 128 | 129 | void TVD_set_width(__u32 id,__u32 w) 130 | { 131 | __u32 reg_val; 132 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 133 | reg_val &= ~(0xfff<<0); 134 | reg_val |= ((w>720)?720:w)<<0; 135 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 136 | } 137 | 138 | void TVD_set_width_jump(__u32 id,__u32 j) 139 | { 140 | REG_WR32(addr_base+0x0138+0x100*id, j); 141 | } 142 | 143 | void TVD_set_height(__u32 id,__u32 h) 144 | { 145 | __u32 reg_val; 146 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 147 | reg_val &= ~(0x7ff<<16); 148 | reg_val |= h<<16; 149 | reg_val |= h<<16; 150 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 151 | } 152 | 153 | void TVD_irq_enable(__u32 id,tvd_irq_t irq) 154 | { 155 | __u32 reg_val; 156 | switch(irq){ 157 | case TVD_FRAME_DONE: 158 | reg_val = REG_RD32(addr_base + 0x148); 159 | reg_val |= 1<<(24+id); 160 | REG_WR32(addr_base + 0x148, reg_val); 161 | break; 162 | case TVD_LOCK: 163 | break; 164 | case TVD_UNLOCK: 165 | break; 166 | default: 167 | break; 168 | } 169 | } 170 | 171 | void TVD_irq_disable(__u32 id,tvd_irq_t irq) 172 | { 173 | __u32 reg_val; 174 | switch(irq){ 175 | case TVD_FRAME_DONE: 176 | reg_val = REG_RD32(addr_base + 0x148); 177 | reg_val &= ~(1<<(24+id)); 178 | REG_WR32(addr_base + 0x148, reg_val); 179 | break; 180 | default: 181 | break; 182 | } 183 | } 184 | 185 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq) 186 | { 187 | __u32 reg_val, ret = -1; 188 | switch(irq){ 189 | case TVD_FRAME_DONE: 190 | reg_val = REG_RD32(addr_base+0x140); 191 | ret = (reg_val>>(24+id))&1; 192 | break; 193 | default: 194 | printk("TVD get irq status error\n"); 195 | break; 196 | } 197 | return ret; 198 | } 199 | 200 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq) 201 | { 202 | __u32 reg_val; 203 | switch(irq){ 204 | case TVD_FRAME_DONE: 205 | reg_val = 1<<(24+id); 206 | REG_WR32(addr_base+0x140, reg_val); 207 | break; 208 | default: 209 | break; 210 | } 211 | } 212 | 213 | void TVD_capture_on(__u32 id) 214 | { 215 | __u32 reg_val; 216 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 217 | reg_val |= 1<<0; 218 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 219 | } 220 | void TVD_capture_off(__u32 id) 221 | { 222 | __u32 reg_val; 223 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 224 | reg_val &= ~(1<<0); 225 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 226 | } 227 | 228 | void TVD_set_addr_y(__u32 id,__u32 addr) 229 | { 230 | REG_WR32(addr_base + 0x100+0x100*id, addr); 231 | } 232 | 233 | void TVD_set_addr_c(__u32 id,__u32 addr) 234 | { 235 | REG_WR32(addr_base + 0x110+0x100*id, addr); 236 | } 237 | 238 | void TVD_set_fmt(__u32 id, tvd_fmt_t fmt) 239 | { 240 | __u32 reg_val; 241 | reg_val = REG_RD32(addr_base + 0x130+0x100*id); 242 | switch(fmt){ 243 | case TVD_PL_YUV422: 244 | reg_val &= ~(1<<24); 245 | reg_val |= 1<<4; 246 | break; 247 | case TVD_PL_YUV420: 248 | reg_val &= ~(1<<24); 249 | reg_val &= ~(1<<4); 250 | break; 251 | case TVD_MB_YUV420: 252 | reg_val |= 1<<24; 253 | reg_val &= ~(1<<4); 254 | break; 255 | } 256 | REG_WR32(addr_base + 0x130+0x100*id, reg_val); 257 | } 258 | 259 | __u32 TVD_get_status(__u32 id) 260 | { 261 | __u32 reg_val = 0; 262 | __u32 det = 0; 263 | __u32 system = 0; 264 | reg_val = REG_RD32(addr_base+0x0600+0x20*id); 265 | if(reg_val&1){ 266 | det = 0; 267 | } 268 | else{ 269 | det = 1; 270 | } 271 | if(reg_val&(1<<18)){ 272 | system = 1; 273 | } 274 | else{ 275 | system = 0; 276 | } 277 | return ((det<<0)+(system<<4));//bit0=det bit4=system 278 | } 279 | 280 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue) 281 | { 282 | __u32 reg_val=0; 283 | reg_val = REG_RD32(addr_base+0x0018); 284 | reg_val &= 0xffff0000; 285 | reg_val |= contrast; 286 | reg_val |= luma<<8; 287 | REG_WR32(addr_base + 0x0018, reg_val); 288 | 289 | 290 | reg_val = REG_RD32(addr_base+0x001c); 291 | reg_val &= 0xffff0000; 292 | reg_val |= saturation; 293 | reg_val |= hue<<8; 294 | REG_WR32(addr_base + 0x001c, reg_val); 295 | } 296 | 297 | void TVD_uv_swap(__u8 uv_swap) 298 | { 299 | __u32 reg_val=0; 300 | if(uv_swap) 301 | { 302 | reg_val = REG_RD32(addr_base+0x0014); 303 | reg_val &= 0xffffffbf; 304 | reg_val |= 1<<6; 305 | REG_WR32(addr_base + 0x0014, reg_val); 306 | } 307 | else 308 | { 309 | reg_val = REG_RD32(addr_base+0x0014); 310 | reg_val &= 0xffffffbf; 311 | REG_WR32(addr_base + 0x0014, reg_val); 312 | } 313 | } 314 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/bsp_tvd.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSP_TVD_H__ 2 | #define __BSP_TVD_H__ 3 | 4 | #include 5 | 6 | typedef enum 7 | { 8 | TVD_PL_YUV422, 9 | TVD_PL_YUV420, 10 | TVD_MB_YUV420, 11 | }tvd_fmt_t; 12 | 13 | typedef enum 14 | { 15 | TVD_CVBS, 16 | TVD_YPBPR_I, 17 | TVD_YPBPR_P, 18 | }tvd_interface_t; 19 | 20 | typedef enum 21 | { 22 | TVD_NTSC, 23 | TVD_PAL, 24 | TVD_SECAM, 25 | }tvd_system_t; 26 | 27 | typedef enum 28 | { 29 | TVD_FRAME_DONE, 30 | TVD_LOCK, 31 | TVD_UNLOCK, 32 | }tvd_irq_t; 33 | 34 | void TVD_init(void * addr); 35 | 36 | //s32 TVD_set_mode(tvd_mode_t mode); 37 | 38 | //void TVD_det_enable(); 39 | //void TVD_det_disable(); 40 | //__u32 TVD_det_finish(); 41 | //tvd_mode_t TVD_det_mode(); 42 | 43 | void TVD_irq_enable(__u32 id,tvd_irq_t irq); 44 | void TVD_irq_disable(__u32 id,tvd_irq_t irq); 45 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq); 46 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq); 47 | 48 | void TVD_capture_on(__u32 id); 49 | void TVD_capture_off(__u32 id); 50 | 51 | void TVD_set_addr_y(__u32 id,__u32 addr); 52 | void TVD_set_addr_c(__u32 id,__u32 addr); 53 | 54 | void TVD_set_width(__u32 id,__u32 w); 55 | void TVD_set_width_jump(__u32 id,__u32 j); 56 | void TVD_set_height(__u32 id,__u32 h); 57 | 58 | void TVD_set_fmt(__u32 id,tvd_fmt_t fmt); 59 | void TVD_config(__u32 interface, __u32 system); 60 | __u32 TVD_get_status(__u32 id); 61 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue); 62 | void TVD_uv_swap(__u8 uv_swap); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/drv_tvd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | #include "bsp_tvd.h" 33 | #include "drv_tvd.h" 34 | 35 | #define DBG_EN 0 36 | #if(DBG_EN == 1) 37 | #define __dbg(x, arg...) printk("[TVD_DBG]"x, ##arg) 38 | #else 39 | #define __dbg(x, arg...) 40 | #endif 41 | #define __err(x, arg...) printk(KERN_INFO"[TVD_ERR]"x, ##arg) 42 | #define __inf(x, arg...) printk(KERN_INFO"[TVD_INF]"x, ##arg) 43 | 44 | 45 | static int is_generating(struct tvd_dev *dev) 46 | { 47 | return test_bit(0, &dev->generating); 48 | } 49 | 50 | static void start_generating(struct tvd_dev *dev) 51 | { 52 | set_bit(0, &dev->generating); 53 | return; 54 | } 55 | 56 | static void stop_generating(struct tvd_dev *dev) 57 | { 58 | first_flag = 0; 59 | clear_bit(0, &dev->generating); 60 | return; 61 | } 62 | 63 | static struct fmt * get_format(struct v4l2_format *format) 64 | { 65 | struct fmt *fmt; 66 | unsigned int k; 67 | 68 | for (k = 0; k < ARRAY_SIZE(formats); k++) { 69 | fmt = &formats[k]; 70 | if (fmt->fourcc == format->fmt.pix.pixelformat && fmt->width == format->fmt.pix.width && fmt->height == format->fmt.pix.height ) 71 | { 72 | __dbg("fmt->fourcc = %d, fmt->width=%d, fmt->height = %d\n", fmt->fourcc, fmt->width, fmt->height); 73 | break; 74 | } 75 | } 76 | if (k == ARRAY_SIZE(formats)) { 77 | return NULL; 78 | } 79 | 80 | return &formats[k]; 81 | }; 82 | 83 | static inline void set_addr(struct tvd_dev *dev,struct buffer *buffer) 84 | { 85 | int i; 86 | struct buffer *buf = buffer; 87 | dma_addr_t addr_org; 88 | 89 | __dbg("buf ptr=%p\n",buf); 90 | addr_org = videobuf_to_dma_contig((struct videobuf_buffer *)buf); 91 | dev->buf_addr.y = addr_org; 92 | dev->buf_addr.c = addr_org + dev->width*dev->height; 93 | 94 | __dbg("dev->buf_addr.y=0x%08x\n", dev->buf_addr.y); 95 | 96 | for(i=0;i<4;i++){ 97 | if(dev->channel_index[i]){ 98 | TVD_set_addr_y(i,dev->buf_addr.y + dev->channel_offset_y[i]); 99 | TVD_set_addr_c(i,dev->buf_addr.c + dev->channel_offset_c[i]); 100 | } 101 | } 102 | __dbg("buf_addr_y=%x\n", dev->buf_addr.y); 103 | __dbg("buf_addr_cb=%x\n", dev->buf_addr.c); 104 | } 105 | 106 | static irqreturn_t tvd_irq(int irq, void *priv) 107 | { 108 | struct buffer *buf; 109 | struct tvd_dev *dev = (struct tvd_dev *)priv; 110 | struct dmaqueue *dma_q = &dev->vidq; 111 | 112 | spin_lock(&dev->slock); 113 | if (first_flag == 0) { 114 | first_flag=1; 115 | goto set_next_addr; 116 | } 117 | 118 | if (list_empty(&dma_q->active)) { 119 | __err("No active queue to serve\n"); 120 | goto unlock; 121 | } 122 | 123 | buf = list_entry(dma_q->active.next,struct buffer, vb.queue); 124 | __dbg("buf ptr=%p\n",buf); 125 | 126 | /* Nobody is waiting on this buffer*/ 127 | 128 | if (!waitqueue_active(&buf->vb.done)) { 129 | __dbg(" Nobody is waiting on this buffer,buf = 0x%p\n",buf); 130 | } 131 | 132 | list_del(&buf->vb.queue); 133 | 134 | do_gettimeofday(&buf->vb.ts); 135 | buf->vb.field_count++; 136 | 137 | dev->ms += jiffies_to_msecs(jiffies - dev->jiffies); 138 | dev->jiffies = jiffies; 139 | 140 | buf->vb.state = VIDEOBUF_DONE; 141 | wake_up(&buf->vb.done); 142 | 143 | //judge if the frame queue has been written to the last 144 | if (list_empty(&dma_q->active)) { 145 | __dbg("No more free frame\n"); 146 | goto unlock; 147 | } 148 | 149 | if ((&dma_q->active) == dma_q->active.next->next) { 150 | __dbg("No more free frame on next time\n"); 151 | goto unlock; 152 | } 153 | 154 | set_next_addr: 155 | buf = list_entry(dma_q->active.next->next,struct buffer, vb.queue); 156 | set_addr(dev,buf); 157 | 158 | unlock: 159 | spin_unlock(&dev->slock); 160 | 161 | TVD_irq_status_clear(dev->channel_irq, TVD_FRAME_DONE); 162 | 163 | return IRQ_HANDLED; 164 | } 165 | 166 | 167 | static int tvd_clk_init(struct tvd_dev *dev,int interface) 168 | { 169 | int ret; 170 | struct clk *module_clk_src; 171 | 172 | dev->ahb_clk=clk_get(NULL, "ahb_tvd"); 173 | if (NULL == dev->ahb_clk || IS_ERR(dev->ahb_clk)) 174 | { 175 | __err("get tvd ahb clk error!\n"); 176 | return -1; 177 | } 178 | 179 | dev->module1_clk=clk_get(NULL,"tvdmod1"); 180 | if(NULL == dev->module1_clk || IS_ERR(dev->module1_clk)) 181 | { 182 | __err("get tvd module1 clock error!\n"); 183 | return -1; 184 | } 185 | 186 | dev->module2_clk=clk_get(NULL,"tvdmod2"); 187 | if(NULL == dev->module2_clk || IS_ERR(dev->module2_clk)) 188 | { 189 | __err("get tvd module2 clock error!\n"); 190 | return -1; 191 | } 192 | 193 | dev->dram_clk = clk_get(NULL, "sdram_tvd"); 194 | if (NULL == dev->dram_clk || IS_ERR(dev->dram_clk)) 195 | { 196 | __err("get tvd dram clock error!\n"); 197 | return -1; 198 | } 199 | 200 | module_clk_src=clk_get(NULL,"video_pll0"); //can select video_pll0 or video_pll1 201 | if (NULL == module_clk_src || IS_ERR(module_clk_src)) 202 | { 203 | __err("get tvd clock source error!\n"); 204 | return -1; 205 | } 206 | 207 | if (interface == 2) {//YpbPr_P 208 | //ret = clk_set_rate(module_clk_src, 330000000); //264000000//297000000 209 | ret = clk_set_rate(module_clk_src, 270000000); //264000000//297000000 210 | } else {//CVBS and YPbPr_I 211 | ret = clk_set_rate(module_clk_src, 297000000); //264000000//297000000 212 | } 213 | 214 | if (ret == -1) 215 | { 216 | __err("set tvd parent clock error!\n"); 217 | return -1; 218 | } 219 | 220 | ret = clk_set_parent(dev->module1_clk, module_clk_src); 221 | if (ret == -1) 222 | { 223 | __err("set tvd parent clock error!\n"); 224 | return -1; 225 | } 226 | 227 | /* add by yaowenjun@allwinnertech.com 228 | * spec p77 TVD_CLK_REG 229 | * bit[3-0] set TVD_CLK divid ratio(m) 230 | * the per-divided clock is divided by(m+1). the divider is from 231 | * 1 to 16 232 | * 0xb,0x5 from dulianping@allwinnertech.com 233 | */ 234 | if (interface == 2) {//YpbPr_P 235 | ret = clk_set_rate(dev->module1_clk, 270000000 / 0x5); 236 | } else {//CVBS and YPbPr_I 237 | ret = clk_set_rate(dev->module1_clk, 297000000 / 0xb); 238 | } 239 | 240 | if (ret == -1) 241 | { 242 | __err("set tvd clk rate error!\n"); 243 | return -1; 244 | } 245 | 246 | if(NULL == module_clk_src || IS_ERR(module_clk_src)) 247 | { 248 | __err("tvd module_clk_src NULL hdle\n"); 249 | return -1; 250 | } 251 | clk_put(module_clk_src); //use ok 252 | 253 | return 0; 254 | } 255 | 256 | static int tvd_clk_exit(struct tvd_dev *dev) 257 | { 258 | if(NULL == dev->ahb_clk || IS_ERR(dev->ahb_clk)) 259 | { 260 | __err("tvd ahb_clk NULL hdle\n"); 261 | return -1; 262 | } 263 | clk_put(dev->ahb_clk); 264 | dev->ahb_clk = NULL; 265 | 266 | if(NULL == dev->module1_clk || IS_ERR(dev->module1_clk)) 267 | { 268 | __err("tvd module1_clk NULL hdle\n"); 269 | return -1; 270 | } 271 | clk_put(dev->module1_clk); 272 | dev->module1_clk = NULL; 273 | 274 | if(NULL == dev->module2_clk || IS_ERR(dev->module2_clk)) 275 | { 276 | __err("tvd module2_clk NULL hdle\n"); 277 | return -1; 278 | } 279 | clk_put(dev->module2_clk); 280 | dev->module2_clk = NULL; 281 | 282 | if(NULL == dev->dram_clk || IS_ERR(dev->dram_clk)) 283 | { 284 | __err("tvd dram_clk NULL hdle\n"); 285 | return -1; 286 | } 287 | clk_put(dev->dram_clk); 288 | dev->dram_clk = NULL; 289 | 290 | return 0; 291 | } 292 | 293 | static int tvd_clk_open(struct tvd_dev *dev) 294 | { 295 | if(clk_enable(dev->dram_clk)) 296 | { 297 | __err("tvd dram_clk enable fail\n"); 298 | } 299 | if(clk_enable(dev->module1_clk)) 300 | { 301 | __err("tvd module1_clk enable fail\n"); 302 | } 303 | if(clk_enable(dev->module2_clk)) 304 | { 305 | __err("tvd module2_clk enable fail\n"); 306 | } 307 | if(clk_enable(dev->ahb_clk)) 308 | { 309 | __err("tvd ahb_clk enable fail\n"); 310 | } 311 | return 0; 312 | } 313 | 314 | static int tvd_clk_close(struct tvd_dev *dev) 315 | { 316 | if(NULL == dev->ahb_clk || IS_ERR(dev->ahb_clk)) 317 | { 318 | __err("tvd ahb_clk NULL hdle\n"); 319 | return -1; 320 | } 321 | clk_disable(dev->ahb_clk); 322 | 323 | if(NULL == dev->module1_clk || IS_ERR(dev->module1_clk)) 324 | { 325 | __err("tvd module1_clk NULL hdle\n"); 326 | return -1; 327 | } 328 | clk_disable(dev->module1_clk); 329 | 330 | if(NULL == dev->module2_clk || IS_ERR(dev->module2_clk)) 331 | { 332 | __err("tvd module2_clk NULL hdle\n"); 333 | return -1; 334 | } 335 | clk_disable(dev->module2_clk); 336 | 337 | if(NULL == dev->dram_clk || IS_ERR(dev->dram_clk)) 338 | { 339 | __err("tvd dram_clk NULL hdle\n"); 340 | return -1; 341 | } 342 | clk_disable(dev->dram_clk); 343 | 344 | return 0; 345 | } 346 | 347 | static ssize_t tvd_read(struct file *file, char __user *data, size_t count, loff_t *ppos) 348 | { 349 | struct tvd_dev *dev = video_drvdata(file); 350 | 351 | __dbg("%s\n", __FUNCTION__); 352 | 353 | start_generating(dev); 354 | return videobuf_read_stream(&dev->vb_vidq, data, count, ppos, 0, 355 | file->f_flags & O_NONBLOCK); 356 | } 357 | 358 | static unsigned int tvd_poll(struct file *file, struct poll_table_struct *wait) 359 | { 360 | struct tvd_dev *dev = video_drvdata(file); 361 | struct videobuf_queue *q = &dev->vb_vidq; 362 | 363 | __dbg("%s\n", __FUNCTION__); 364 | 365 | start_generating(dev); 366 | return videobuf_poll_stream(file, q, wait); 367 | } 368 | 369 | static int tvd_open(struct file *file) 370 | { 371 | struct tvd_dev *dev = video_drvdata(file); 372 | int ret=0; 373 | __dbg("%s\n", __FUNCTION__); 374 | 375 | if (dev->opened == 1) { 376 | __err("device open busy\n"); 377 | return -EBUSY; 378 | } 379 | 380 | if (tvd_clk_init(dev,0)) 381 | { 382 | __err("clock init fail!\n"); 383 | } 384 | tvd_clk_open(dev); 385 | 386 | TVD_init(dev->regs); 387 | dev->input=0;//default input 388 | dev->opened=1; 389 | 390 | return ret; 391 | } 392 | 393 | static int tvd_close(struct file *file) 394 | { 395 | struct tvd_dev *dev = video_drvdata(file); 396 | int ret=0; 397 | __dbg("%s\n", __FUNCTION__); 398 | tvd_clk_close(dev); 399 | videobuf_stop(&dev->vb_vidq); 400 | videobuf_mmap_free(&dev->vb_vidq); 401 | 402 | dev->opened=0; 403 | stop_generating(dev); 404 | return ret; 405 | } 406 | 407 | static int tvd_mmap(struct file *file, struct vm_area_struct *vma) 408 | { 409 | struct tvd_dev *dev = video_drvdata(file); 410 | int ret; 411 | 412 | __dbg("%s\n", __FUNCTION__); 413 | 414 | __dbg("mmap called, vma=0x%08lx\n", (unsigned long)vma); 415 | 416 | ret = videobuf_mmap_mapper(&dev->vb_vidq, vma); 417 | 418 | __dbg("vma start=0x%08lx, size=%ld, ret=%d\n", 419 | (unsigned long)vma->vm_start, 420 | (unsigned long)vma->vm_end-(unsigned long)vma->vm_start,ret); 421 | 422 | return ret; 423 | } 424 | 425 | static const struct v4l2_file_operations fops = { 426 | .owner = THIS_MODULE, 427 | .open = tvd_open, 428 | .release = tvd_close, 429 | .read = tvd_read, 430 | .poll = tvd_poll, 431 | .ioctl = video_ioctl2, 432 | .mmap = tvd_mmap, 433 | }; 434 | 435 | 436 | static int vidioc_querycap(struct file *file, void *priv,struct v4l2_capability *cap) 437 | { 438 | struct tvd_dev *dev = video_drvdata(file); 439 | 440 | __dbg("%s\n", __FUNCTION__); 441 | 442 | strcpy(cap->driver, "tvd"); 443 | strcpy(cap->card, "tvd"); 444 | strlcpy(cap->bus_info, dev->v4l2_dev.name, sizeof(cap->bus_info)); 445 | 446 | cap->version = TVD_VERSION; 447 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE|V4L2_CAP_STREAMING|V4L2_CAP_READWRITE; 448 | return 0; 449 | } 450 | 451 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,struct v4l2_fmtdesc *format) 452 | { 453 | struct fmt *fmt; 454 | 455 | __dbg("%s\n", __FUNCTION__); 456 | 457 | if (format->index > ARRAY_SIZE(formats)-1) { 458 | return -EINVAL; 459 | } 460 | fmt = &formats[format->index]; 461 | 462 | strlcpy(format->description, fmt->name, sizeof(format->description)); 463 | format->pixelformat = fmt->fourcc; 464 | 465 | return 0; 466 | } 467 | 468 | static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,struct v4l2_format *format) 469 | { 470 | int ret = 0; 471 | #if 0 472 | struct tvd_dev *dev = video_drvdata(file); 473 | struct fmt *fmt; 474 | 475 | 476 | __dbg("%s\n", __FUNCTION__); 477 | 478 | //judge the resolution 479 | if(format->fmt.pix.width > MAX_WIDTH || format->fmt.pix.height > MAX_HEIGHT) { 480 | __err("size is too large,automatically set to maximum!\n"); 481 | format->fmt.pix.width = MAX_WIDTH; 482 | format->fmt.pix.height = MAX_HEIGHT; 483 | } 484 | 485 | fmt = get_format(format); 486 | if (!fmt) { 487 | __err("Fourcc format (0x%08x) invalid.\n",format->fmt.pix.pixelformat); 488 | return -EINVAL; 489 | } 490 | 491 | //format->fmt.pix.width = 720; 492 | //format->fmt.pix.height = 480; 493 | 494 | __dbg("pix->width=%d\n",format->fmt.pix.width); 495 | __dbg("pix->height=%d\n",format->fmt.pix.height); 496 | #endif 497 | return ret; 498 | } 499 | 500 | 501 | static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,struct v4l2_format *format) 502 | { 503 | struct tvd_dev *dev = video_drvdata(file); 504 | 505 | __dbg("%s\n", __FUNCTION__); 506 | 507 | format->fmt.pix.width = dev->width; 508 | format->fmt.pix.height = dev->height; 509 | format->fmt.pix.field = dev->vb_vidq.field; 510 | format->fmt.pix.pixelformat = dev->fmt->fourcc; 511 | format->fmt.pix.bytesperline = (format->fmt.pix.width * dev->fmt->depth) >> 3; 512 | format->fmt.pix.sizeimage = format->fmt.pix.height * format->fmt.pix.bytesperline; 513 | 514 | return 0; 515 | } 516 | 517 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,struct v4l2_format *format) 518 | { 519 | int ret = 0; 520 | struct tvd_dev *dev = video_drvdata(file); 521 | struct videobuf_queue *q = &dev->vb_vidq; 522 | struct fmt *fmt; 523 | if (is_generating(dev)) { 524 | __err("%s device busy\n", __func__); 525 | return -EBUSY; 526 | } 527 | 528 | mutex_lock(&q->vb_lock); 529 | 530 | ret = vidioc_try_fmt_vid_cap(file, priv, format); 531 | if (ret < 0) { 532 | __err("try format failed!\n"); 533 | goto out; 534 | } 535 | 536 | fmt = get_format(format); 537 | if (!fmt) { 538 | __err("Fourcc format (0x%08x) invalid.\n",format->fmt.pix.pixelformat); 539 | ret = -EINVAL; 540 | goto out; 541 | } 542 | 543 | //save the current format info 544 | dev->fmt = fmt; 545 | dev->vb_vidq.field = format->fmt.pix.field; 546 | dev->width = format->fmt.pix.width; 547 | dev->height = format->fmt.pix.height; 548 | 549 | dev->interface = 0; 550 | 551 | if(dev->height==480) 552 | dev->system = 0;//ntsc 553 | else if(dev->height==576) 554 | dev->system = 1;//pal 555 | 556 | if(dev->width==720) 557 | dev->format = 0; //non mb 558 | else if(dev->width==704) 559 | dev->format = 1;//mb 560 | 561 | dev->row = 1; 562 | dev->column = 1; 563 | dev->channel_index[0] = 1; 564 | dev->channel_index[1] = 0; 565 | dev->channel_index[2] = 0; 566 | dev->channel_index[3] = 0; 567 | 568 | TVD_config(dev->interface, dev->system); 569 | 570 | TVD_set_width(0,format->fmt.pix.width); 571 | TVD_set_width_jump(0,format->fmt.pix.width); 572 | TVD_set_height(0,format->fmt.pix.height/2);//for interlace here set half of heigh 573 | TVD_set_fmt(0, dev->format+1); 574 | 575 | dev->channel_offset_y[0] = 0; 576 | dev->channel_offset_c[0] = 0; 577 | 578 | out: 579 | mutex_unlock(&q->vb_lock); 580 | 581 | 582 | return ret; 583 | } 584 | 585 | static int vidioc_g_fmt_type_private(struct file *file, void *priv,struct v4l2_format *format) 586 | { 587 | struct tvd_dev *dev = video_drvdata(file); 588 | int i; 589 | 590 | __dbg("%s\n", __FUNCTION__); 591 | 592 | format->fmt.raw_data[0] = dev->interface ; 593 | format->fmt.raw_data[1] = dev->system ; 594 | format->fmt.raw_data[2] = dev->format ; //for test only 595 | format->fmt.raw_data[8] = dev->row ; 596 | format->fmt.raw_data[9] = dev->column ; 597 | format->fmt.raw_data[10] = dev->channel_index[0]; 598 | format->fmt.raw_data[11] = dev->channel_index[1]; 599 | format->fmt.raw_data[12] = dev->channel_index[2]; 600 | format->fmt.raw_data[13] = dev->channel_index[3]; 601 | 602 | for(i=0;i<4;i++){ 603 | format->fmt.raw_data[16 + i] = TVD_get_status(i); 604 | } 605 | 606 | return 0; 607 | } 608 | 609 | static int vidioc_s_fmt_type_private(struct file *file, void *priv,struct v4l2_format *format) 610 | { 611 | struct tvd_dev *dev = video_drvdata(file); 612 | __u32 i; 613 | 614 | __dbg("%s\n", __FUNCTION__); 615 | 616 | if (is_generating(dev)) { 617 | __err("%s device busy\n", __func__); 618 | return -EBUSY; 619 | } 620 | 621 | dev->interface = format->fmt.raw_data[0]; //cvbs or yuv 622 | dev->system = format->fmt.raw_data[1]; //ntsc or pal 623 | dev->format = format->fmt.raw_data[2]; //mb or non-mb 624 | dev->row = format->fmt.raw_data[8]; 625 | dev->column = format->fmt.raw_data[9]; 626 | dev->channel_index[0] = format->fmt.raw_data[10]; 627 | dev->channel_index[1] = format->fmt.raw_data[11]; 628 | dev->channel_index[2] = format->fmt.raw_data[12]; 629 | dev->channel_index[3] = format->fmt.raw_data[13]; 630 | 631 | dev->vb_vidq.field = V4L2_FIELD_NONE; 632 | dev->width = dev->row*(dev->format?704:720); 633 | dev->height = dev->column*(dev->system?576:480); 634 | tvd_fmt.width = dev->width; 635 | tvd_fmt.height = dev->height; 636 | dev->fmt = &tvd_fmt; 637 | 638 | __inf("interface=%d\n",dev->interface); 639 | __inf("system=%d\n",dev->system); 640 | __inf("format=%d\n",dev->format); 641 | __inf("row=%d\n",dev->row); 642 | __inf("column=%d\n",dev->column); 643 | __inf("channel_index[0]=%d\n",dev->channel_index[0]); 644 | __inf("channel_index[1]=%d\n",dev->channel_index[1]); 645 | __inf("channel_index[2]=%d\n",dev->channel_index[2]); 646 | __inf("channel_index[3]=%d\n",dev->channel_index[3]); 647 | __inf("width=%d\n",dev->width); 648 | __inf("height=%d\n",dev->height); 649 | 650 | TVD_config(dev->interface, dev->system); 651 | for(i=0;i<4;i++){ 652 | if(dev->channel_index[i]){ 653 | TVD_set_fmt(i, dev->format?TVD_MB_YUV420:TVD_PL_YUV420); 654 | TVD_set_width(i, (dev->format?704:720)); 655 | if(dev->interface==2) 656 | TVD_set_height(i, (dev->system?576:480)); 657 | else 658 | TVD_set_height(i, (dev->system?576:480)/2); 659 | TVD_set_width_jump(i, (dev->format?704:720)*dev->row); 660 | dev->channel_offset_y[i] = ((dev->channel_index[i]-1)%dev->row)*(dev->format?704:720) + ((dev->channel_index[i]-1)/dev->row)*dev->row*(dev->format?704:720)*(dev->system?576:480); 661 | dev->channel_offset_c[i] = ((dev->channel_index[i]-1)%dev->row)*(dev->format?704:720) + ((dev->channel_index[i]-1)/dev->row)*dev->row*(dev->format?704:720)*(dev->system?576:480)/2; 662 | __inf("channel_offset_y[%d]=%d\n", i, dev->channel_offset_y[i]); 663 | __inf("channel_offset_c[%d]=%d\n", i, dev->channel_offset_c[i]); 664 | 665 | } 666 | } 667 | 668 | if (tvd_clk_init(dev,dev->interface)) 669 | { 670 | __err("clock init fail!\n"); 671 | } 672 | return 0; 673 | } 674 | 675 | 676 | 677 | static int vidioc_reqbufs(struct file *file, void *priv,struct v4l2_requestbuffers *p) 678 | { 679 | struct tvd_dev *dev = video_drvdata(file); 680 | 681 | __dbg("%s\n", __FUNCTION__); 682 | 683 | return videobuf_reqbufs(&dev->vb_vidq, p); 684 | } 685 | 686 | static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) 687 | { 688 | struct tvd_dev *dev = video_drvdata(file); 689 | __dbg("%s\n", __FUNCTION__); 690 | 691 | return videobuf_querybuf(&dev->vb_vidq, p); 692 | } 693 | 694 | static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) 695 | { 696 | struct tvd_dev *dev = video_drvdata(file); 697 | __dbg("%s\n", __FUNCTION__); 698 | 699 | return videobuf_qbuf(&dev->vb_vidq, p); 700 | } 701 | 702 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) 703 | { 704 | struct tvd_dev *dev = video_drvdata(file); 705 | __dbg("%s\n", __FUNCTION__); 706 | 707 | return videobuf_dqbuf(&dev->vb_vidq, p, file->f_flags & O_NONBLOCK); 708 | } 709 | 710 | #ifdef CONFIG_VIDEO_V4L1_COMPAT 711 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) 712 | { 713 | struct tvd_dev *dev = video_drvdata(file); 714 | __dbg("%s\n", __FUNCTION__); 715 | 716 | return videobuf_cgmbuf(&dev->vb_vidq, mbuf, 8); 717 | } 718 | #endif 719 | 720 | 721 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) 722 | { 723 | struct tvd_dev *dev = video_drvdata(file); 724 | struct dmaqueue *dma_q = &dev->vidq; 725 | struct buffer *buf; 726 | int j; 727 | 728 | int ret; 729 | 730 | __dbg("%s\n", __FUNCTION__); 731 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) { 732 | return -EINVAL; 733 | } 734 | 735 | if (is_generating(dev)) { 736 | __err("stream has been already on\n"); 737 | return 0; 738 | } 739 | 740 | /* Resets frame counters */ 741 | dev->ms = 0; 742 | dev->jiffies = jiffies; 743 | 744 | dma_q->frame = 0; 745 | dma_q->ini_jiffies = jiffies; 746 | 747 | ret = videobuf_streamon(&dev->vb_vidq); 748 | if (ret) { 749 | return ret; 750 | } 751 | 752 | buf = list_entry(dma_q->active.next, struct buffer, vb.queue); 753 | set_addr(dev,buf); 754 | 755 | for(j=0;j<4;j++){ 756 | if(dev->channel_index[j]){ 757 | dev->channel_irq = j;//FIXME, what frame done irq you should use when more than one channel signal? 758 | break; 759 | } 760 | } 761 | __dbg("channel_irq=%d\n", dev->channel_irq); 762 | TVD_irq_status_clear(dev->channel_irq,TVD_FRAME_DONE); 763 | TVD_irq_enable(dev->channel_irq,TVD_FRAME_DONE); 764 | for(j=0;j<4;j++){ 765 | if(dev->channel_index[j]) 766 | TVD_capture_on(j); 767 | } 768 | 769 | start_generating(dev); 770 | 771 | return 0; 772 | } 773 | 774 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) 775 | { 776 | struct tvd_dev *dev = video_drvdata(file); 777 | struct dmaqueue *dma_q = &dev->vidq; 778 | int ret; 779 | int j; 780 | 781 | __dbg("%s\n", __FUNCTION__); 782 | 783 | if (!is_generating(dev)) { 784 | __err("stream has been already off\n"); 785 | return 0; 786 | } 787 | 788 | stop_generating(dev); 789 | 790 | /* Resets frame counters */ 791 | dev->ms = 0; 792 | dev->jiffies = jiffies; 793 | 794 | dma_q->frame = 0; 795 | dma_q->ini_jiffies = jiffies; 796 | 797 | //FIXME 798 | TVD_irq_disable(dev->channel_irq,TVD_FRAME_DONE); 799 | TVD_irq_status_clear(dev->channel_irq,TVD_FRAME_DONE); 800 | for(j=0;j<4;j++){ 801 | if(dev->channel_index[j]) 802 | TVD_capture_off(j); 803 | } 804 | 805 | if (i != V4L2_BUF_TYPE_VIDEO_CAPTURE) { 806 | return -EINVAL; 807 | } 808 | 809 | ret = videobuf_streamoff(&dev->vb_vidq); 810 | if (ret!=0) { 811 | __err("videobu_streamoff error!\n"); 812 | return ret; 813 | } 814 | 815 | if (ret!=0) { 816 | __err("videobuf_mmap_free error!\n"); 817 | return ret; 818 | } 819 | 820 | return 0; 821 | } 822 | 823 | 824 | static int vidioc_enum_input(struct file *file, void *priv,struct v4l2_input *inp) 825 | { 826 | __dbg("%s\n", __FUNCTION__); 827 | if (inp->index > NUM_INPUTS-1) { 828 | __err("input index invalid!\n"); 829 | return -EINVAL; 830 | } 831 | 832 | inp->type = V4L2_INPUT_TYPE_CAMERA; 833 | 834 | return 0; 835 | } 836 | 837 | static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) 838 | { 839 | struct tvd_dev *dev = video_drvdata(file); 840 | __dbg("%s\n", __FUNCTION__); 841 | 842 | *i = dev->input; 843 | return 0; 844 | } 845 | 846 | static int vidioc_s_input(struct file *file, void *priv, unsigned int i) 847 | { 848 | struct tvd_dev *dev = video_drvdata(file); 849 | __dbg("%s\n", __FUNCTION__); 850 | 851 | if (i > NUM_INPUTS-1) { 852 | __err("set input error!\n"); 853 | return -EINVAL; 854 | } 855 | dev->input = i; 856 | 857 | return 0; 858 | } 859 | 860 | static int vidioc_queryctrl(struct file *file, void *priv,struct v4l2_queryctrl *qc) 861 | { 862 | int ret=0; 863 | #if 0 864 | struct tvd_dev *dev = video_drvdata(file); 865 | __dbg("%s\n", __FUNCTION__); 866 | #endif 867 | return ret; 868 | } 869 | 870 | static int vidioc_g_ctrl(struct file *file, void *priv,struct v4l2_control *ctrl) 871 | { 872 | int ret=0; 873 | #if 0 874 | struct tvd_dev *dev = video_drvdata(file); 875 | __dbg("%s\n", __FUNCTION__); 876 | #endif 877 | return ret; 878 | } 879 | 880 | 881 | static int vidioc_s_ctrl(struct file *file, void *priv,struct v4l2_control *ctrl) 882 | { 883 | int ret=0; 884 | #if 0 885 | struct tvd_dev *dev = video_drvdata(file); 886 | struct v4l2_queryctrl qc; 887 | 888 | __dbg("%s\n", __FUNCTION__); 889 | 890 | qc.id = ctrl->id; 891 | ret = vidioc_queryctrl(file, priv, &qc); 892 | if (ret < 0) { 893 | return ret; 894 | } 895 | 896 | if (ctrl->value < qc.minimum || ctrl->value > qc.maximum) { 897 | return -ERANGE; 898 | } 899 | 900 | #endif 901 | return ret; 902 | } 903 | 904 | static int vidioc_g_parm(struct file *file, void *priv,struct v4l2_streamparm *parms) 905 | { 906 | int ret=0; 907 | struct tvd_dev *dev = video_drvdata(file); 908 | if(parms->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) 909 | { 910 | parms->parm.capture.timeperframe.numerator=dev->fps.numerator; 911 | parms->parm.capture.timeperframe.denominator=dev->fps.denominator; 912 | __dbg("%s\n", __FUNCTION__); 913 | } 914 | return ret; 915 | } 916 | 917 | static int vidioc_s_parm(struct file *file, void *priv,struct v4l2_streamparm *parms) 918 | { 919 | struct tvd_dev *dev = video_drvdata(file); 920 | int ret=0; 921 | if(parms->type==V4L2_BUF_TYPE_PRIVATE) 922 | { 923 | if(parms->parm.raw_data[0] == TVD_COLOR_SET) 924 | { 925 | dev->luma = parms->parm.raw_data[1]; 926 | dev->contrast = parms->parm.raw_data[2]; 927 | dev->saturation = parms->parm.raw_data[3]; 928 | dev->hue = parms->parm.raw_data[4]; 929 | TVD_set_color(0,dev->luma,dev->contrast,dev->saturation,dev->hue); 930 | } 931 | else if(parms->parm.raw_data[0] == TVD_UV_SWAP) 932 | { 933 | dev->uv_swap = parms->parm.raw_data[1]; 934 | TVD_uv_swap(dev->uv_swap); 935 | } 936 | } 937 | else if(parms->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) 938 | { 939 | dev->fps.numerator=parms->parm.capture.timeperframe.numerator; 940 | dev->fps.denominator=parms->parm.capture.timeperframe.denominator; 941 | } 942 | __dbg("%s\n", __FUNCTION__); 943 | return ret; 944 | } 945 | 946 | static const struct v4l2_ioctl_ops ioctl_ops = { 947 | .vidioc_querycap = vidioc_querycap, 948 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 949 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 950 | .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 951 | .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 952 | .vidioc_s_fmt_type_private = vidioc_s_fmt_type_private, 953 | .vidioc_g_fmt_type_private = vidioc_g_fmt_type_private, 954 | .vidioc_reqbufs = vidioc_reqbufs, 955 | .vidioc_querybuf = vidioc_querybuf, 956 | .vidioc_qbuf = vidioc_qbuf, 957 | .vidioc_dqbuf = vidioc_dqbuf, 958 | .vidioc_enum_input = vidioc_enum_input, 959 | .vidioc_g_input = vidioc_g_input, 960 | .vidioc_s_input = vidioc_s_input, 961 | .vidioc_streamon = vidioc_streamon, 962 | .vidioc_streamoff = vidioc_streamoff, 963 | .vidioc_queryctrl = vidioc_queryctrl, 964 | .vidioc_g_ctrl = vidioc_g_ctrl, 965 | .vidioc_s_ctrl = vidioc_s_ctrl, 966 | .vidioc_g_parm = vidioc_g_parm, 967 | .vidioc_s_parm = vidioc_s_parm, 968 | #ifdef CONFIG_VIDEO_V4L1_COMPAT 969 | .vidiocgmbuf = vidiocgmbuf, 970 | #endif 971 | }; 972 | 973 | 974 | static struct video_device device = { 975 | .name = "tvd", 976 | .fops = &fops, 977 | .ioctl_ops = &ioctl_ops, 978 | .release = video_device_release, 979 | }; 980 | 981 | 982 | static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) 983 | { 984 | struct tvd_dev *dev = vq->priv_data; 985 | __dbg("%s\n", __FUNCTION__); 986 | 987 | switch (dev->fmt->output_fmt) { 988 | case TVD_MB_YUV420: 989 | case TVD_PL_YUV420: 990 | *size = dev->width * dev->height * 2; 991 | break; 992 | case TVD_PL_YUV422: 993 | default: 994 | *size = dev->width * dev->height * 3/2; 995 | break; 996 | } 997 | 998 | dev->frame_size = *size; 999 | 1000 | if (*count < 3) { 1001 | *count = 3; 1002 | __err("buffer count is invalid, set to 3\n"); 1003 | } else if(*count > 5) { 1004 | *count = 5; 1005 | __err("buffer count is invalid, set to 5\n"); 1006 | } 1007 | 1008 | while (*size * *count > MAX_BUFFER) {//FIXME 1009 | (*count)--; 1010 | } 1011 | 1012 | __dbg("%s, buffer count=%d, size=%d\n", __func__,*count, *size); 1013 | return 0; 1014 | } 1015 | 1016 | static void free_buffer(struct videobuf_queue *vq, struct buffer *buf) 1017 | { 1018 | __dbg("%s\n", __FUNCTION__); 1019 | __dbg("%s, state: %i\n", __func__, buf->vb.state); 1020 | 1021 | #ifdef USE_DMA_CONTIG 1022 | videobuf_dma_contig_free(vq, &buf->vb); 1023 | #endif 1024 | 1025 | __dbg("free_buffer: freed\n"); 1026 | 1027 | buf->vb.state = VIDEOBUF_NEEDS_INIT; 1028 | } 1029 | 1030 | static int buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,enum v4l2_field field) 1031 | { 1032 | struct tvd_dev *dev = vq->priv_data; 1033 | struct buffer *buf = container_of(vb, struct buffer, vb); 1034 | int rc; 1035 | 1036 | __dbg("%s\n", __FUNCTION__); 1037 | 1038 | BUG_ON(NULL == dev->fmt); 1039 | 1040 | if (dev->width < MIN_WIDTH || dev->width > MAX_WIDTH || 1041 | dev->height < MIN_HEIGHT || dev->height > MAX_HEIGHT) { 1042 | return -EINVAL; 1043 | } 1044 | 1045 | buf->vb.size = dev->frame_size; 1046 | 1047 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) { 1048 | return -EINVAL; 1049 | } 1050 | 1051 | /* These properties only change when queue is idle, see s_fmt */ 1052 | buf->fmt = dev->fmt; 1053 | buf->vb.width = dev->width; 1054 | buf->vb.height = dev->height; 1055 | buf->vb.field = field; 1056 | 1057 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { 1058 | rc = videobuf_iolock(vq, &buf->vb, NULL); 1059 | if (rc < 0) { 1060 | goto fail; 1061 | } 1062 | } 1063 | 1064 | vb->boff= videobuf_to_dma_contig(vb); 1065 | buf->vb.state = VIDEOBUF_PREPARED; 1066 | 1067 | return 0; 1068 | 1069 | fail: 1070 | free_buffer(vq, buf); 1071 | return rc; 1072 | } 1073 | 1074 | static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) 1075 | { 1076 | struct tvd_dev *dev = vq->priv_data; 1077 | struct buffer *buf = container_of(vb, struct buffer, vb); 1078 | struct dmaqueue *vidq = &dev->vidq; 1079 | 1080 | __dbg("%s\n", __FUNCTION__); 1081 | buf->vb.state = VIDEOBUF_QUEUED; 1082 | list_add_tail(&buf->vb.queue, &vidq->active); 1083 | } 1084 | 1085 | static void buffer_release(struct videobuf_queue *vq, 1086 | struct videobuf_buffer *vb) 1087 | { 1088 | struct buffer *buf = container_of(vb, struct buffer, vb); 1089 | 1090 | __dbg("%s\n", __FUNCTION__); 1091 | 1092 | free_buffer(vq, buf); 1093 | } 1094 | 1095 | static struct videobuf_queue_ops video_qops = { 1096 | .buf_setup = buffer_setup, 1097 | .buf_prepare = buffer_prepare, 1098 | .buf_queue = buffer_queue, 1099 | .buf_release = buffer_release, 1100 | }; 1101 | 1102 | static int tvd_probe(struct platform_device *pdev) 1103 | { 1104 | struct tvd_dev *dev; 1105 | struct resource *res; 1106 | struct video_device *vfd; 1107 | int ret = 0; 1108 | __dbg("%s\n", __FUNCTION__); 1109 | 1110 | /*request mem for dev*/ 1111 | dev = kzalloc(sizeof(struct tvd_dev), GFP_KERNEL); 1112 | if (!dev) { 1113 | __err("request dev mem failed!\n"); 1114 | return -ENOMEM; 1115 | } 1116 | dev->id = pdev->id; 1117 | dev->pdev = pdev; 1118 | 1119 | spin_lock_init(&dev->slock); 1120 | 1121 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1122 | if (!res) { 1123 | __err("failed to find the registers\n"); 1124 | ret = -ENOENT; 1125 | goto err_info; 1126 | } 1127 | 1128 | dev->regs_res = request_mem_region(res->start, resource_size(res), 1129 | dev_name(&pdev->dev)); 1130 | if (!dev->regs_res) { 1131 | __err("failed to obtain register region\n"); 1132 | ret = -ENOENT; 1133 | goto err_info; 1134 | } 1135 | 1136 | dev->regs = ioremap(res->start, resource_size(res)); 1137 | if (!dev->regs) { 1138 | __err("failed to map registers\n"); 1139 | ret = -ENXIO; 1140 | goto err_req_region; 1141 | } 1142 | 1143 | /*get irq resource*/ 1144 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1145 | if (!res) { 1146 | __err("failed to get IRQ resource\n"); 1147 | ret = -ENXIO; 1148 | goto err_regs_unmap; 1149 | } 1150 | 1151 | dev->irq = res->start; 1152 | 1153 | ret = request_irq(dev->irq, tvd_irq, 0, pdev->name, dev); 1154 | if (ret) { 1155 | __err("failed to install irq (%d)\n", ret); 1156 | goto err_clk; 1157 | } 1158 | 1159 | /* v4l2 device register */ 1160 | ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); 1161 | if (ret) { 1162 | __err("Error registering v4l2 device\n"); 1163 | goto err_irq; 1164 | 1165 | } 1166 | 1167 | dev_set_drvdata(&(pdev)->dev, (dev)); 1168 | 1169 | if (tvd_clk_init(dev,0)) { 1170 | __err("clock init fail!\n"); 1171 | ret = -ENXIO; 1172 | goto unreg_dev; 1173 | } 1174 | 1175 | /*video device register */ 1176 | ret = -ENOMEM; 1177 | vfd = video_device_alloc(); 1178 | if (!vfd) { 1179 | goto err_clk; 1180 | } 1181 | 1182 | *vfd = device; 1183 | vfd->v4l2_dev = &dev->v4l2_dev; 1184 | 1185 | dev_set_name(&vfd->dev, "tvd"); 1186 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); 1187 | if (ret < 0) { 1188 | goto rel_vdev; 1189 | } 1190 | video_set_drvdata(vfd, dev); 1191 | 1192 | /*add device list*/ 1193 | /* Now that everything is fine, let's add it to device list */ 1194 | list_add_tail(&dev->devlist, &devlist); 1195 | 1196 | if (video_nr != -1) { 1197 | video_nr++; 1198 | } 1199 | dev->vfd = vfd; 1200 | 1201 | __inf("V4L2 device registered as %s\n",video_device_node_name(vfd)); 1202 | 1203 | /*initial video buffer queue*/ 1204 | videobuf_queue_dma_contig_init(&dev->vb_vidq, &video_qops, 1205 | NULL, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE, 1206 | V4L2_FIELD_NONE, 1207 | sizeof(struct buffer), dev,NULL); 1208 | 1209 | /* init video dma queues */ 1210 | INIT_LIST_HEAD(&dev->vidq.active); 1211 | //init_waitqueue_head(&dev->vidq.wq); 1212 | 1213 | return 0; 1214 | 1215 | rel_vdev: 1216 | video_device_release(vfd); 1217 | err_clk: 1218 | tvd_clk_exit(dev); 1219 | unreg_dev: 1220 | v4l2_device_unregister(&dev->v4l2_dev); 1221 | kfree(dev); 1222 | err_irq: 1223 | free_irq(dev->irq, dev); 1224 | err_regs_unmap: 1225 | iounmap(dev->regs); 1226 | err_req_region: 1227 | release_resource(dev->regs_res); 1228 | kfree(dev->regs_res); 1229 | err_info: 1230 | kfree(dev); 1231 | __err("failed to install\n"); 1232 | 1233 | return ret; 1234 | } 1235 | 1236 | static int tvd_release(void) 1237 | { 1238 | struct tvd_dev *dev; 1239 | struct list_head *list; 1240 | 1241 | __dbg("%s\n", __FUNCTION__); 1242 | 1243 | while (!list_empty(&devlist)) 1244 | { 1245 | list = devlist.next; 1246 | list_del(list); 1247 | dev = list_entry(list, struct tvd_dev, devlist); 1248 | 1249 | v4l2_info(&dev->v4l2_dev, "unregistering %s\n", video_device_node_name(dev->vfd)); 1250 | video_unregister_device(dev->vfd); 1251 | v4l2_device_unregister(&dev->v4l2_dev); 1252 | kfree(dev); 1253 | } 1254 | 1255 | return 0; 1256 | } 1257 | 1258 | static int __devexit tvd_remove(struct platform_device *pdev) 1259 | { 1260 | struct tvd_dev *dev=(struct tvd_dev *)dev_get_drvdata(&(pdev)->dev); 1261 | free_irq(dev->irq, dev);// 1262 | tvd_clk_exit(dev); 1263 | iounmap(dev->regs); 1264 | release_resource(dev->regs_res); 1265 | kfree(dev->regs_res); 1266 | kfree(dev); 1267 | return 0; 1268 | } 1269 | 1270 | static int tvd_suspend(struct platform_device *pdev, pm_message_t state) 1271 | { 1272 | struct tvd_dev *dev=(struct tvd_dev *)dev_get_drvdata(&(pdev)->dev); 1273 | int ret=0; 1274 | 1275 | __dbg("%s\n", __FUNCTION__); 1276 | 1277 | if (dev->opened==1) { 1278 | tvd_clk_close(dev); 1279 | } 1280 | return ret; 1281 | } 1282 | 1283 | static int tvd_resume(struct platform_device *pdev) 1284 | { 1285 | int ret=0; 1286 | struct tvd_dev *dev=(struct tvd_dev *)dev_get_drvdata(&(pdev)->dev); 1287 | 1288 | __dbg("%s\n", __FUNCTION__); 1289 | 1290 | if (dev->opened==1) { 1291 | tvd_clk_open(dev); 1292 | } 1293 | 1294 | return ret; 1295 | } 1296 | 1297 | static struct platform_driver tvd_driver = { 1298 | .probe = tvd_probe, 1299 | .remove = __devexit_p(tvd_remove), 1300 | .suspend = tvd_suspend, 1301 | .resume = tvd_resume, 1302 | .driver = { 1303 | .name = "tvd", 1304 | .owner = THIS_MODULE, 1305 | } 1306 | }; 1307 | 1308 | static struct resource tvd_resource[2] = { 1309 | [0] = { 1310 | .start = TVD_REGS_BASE, 1311 | .end = (TVD_REGS_BASE + TVD_REG_SIZE - 1), 1312 | .flags = IORESOURCE_MEM, 1313 | }, 1314 | [1] = { 1315 | .start = AW_IRQ_TVD, 1316 | .end = AW_IRQ_TVD, 1317 | .flags = IORESOURCE_IRQ, 1318 | }, 1319 | }; 1320 | 1321 | static struct platform_device tvd_device = { 1322 | .name = "tvd", 1323 | .id = -1,//?? 1324 | .num_resources = ARRAY_SIZE(tvd_resource), 1325 | .resource = tvd_resource, 1326 | .dev = {} 1327 | }; 1328 | 1329 | static int __init tvd_init(void) 1330 | { 1331 | __u32 ret=0; 1332 | ret = platform_device_register(&tvd_device); 1333 | if (ret) { 1334 | __err("platform device register failed!\n"); 1335 | return -1; 1336 | } 1337 | 1338 | ret = platform_driver_register(&tvd_driver); 1339 | 1340 | if (ret) { 1341 | __err("platform driver register failed!\n"); 1342 | return -1; 1343 | } 1344 | return ret; 1345 | } 1346 | 1347 | static void __exit tvd_exit(void) 1348 | { 1349 | __dbg("%s\n", __FUNCTION__); 1350 | tvd_release(); 1351 | platform_driver_unregister(&tvd_driver); 1352 | } 1353 | 1354 | module_init(tvd_init); 1355 | module_exit(tvd_exit); 1356 | 1357 | MODULE_AUTHOR("jshwang"); 1358 | MODULE_LICENSE("GPL"); 1359 | MODULE_DESCRIPTION("TV decoder driver"); 1360 | -------------------------------------------------------------------------------- /sun7i_tvd-lichee-android-linux3.3/drv_tvd.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #define TVD_REGS_BASE 0x01c08000 34 | #define TVD_REG_SIZE 0x1000 35 | 36 | #define TVD_MAJOR_VERSION 1 37 | #define TVD_MINOR_VERSION 0 38 | #define TVD_RELEASE 0 39 | #define TVD_VERSION KERNEL_VERSION(TVD_MAJOR_VERSION, TVD_MINOR_VERSION, TVD_RELEASE) 40 | #define TVD_MODULE_NAME "tvd" 41 | 42 | #define NUM_INPUTS 2 43 | 44 | #define MIN_WIDTH (32) 45 | #define MIN_HEIGHT (32) 46 | #define MAX_WIDTH (4096) 47 | #define MAX_HEIGHT (4096) 48 | #define MAX_BUFFER (32*1024*1024) 49 | 50 | //#define USE_DMA_CONTIG 51 | 52 | #define BLINK_DELAY HZ/2 53 | 54 | static unsigned video_nr = 1; 55 | static unsigned first_flag = 0; 56 | //static struct timer_list timer; 57 | 58 | typedef enum 59 | { 60 | TVD_UV_SWAP, 61 | TVD_COLOR_SET, 62 | }tvd_param_t; 63 | 64 | struct fmt { 65 | u8 name[32]; 66 | __u32 fourcc; /* v4l2 format id */ 67 | tvd_fmt_t output_fmt; 68 | int depth; 69 | __u32 width; 70 | __u32 height; 71 | }; 72 | 73 | static struct fmt tvd_fmt = { 74 | .name = "planar YUV420", 75 | .fourcc = V4L2_PIX_FMT_NV12, 76 | .output_fmt = TVD_PL_YUV420, 77 | .depth = 12, 78 | .width = 720,//may be change 79 | .height = 480,//may be change 80 | }; 81 | 82 | static struct fmt formats[] = { 83 | { 84 | .name = "planar YUV420", 85 | .fourcc = V4L2_PIX_FMT_NV12, 86 | .output_fmt = TVD_PL_YUV420, 87 | .depth = 12, 88 | .width = 720, 89 | .height = 480, 90 | }, 91 | { 92 | .name = "planar YUV420", 93 | .fourcc = V4L2_PIX_FMT_NV12, 94 | .output_fmt = TVD_PL_YUV420, 95 | .depth = 12, 96 | .width = 720, 97 | .height = 960, 98 | }, 99 | { 100 | .name = "planar YUV420", 101 | .fourcc = V4L2_PIX_FMT_NV12, 102 | .output_fmt = TVD_PL_YUV420, 103 | .depth = 12, 104 | .width = 720, 105 | .height = 1920, 106 | }, 107 | { 108 | .name = "planar YUV420", 109 | .fourcc = V4L2_PIX_FMT_NV12, 110 | .output_fmt = TVD_PL_YUV420, 111 | .depth = 12, 112 | .width = 1440, 113 | .height = 480, 114 | }, 115 | { 116 | .name = "planar YUV420", 117 | .fourcc = V4L2_PIX_FMT_NV12, 118 | .output_fmt = TVD_PL_YUV420, 119 | .depth = 12, 120 | .width = 2880, 121 | .height = 480, 122 | }, 123 | { 124 | .name = "planar YUV420", 125 | .fourcc = V4L2_PIX_FMT_NV12, 126 | .output_fmt = TVD_PL_YUV420, 127 | .depth = 12, 128 | .width = 1440, 129 | .height = 960, 130 | }, 131 | { 132 | .name = "planar YUV420", 133 | .fourcc = V4L2_PIX_FMT_NV12, 134 | .output_fmt = TVD_PL_YUV420, 135 | .depth = 12, 136 | .width = 720, 137 | .height = 576, 138 | }, 139 | { 140 | .name = "planar YUV420", 141 | .fourcc = V4L2_PIX_FMT_NV21, 142 | .output_fmt = TVD_PL_YUV420, 143 | .depth = 12, 144 | .width = 720, 145 | .height = 480, 146 | }, 147 | { 148 | .name = "planar YUV420", 149 | .fourcc = V4L2_PIX_FMT_NV21, 150 | .output_fmt = TVD_PL_YUV420, 151 | .depth = 12, 152 | .width = 720, 153 | .height = 960, 154 | }, 155 | { 156 | .name = "planar YUV420", 157 | .fourcc = V4L2_PIX_FMT_NV21, 158 | .output_fmt = TVD_PL_YUV420, 159 | .depth = 12, 160 | .width = 720, 161 | .height = 1920, 162 | }, 163 | { 164 | .name = "planar YUV420", 165 | .fourcc = V4L2_PIX_FMT_NV21, 166 | .output_fmt = TVD_PL_YUV420, 167 | .depth = 12, 168 | .width = 1440, 169 | .height = 480, 170 | }, 171 | { 172 | .name = "planar YUV420", 173 | .fourcc = V4L2_PIX_FMT_NV21, 174 | .output_fmt = TVD_PL_YUV420, 175 | .depth = 12, 176 | .width = 2880, 177 | .height = 480, 178 | }, 179 | { 180 | .name = "planar YUV420", 181 | .fourcc = V4L2_PIX_FMT_NV21, 182 | .output_fmt = TVD_PL_YUV420, 183 | .depth = 12, 184 | .width = 1440, 185 | .height = 960, 186 | }, 187 | { 188 | .name = "planar YUV420", 189 | .fourcc = V4L2_PIX_FMT_NV21, 190 | .output_fmt = TVD_PL_YUV420, 191 | .depth = 12, 192 | .width = 720, 193 | .height = 576, 194 | }, 195 | }; 196 | 197 | /* buffer for one video frame */ 198 | struct buffer { 199 | struct videobuf_buffer vb; 200 | struct fmt *fmt; 201 | }; 202 | 203 | struct dmaqueue { 204 | struct list_head active; 205 | int frame; /* Counters to control fps rate */ 206 | int ini_jiffies; 207 | }; 208 | 209 | struct buf_addr { 210 | dma_addr_t y; 211 | dma_addr_t c; 212 | }; 213 | 214 | static LIST_HEAD(devlist); 215 | 216 | struct tvd_dev { 217 | struct list_head devlist; 218 | struct v4l2_device v4l2_dev; 219 | struct v4l2_subdev *sd; 220 | struct platform_device *pdev; 221 | 222 | int id; 223 | 224 | spinlock_t slock; 225 | 226 | /* various device info */ 227 | struct video_device *vfd; 228 | 229 | struct dmaqueue vidq; 230 | 231 | /* Several counters */ 232 | unsigned ms; 233 | unsigned long jiffies; 234 | 235 | /* Input Number */ 236 | int input; 237 | 238 | /* video capture */ 239 | struct fmt *fmt; 240 | unsigned int width; 241 | unsigned int height; 242 | unsigned int frame_size; 243 | struct videobuf_queue vb_vidq; 244 | 245 | /* */ 246 | unsigned int interface; 247 | unsigned int system; 248 | unsigned int format; 249 | unsigned int row; 250 | unsigned int column; 251 | //unsigned int channel_en[4]; 252 | unsigned int channel_index[4]; 253 | unsigned int channel_offset_y[4]; 254 | unsigned int channel_offset_c[4]; 255 | unsigned int channel_irq; 256 | 257 | /*working state*/ 258 | unsigned long generating; 259 | int opened; 260 | 261 | //clock 262 | struct clk *ahb_clk; 263 | struct clk *module1_clk; 264 | struct clk *module2_clk; 265 | struct clk *dram_clk; 266 | 267 | int irq; 268 | void __iomem *regs; 269 | struct resource *regs_res; //?? 270 | 271 | struct buf_addr buf_addr; 272 | 273 | //luma contrast saturation hue 274 | unsigned int luma; 275 | unsigned int contrast; 276 | unsigned int saturation; 277 | unsigned int hue; 278 | 279 | unsigned int uv_swap; 280 | //fps 281 | struct v4l2_fract fps; 282 | 283 | }; 284 | 285 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.3/Kconfig: -------------------------------------------------------------------------------- 1 | config SUN7I_TVD 2 | tristate "TV Decoder" 3 | default m 4 | depends on VIDEO_DEV && VIDEO_V4L2 5 | select VIDEOBUF_DMA_CONTIG 6 | help 7 | This is the driver of TV decoder. 8 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.3/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_SUN7I_TVD) += sun7i_tvd.o 2 | 3 | sun7i_tvd-objs := drv_tvd.o bsp_tvd.o 4 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.3/bsp_tvd.c: -------------------------------------------------------------------------------- 1 | #include "bsp_tvd.h" 2 | #include 3 | 4 | #define REG_RD32(reg) (*((volatile __u32 *)(reg))) 5 | #define REG_WR32(reg, value) (*((volatile __u32 *)(reg)) = (value)) 6 | 7 | static __u32 addr_base = 0; 8 | 9 | void TVD_init(void *addr) 10 | { 11 | __u32 i; 12 | addr_base = (__u32)addr; 13 | for(i=0;i<4;i++){ 14 | REG_WR32(addr_base+0x0130+0x100*i,0x04000000);//reg for set once here 15 | } 16 | } 17 | 18 | void TVD_config(__u32 interface, __u32 system) 19 | { 20 | //global reg set here 21 | REG_WR32(addr_base+0x0500,0x00000f11); //first, open adc, so the tvd has clock 22 | REG_WR32(addr_base+0x0000,0x00001f00); //reset tvd 23 | msleep(1); //need delay here for tvd reset 24 | if(interface==TVD_CVBS) //composite 25 | { 26 | switch(system) 27 | { 28 | case TVD_NTSC://NTSC 29 | REG_WR32(addr_base+0x0008,0x00590000);//ntsc vs pal 30 | REG_WR32(addr_base+0x000c,0x00000010);//ntsc vs pal 31 | REG_WR32(addr_base+0x0018,0x00002080); 32 | REG_WR32(addr_base+0x0024,0x0682810a); 33 | REG_WR32(addr_base+0x0028,0x00006440); 34 | REG_WR32(addr_base+0x002c,0x0000cb74);//ntsc vs pal 35 | REG_WR32(addr_base+0x0030,0x21f07c1f);//ntsc vs pal 36 | REG_WR32(addr_base+0x0034,0x20000000); 37 | 38 | //REG_WR32(addr_base+0x0024,0x05C8B10A); 39 | //REG_WR32(addr_base+0x0028,0x00005838); 40 | //REG_WR32(addr_base+0x002c,0x0000cb74); 41 | //REG_WR32(addr_base+0x0030,0x262E8BA2); 42 | //REG_WR32(addr_base+0x0034,0x24000000); 43 | 44 | REG_WR32(addr_base+0x0044,0x50823925); 45 | REG_WR32(addr_base+0x004c,0x0e70106c); 46 | REG_WR32(addr_base+0x0050,0x00000a00); 47 | REG_WR32(addr_base+0x005c,0x0000006f); 48 | REG_WR32(addr_base+0x0070,0x00002050); 49 | REG_WR32(addr_base+0x0074,0x000003c3); 50 | REG_WR32(addr_base+0x0080,0x00500082);//ntsc vs pal 51 | REG_WR32(addr_base+0x0084,0x00610022);//ntsc vs pal 52 | break; 53 | case TVD_PAL://PAL 54 | REG_WR32(addr_base+0x0008,0x11590102);//ntsc vs pal 55 | REG_WR32(addr_base+0x000c,0x0000001e);//ntsc vs pal 56 | REG_WR32(addr_base+0x0018,0x00002480); 57 | REG_WR32(addr_base+0x0024,0x0682810a); 58 | REG_WR32(addr_base+0x0028,0x00006440); 59 | REG_WR32(addr_base+0x002c,0x00000d74);//ntsc vs pal 60 | REG_WR32(addr_base+0x0030,0x2a098acb);//ntsc vs pal 61 | REG_WR32(addr_base+0x0034,0x20000000); 62 | REG_WR32(addr_base+0x0044,0x50823925); 63 | REG_WR32(addr_base+0x004c,0x0e70106c); 64 | REG_WR32(addr_base+0x0050,0x00000a00); 65 | REG_WR32(addr_base+0x005c,0x0000006f); 66 | REG_WR32(addr_base+0x0070,0x00002050); 67 | REG_WR32(addr_base+0x0074,0x000003c3); 68 | REG_WR32(addr_base+0x0080,0x00500087);//ntsc vs pal 69 | REG_WR32(addr_base+0x0084,0x00c10026);//ntsc vs pal 70 | break; 71 | default: 72 | break; 73 | } 74 | REG_WR32(addr_base+0x0504,0x00000000); 75 | REG_WR32(addr_base+0x052c,0x00110000); 76 | //1 channel cvbs 77 | //REG_WR32(addr_base+0x0500,0x00000111); 78 | //REG_WR32(addr_base+0x0000,0x00000321); 79 | //default open all 4 channels if you don't care power consumption 80 | REG_WR32(addr_base+0x0500,0x00000f11); 81 | REG_WR32(addr_base+0x0000,0x00001f2f); 82 | } 83 | else if(interface==TVD_YPBPR_I)//ypbpr 480i/576i 84 | { 85 | switch(system) 86 | { 87 | case TVD_NTSC://480i 88 | REG_WR32(addr_base+0x0008,0x00594001); 89 | REG_WR32(addr_base+0x0018,0x00002080); 90 | REG_WR32(addr_base+0x0080,0x00500082); 91 | REG_WR32(addr_base+0x0084,0x00610022); 92 | break; 93 | case TVD_PAL://576i 94 | REG_WR32(addr_base+0x0008,0x10594101); 95 | REG_WR32(addr_base+0x0018,0x00002480); 96 | REG_WR32(addr_base+0x0080,0x00500087); 97 | REG_WR32(addr_base+0x0084,0x00c10026); 98 | break; 99 | } 100 | REG_WR32(addr_base+0x0504,0x00000000); 101 | REG_WR32(addr_base+0x052c,0x00110000); 102 | REG_WR32(addr_base+0x0500,0x00020711); 103 | REG_WR32(addr_base+0x0000,0x00000321); 104 | } 105 | else if(interface==TVD_YPBPR_P)//ypbpr 480p/576p 106 | { 107 | switch(system) 108 | { 109 | case TVD_NTSC://480p 110 | REG_WR32(addr_base+0x0008,0x00594001); 111 | REG_WR32(addr_base+0x0018,0x00002080); 112 | REG_WR32(addr_base+0x0080,0x00500082); 113 | REG_WR32(addr_base+0x0084,0x00610022); 114 | 115 | REG_WR32(addr_base+0x0008,0x80594001); 116 | REG_WR32(addr_base+0x0024,0x039db10a); 117 | REG_WR32(addr_base+0x0028,0x000037b1); 118 | REG_WR32(addr_base+0x0034,0x39999999); 119 | break; 120 | case TVD_PAL://576p not work 121 | REG_WR32(addr_base+0x0008,0x10594101); 122 | REG_WR32(addr_base+0x0018,0x00002480); 123 | REG_WR32(addr_base+0x0080,0x00500087); 124 | REG_WR32(addr_base+0x0084,0x00c10026); 125 | break; 126 | } 127 | REG_WR32(addr_base+0x0504,0x00000000); 128 | REG_WR32(addr_base+0x052c,0x00110000); 129 | REG_WR32(addr_base+0x0500,0x00020711); 130 | REG_WR32(addr_base+0x0000,0x00000321); 131 | } 132 | } 133 | 134 | void TVD_set_width(__u32 id,__u32 w) 135 | { 136 | __u32 reg_val; 137 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 138 | reg_val &= ~(0xfff<<0); 139 | reg_val |= ((w>720)?720:w)<<0; 140 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 141 | } 142 | 143 | void TVD_set_width_jump(__u32 id,__u32 j) 144 | { 145 | REG_WR32(addr_base+0x0138+0x100*id, j); 146 | } 147 | 148 | void TVD_set_height(__u32 id,__u32 h) 149 | { 150 | __u32 reg_val; 151 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 152 | reg_val &= ~(0x7ff<<16); 153 | reg_val |= h<<16; 154 | reg_val |= h<<16; 155 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 156 | } 157 | 158 | void TVD_irq_enable(__u32 id,tvd_irq_t irq) 159 | { 160 | __u32 reg_val; 161 | switch(irq){ 162 | case TVD_FRAME_DONE: 163 | reg_val = REG_RD32(addr_base + 0x148); 164 | reg_val |= 1<<(24+id); 165 | REG_WR32(addr_base + 0x148, reg_val); 166 | break; 167 | case TVD_LOCK: 168 | break; 169 | case TVD_UNLOCK: 170 | break; 171 | default: 172 | break; 173 | } 174 | } 175 | 176 | void TVD_irq_disable(__u32 id,tvd_irq_t irq) 177 | { 178 | __u32 reg_val; 179 | switch(irq){ 180 | case TVD_FRAME_DONE: 181 | reg_val = REG_RD32(addr_base + 0x148); 182 | reg_val &= ~(1<<(24+id)); 183 | REG_WR32(addr_base + 0x148, reg_val); 184 | break; 185 | default: 186 | break; 187 | } 188 | } 189 | 190 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq) 191 | { 192 | __u32 reg_val, ret = -1; 193 | switch(irq){ 194 | case TVD_FRAME_DONE: 195 | reg_val = REG_RD32(addr_base+0x140); 196 | ret = (reg_val>>(24+id))&1; 197 | break; 198 | default: 199 | printk("TVD get irq status error\n"); 200 | break; 201 | } 202 | return ret; 203 | } 204 | 205 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq) 206 | { 207 | __u32 reg_val; 208 | switch(irq){ 209 | case TVD_FRAME_DONE: 210 | reg_val = 1<<(24+id); 211 | REG_WR32(addr_base+0x140, reg_val); 212 | break; 213 | default: 214 | break; 215 | } 216 | } 217 | 218 | void TVD_capture_on(__u32 id) 219 | { 220 | __u32 reg_val; 221 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 222 | reg_val |= 1<<0; 223 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 224 | } 225 | void TVD_capture_off(__u32 id) 226 | { 227 | __u32 reg_val; 228 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 229 | reg_val &= ~(1<<0); 230 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 231 | } 232 | 233 | void TVD_set_addr_y(__u32 id,__u32 addr) 234 | { 235 | REG_WR32(addr_base + 0x100+0x100*id, addr); 236 | } 237 | 238 | void TVD_set_addr_c(__u32 id,__u32 addr) 239 | { 240 | REG_WR32(addr_base + 0x110+0x100*id, addr); 241 | } 242 | 243 | void TVD_set_fmt(__u32 id, tvd_fmt_t fmt) 244 | { 245 | __u32 reg_val; 246 | reg_val = REG_RD32(addr_base + 0x130+0x100*id); 247 | switch(fmt){ 248 | case TVD_PL_YUV422: 249 | reg_val &= ~(1<<24); 250 | reg_val |= 1<<4; 251 | break; 252 | case TVD_PL_YUV420: 253 | reg_val &= ~(1<<24); 254 | reg_val &= ~(1<<4); 255 | break; 256 | case TVD_MB_YUV420: 257 | reg_val |= 1<<24; 258 | reg_val &= ~(1<<4); 259 | break; 260 | } 261 | REG_WR32(addr_base + 0x130+0x100*id, reg_val); 262 | } 263 | 264 | __u32 TVD_get_status(__u32 id) 265 | { 266 | __u32 reg_val = 0; 267 | __u32 det = 0; 268 | __u32 system = 0; 269 | reg_val = REG_RD32(addr_base+0x0600+0x20*id); 270 | if(reg_val&1){ 271 | det = 0; 272 | } 273 | else{ 274 | det = 1; 275 | } 276 | if(reg_val&(1<<18)){ 277 | system = 1; 278 | } 279 | else{ 280 | system = 0; 281 | } 282 | return ((det<<0)+(system<<4));//bit0=det bit4=system 283 | } 284 | 285 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue) 286 | { 287 | __u32 reg_val=0; 288 | reg_val = REG_RD32(addr_base+0x0018); 289 | reg_val &= 0xffff0000; 290 | reg_val |= contrast; 291 | reg_val |= luma<<8; 292 | REG_WR32(addr_base + 0x0018, reg_val); 293 | 294 | 295 | reg_val = REG_RD32(addr_base+0x001c); 296 | reg_val &= 0xffff0000; 297 | reg_val |= saturation; 298 | reg_val |= hue<<8; 299 | REG_WR32(addr_base + 0x001c, reg_val); 300 | } 301 | 302 | void TVD_uv_swap(__u8 uv_swap) 303 | { 304 | __u32 reg_val=0; 305 | if(uv_swap) 306 | { 307 | reg_val = REG_RD32(addr_base+0x0014); 308 | reg_val &= 0xffffffbf; 309 | reg_val |= 1<<6; 310 | REG_WR32(addr_base + 0x0014, reg_val); 311 | } 312 | else 313 | { 314 | reg_val = REG_RD32(addr_base+0x0014); 315 | reg_val &= 0xffffffbf; 316 | REG_WR32(addr_base + 0x0014, reg_val); 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.3/bsp_tvd.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSP_TVD_H__ 2 | #define __BSP_TVD_H__ 3 | 4 | #include 5 | 6 | typedef enum 7 | { 8 | TVD_PL_YUV422, 9 | TVD_PL_YUV420, 10 | TVD_MB_YUV420, 11 | }tvd_fmt_t; 12 | 13 | typedef enum 14 | { 15 | TVD_CVBS, 16 | TVD_YPBPR_I, 17 | TVD_YPBPR_P, 18 | }tvd_interface_t; 19 | 20 | typedef enum 21 | { 22 | TVD_NTSC, 23 | TVD_PAL, 24 | TVD_SECAM, 25 | }tvd_system_t; 26 | 27 | typedef enum 28 | { 29 | TVD_FRAME_DONE, 30 | TVD_LOCK, 31 | TVD_UNLOCK, 32 | }tvd_irq_t; 33 | 34 | void TVD_init(void * addr); 35 | 36 | //s32 TVD_set_mode(tvd_mode_t mode); 37 | 38 | //void TVD_det_enable(); 39 | //void TVD_det_disable(); 40 | //__u32 TVD_det_finish(); 41 | //tvd_mode_t TVD_det_mode(); 42 | 43 | void TVD_irq_enable(__u32 id,tvd_irq_t irq); 44 | void TVD_irq_disable(__u32 id,tvd_irq_t irq); 45 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq); 46 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq); 47 | 48 | void TVD_capture_on(__u32 id); 49 | void TVD_capture_off(__u32 id); 50 | 51 | void TVD_set_addr_y(__u32 id,__u32 addr); 52 | void TVD_set_addr_c(__u32 id,__u32 addr); 53 | 54 | void TVD_set_width(__u32 id,__u32 w); 55 | void TVD_set_width_jump(__u32 id,__u32 j); 56 | void TVD_set_height(__u32 id,__u32 h); 57 | 58 | void TVD_set_fmt(__u32 id,tvd_fmt_t fmt); 59 | void TVD_config(__u32 interface, __u32 system); 60 | __u32 TVD_get_status(__u32 id); 61 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue); 62 | void TVD_uv_swap(__u8 uv_swap); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.3/drv_tvd.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #define TVD_REGS_BASE 0x01c08000 34 | #define TVD_REG_SIZE 0x1000 35 | 36 | #define TVD_MAJOR_VERSION 1 37 | #define TVD_MINOR_VERSION 0 38 | #define TVD_RELEASE 0 39 | #define TVD_VERSION KERNEL_VERSION(TVD_MAJOR_VERSION, TVD_MINOR_VERSION, TVD_RELEASE) 40 | #define TVD_MODULE_NAME "tvd" 41 | 42 | #define NUM_INPUTS 2 43 | 44 | #define MIN_WIDTH (32) 45 | #define MIN_HEIGHT (32) 46 | #define MAX_WIDTH (4096) 47 | #define MAX_HEIGHT (4096) 48 | #define MAX_BUFFER (32*1024*1024) 49 | 50 | //#define USE_DMA_CONTIG 51 | 52 | #define BLINK_DELAY HZ/2 53 | 54 | static unsigned video_nr = 1; 55 | static unsigned first_flag = 0; 56 | //static struct timer_list timer; 57 | 58 | typedef enum 59 | { 60 | TVD_UV_SWAP, 61 | TVD_COLOR_SET, 62 | }tvd_param_t; 63 | 64 | struct fmt { 65 | u8 name[32]; 66 | __u32 fourcc; /* v4l2 format id */ 67 | tvd_fmt_t output_fmt; 68 | int depth; 69 | __u32 width; 70 | __u32 height; 71 | }; 72 | 73 | static struct fmt tvd_fmt = { 74 | .name = "planar YUV420", 75 | .fourcc = V4L2_PIX_FMT_NV12, 76 | .output_fmt = TVD_PL_YUV420, 77 | .depth = 12, 78 | .width = 720,//may be change 79 | .height = 480,//may be change 80 | }; 81 | 82 | static struct fmt formats[] = { 83 | { 84 | .name = "planar YUV420", 85 | .fourcc = V4L2_PIX_FMT_NV12, 86 | .output_fmt = TVD_PL_YUV420, 87 | .depth = 12, 88 | .width = 720, 89 | .height = 480, 90 | }, 91 | { 92 | .name = "planar YUV420", 93 | .fourcc = V4L2_PIX_FMT_NV12, 94 | .output_fmt = TVD_PL_YUV420, 95 | .depth = 12, 96 | .width = 720, 97 | .height = 960, 98 | }, 99 | { 100 | .name = "planar YUV420", 101 | .fourcc = V4L2_PIX_FMT_NV12, 102 | .output_fmt = TVD_PL_YUV420, 103 | .depth = 12, 104 | .width = 720, 105 | .height = 1920, 106 | }, 107 | { 108 | .name = "planar YUV420", 109 | .fourcc = V4L2_PIX_FMT_NV12, 110 | .output_fmt = TVD_PL_YUV420, 111 | .depth = 12, 112 | .width = 1440, 113 | .height = 480, 114 | }, 115 | { 116 | .name = "planar YUV420", 117 | .fourcc = V4L2_PIX_FMT_NV12, 118 | .output_fmt = TVD_PL_YUV420, 119 | .depth = 12, 120 | .width = 2880, 121 | .height = 480, 122 | }, 123 | { 124 | .name = "planar YUV420", 125 | .fourcc = V4L2_PIX_FMT_NV12, 126 | .output_fmt = TVD_PL_YUV420, 127 | .depth = 12, 128 | .width = 1440, 129 | .height = 960, 130 | }, 131 | { 132 | .name = "planar YUV420", 133 | .fourcc = V4L2_PIX_FMT_NV12, 134 | .output_fmt = TVD_PL_YUV420, 135 | .depth = 12, 136 | .width = 720, 137 | .height = 576, 138 | }, 139 | { 140 | .name = "planar YUV420", 141 | .fourcc = V4L2_PIX_FMT_NV21, 142 | .output_fmt = TVD_PL_YUV420, 143 | .depth = 12, 144 | .width = 720, 145 | .height = 480, 146 | }, 147 | { 148 | .name = "planar YUV420", 149 | .fourcc = V4L2_PIX_FMT_NV21, 150 | .output_fmt = TVD_PL_YUV420, 151 | .depth = 12, 152 | .width = 720, 153 | .height = 960, 154 | }, 155 | { 156 | .name = "planar YUV420", 157 | .fourcc = V4L2_PIX_FMT_NV21, 158 | .output_fmt = TVD_PL_YUV420, 159 | .depth = 12, 160 | .width = 720, 161 | .height = 1920, 162 | }, 163 | { 164 | .name = "planar YUV420", 165 | .fourcc = V4L2_PIX_FMT_NV21, 166 | .output_fmt = TVD_PL_YUV420, 167 | .depth = 12, 168 | .width = 1440, 169 | .height = 480, 170 | }, 171 | { 172 | .name = "planar YUV420", 173 | .fourcc = V4L2_PIX_FMT_NV21, 174 | .output_fmt = TVD_PL_YUV420, 175 | .depth = 12, 176 | .width = 2880, 177 | .height = 480, 178 | }, 179 | { 180 | .name = "planar YUV420", 181 | .fourcc = V4L2_PIX_FMT_NV21, 182 | .output_fmt = TVD_PL_YUV420, 183 | .depth = 12, 184 | .width = 1440, 185 | .height = 960, 186 | }, 187 | { 188 | .name = "planar YUV420", 189 | .fourcc = V4L2_PIX_FMT_NV21, 190 | .output_fmt = TVD_PL_YUV420, 191 | .depth = 12, 192 | .width = 720, 193 | .height = 576, 194 | }, 195 | }; 196 | 197 | /* buffer for one video frame */ 198 | struct buffer { 199 | struct videobuf_buffer vb; 200 | struct fmt *fmt; 201 | }; 202 | 203 | struct dmaqueue { 204 | struct list_head active; 205 | int frame; /* Counters to control fps rate */ 206 | int ini_jiffies; 207 | }; 208 | 209 | struct buf_addr { 210 | dma_addr_t y; 211 | dma_addr_t c; 212 | }; 213 | 214 | static LIST_HEAD(devlist); 215 | 216 | struct tvd_dev { 217 | struct list_head devlist; 218 | struct v4l2_device v4l2_dev; 219 | struct v4l2_subdev *sd; 220 | struct platform_device *pdev; 221 | 222 | int id; 223 | 224 | spinlock_t slock; 225 | 226 | /* various device info */ 227 | struct video_device *vfd; 228 | 229 | struct dmaqueue vidq; 230 | 231 | /* Several counters */ 232 | unsigned ms; 233 | unsigned long jiffies; 234 | 235 | /* Input Number */ 236 | int input; 237 | 238 | /* video capture */ 239 | struct fmt *fmt; 240 | unsigned int width; 241 | unsigned int height; 242 | unsigned int frame_size; 243 | struct videobuf_queue vb_vidq; 244 | 245 | /* */ 246 | unsigned int interface; 247 | unsigned int system; 248 | unsigned int format; 249 | unsigned int row; 250 | unsigned int column; 251 | //unsigned int channel_en[4]; 252 | unsigned int channel_index[4]; 253 | unsigned int channel_offset_y[4]; 254 | unsigned int channel_offset_c[4]; 255 | unsigned int channel_irq; 256 | 257 | /*working state*/ 258 | unsigned long generating; 259 | int opened; 260 | 261 | //clock 262 | struct clk *ahb_clk; 263 | struct clk *module1_clk; 264 | struct clk *module2_clk; 265 | struct clk *dram_clk; 266 | 267 | int irq; 268 | void __iomem *regs; 269 | struct resource *regs_res; //?? 270 | 271 | struct buf_addr buf_addr; 272 | 273 | //luma contrast saturation hue 274 | unsigned int luma; 275 | unsigned int contrast; 276 | unsigned int saturation; 277 | unsigned int hue; 278 | 279 | unsigned int uv_swap; 280 | //fps 281 | struct v4l2_fract fps; 282 | 283 | }; 284 | 285 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/.bsp_tvd.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_drivers/media/video/sun7i_tvd/bsp_tvd.o := arm-linux-gnueabihf-gcc -Wp,-MD,drivers/media/video/sun7i_tvd/.bsp_tvd.o.d -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include -I/home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include -Iarch/arm/include/generated -Iinclude -include /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-sun7i/include -Iarch/arm/plat-sunxi/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -marm -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=2048 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -femit-struct-debug-baseonly -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(bsp_tvd)" -D"KBUILD_MODNAME=KBUILD_STR(sun7i_tvd)" -c -o drivers/media/video/sun7i_tvd/.tmp_bsp_tvd.o drivers/media/video/sun7i_tvd/bsp_tvd.c 2 | 3 | source_drivers/media/video/sun7i_tvd/bsp_tvd.o := drivers/media/video/sun7i_tvd/bsp_tvd.c 4 | 5 | deps_drivers/media/video/sun7i_tvd/bsp_tvd.o := \ 6 | drivers/media/video/sun7i_tvd/bsp_tvd.h \ 7 | include/linux/kernel.h \ 8 | $(wildcard include/config/lbdaf.h) \ 9 | $(wildcard include/config/preempt/voluntary.h) \ 10 | $(wildcard include/config/debug/atomic/sleep.h) \ 11 | $(wildcard include/config/prove/locking.h) \ 12 | $(wildcard include/config/ring/buffer.h) \ 13 | $(wildcard include/config/tracing.h) \ 14 | $(wildcard include/config/numa.h) \ 15 | $(wildcard include/config/compaction.h) \ 16 | $(wildcard include/config/ftrace/mcount/record.h) \ 17 | include/linux/sysinfo.h \ 18 | include/linux/types.h \ 19 | $(wildcard include/config/uid16.h) \ 20 | $(wildcard include/config/arch/dma/addr/t/64bit.h) \ 21 | $(wildcard include/config/phys/addr/t/64bit.h) \ 22 | $(wildcard include/config/64bit.h) \ 23 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/types.h \ 24 | include/asm-generic/int-ll64.h \ 25 | arch/arm/include/generated/asm/bitsperlong.h \ 26 | include/asm-generic/bitsperlong.h \ 27 | include/linux/posix_types.h \ 28 | include/linux/stddef.h \ 29 | include/linux/compiler.h \ 30 | $(wildcard include/config/sparse/rcu/pointer.h) \ 31 | $(wildcard include/config/trace/branch/profiling.h) \ 32 | $(wildcard include/config/profile/all/branches.h) \ 33 | $(wildcard include/config/enable/must/check.h) \ 34 | $(wildcard include/config/enable/warn/deprecated.h) \ 35 | include/linux/compiler-gcc.h \ 36 | $(wildcard include/config/arch/supports/optimized/inlining.h) \ 37 | $(wildcard include/config/optimize/inlining.h) \ 38 | include/linux/compiler-gcc4.h \ 39 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/posix_types.h \ 40 | include/asm-generic/posix_types.h \ 41 | /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include/stdarg.h \ 42 | include/linux/linkage.h \ 43 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/linkage.h \ 44 | include/linux/bitops.h \ 45 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bitops.h \ 46 | $(wildcard include/config/smp.h) \ 47 | include/linux/irqflags.h \ 48 | $(wildcard include/config/trace/irqflags.h) \ 49 | $(wildcard include/config/irqsoff/tracer.h) \ 50 | $(wildcard include/config/preempt/tracer.h) \ 51 | $(wildcard include/config/trace/irqflags/support.h) \ 52 | include/linux/typecheck.h \ 53 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/irqflags.h \ 54 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/ptrace.h \ 55 | $(wildcard include/config/cpu/endian/be8.h) \ 56 | $(wildcard include/config/arm/thumb.h) \ 57 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hwcap.h \ 58 | include/asm-generic/bitops/non-atomic.h \ 59 | include/asm-generic/bitops/fls64.h \ 60 | include/asm-generic/bitops/sched.h \ 61 | include/asm-generic/bitops/hweight.h \ 62 | include/asm-generic/bitops/arch_hweight.h \ 63 | include/asm-generic/bitops/const_hweight.h \ 64 | include/asm-generic/bitops/lock.h \ 65 | include/asm-generic/bitops/le.h \ 66 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/byteorder.h \ 67 | include/linux/byteorder/little_endian.h \ 68 | include/linux/swab.h \ 69 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/swab.h \ 70 | include/linux/byteorder/generic.h \ 71 | include/asm-generic/bitops/ext2-atomic-setbit.h \ 72 | include/linux/log2.h \ 73 | $(wildcard include/config/arch/has/ilog2/u32.h) \ 74 | $(wildcard include/config/arch/has/ilog2/u64.h) \ 75 | include/linux/printk.h \ 76 | $(wildcard include/config/printk.h) \ 77 | $(wildcard include/config/dynamic/debug.h) \ 78 | include/linux/init.h \ 79 | $(wildcard include/config/modules.h) \ 80 | $(wildcard include/config/hotplug.h) \ 81 | include/linux/dynamic_debug.h \ 82 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/div64.h \ 83 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/compiler.h \ 84 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bug.h \ 85 | $(wildcard include/config/bug.h) \ 86 | $(wildcard include/config/thumb2/kernel.h) \ 87 | $(wildcard include/config/debug/bugverbose.h) \ 88 | $(wildcard include/config/arm/lpae.h) \ 89 | include/asm-generic/bug.h \ 90 | $(wildcard include/config/generic/bug.h) \ 91 | $(wildcard include/config/generic/bug/relative/pointers.h) \ 92 | include/linux/delay.h \ 93 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/delay.h \ 94 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/param.h \ 95 | $(wildcard include/config/hz.h) \ 96 | 97 | drivers/media/video/sun7i_tvd/bsp_tvd.o: $(deps_drivers/media/video/sun7i_tvd/bsp_tvd.o) 98 | 99 | $(deps_drivers/media/video/sun7i_tvd/bsp_tvd.o): 100 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/.drv_tvd.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_drivers/media/video/sun7i_tvd/drv_tvd.o := arm-linux-gnueabihf-gcc -Wp,-MD,drivers/media/video/sun7i_tvd/.drv_tvd.o.d -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include -I/home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include -Iarch/arm/include/generated -Iinclude -include /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-sun7i/include -Iarch/arm/plat-sunxi/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -marm -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=2048 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -femit-struct-debug-baseonly -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(drv_tvd)" -D"KBUILD_MODNAME=KBUILD_STR(sun7i_tvd)" -c -o drivers/media/video/sun7i_tvd/.tmp_drv_tvd.o drivers/media/video/sun7i_tvd/drv_tvd.c 2 | 3 | source_drivers/media/video/sun7i_tvd/drv_tvd.o := drivers/media/video/sun7i_tvd/drv_tvd.c 4 | 5 | deps_drivers/media/video/sun7i_tvd/drv_tvd.o := \ 6 | $(wildcard include/config/video/v4l1/compat.h) \ 7 | include/linux/module.h \ 8 | $(wildcard include/config/sysfs.h) \ 9 | $(wildcard include/config/modules.h) \ 10 | $(wildcard include/config/unused/symbols.h) \ 11 | $(wildcard include/config/generic/bug.h) \ 12 | $(wildcard include/config/kallsyms.h) \ 13 | $(wildcard include/config/smp.h) \ 14 | $(wildcard include/config/tracepoints.h) \ 15 | $(wildcard include/config/tracing.h) \ 16 | $(wildcard include/config/event/tracing.h) \ 17 | $(wildcard include/config/ftrace/mcount/record.h) \ 18 | $(wildcard include/config/module/unload.h) \ 19 | $(wildcard include/config/constructors.h) \ 20 | $(wildcard include/config/debug/set/module/ronx.h) \ 21 | include/linux/list.h \ 22 | $(wildcard include/config/debug/list.h) \ 23 | include/linux/types.h \ 24 | $(wildcard include/config/uid16.h) \ 25 | $(wildcard include/config/lbdaf.h) \ 26 | $(wildcard include/config/arch/dma/addr/t/64bit.h) \ 27 | $(wildcard include/config/phys/addr/t/64bit.h) \ 28 | $(wildcard include/config/64bit.h) \ 29 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/types.h \ 30 | include/asm-generic/int-ll64.h \ 31 | arch/arm/include/generated/asm/bitsperlong.h \ 32 | include/asm-generic/bitsperlong.h \ 33 | include/linux/posix_types.h \ 34 | include/linux/stddef.h \ 35 | include/linux/compiler.h \ 36 | $(wildcard include/config/sparse/rcu/pointer.h) \ 37 | $(wildcard include/config/trace/branch/profiling.h) \ 38 | $(wildcard include/config/profile/all/branches.h) \ 39 | $(wildcard include/config/enable/must/check.h) \ 40 | $(wildcard include/config/enable/warn/deprecated.h) \ 41 | include/linux/compiler-gcc.h \ 42 | $(wildcard include/config/arch/supports/optimized/inlining.h) \ 43 | $(wildcard include/config/optimize/inlining.h) \ 44 | include/linux/compiler-gcc4.h \ 45 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/posix_types.h \ 46 | include/asm-generic/posix_types.h \ 47 | include/linux/poison.h \ 48 | $(wildcard include/config/illegal/pointer/value.h) \ 49 | include/linux/const.h \ 50 | include/linux/stat.h \ 51 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/stat.h \ 52 | include/linux/time.h \ 53 | $(wildcard include/config/arch/uses/gettimeoffset.h) \ 54 | include/linux/cache.h \ 55 | $(wildcard include/config/arch/has/cache/line/size.h) \ 56 | include/linux/kernel.h \ 57 | $(wildcard include/config/preempt/voluntary.h) \ 58 | $(wildcard include/config/debug/atomic/sleep.h) \ 59 | $(wildcard include/config/prove/locking.h) \ 60 | $(wildcard include/config/ring/buffer.h) \ 61 | $(wildcard include/config/numa.h) \ 62 | $(wildcard include/config/compaction.h) \ 63 | include/linux/sysinfo.h \ 64 | /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include/stdarg.h \ 65 | include/linux/linkage.h \ 66 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/linkage.h \ 67 | include/linux/bitops.h \ 68 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bitops.h \ 69 | include/linux/irqflags.h \ 70 | $(wildcard include/config/trace/irqflags.h) \ 71 | $(wildcard include/config/irqsoff/tracer.h) \ 72 | $(wildcard include/config/preempt/tracer.h) \ 73 | $(wildcard include/config/trace/irqflags/support.h) \ 74 | include/linux/typecheck.h \ 75 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/irqflags.h \ 76 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/ptrace.h \ 77 | $(wildcard include/config/cpu/endian/be8.h) \ 78 | $(wildcard include/config/arm/thumb.h) \ 79 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hwcap.h \ 80 | include/asm-generic/bitops/non-atomic.h \ 81 | include/asm-generic/bitops/fls64.h \ 82 | include/asm-generic/bitops/sched.h \ 83 | include/asm-generic/bitops/hweight.h \ 84 | include/asm-generic/bitops/arch_hweight.h \ 85 | include/asm-generic/bitops/const_hweight.h \ 86 | include/asm-generic/bitops/lock.h \ 87 | include/asm-generic/bitops/le.h \ 88 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/byteorder.h \ 89 | include/linux/byteorder/little_endian.h \ 90 | include/linux/swab.h \ 91 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/swab.h \ 92 | include/linux/byteorder/generic.h \ 93 | include/asm-generic/bitops/ext2-atomic-setbit.h \ 94 | include/linux/log2.h \ 95 | $(wildcard include/config/arch/has/ilog2/u32.h) \ 96 | $(wildcard include/config/arch/has/ilog2/u64.h) \ 97 | include/linux/printk.h \ 98 | $(wildcard include/config/printk.h) \ 99 | $(wildcard include/config/dynamic/debug.h) \ 100 | include/linux/init.h \ 101 | $(wildcard include/config/hotplug.h) \ 102 | include/linux/dynamic_debug.h \ 103 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/div64.h \ 104 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/compiler.h \ 105 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bug.h \ 106 | $(wildcard include/config/bug.h) \ 107 | $(wildcard include/config/thumb2/kernel.h) \ 108 | $(wildcard include/config/debug/bugverbose.h) \ 109 | $(wildcard include/config/arm/lpae.h) \ 110 | include/asm-generic/bug.h \ 111 | $(wildcard include/config/generic/bug/relative/pointers.h) \ 112 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/cache.h \ 113 | $(wildcard include/config/arm/l1/cache/shift.h) \ 114 | $(wildcard include/config/aeabi.h) \ 115 | include/linux/seqlock.h \ 116 | include/linux/spinlock.h \ 117 | $(wildcard include/config/debug/spinlock.h) \ 118 | $(wildcard include/config/generic/lockbreak.h) \ 119 | $(wildcard include/config/preempt.h) \ 120 | $(wildcard include/config/debug/lock/alloc.h) \ 121 | include/linux/preempt.h \ 122 | $(wildcard include/config/debug/preempt.h) \ 123 | $(wildcard include/config/preempt/count.h) \ 124 | $(wildcard include/config/preempt/notifiers.h) \ 125 | include/linux/thread_info.h \ 126 | $(wildcard include/config/compat.h) \ 127 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/thread_info.h \ 128 | $(wildcard include/config/arm/thumbee.h) \ 129 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/fpstate.h \ 130 | $(wildcard include/config/vfpv3.h) \ 131 | $(wildcard include/config/iwmmxt.h) \ 132 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/domain.h \ 133 | $(wildcard include/config/io/36.h) \ 134 | $(wildcard include/config/cpu/use/domains.h) \ 135 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/barrier.h \ 136 | $(wildcard include/config/cpu/32v6k.h) \ 137 | $(wildcard include/config/cpu/xsc3.h) \ 138 | $(wildcard include/config/cpu/fa526.h) \ 139 | $(wildcard include/config/arch/has/barriers.h) \ 140 | $(wildcard include/config/arm/dma/mem/bufferable.h) \ 141 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/outercache.h \ 142 | $(wildcard include/config/outer/cache/sync.h) \ 143 | $(wildcard include/config/outer/cache.h) \ 144 | arch/arm/mach-sun7i/include/mach/barriers.h \ 145 | include/linux/stringify.h \ 146 | include/linux/bottom_half.h \ 147 | include/linux/spinlock_types.h \ 148 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/spinlock_types.h \ 149 | include/linux/lockdep.h \ 150 | $(wildcard include/config/lockdep.h) \ 151 | $(wildcard include/config/lock/stat.h) \ 152 | $(wildcard include/config/prove/rcu.h) \ 153 | include/linux/rwlock_types.h \ 154 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/spinlock.h \ 155 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/processor.h \ 156 | $(wildcard include/config/have/hw/breakpoint.h) \ 157 | $(wildcard include/config/mmu.h) \ 158 | $(wildcard include/config/arm/errata/754327.h) \ 159 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hw_breakpoint.h \ 160 | include/linux/rwlock.h \ 161 | include/linux/spinlock_api_smp.h \ 162 | $(wildcard include/config/inline/spin/lock.h) \ 163 | $(wildcard include/config/inline/spin/lock/bh.h) \ 164 | $(wildcard include/config/inline/spin/lock/irq.h) \ 165 | $(wildcard include/config/inline/spin/lock/irqsave.h) \ 166 | $(wildcard include/config/inline/spin/trylock.h) \ 167 | $(wildcard include/config/inline/spin/trylock/bh.h) \ 168 | $(wildcard include/config/uninline/spin/unlock.h) \ 169 | $(wildcard include/config/inline/spin/unlock/bh.h) \ 170 | $(wildcard include/config/inline/spin/unlock/irq.h) \ 171 | $(wildcard include/config/inline/spin/unlock/irqrestore.h) \ 172 | include/linux/rwlock_api_smp.h \ 173 | $(wildcard include/config/inline/read/lock.h) \ 174 | $(wildcard include/config/inline/write/lock.h) \ 175 | $(wildcard include/config/inline/read/lock/bh.h) \ 176 | $(wildcard include/config/inline/write/lock/bh.h) \ 177 | $(wildcard include/config/inline/read/lock/irq.h) \ 178 | $(wildcard include/config/inline/write/lock/irq.h) \ 179 | $(wildcard include/config/inline/read/lock/irqsave.h) \ 180 | $(wildcard include/config/inline/write/lock/irqsave.h) \ 181 | $(wildcard include/config/inline/read/trylock.h) \ 182 | $(wildcard include/config/inline/write/trylock.h) \ 183 | $(wildcard include/config/inline/read/unlock.h) \ 184 | $(wildcard include/config/inline/write/unlock.h) \ 185 | $(wildcard include/config/inline/read/unlock/bh.h) \ 186 | $(wildcard include/config/inline/write/unlock/bh.h) \ 187 | $(wildcard include/config/inline/read/unlock/irq.h) \ 188 | $(wildcard include/config/inline/write/unlock/irq.h) \ 189 | $(wildcard include/config/inline/read/unlock/irqrestore.h) \ 190 | $(wildcard include/config/inline/write/unlock/irqrestore.h) \ 191 | include/linux/atomic.h \ 192 | $(wildcard include/config/arch/has/atomic/or.h) \ 193 | $(wildcard include/config/generic/atomic64.h) \ 194 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/atomic.h \ 195 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/cmpxchg.h \ 196 | $(wildcard include/config/cpu/sa1100.h) \ 197 | $(wildcard include/config/cpu/sa110.h) \ 198 | $(wildcard include/config/cpu/v6.h) \ 199 | include/asm-generic/cmpxchg-local.h \ 200 | include/asm-generic/atomic-long.h \ 201 | include/linux/math64.h \ 202 | include/linux/kmod.h \ 203 | include/linux/gfp.h \ 204 | $(wildcard include/config/kmemcheck.h) \ 205 | $(wildcard include/config/highmem.h) \ 206 | $(wildcard include/config/zone/dma.h) \ 207 | $(wildcard include/config/zone/dma32.h) \ 208 | $(wildcard include/config/pm/sleep.h) \ 209 | $(wildcard include/config/cma.h) \ 210 | include/linux/mmzone.h \ 211 | $(wildcard include/config/force/max/zoneorder.h) \ 212 | $(wildcard include/config/memory/hotplug.h) \ 213 | $(wildcard include/config/sparsemem.h) \ 214 | $(wildcard include/config/have/memblock/node/map.h) \ 215 | $(wildcard include/config/discontigmem.h) \ 216 | $(wildcard include/config/flat/node/mem/map.h) \ 217 | $(wildcard include/config/cgroup/mem/res/ctlr.h) \ 218 | $(wildcard include/config/no/bootmem.h) \ 219 | $(wildcard include/config/have/memory/present.h) \ 220 | $(wildcard include/config/have/memoryless/nodes.h) \ 221 | $(wildcard include/config/need/node/memmap/size.h) \ 222 | $(wildcard include/config/have/memblock/node.h) \ 223 | $(wildcard include/config/need/multiple/nodes.h) \ 224 | $(wildcard include/config/have/arch/early/pfn/to/nid.h) \ 225 | $(wildcard include/config/flatmem.h) \ 226 | $(wildcard include/config/sparsemem/extreme.h) \ 227 | $(wildcard include/config/have/arch/pfn/valid.h) \ 228 | $(wildcard include/config/nodes/span/other/nodes.h) \ 229 | $(wildcard include/config/holes/in/zone.h) \ 230 | $(wildcard include/config/arch/has/holes/memorymodel.h) \ 231 | include/linux/wait.h \ 232 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/current.h \ 233 | include/linux/threads.h \ 234 | $(wildcard include/config/nr/cpus.h) \ 235 | $(wildcard include/config/base/small.h) \ 236 | include/linux/numa.h \ 237 | $(wildcard include/config/nodes/shift.h) \ 238 | include/linux/nodemask.h \ 239 | include/linux/bitmap.h \ 240 | include/linux/string.h \ 241 | $(wildcard include/config/binary/printf.h) \ 242 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/string.h \ 243 | include/linux/pageblock-flags.h \ 244 | $(wildcard include/config/hugetlb/page.h) \ 245 | $(wildcard include/config/hugetlb/page/size/variable.h) \ 246 | include/generated/bounds.h \ 247 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/page.h \ 248 | $(wildcard include/config/cpu/copy/v3.h) \ 249 | $(wildcard include/config/cpu/copy/v4wt.h) \ 250 | $(wildcard include/config/cpu/copy/v4wb.h) \ 251 | $(wildcard include/config/cpu/copy/feroceon.h) \ 252 | $(wildcard include/config/cpu/copy/fa.h) \ 253 | $(wildcard include/config/cpu/xscale.h) \ 254 | $(wildcard include/config/cpu/copy/v6.h) \ 255 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/glue.h \ 256 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable-2level-types.h \ 257 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/memory.h \ 258 | $(wildcard include/config/need/mach/memory/h.h) \ 259 | $(wildcard include/config/page/offset.h) \ 260 | $(wildcard include/config/dram/size.h) \ 261 | $(wildcard include/config/dram/base.h) \ 262 | $(wildcard include/config/have/tcm.h) \ 263 | $(wildcard include/config/arm/patch/phys/virt.h) \ 264 | $(wildcard include/config/phys/offset.h) \ 265 | arch/arm/include/generated/asm/sizes.h \ 266 | include/asm-generic/sizes.h \ 267 | arch/arm/mach-sun7i/include/mach/memory.h \ 268 | arch/arm/plat-sunxi/include/plat/memory.h \ 269 | include/asm-generic/memory_model.h \ 270 | $(wildcard include/config/sparsemem/vmemmap.h) \ 271 | include/asm-generic/getorder.h \ 272 | include/linux/memory_hotplug.h \ 273 | $(wildcard include/config/memory/hotremove.h) \ 274 | $(wildcard include/config/have/arch/nodedata/extension.h) \ 275 | include/linux/notifier.h \ 276 | include/linux/errno.h \ 277 | arch/arm/include/generated/asm/errno.h \ 278 | include/asm-generic/errno.h \ 279 | include/asm-generic/errno-base.h \ 280 | include/linux/mutex.h \ 281 | $(wildcard include/config/debug/mutexes.h) \ 282 | $(wildcard include/config/have/arch/mutex/cpu/relax.h) \ 283 | include/linux/rwsem.h \ 284 | $(wildcard include/config/rwsem/generic/spinlock.h) \ 285 | include/linux/rwsem-spinlock.h \ 286 | include/linux/srcu.h \ 287 | include/linux/rcupdate.h \ 288 | $(wildcard include/config/rcu/torture/test.h) \ 289 | $(wildcard include/config/tree/rcu.h) \ 290 | $(wildcard include/config/tree/preempt/rcu.h) \ 291 | $(wildcard include/config/rcu/trace.h) \ 292 | $(wildcard include/config/preempt/rcu.h) \ 293 | $(wildcard include/config/tiny/rcu.h) \ 294 | $(wildcard include/config/tiny/preempt/rcu.h) \ 295 | $(wildcard include/config/debug/objects/rcu/head.h) \ 296 | $(wildcard include/config/hotplug/cpu.h) \ 297 | $(wildcard include/config/preempt/rt.h) \ 298 | include/linux/cpumask.h \ 299 | $(wildcard include/config/cpumask/offstack.h) \ 300 | $(wildcard include/config/debug/per/cpu/maps.h) \ 301 | $(wildcard include/config/disable/obsolete/cpumask/functions.h) \ 302 | include/linux/bug.h \ 303 | include/linux/completion.h \ 304 | include/linux/debugobjects.h \ 305 | $(wildcard include/config/debug/objects.h) \ 306 | $(wildcard include/config/debug/objects/free.h) \ 307 | include/linux/rcutree.h \ 308 | include/linux/topology.h \ 309 | $(wildcard include/config/sched/smt.h) \ 310 | $(wildcard include/config/sched/mc.h) \ 311 | $(wildcard include/config/sched/book.h) \ 312 | $(wildcard include/config/use/percpu/numa/node/id.h) \ 313 | include/linux/smp.h \ 314 | $(wildcard include/config/use/generic/smp/helpers.h) \ 315 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/smp.h \ 316 | include/linux/percpu.h \ 317 | $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \ 318 | $(wildcard include/config/need/per/cpu/page/first/chunk.h) \ 319 | $(wildcard include/config/have/setup/per/cpu/area.h) \ 320 | include/linux/pfn.h \ 321 | arch/arm/include/generated/asm/percpu.h \ 322 | include/asm-generic/percpu.h \ 323 | include/linux/percpu-defs.h \ 324 | $(wildcard include/config/debug/force/weak/per/cpu.h) \ 325 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/topology.h \ 326 | $(wildcard include/config/arm/cpu/topology.h) \ 327 | include/asm-generic/topology.h \ 328 | include/linux/mmdebug.h \ 329 | $(wildcard include/config/debug/vm.h) \ 330 | $(wildcard include/config/debug/virtual.h) \ 331 | include/linux/workqueue.h \ 332 | $(wildcard include/config/debug/objects/work.h) \ 333 | $(wildcard include/config/freezer.h) \ 334 | include/linux/timer.h \ 335 | $(wildcard include/config/timer/stats.h) \ 336 | $(wildcard include/config/debug/objects/timers.h) \ 337 | include/linux/ktime.h \ 338 | $(wildcard include/config/ktime/scalar.h) \ 339 | include/linux/jiffies.h \ 340 | include/linux/timex.h \ 341 | include/linux/param.h \ 342 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/param.h \ 343 | $(wildcard include/config/hz.h) \ 344 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/timex.h \ 345 | arch/arm/mach-sun7i/include/mach/timex.h \ 346 | arch/arm/plat-sunxi/include/plat/timex.h \ 347 | include/linux/sysctl.h \ 348 | $(wildcard include/config/sysctl.h) \ 349 | include/linux/rbtree.h \ 350 | include/linux/elf.h \ 351 | include/linux/elf-em.h \ 352 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/elf.h \ 353 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/user.h \ 354 | include/linux/kobject.h \ 355 | include/linux/sysfs.h \ 356 | include/linux/kobject_ns.h \ 357 | include/linux/kref.h \ 358 | include/linux/moduleparam.h \ 359 | $(wildcard include/config/alpha.h) \ 360 | $(wildcard include/config/ia64.h) \ 361 | $(wildcard include/config/ppc64.h) \ 362 | include/linux/tracepoint.h \ 363 | include/linux/static_key.h \ 364 | include/linux/jump_label.h \ 365 | $(wildcard include/config/jump/label.h) \ 366 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/jump_label.h \ 367 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system.h \ 368 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/exec.h \ 369 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/switch_to.h \ 370 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system_info.h \ 371 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system_misc.h \ 372 | include/linux/export.h \ 373 | $(wildcard include/config/symbol/prefix.h) \ 374 | $(wildcard include/config/modversions.h) \ 375 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/module.h \ 376 | $(wildcard include/config/arm/unwind.h) \ 377 | include/linux/sched.h \ 378 | $(wildcard include/config/sched/debug.h) \ 379 | $(wildcard include/config/no/hz.h) \ 380 | $(wildcard include/config/lockup/detector.h) \ 381 | $(wildcard include/config/detect/hung/task.h) \ 382 | $(wildcard include/config/core/dump/default/elf/headers.h) \ 383 | $(wildcard include/config/sched/autogroup.h) \ 384 | $(wildcard include/config/virt/cpu/accounting.h) \ 385 | $(wildcard include/config/bsd/process/acct.h) \ 386 | $(wildcard include/config/taskstats.h) \ 387 | $(wildcard include/config/audit.h) \ 388 | $(wildcard include/config/cgroups.h) \ 389 | $(wildcard include/config/inotify/user.h) \ 390 | $(wildcard include/config/fanotify.h) \ 391 | $(wildcard include/config/epoll.h) \ 392 | $(wildcard include/config/posix/mqueue.h) \ 393 | $(wildcard include/config/keys.h) \ 394 | $(wildcard include/config/perf/events.h) \ 395 | $(wildcard include/config/schedstats.h) \ 396 | $(wildcard include/config/task/delay/acct.h) \ 397 | $(wildcard include/config/fair/group/sched.h) \ 398 | $(wildcard include/config/rt/group/sched.h) \ 399 | $(wildcard include/config/cgroup/sched.h) \ 400 | $(wildcard include/config/blk/dev/io/trace.h) \ 401 | $(wildcard include/config/rcu/boost.h) \ 402 | $(wildcard include/config/compat/brk.h) \ 403 | $(wildcard include/config/generic/hardirqs.h) \ 404 | $(wildcard include/config/cc/stackprotector.h) \ 405 | $(wildcard include/config/sysvipc.h) \ 406 | $(wildcard include/config/auditsyscall.h) \ 407 | $(wildcard include/config/rt/mutexes.h) \ 408 | $(wildcard include/config/block.h) \ 409 | $(wildcard include/config/task/xacct.h) \ 410 | $(wildcard include/config/cpusets.h) \ 411 | $(wildcard include/config/futex.h) \ 412 | $(wildcard include/config/fault/injection.h) \ 413 | $(wildcard include/config/latencytop.h) \ 414 | $(wildcard include/config/function/graph/tracer.h) \ 415 | $(wildcard include/config/have/unstable/sched/clock.h) \ 416 | $(wildcard include/config/irq/time/accounting.h) \ 417 | $(wildcard include/config/proc/fs.h) \ 418 | $(wildcard include/config/cfs/bandwidth.h) \ 419 | $(wildcard include/config/stack/growsup.h) \ 420 | $(wildcard include/config/debug/stack/usage.h) \ 421 | $(wildcard include/config/mm/owner.h) \ 422 | include/linux/capability.h \ 423 | include/linux/mm_types.h \ 424 | $(wildcard include/config/split/ptlock/cpus.h) \ 425 | $(wildcard include/config/have/cmpxchg/double.h) \ 426 | $(wildcard include/config/have/aligned/struct/page.h) \ 427 | $(wildcard include/config/want/page/debug/flags.h) \ 428 | $(wildcard include/config/aio.h) \ 429 | $(wildcard include/config/mmu/notifier.h) \ 430 | $(wildcard include/config/transparent/hugepage.h) \ 431 | include/linux/auxvec.h \ 432 | arch/arm/include/generated/asm/auxvec.h \ 433 | include/asm-generic/auxvec.h \ 434 | include/linux/prio_tree.h \ 435 | include/linux/page-debug-flags.h \ 436 | $(wildcard include/config/page/poisoning.h) \ 437 | $(wildcard include/config/page/guard.h) \ 438 | $(wildcard include/config/page/debug/something/else.h) \ 439 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/mmu.h \ 440 | $(wildcard include/config/cpu/has/asid.h) \ 441 | arch/arm/include/generated/asm/cputime.h \ 442 | include/asm-generic/cputime.h \ 443 | include/linux/sem.h \ 444 | include/linux/ipc.h \ 445 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/ipcbuf.h \ 446 | include/asm-generic/ipcbuf.h \ 447 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/sembuf.h \ 448 | include/linux/signal.h \ 449 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/signal.h \ 450 | include/asm-generic/signal-defs.h \ 451 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/sigcontext.h \ 452 | arch/arm/include/generated/asm/siginfo.h \ 453 | include/asm-generic/siginfo.h \ 454 | include/linux/pid.h \ 455 | include/linux/proportions.h \ 456 | include/linux/percpu_counter.h \ 457 | include/linux/seccomp.h \ 458 | $(wildcard include/config/seccomp.h) \ 459 | include/linux/rculist.h \ 460 | include/linux/rtmutex.h \ 461 | $(wildcard include/config/debug/rt/mutexes.h) \ 462 | include/linux/plist.h \ 463 | $(wildcard include/config/debug/pi/list.h) \ 464 | include/linux/resource.h \ 465 | arch/arm/include/generated/asm/resource.h \ 466 | include/asm-generic/resource.h \ 467 | include/linux/hrtimer.h \ 468 | $(wildcard include/config/high/res/timers.h) \ 469 | $(wildcard include/config/timerfd.h) \ 470 | include/linux/timerqueue.h \ 471 | include/linux/task_io_accounting.h \ 472 | $(wildcard include/config/task/io/accounting.h) \ 473 | include/linux/latencytop.h \ 474 | include/linux/cred.h \ 475 | $(wildcard include/config/debug/credentials.h) \ 476 | $(wildcard include/config/security.h) \ 477 | $(wildcard include/config/user/ns.h) \ 478 | include/linux/key.h \ 479 | include/linux/selinux.h \ 480 | $(wildcard include/config/security/selinux.h) \ 481 | include/linux/llist.h \ 482 | $(wildcard include/config/arch/have/nmi/safe/cmpxchg.h) \ 483 | include/linux/aio.h \ 484 | include/linux/aio_abi.h \ 485 | include/linux/uio.h \ 486 | include/linux/slab.h \ 487 | $(wildcard include/config/slab/debug.h) \ 488 | $(wildcard include/config/failslab.h) \ 489 | $(wildcard include/config/slub.h) \ 490 | $(wildcard include/config/slob.h) \ 491 | $(wildcard include/config/debug/slab.h) \ 492 | $(wildcard include/config/slab.h) \ 493 | include/linux/slub_def.h \ 494 | $(wildcard include/config/slub/stats.h) \ 495 | $(wildcard include/config/slub/debug.h) \ 496 | include/linux/kmemleak.h \ 497 | $(wildcard include/config/debug/kmemleak.h) \ 498 | include/linux/version.h \ 499 | include/linux/videodev2.h \ 500 | $(wildcard include/config/video/adv/debug.h) \ 501 | include/linux/ioctl.h \ 502 | arch/arm/include/generated/asm/ioctl.h \ 503 | include/asm-generic/ioctl.h \ 504 | include/linux/clk.h \ 505 | $(wildcard include/config/common/clk.h) \ 506 | $(wildcard include/config/have/clk/prepare.h) \ 507 | include/linux/delay.h \ 508 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/delay.h \ 509 | include/linux/freezer.h \ 510 | $(wildcard include/config/cgroup/freezer.h) \ 511 | include/linux/debug_locks.h \ 512 | $(wildcard include/config/debug/locking/api/selftests.h) \ 513 | include/media/v4l2-device.h \ 514 | $(wildcard include/config/media/controller.h) \ 515 | include/media/media-device.h \ 516 | include/media/media-devnode.h \ 517 | include/linux/poll.h \ 518 | arch/arm/include/generated/asm/poll.h \ 519 | include/asm-generic/poll.h \ 520 | include/linux/fs.h \ 521 | $(wildcard include/config/fs/posix/acl.h) \ 522 | $(wildcard include/config/quota.h) \ 523 | $(wildcard include/config/fsnotify.h) \ 524 | $(wildcard include/config/ima.h) \ 525 | $(wildcard include/config/debug/writecount.h) \ 526 | $(wildcard include/config/file/locking.h) \ 527 | $(wildcard include/config/fs/xip.h) \ 528 | $(wildcard include/config/migration.h) \ 529 | include/linux/limits.h \ 530 | include/linux/blk_types.h \ 531 | $(wildcard include/config/blk/dev/integrity.h) \ 532 | include/linux/kdev_t.h \ 533 | include/linux/dcache.h \ 534 | include/linux/rculist_bl.h \ 535 | include/linux/list_bl.h \ 536 | include/linux/bit_spinlock.h \ 537 | include/linux/path.h \ 538 | include/linux/radix-tree.h \ 539 | include/linux/semaphore.h \ 540 | include/linux/fiemap.h \ 541 | include/linux/shrinker.h \ 542 | include/linux/migrate_mode.h \ 543 | include/linux/quota.h \ 544 | $(wildcard include/config/quota/netlink/interface.h) \ 545 | include/linux/dqblk_xfs.h \ 546 | include/linux/dqblk_v1.h \ 547 | include/linux/dqblk_v2.h \ 548 | include/linux/dqblk_qtree.h \ 549 | include/linux/nfs_fs_i.h \ 550 | include/linux/fcntl.h \ 551 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/fcntl.h \ 552 | include/asm-generic/fcntl.h \ 553 | include/linux/err.h \ 554 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/uaccess.h \ 555 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/unified.h \ 556 | $(wildcard include/config/arm/asm/unified.h) \ 557 | include/linux/device.h \ 558 | $(wildcard include/config/debug/devres.h) \ 559 | $(wildcard include/config/devtmpfs.h) \ 560 | $(wildcard include/config/sysfs/deprecated.h) \ 561 | include/linux/ioport.h \ 562 | include/linux/klist.h \ 563 | include/linux/pm.h \ 564 | $(wildcard include/config/pm.h) \ 565 | $(wildcard include/config/pm/runtime.h) \ 566 | $(wildcard include/config/pm/clk.h) \ 567 | $(wildcard include/config/pm/generic/domains.h) \ 568 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/device.h \ 569 | $(wildcard include/config/dmabounce.h) \ 570 | $(wildcard include/config/iommu/api.h) \ 571 | $(wildcard include/config/arm/dma/use/iommu.h) \ 572 | $(wildcard include/config/arch/omap.h) \ 573 | include/linux/pm_wakeup.h \ 574 | include/linux/cdev.h \ 575 | include/media/media-entity.h \ 576 | include/linux/media.h \ 577 | include/media/v4l2-subdev.h \ 578 | $(wildcard include/config/video/v4l2/subdev/api.h) \ 579 | include/linux/v4l2-subdev.h \ 580 | include/linux/v4l2-mediabus.h \ 581 | include/media/v4l2-common.h \ 582 | $(wildcard include/config/spi.h) \ 583 | include/media/v4l2-dev.h \ 584 | include/linux/spi/spi.h \ 585 | include/linux/mod_devicetable.h \ 586 | include/linux/kthread.h \ 587 | include/media/v4l2-fh.h \ 588 | include/media/v4l2-mediabus.h \ 589 | include/media/v4l2-ioctl.h \ 590 | include/linux/io.h \ 591 | $(wildcard include/config/has/ioport.h) \ 592 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/io.h \ 593 | $(wildcard include/config/need/mach/io/h.h) \ 594 | $(wildcard include/config/pcmcia/soc/common.h) \ 595 | $(wildcard include/config/pci.h) \ 596 | $(wildcard include/config/isa.h) \ 597 | $(wildcard include/config/pccard.h) \ 598 | include/asm-generic/pci_iomap.h \ 599 | $(wildcard include/config/no/generic/pci/ioport/map.h) \ 600 | $(wildcard include/config/generic/pci/iomap.h) \ 601 | arch/arm/mach-sun7i/include/mach/io.h \ 602 | include/linux/platform_device.h \ 603 | $(wildcard include/config/suspend.h) \ 604 | $(wildcard include/config/hibernate/callbacks.h) \ 605 | include/linux/interrupt.h \ 606 | $(wildcard include/config/irq/forced/threading.h) \ 607 | $(wildcard include/config/generic/irq/probe.h) \ 608 | include/linux/irqreturn.h \ 609 | include/linux/irqnr.h \ 610 | include/linux/hardirq.h \ 611 | include/linux/ftrace_irq.h \ 612 | $(wildcard include/config/ftrace/nmi/enter.h) \ 613 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hardirq.h \ 614 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/irq.h \ 615 | $(wildcard include/config/sparse/irq.h) \ 616 | arch/arm/mach-sun7i/include/mach/irqs.h \ 617 | arch/arm/plat-sunxi/include/plat/irqs.h \ 618 | $(wildcard include/config/arch/sun7i.h) \ 619 | arch/arm/mach-sun7i/include/mach/platform.h \ 620 | arch/arm/plat-sunxi/include/plat/platform.h \ 621 | $(wildcard include/config/arch/sun5i.h) \ 622 | include/linux/irq_cpustat.h \ 623 | include/linux/i2c.h \ 624 | $(wildcard include/config/i2c.h) \ 625 | $(wildcard include/config/i2c/boardinfo.h) \ 626 | include/linux/of.h \ 627 | $(wildcard include/config/sparc.h) \ 628 | $(wildcard include/config/of/dynamic.h) \ 629 | $(wildcard include/config/of.h) \ 630 | include/media/videobuf-core.h \ 631 | include/media/videobuf-dma-contig.h \ 632 | include/linux/dma-mapping.h \ 633 | $(wildcard include/config/has/dma.h) \ 634 | $(wildcard include/config/arch/has/dma/set/coherent/mask.h) \ 635 | $(wildcard include/config/have/dma/attrs.h) \ 636 | $(wildcard include/config/need/dma/map/state.h) \ 637 | include/linux/dma-attrs.h \ 638 | include/linux/dma-direction.h \ 639 | include/linux/scatterlist.h \ 640 | $(wildcard include/config/debug/sg.h) \ 641 | include/linux/mm.h \ 642 | $(wildcard include/config/ksm.h) \ 643 | $(wildcard include/config/debug/pagealloc.h) \ 644 | $(wildcard include/config/hibernation.h) \ 645 | $(wildcard include/config/hugetlbfs.h) \ 646 | include/linux/range.h \ 647 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable.h \ 648 | $(wildcard include/config/highpte.h) \ 649 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/proc-fns.h \ 650 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/glue-proc.h \ 651 | $(wildcard include/config/cpu/arm610.h) \ 652 | $(wildcard include/config/cpu/arm7tdmi.h) \ 653 | $(wildcard include/config/cpu/arm710.h) \ 654 | $(wildcard include/config/cpu/arm720t.h) \ 655 | $(wildcard include/config/cpu/arm740t.h) \ 656 | $(wildcard include/config/cpu/arm9tdmi.h) \ 657 | $(wildcard include/config/cpu/arm920t.h) \ 658 | $(wildcard include/config/cpu/arm922t.h) \ 659 | $(wildcard include/config/cpu/arm925t.h) \ 660 | $(wildcard include/config/cpu/arm926t.h) \ 661 | $(wildcard include/config/cpu/arm940t.h) \ 662 | $(wildcard include/config/cpu/arm946e.h) \ 663 | $(wildcard include/config/cpu/arm1020.h) \ 664 | $(wildcard include/config/cpu/arm1020e.h) \ 665 | $(wildcard include/config/cpu/arm1022.h) \ 666 | $(wildcard include/config/cpu/arm1026.h) \ 667 | $(wildcard include/config/cpu/mohawk.h) \ 668 | $(wildcard include/config/cpu/feroceon.h) \ 669 | $(wildcard include/config/cpu/v6k.h) \ 670 | $(wildcard include/config/cpu/v7.h) \ 671 | include/asm-generic/pgtable-nopud.h \ 672 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable-hwdef.h \ 673 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable-2level-hwdef.h \ 674 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable-2level.h \ 675 | include/asm-generic/pgtable.h \ 676 | include/linux/page-flags.h \ 677 | $(wildcard include/config/pageflags/extended.h) \ 678 | $(wildcard include/config/arch/uses/pg/uncached.h) \ 679 | $(wildcard include/config/memory/failure.h) \ 680 | $(wildcard include/config/swap.h) \ 681 | $(wildcard include/config/s390.h) \ 682 | include/linux/huge_mm.h \ 683 | include/linux/vmstat.h \ 684 | $(wildcard include/config/vm/event/counters.h) \ 685 | include/linux/vm_event_item.h \ 686 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/scatterlist.h \ 687 | $(wildcard include/config/arm/has/sg/chain.h) \ 688 | include/asm-generic/scatterlist.h \ 689 | $(wildcard include/config/need/sg/dma/length.h) \ 690 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/dma-mapping.h \ 691 | include/linux/dma-debug.h \ 692 | $(wildcard include/config/dma/api/debug.h) \ 693 | include/asm-generic/dma-coherent.h \ 694 | $(wildcard include/config/have/generic/dma/coherent.h) \ 695 | include/asm-generic/dma-mapping-common.h \ 696 | include/linux/kmemcheck.h \ 697 | arch/arm/mach-sun7i/include/mach/clock.h \ 698 | include/linux/clocksource.h \ 699 | $(wildcard include/config/arch/clocksource/data.h) \ 700 | $(wildcard include/config/clocksource/watchdog.h) \ 701 | $(wildcard include/config/generic/time/vsyscall.h) \ 702 | include/linux/regulator/consumer.h \ 703 | $(wildcard include/config/regulator.h) \ 704 | drivers/media/video/sun7i_tvd/bsp_tvd.h \ 705 | drivers/media/video/sun7i_tvd/drv_tvd.h \ 706 | 707 | drivers/media/video/sun7i_tvd/drv_tvd.o: $(deps_drivers/media/video/sun7i_tvd/drv_tvd.o) 708 | 709 | $(deps_drivers/media/video/sun7i_tvd/drv_tvd.o): 710 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/.sun7i_tvd.ko.cmd: -------------------------------------------------------------------------------- 1 | cmd_drivers/media/video/sun7i_tvd/sun7i_tvd.ko := arm-linux-gnueabihf-ld -EL -r -T /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/scripts/module-common.lds --build-id -o drivers/media/video/sun7i_tvd/sun7i_tvd.ko drivers/media/video/sun7i_tvd/sun7i_tvd.o drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o 2 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/.sun7i_tvd.mod.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o := arm-linux-gnueabihf-gcc -Wp,-MD,drivers/media/video/sun7i_tvd/.sun7i_tvd.mod.o.d -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include -I/home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include -Iarch/arm/include/generated -Iinclude -include /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-sun7i/include -Iarch/arm/plat-sunxi/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -marm -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=2048 -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -femit-struct-debug-baseonly -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(sun7i_tvd.mod)" -D"KBUILD_MODNAME=KBUILD_STR(sun7i_tvd)" -DMODULE -c -o drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o drivers/media/video/sun7i_tvd/sun7i_tvd.mod.c 2 | 3 | source_drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o := drivers/media/video/sun7i_tvd/sun7i_tvd.mod.c 4 | 5 | deps_drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o := \ 6 | $(wildcard include/config/module/unload.h) \ 7 | include/linux/module.h \ 8 | $(wildcard include/config/sysfs.h) \ 9 | $(wildcard include/config/modules.h) \ 10 | $(wildcard include/config/unused/symbols.h) \ 11 | $(wildcard include/config/generic/bug.h) \ 12 | $(wildcard include/config/kallsyms.h) \ 13 | $(wildcard include/config/smp.h) \ 14 | $(wildcard include/config/tracepoints.h) \ 15 | $(wildcard include/config/tracing.h) \ 16 | $(wildcard include/config/event/tracing.h) \ 17 | $(wildcard include/config/ftrace/mcount/record.h) \ 18 | $(wildcard include/config/constructors.h) \ 19 | $(wildcard include/config/debug/set/module/ronx.h) \ 20 | include/linux/list.h \ 21 | $(wildcard include/config/debug/list.h) \ 22 | include/linux/types.h \ 23 | $(wildcard include/config/uid16.h) \ 24 | $(wildcard include/config/lbdaf.h) \ 25 | $(wildcard include/config/arch/dma/addr/t/64bit.h) \ 26 | $(wildcard include/config/phys/addr/t/64bit.h) \ 27 | $(wildcard include/config/64bit.h) \ 28 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/types.h \ 29 | include/asm-generic/int-ll64.h \ 30 | arch/arm/include/generated/asm/bitsperlong.h \ 31 | include/asm-generic/bitsperlong.h \ 32 | include/linux/posix_types.h \ 33 | include/linux/stddef.h \ 34 | include/linux/compiler.h \ 35 | $(wildcard include/config/sparse/rcu/pointer.h) \ 36 | $(wildcard include/config/trace/branch/profiling.h) \ 37 | $(wildcard include/config/profile/all/branches.h) \ 38 | $(wildcard include/config/enable/must/check.h) \ 39 | $(wildcard include/config/enable/warn/deprecated.h) \ 40 | include/linux/compiler-gcc.h \ 41 | $(wildcard include/config/arch/supports/optimized/inlining.h) \ 42 | $(wildcard include/config/optimize/inlining.h) \ 43 | include/linux/compiler-gcc4.h \ 44 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/posix_types.h \ 45 | include/asm-generic/posix_types.h \ 46 | include/linux/poison.h \ 47 | $(wildcard include/config/illegal/pointer/value.h) \ 48 | include/linux/const.h \ 49 | include/linux/stat.h \ 50 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/stat.h \ 51 | include/linux/time.h \ 52 | $(wildcard include/config/arch/uses/gettimeoffset.h) \ 53 | include/linux/cache.h \ 54 | $(wildcard include/config/arch/has/cache/line/size.h) \ 55 | include/linux/kernel.h \ 56 | $(wildcard include/config/preempt/voluntary.h) \ 57 | $(wildcard include/config/debug/atomic/sleep.h) \ 58 | $(wildcard include/config/prove/locking.h) \ 59 | $(wildcard include/config/ring/buffer.h) \ 60 | $(wildcard include/config/numa.h) \ 61 | $(wildcard include/config/compaction.h) \ 62 | include/linux/sysinfo.h \ 63 | /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/include/stdarg.h \ 64 | include/linux/linkage.h \ 65 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/linkage.h \ 66 | include/linux/bitops.h \ 67 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bitops.h \ 68 | include/linux/irqflags.h \ 69 | $(wildcard include/config/trace/irqflags.h) \ 70 | $(wildcard include/config/irqsoff/tracer.h) \ 71 | $(wildcard include/config/preempt/tracer.h) \ 72 | $(wildcard include/config/trace/irqflags/support.h) \ 73 | include/linux/typecheck.h \ 74 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/irqflags.h \ 75 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/ptrace.h \ 76 | $(wildcard include/config/cpu/endian/be8.h) \ 77 | $(wildcard include/config/arm/thumb.h) \ 78 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hwcap.h \ 79 | include/asm-generic/bitops/non-atomic.h \ 80 | include/asm-generic/bitops/fls64.h \ 81 | include/asm-generic/bitops/sched.h \ 82 | include/asm-generic/bitops/hweight.h \ 83 | include/asm-generic/bitops/arch_hweight.h \ 84 | include/asm-generic/bitops/const_hweight.h \ 85 | include/asm-generic/bitops/lock.h \ 86 | include/asm-generic/bitops/le.h \ 87 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/byteorder.h \ 88 | include/linux/byteorder/little_endian.h \ 89 | include/linux/swab.h \ 90 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/swab.h \ 91 | include/linux/byteorder/generic.h \ 92 | include/asm-generic/bitops/ext2-atomic-setbit.h \ 93 | include/linux/log2.h \ 94 | $(wildcard include/config/arch/has/ilog2/u32.h) \ 95 | $(wildcard include/config/arch/has/ilog2/u64.h) \ 96 | include/linux/printk.h \ 97 | $(wildcard include/config/printk.h) \ 98 | $(wildcard include/config/dynamic/debug.h) \ 99 | include/linux/init.h \ 100 | $(wildcard include/config/hotplug.h) \ 101 | include/linux/dynamic_debug.h \ 102 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/div64.h \ 103 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/compiler.h \ 104 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/bug.h \ 105 | $(wildcard include/config/bug.h) \ 106 | $(wildcard include/config/thumb2/kernel.h) \ 107 | $(wildcard include/config/debug/bugverbose.h) \ 108 | $(wildcard include/config/arm/lpae.h) \ 109 | include/asm-generic/bug.h \ 110 | $(wildcard include/config/generic/bug/relative/pointers.h) \ 111 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/cache.h \ 112 | $(wildcard include/config/arm/l1/cache/shift.h) \ 113 | $(wildcard include/config/aeabi.h) \ 114 | include/linux/seqlock.h \ 115 | include/linux/spinlock.h \ 116 | $(wildcard include/config/debug/spinlock.h) \ 117 | $(wildcard include/config/generic/lockbreak.h) \ 118 | $(wildcard include/config/preempt.h) \ 119 | $(wildcard include/config/debug/lock/alloc.h) \ 120 | include/linux/preempt.h \ 121 | $(wildcard include/config/debug/preempt.h) \ 122 | $(wildcard include/config/preempt/count.h) \ 123 | $(wildcard include/config/preempt/notifiers.h) \ 124 | include/linux/thread_info.h \ 125 | $(wildcard include/config/compat.h) \ 126 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/thread_info.h \ 127 | $(wildcard include/config/arm/thumbee.h) \ 128 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/fpstate.h \ 129 | $(wildcard include/config/vfpv3.h) \ 130 | $(wildcard include/config/iwmmxt.h) \ 131 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/domain.h \ 132 | $(wildcard include/config/io/36.h) \ 133 | $(wildcard include/config/cpu/use/domains.h) \ 134 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/barrier.h \ 135 | $(wildcard include/config/cpu/32v6k.h) \ 136 | $(wildcard include/config/cpu/xsc3.h) \ 137 | $(wildcard include/config/cpu/fa526.h) \ 138 | $(wildcard include/config/arch/has/barriers.h) \ 139 | $(wildcard include/config/arm/dma/mem/bufferable.h) \ 140 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/outercache.h \ 141 | $(wildcard include/config/outer/cache/sync.h) \ 142 | $(wildcard include/config/outer/cache.h) \ 143 | arch/arm/mach-sun7i/include/mach/barriers.h \ 144 | include/linux/stringify.h \ 145 | include/linux/bottom_half.h \ 146 | include/linux/spinlock_types.h \ 147 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/spinlock_types.h \ 148 | include/linux/lockdep.h \ 149 | $(wildcard include/config/lockdep.h) \ 150 | $(wildcard include/config/lock/stat.h) \ 151 | $(wildcard include/config/prove/rcu.h) \ 152 | include/linux/rwlock_types.h \ 153 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/spinlock.h \ 154 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/processor.h \ 155 | $(wildcard include/config/have/hw/breakpoint.h) \ 156 | $(wildcard include/config/mmu.h) \ 157 | $(wildcard include/config/arm/errata/754327.h) \ 158 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/hw_breakpoint.h \ 159 | include/linux/rwlock.h \ 160 | include/linux/spinlock_api_smp.h \ 161 | $(wildcard include/config/inline/spin/lock.h) \ 162 | $(wildcard include/config/inline/spin/lock/bh.h) \ 163 | $(wildcard include/config/inline/spin/lock/irq.h) \ 164 | $(wildcard include/config/inline/spin/lock/irqsave.h) \ 165 | $(wildcard include/config/inline/spin/trylock.h) \ 166 | $(wildcard include/config/inline/spin/trylock/bh.h) \ 167 | $(wildcard include/config/uninline/spin/unlock.h) \ 168 | $(wildcard include/config/inline/spin/unlock/bh.h) \ 169 | $(wildcard include/config/inline/spin/unlock/irq.h) \ 170 | $(wildcard include/config/inline/spin/unlock/irqrestore.h) \ 171 | include/linux/rwlock_api_smp.h \ 172 | $(wildcard include/config/inline/read/lock.h) \ 173 | $(wildcard include/config/inline/write/lock.h) \ 174 | $(wildcard include/config/inline/read/lock/bh.h) \ 175 | $(wildcard include/config/inline/write/lock/bh.h) \ 176 | $(wildcard include/config/inline/read/lock/irq.h) \ 177 | $(wildcard include/config/inline/write/lock/irq.h) \ 178 | $(wildcard include/config/inline/read/lock/irqsave.h) \ 179 | $(wildcard include/config/inline/write/lock/irqsave.h) \ 180 | $(wildcard include/config/inline/read/trylock.h) \ 181 | $(wildcard include/config/inline/write/trylock.h) \ 182 | $(wildcard include/config/inline/read/unlock.h) \ 183 | $(wildcard include/config/inline/write/unlock.h) \ 184 | $(wildcard include/config/inline/read/unlock/bh.h) \ 185 | $(wildcard include/config/inline/write/unlock/bh.h) \ 186 | $(wildcard include/config/inline/read/unlock/irq.h) \ 187 | $(wildcard include/config/inline/write/unlock/irq.h) \ 188 | $(wildcard include/config/inline/read/unlock/irqrestore.h) \ 189 | $(wildcard include/config/inline/write/unlock/irqrestore.h) \ 190 | include/linux/atomic.h \ 191 | $(wildcard include/config/arch/has/atomic/or.h) \ 192 | $(wildcard include/config/generic/atomic64.h) \ 193 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/atomic.h \ 194 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/cmpxchg.h \ 195 | $(wildcard include/config/cpu/sa1100.h) \ 196 | $(wildcard include/config/cpu/sa110.h) \ 197 | $(wildcard include/config/cpu/v6.h) \ 198 | include/asm-generic/cmpxchg-local.h \ 199 | include/asm-generic/atomic-long.h \ 200 | include/linux/math64.h \ 201 | include/linux/kmod.h \ 202 | include/linux/gfp.h \ 203 | $(wildcard include/config/kmemcheck.h) \ 204 | $(wildcard include/config/highmem.h) \ 205 | $(wildcard include/config/zone/dma.h) \ 206 | $(wildcard include/config/zone/dma32.h) \ 207 | $(wildcard include/config/pm/sleep.h) \ 208 | $(wildcard include/config/cma.h) \ 209 | include/linux/mmzone.h \ 210 | $(wildcard include/config/force/max/zoneorder.h) \ 211 | $(wildcard include/config/memory/hotplug.h) \ 212 | $(wildcard include/config/sparsemem.h) \ 213 | $(wildcard include/config/have/memblock/node/map.h) \ 214 | $(wildcard include/config/discontigmem.h) \ 215 | $(wildcard include/config/flat/node/mem/map.h) \ 216 | $(wildcard include/config/cgroup/mem/res/ctlr.h) \ 217 | $(wildcard include/config/no/bootmem.h) \ 218 | $(wildcard include/config/have/memory/present.h) \ 219 | $(wildcard include/config/have/memoryless/nodes.h) \ 220 | $(wildcard include/config/need/node/memmap/size.h) \ 221 | $(wildcard include/config/have/memblock/node.h) \ 222 | $(wildcard include/config/need/multiple/nodes.h) \ 223 | $(wildcard include/config/have/arch/early/pfn/to/nid.h) \ 224 | $(wildcard include/config/flatmem.h) \ 225 | $(wildcard include/config/sparsemem/extreme.h) \ 226 | $(wildcard include/config/have/arch/pfn/valid.h) \ 227 | $(wildcard include/config/nodes/span/other/nodes.h) \ 228 | $(wildcard include/config/holes/in/zone.h) \ 229 | $(wildcard include/config/arch/has/holes/memorymodel.h) \ 230 | include/linux/wait.h \ 231 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/current.h \ 232 | include/linux/threads.h \ 233 | $(wildcard include/config/nr/cpus.h) \ 234 | $(wildcard include/config/base/small.h) \ 235 | include/linux/numa.h \ 236 | $(wildcard include/config/nodes/shift.h) \ 237 | include/linux/nodemask.h \ 238 | include/linux/bitmap.h \ 239 | include/linux/string.h \ 240 | $(wildcard include/config/binary/printf.h) \ 241 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/string.h \ 242 | include/linux/pageblock-flags.h \ 243 | $(wildcard include/config/hugetlb/page.h) \ 244 | $(wildcard include/config/hugetlb/page/size/variable.h) \ 245 | include/generated/bounds.h \ 246 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/page.h \ 247 | $(wildcard include/config/cpu/copy/v3.h) \ 248 | $(wildcard include/config/cpu/copy/v4wt.h) \ 249 | $(wildcard include/config/cpu/copy/v4wb.h) \ 250 | $(wildcard include/config/cpu/copy/feroceon.h) \ 251 | $(wildcard include/config/cpu/copy/fa.h) \ 252 | $(wildcard include/config/cpu/xscale.h) \ 253 | $(wildcard include/config/cpu/copy/v6.h) \ 254 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/glue.h \ 255 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/pgtable-2level-types.h \ 256 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/memory.h \ 257 | $(wildcard include/config/need/mach/memory/h.h) \ 258 | $(wildcard include/config/page/offset.h) \ 259 | $(wildcard include/config/dram/size.h) \ 260 | $(wildcard include/config/dram/base.h) \ 261 | $(wildcard include/config/have/tcm.h) \ 262 | $(wildcard include/config/arm/patch/phys/virt.h) \ 263 | $(wildcard include/config/phys/offset.h) \ 264 | arch/arm/include/generated/asm/sizes.h \ 265 | include/asm-generic/sizes.h \ 266 | arch/arm/mach-sun7i/include/mach/memory.h \ 267 | arch/arm/plat-sunxi/include/plat/memory.h \ 268 | include/asm-generic/memory_model.h \ 269 | $(wildcard include/config/sparsemem/vmemmap.h) \ 270 | include/asm-generic/getorder.h \ 271 | include/linux/memory_hotplug.h \ 272 | $(wildcard include/config/memory/hotremove.h) \ 273 | $(wildcard include/config/have/arch/nodedata/extension.h) \ 274 | include/linux/notifier.h \ 275 | include/linux/errno.h \ 276 | arch/arm/include/generated/asm/errno.h \ 277 | include/asm-generic/errno.h \ 278 | include/asm-generic/errno-base.h \ 279 | include/linux/mutex.h \ 280 | $(wildcard include/config/debug/mutexes.h) \ 281 | $(wildcard include/config/have/arch/mutex/cpu/relax.h) \ 282 | include/linux/rwsem.h \ 283 | $(wildcard include/config/rwsem/generic/spinlock.h) \ 284 | include/linux/rwsem-spinlock.h \ 285 | include/linux/srcu.h \ 286 | include/linux/rcupdate.h \ 287 | $(wildcard include/config/rcu/torture/test.h) \ 288 | $(wildcard include/config/tree/rcu.h) \ 289 | $(wildcard include/config/tree/preempt/rcu.h) \ 290 | $(wildcard include/config/rcu/trace.h) \ 291 | $(wildcard include/config/preempt/rcu.h) \ 292 | $(wildcard include/config/tiny/rcu.h) \ 293 | $(wildcard include/config/tiny/preempt/rcu.h) \ 294 | $(wildcard include/config/debug/objects/rcu/head.h) \ 295 | $(wildcard include/config/hotplug/cpu.h) \ 296 | $(wildcard include/config/preempt/rt.h) \ 297 | include/linux/cpumask.h \ 298 | $(wildcard include/config/cpumask/offstack.h) \ 299 | $(wildcard include/config/debug/per/cpu/maps.h) \ 300 | $(wildcard include/config/disable/obsolete/cpumask/functions.h) \ 301 | include/linux/bug.h \ 302 | include/linux/completion.h \ 303 | include/linux/debugobjects.h \ 304 | $(wildcard include/config/debug/objects.h) \ 305 | $(wildcard include/config/debug/objects/free.h) \ 306 | include/linux/rcutree.h \ 307 | include/linux/topology.h \ 308 | $(wildcard include/config/sched/smt.h) \ 309 | $(wildcard include/config/sched/mc.h) \ 310 | $(wildcard include/config/sched/book.h) \ 311 | $(wildcard include/config/use/percpu/numa/node/id.h) \ 312 | include/linux/smp.h \ 313 | $(wildcard include/config/use/generic/smp/helpers.h) \ 314 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/smp.h \ 315 | include/linux/percpu.h \ 316 | $(wildcard include/config/need/per/cpu/embed/first/chunk.h) \ 317 | $(wildcard include/config/need/per/cpu/page/first/chunk.h) \ 318 | $(wildcard include/config/have/setup/per/cpu/area.h) \ 319 | include/linux/pfn.h \ 320 | arch/arm/include/generated/asm/percpu.h \ 321 | include/asm-generic/percpu.h \ 322 | include/linux/percpu-defs.h \ 323 | $(wildcard include/config/debug/force/weak/per/cpu.h) \ 324 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/topology.h \ 325 | $(wildcard include/config/arm/cpu/topology.h) \ 326 | include/asm-generic/topology.h \ 327 | include/linux/mmdebug.h \ 328 | $(wildcard include/config/debug/vm.h) \ 329 | $(wildcard include/config/debug/virtual.h) \ 330 | include/linux/workqueue.h \ 331 | $(wildcard include/config/debug/objects/work.h) \ 332 | $(wildcard include/config/freezer.h) \ 333 | include/linux/timer.h \ 334 | $(wildcard include/config/timer/stats.h) \ 335 | $(wildcard include/config/debug/objects/timers.h) \ 336 | include/linux/ktime.h \ 337 | $(wildcard include/config/ktime/scalar.h) \ 338 | include/linux/jiffies.h \ 339 | include/linux/timex.h \ 340 | include/linux/param.h \ 341 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/param.h \ 342 | $(wildcard include/config/hz.h) \ 343 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/timex.h \ 344 | arch/arm/mach-sun7i/include/mach/timex.h \ 345 | arch/arm/plat-sunxi/include/plat/timex.h \ 346 | include/linux/sysctl.h \ 347 | $(wildcard include/config/sysctl.h) \ 348 | include/linux/rbtree.h \ 349 | include/linux/elf.h \ 350 | include/linux/elf-em.h \ 351 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/elf.h \ 352 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/user.h \ 353 | include/linux/kobject.h \ 354 | include/linux/sysfs.h \ 355 | include/linux/kobject_ns.h \ 356 | include/linux/kref.h \ 357 | include/linux/moduleparam.h \ 358 | $(wildcard include/config/alpha.h) \ 359 | $(wildcard include/config/ia64.h) \ 360 | $(wildcard include/config/ppc64.h) \ 361 | include/linux/tracepoint.h \ 362 | include/linux/static_key.h \ 363 | include/linux/jump_label.h \ 364 | $(wildcard include/config/jump/label.h) \ 365 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/jump_label.h \ 366 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system.h \ 367 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/exec.h \ 368 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/switch_to.h \ 369 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system_info.h \ 370 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/system_misc.h \ 371 | include/linux/export.h \ 372 | $(wildcard include/config/symbol/prefix.h) \ 373 | $(wildcard include/config/modversions.h) \ 374 | /home/ubuntu/A20_BUILD/MarsBoard-A20-Linux-SDK-V1.1/linux-sunxi/arch/arm/include/asm/module.h \ 375 | $(wildcard include/config/arm/unwind.h) \ 376 | include/linux/vermagic.h \ 377 | include/generated/utsrelease.h \ 378 | 379 | drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o: $(deps_drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o) 380 | 381 | $(deps_drivers/media/video/sun7i_tvd/sun7i_tvd.mod.o): 382 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/.sun7i_tvd.o.cmd: -------------------------------------------------------------------------------- 1 | cmd_drivers/media/video/sun7i_tvd/sun7i_tvd.o := arm-linux-gnueabihf-ld -EL -r -o drivers/media/video/sun7i_tvd/sun7i_tvd.o drivers/media/video/sun7i_tvd/drv_tvd.o drivers/media/video/sun7i_tvd/bsp_tvd.o 2 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/Kconfig: -------------------------------------------------------------------------------- 1 | config SUN7I_TVD 2 | tristate "TV Decoder" 3 | default m 4 | depends on VIDEO_DEV && VIDEO_V4L2 5 | select VIDEOBUF_DMA_CONTIG 6 | help 7 | This is the driver of TV decoder. 8 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/Makefile: -------------------------------------------------------------------------------- 1 | MODULE_NAME := sunxi_tvd 2 | 3 | MODULE_FILENAME := drv_tvd 4 | 5 | LINUXINCLUDE := -I$(PWD)/include $(LINUXINCLUDE) 6 | 7 | $(MODULE_NAME)-y := $(MODULE_FILENAME).o bsp_tvd.o 8 | 9 | obj-m += $(MODULE_NAME).o 10 | 11 | KDIR := /lib/modules/$(shell uname -r)/build 12 | PWD := $(shell pwd) 13 | default: 14 | $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules 15 | 16 | install: $(MODULE_NAME).ko $(MODULE_NAME).mod.c 17 | $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install 18 | 19 | uninstall: 20 | /bin/bash restore.sh $(MODULE_NAME) 21 | 22 | clean: 23 | $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean 24 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/bsp_tvd.c: -------------------------------------------------------------------------------- 1 | #include "bsp_tvd.h" 2 | #include 3 | 4 | #define REG_RD32(reg) (*((volatile __u32 *)(reg))) 5 | #define REG_WR32(reg, value) (*((volatile __u32 *)(reg)) = (value)) 6 | 7 | static __u32 addr_base = 0; 8 | 9 | void TVD_init(void *addr) 10 | { 11 | __u32 i; 12 | addr_base = (__u32)addr; 13 | for(i=0;i<4;i++){ 14 | REG_WR32(addr_base+0x0130+0x100*i,0x04000000);//reg for set once here 15 | } 16 | } 17 | 18 | void TVD_config(__u32 interface, __u32 system) 19 | { 20 | //global reg set here 21 | REG_WR32(addr_base+0x0500,0x00000f11); //first, open adc, so the tvd has clock 22 | REG_WR32(addr_base+0x0000,0x00001f00); //reset tvd 23 | msleep(1); //need delay here for tvd reset 24 | if(interface==TVD_CVBS) //composite 25 | { 26 | switch(system) 27 | { 28 | case TVD_NTSC://NTSC 29 | REG_WR32(addr_base+0x0008,0x00590000);//ntsc vs pal 30 | REG_WR32(addr_base+0x000c,0x00000010);//ntsc vs pal 31 | REG_WR32(addr_base+0x0018,0x00002080); 32 | REG_WR32(addr_base+0x0024,0x0682810a); 33 | REG_WR32(addr_base+0x0028,0x00006440); 34 | REG_WR32(addr_base+0x002c,0x0000cb74);//ntsc vs pal 35 | REG_WR32(addr_base+0x0030,0x21f07c1f);//ntsc vs pal 36 | REG_WR32(addr_base+0x0034,0x20000000); 37 | 38 | //REG_WR32(addr_base+0x0024,0x05C8B10A); 39 | //REG_WR32(addr_base+0x0028,0x00005838); 40 | //REG_WR32(addr_base+0x002c,0x0000cb74); 41 | //REG_WR32(addr_base+0x0030,0x262E8BA2); 42 | //REG_WR32(addr_base+0x0034,0x24000000); 43 | 44 | REG_WR32(addr_base+0x0044,0x50823925); 45 | REG_WR32(addr_base+0x004c,0x0e70106c); 46 | REG_WR32(addr_base+0x0050,0x00000a00); 47 | REG_WR32(addr_base+0x005c,0x0000006f); 48 | REG_WR32(addr_base+0x0070,0x00002050); 49 | REG_WR32(addr_base+0x0074,0x000003c3); 50 | REG_WR32(addr_base+0x0080,0x00500082);//ntsc vs pal 51 | REG_WR32(addr_base+0x0084,0x00610022);//ntsc vs pal 52 | break; 53 | case TVD_PAL://PAL 54 | REG_WR32(addr_base+0x0008,0x11590102);//ntsc vs pal 55 | REG_WR32(addr_base+0x000c,0x0000001e);//ntsc vs pal 56 | REG_WR32(addr_base+0x0018,0x00002480); 57 | REG_WR32(addr_base+0x0024,0x0682810a); 58 | REG_WR32(addr_base+0x0028,0x00006440); 59 | REG_WR32(addr_base+0x002c,0x00000d74);//ntsc vs pal 60 | REG_WR32(addr_base+0x0030,0x2a098acb);//ntsc vs pal 61 | REG_WR32(addr_base+0x0034,0x20000000); 62 | REG_WR32(addr_base+0x0044,0x50823925); 63 | REG_WR32(addr_base+0x004c,0x0e70106c); 64 | REG_WR32(addr_base+0x0050,0x00000a00); 65 | REG_WR32(addr_base+0x005c,0x0000006f); 66 | REG_WR32(addr_base+0x0070,0x00002050); 67 | REG_WR32(addr_base+0x0074,0x000003c3); 68 | REG_WR32(addr_base+0x0080,0x00500087);//ntsc vs pal 69 | REG_WR32(addr_base+0x0084,0x00c10026);//ntsc vs pal 70 | break; 71 | default: 72 | break; 73 | } 74 | REG_WR32(addr_base+0x0504,0x00000000); 75 | REG_WR32(addr_base+0x052c,0xe0110000); 76 | //1 channel cvbs 77 | //REG_WR32(addr_base+0x0500,0x00000111); 78 | //REG_WR32(addr_base+0x0000,0x00000321); 79 | //default open all 4 channels if you don't care power consumption 80 | REG_WR32(addr_base+0x0500,0x00000f11); 81 | REG_WR32(addr_base+0x0000,0x00001f2f); 82 | } 83 | else if(interface==TVD_YPBPR_I)//ypbpr 480i/576i 84 | { 85 | switch(system) 86 | { 87 | case TVD_NTSC://480i 88 | REG_WR32(addr_base+0x0008,0x00594001); 89 | REG_WR32(addr_base+0x0018,0x00002080); 90 | REG_WR32(addr_base+0x0080,0x00500082); 91 | REG_WR32(addr_base+0x0084,0x00610022); 92 | break; 93 | case TVD_PAL://576i 94 | REG_WR32(addr_base+0x0008,0x10594101); 95 | REG_WR32(addr_base+0x0018,0x00002480); 96 | REG_WR32(addr_base+0x0080,0x00500087); 97 | REG_WR32(addr_base+0x0084,0x00c10026); 98 | break; 99 | } 100 | REG_WR32(addr_base+0x0504,0x00000000); 101 | REG_WR32(addr_base+0x052c,0xe0110000); 102 | REG_WR32(addr_base+0x0500,0x00020711); 103 | REG_WR32(addr_base+0x0000,0x00000321); 104 | } 105 | else if(interface==TVD_YPBPR_P)//ypbpr 480p/576p 106 | { 107 | switch(system) 108 | { 109 | case TVD_NTSC://480p 110 | REG_WR32(addr_base+0x0008,0x80594001); 111 | REG_WR32(addr_base+0x0034,0x20000000); 112 | REG_WR32(addr_base+0x0070,0x00002050); 113 | break; 114 | case TVD_PAL://576p not work 115 | REG_WR32(addr_base+0x0008,0x90594101); 116 | REG_WR32(addr_base+0x0034,0x20000000); 117 | REG_WR32(addr_base+0x0070,0x00002050); 118 | REG_WR32(addr_base+0x0080,0x00500087); 119 | REG_WR32(addr_base+0x0084,0x00c10026); 120 | break; 121 | } 122 | REG_WR32(addr_base+0x0504,0x00000000); 123 | REG_WR32(addr_base+0x052c,0xe0110000); 124 | REG_WR32(addr_base+0x0500,0x00020711); 125 | REG_WR32(addr_base+0x0000,0x00000321); 126 | } 127 | } 128 | 129 | void TVD_set_width(__u32 id,__u32 w) 130 | { 131 | __u32 reg_val; 132 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 133 | reg_val &= ~(0xfff<<0); 134 | reg_val |= ((w>720)?720:w)<<0; 135 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 136 | } 137 | 138 | void TVD_set_width_jump(__u32 id,__u32 j) 139 | { 140 | REG_WR32(addr_base+0x0138+0x100*id, j); 141 | } 142 | 143 | void TVD_set_height(__u32 id,__u32 h) 144 | { 145 | __u32 reg_val; 146 | reg_val = REG_RD32(addr_base + 0x134+0x100*id); 147 | reg_val &= ~(0x7ff<<16); 148 | reg_val |= h<<16; 149 | reg_val |= h<<16; 150 | REG_WR32(addr_base+0x0134+0x100*id, reg_val); 151 | } 152 | 153 | void TVD_irq_enable(__u32 id,tvd_irq_t irq) 154 | { 155 | __u32 reg_val; 156 | switch(irq){ 157 | case TVD_FRAME_DONE: 158 | reg_val = REG_RD32(addr_base + 0x148); 159 | reg_val |= 1<<(24+id); 160 | REG_WR32(addr_base + 0x148, reg_val); 161 | break; 162 | case TVD_LOCK: 163 | break; 164 | case TVD_UNLOCK: 165 | break; 166 | default: 167 | break; 168 | } 169 | } 170 | 171 | void TVD_irq_disable(__u32 id,tvd_irq_t irq) 172 | { 173 | __u32 reg_val; 174 | switch(irq){ 175 | case TVD_FRAME_DONE: 176 | reg_val = REG_RD32(addr_base + 0x148); 177 | reg_val &= ~(1<<(24+id)); 178 | REG_WR32(addr_base + 0x148, reg_val); 179 | break; 180 | default: 181 | break; 182 | } 183 | } 184 | 185 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq) 186 | { 187 | __u32 reg_val, ret = -1; 188 | switch(irq){ 189 | case TVD_FRAME_DONE: 190 | reg_val = REG_RD32(addr_base+0x140); 191 | ret = (reg_val>>(24+id))&1; 192 | break; 193 | default: 194 | printk("TVD get irq status error\n"); 195 | break; 196 | } 197 | return ret; 198 | } 199 | 200 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq) 201 | { 202 | __u32 reg_val; 203 | switch(irq){ 204 | case TVD_FRAME_DONE: 205 | reg_val = 1<<(24+id); 206 | REG_WR32(addr_base+0x140, reg_val); 207 | break; 208 | default: 209 | break; 210 | } 211 | } 212 | 213 | void TVD_capture_on(__u32 id) 214 | { 215 | __u32 reg_val; 216 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 217 | reg_val |= 1<<0; 218 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 219 | } 220 | void TVD_capture_off(__u32 id) 221 | { 222 | __u32 reg_val; 223 | reg_val = REG_RD32(addr_base+0x130+0x100*id); 224 | reg_val &= ~(1<<0); 225 | REG_WR32(addr_base+0x130+0x100*id, reg_val); 226 | } 227 | 228 | void TVD_set_addr_y(__u32 id,__u32 addr) 229 | { 230 | REG_WR32(addr_base + 0x100+0x100*id, addr); 231 | } 232 | 233 | void TVD_set_addr_c(__u32 id,__u32 addr) 234 | { 235 | REG_WR32(addr_base + 0x110+0x100*id, addr); 236 | } 237 | 238 | void TVD_set_fmt(__u32 id, tvd_fmt_t fmt) 239 | { 240 | __u32 reg_val; 241 | reg_val = REG_RD32(addr_base + 0x130+0x100*id); 242 | switch(fmt){ 243 | case TVD_PL_YUV422: 244 | reg_val &= ~(1<<24); 245 | reg_val |= 1<<4; 246 | break; 247 | case TVD_PL_YUV420: 248 | reg_val &= ~(1<<24); 249 | reg_val &= ~(1<<4); 250 | break; 251 | /*case TVD_MB_YUV420: 252 | reg_val |= 1<<24; 253 | reg_val &= ~(1<<4); 254 | break;*/ 255 | } 256 | REG_WR32(addr_base + 0x130+0x100*id, reg_val); 257 | } 258 | 259 | __u32 TVD_get_status(__u32 id) 260 | { 261 | __u32 reg_val = 0; 262 | __u32 det = 0; 263 | __u32 system = 0; 264 | reg_val = REG_RD32(addr_base+0x0600+0x20*id); 265 | if(reg_val&1){ 266 | det = 0; 267 | } 268 | else{ 269 | det = 1; 270 | } 271 | if(reg_val&(1<<18)){ 272 | system = 1; 273 | } 274 | else{ 275 | system = 0; 276 | } 277 | return ((det<<0)+(system<<4));//bit0=det bit4=system 278 | } 279 | 280 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue) 281 | { 282 | __u32 reg_val=0; 283 | reg_val = REG_RD32(addr_base+0x0018); 284 | reg_val &= 0xffff0000; 285 | reg_val |= contrast; 286 | reg_val |= luma<<8; 287 | REG_WR32(addr_base + 0x0018, reg_val); 288 | 289 | 290 | reg_val = REG_RD32(addr_base+0x001c); 291 | reg_val &= 0xffff0000; 292 | reg_val |= saturation; 293 | reg_val |= hue<<8; 294 | REG_WR32(addr_base + 0x001c, reg_val); 295 | } 296 | 297 | void TVD_uv_swap(__u8 uv_swap) 298 | { 299 | __u32 reg_val=0; 300 | if(uv_swap) 301 | { 302 | reg_val = REG_RD32(addr_base+0x0014); 303 | reg_val &= 0xffffffbf; 304 | reg_val |= 1<<6; 305 | REG_WR32(addr_base + 0x0014, reg_val); 306 | } 307 | else 308 | { 309 | reg_val = REG_RD32(addr_base+0x0014); 310 | reg_val &= 0xffffffbf; 311 | REG_WR32(addr_base + 0x0014, reg_val); 312 | } 313 | } 314 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/bsp_tvd.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSP_TVD_H__ 2 | #define __BSP_TVD_H__ 3 | 4 | #include 5 | 6 | typedef enum 7 | { 8 | TVD_PL_YUV422, // format NV16 9 | TVD_PL_YUV420 // format NV12 10 | /*TVD_MB_YUV420*/ 11 | }tvd_fmt_t; 12 | 13 | typedef enum 14 | { 15 | TVD_CVBS, 16 | TVD_YPBPR_I, 17 | TVD_YPBPR_P, 18 | }tvd_interface_t; 19 | 20 | typedef enum 21 | { 22 | TVD_NTSC, 23 | TVD_PAL, 24 | TVD_SECAM, 25 | }tvd_system_t; 26 | 27 | typedef enum 28 | { 29 | TVD_FRAME_DONE, 30 | TVD_LOCK, 31 | TVD_UNLOCK, 32 | }tvd_irq_t; 33 | 34 | void TVD_init(void * addr); 35 | 36 | //s32 TVD_set_mode(tvd_mode_t mode); 37 | 38 | //void TVD_det_enable(); 39 | //void TVD_det_disable(); 40 | //__u32 TVD_det_finish(); 41 | //tvd_mode_t TVD_det_mode(); 42 | 43 | void TVD_irq_enable(__u32 id,tvd_irq_t irq); 44 | void TVD_irq_disable(__u32 id,tvd_irq_t irq); 45 | __s32 TVD_irq_status_get(__u32 id,tvd_irq_t irq); 46 | void TVD_irq_status_clear(__u32 id,tvd_irq_t irq); 47 | 48 | void TVD_capture_on(__u32 id); 49 | void TVD_capture_off(__u32 id); 50 | 51 | void TVD_set_addr_y(__u32 id,__u32 addr); 52 | void TVD_set_addr_c(__u32 id,__u32 addr); 53 | 54 | void TVD_set_width(__u32 id,__u32 w); 55 | void TVD_set_width_jump(__u32 id,__u32 j); 56 | void TVD_set_height(__u32 id,__u32 h); 57 | 58 | void TVD_set_fmt(__u32 id,tvd_fmt_t fmt); 59 | void TVD_config(__u32 interface, __u32 system); 60 | __u32 TVD_get_status(__u32 id); 61 | void TVD_set_color(__u32 id,__u32 luma,__u32 contrast,__u32 saturation,__u32 hue); 62 | void TVD_uv_swap(__u8 uv_swap); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /sun7i_tvd-linux-3.4-working/drv_tvd.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | //#include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #define TVD_REGS_BASE 0x01c08000 34 | #define TVD_REG_SIZE 0x1000 35 | 36 | #define TVD_MAJOR_VERSION 1 37 | #define TVD_MINOR_VERSION 0 38 | #define TVD_RELEASE 0 39 | #define TVD_VERSION KERNEL_VERSION(TVD_MAJOR_VERSION, TVD_MINOR_VERSION, TVD_RELEASE) 40 | #define TVD_MODULE_NAME "tvd" 41 | 42 | #define MIN_WIDTH (32) 43 | #define MIN_HEIGHT (32) 44 | #define MAX_WIDTH (4096) 45 | #define MAX_HEIGHT (4096) 46 | #define MAX_BUFFER (32*1024*1024) 47 | 48 | 49 | #define BLINK_DELAY HZ/2 50 | 51 | static unsigned video_nr = 1; 52 | static unsigned first_flag = 0; 53 | //static struct timer_list timer; 54 | 55 | typedef enum 56 | { 57 | TVD_UV_SWAP, 58 | TVD_COLOR_SET, 59 | }tvd_param_t; 60 | 61 | 62 | struct frmsize { 63 | __u32 width; 64 | __u32 height; 65 | int rows; 66 | int cols; 67 | }; 68 | 69 | struct fmt { 70 | u8 name[32]; 71 | __u32 fourcc; /* v4l2 format id */ 72 | tvd_fmt_t output_fmt; 73 | int depth; 74 | }; 75 | 76 | struct input_cnf { 77 | int channels_num; /* number of input channels used: 1, 2 or 4 */ 78 | char *name; /* string with the input name */ 79 | int frmsizes_cnt; /* number of framesizes available for this input */ 80 | struct frmsize *frmsizes; /* framesizes available for this input */ 81 | int channel_idx[4]; /* indexes of channels: enabled/disabled channels and order */ 82 | }; 83 | 84 | /* buffer for one video frame */ 85 | struct buffer { 86 | struct vb2_buffer vb; 87 | struct list_head list; 88 | struct fmt *fmt; 89 | }; 90 | 91 | struct dmaqueue { 92 | struct list_head list; 93 | unsigned long frame_jiffies; 94 | unsigned int frames_count; 95 | }; 96 | 97 | struct buf_addr { 98 | dma_addr_t y; 99 | dma_addr_t c; 100 | }; 101 | 102 | static LIST_HEAD(devlist); 103 | 104 | struct tvd_dev { 105 | struct list_head devlist; 106 | struct v4l2_device v4l2_dev; 107 | struct v4l2_subdev *sd; 108 | struct platform_device *pdev; 109 | 110 | int id; 111 | 112 | spinlock_t slock; 113 | struct mutex mutex; 114 | 115 | struct vb2_alloc_ctx *alloc_ctx; // TODO: remove for new version of vb2 116 | 117 | /* various device info */ 118 | struct video_device *vfd; 119 | 120 | /* queues */ 121 | struct dmaqueue vidq; /* queue for driver */ 122 | struct vb2_queue vb_vidq; /* queue for videobuf2 */ 123 | 124 | /* Input Number */ 125 | int input; 126 | 127 | /* video capture */ 128 | struct fmt *fmt; 129 | unsigned int width; 130 | unsigned int height; 131 | unsigned int interface; 132 | unsigned int system; 133 | unsigned int format; 134 | unsigned int row; 135 | unsigned int column; 136 | unsigned int channel_index[4]; 137 | unsigned int channel_offset_y[4]; 138 | unsigned int channel_offset_c[4]; 139 | unsigned int channel_irq; 140 | 141 | /*working state*/ 142 | unsigned long generating; 143 | int opened; 144 | 145 | //clock 146 | struct clk *ahb_clk; 147 | struct clk *module1_clk; 148 | struct clk *module2_clk; 149 | struct clk *dram_clk; 150 | 151 | int irq; 152 | void __iomem *regs; 153 | struct resource *regs_res; //?? 154 | 155 | struct buf_addr buf_addr; 156 | 157 | //luma contrast saturation hue 158 | unsigned int luma; 159 | unsigned int contrast; 160 | unsigned int saturation; 161 | unsigned int hue; 162 | 163 | unsigned int uv_swap; 164 | 165 | // frame interval (to control fps) 166 | struct v4l2_fract frameival_secs; // selected by user, in seconds (set to 0/X or X/0 to avoid skipping frames) 167 | unsigned long frameival_jiffies; // frame interval converted to jiffies 168 | 169 | }; 170 | 171 | --------------------------------------------------------------------------------